:root {
  --paper: #f2f7fb;
  --card: #ffffff;
  --ink: #1c2f4a;
  --muted: #5b6b80;
  --blue: #2f6fde;
  --sun: #ffc23d;
  --leaf: #2e9e6b;
  --berry: #e0526b;
  --danger: #c8383f;
  --line: #d6e2ee;
  --radius-big: 22px;
  --radius-small: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1, h2 { font-family: "Baloo 2", "Be Vietnam Pro", system-ui, sans-serif; line-height: 1.15; margin: 0; }
h1 { font-size: 2.4rem; font-weight: 800; }
h2 { font-size: 1.45rem; font-weight: 600; }

.top, main { max-width: 820px; margin: 0 auto; padding: 0 20px; }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-top: 32px; padding-bottom: 20px; }
.sub { margin: 4px 0 0; color: var(--muted); }
main { padding-bottom: 64px; }

button, input { font: inherit; color: inherit; }
button {
  border: 0; border-radius: var(--radius-small); padding: 10px 18px;
  background: var(--blue); color: #fff; font-weight: 600; cursor: pointer;
}
button:hover { filter: brightness(1.06); }
button:disabled { opacity: .5; cursor: default; }
button.link { background: none; color: var(--blue); padding: 6px 0; text-decoration: underline; }
button.danger { background: none; color: var(--danger); border: 2px solid currentColor; padding: 8px 14px; }
button.small { padding: 6px 10px; background: #eaf0f7; color: var(--ink); font-weight: 500; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }

input[type="text"], input[type="password"], input:not([type]) {
  flex: 1; min-width: 0; padding: 10px 14px; border: 2px solid var(--line);
  border-radius: var(--radius-small); background: var(--card);
}
input:focus { border-color: var(--blue); outline: none; }

.row { display: flex; gap: 10px; margin-top: 12px; }
.panel { background: var(--card); border-radius: var(--radius-big); padding: 24px; margin-top: 24px; border: 2px solid var(--line); }
.err { color: var(--danger); min-height: 1.5em; margin: 10px 0 0; }
.empty { color: var(--muted); margin-top: 24px; }
.section-title { margin-bottom: 12px; }

/* Chủ đề: mỗi chủ đề một màu bút sáp */
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.chips button {
  --c: var(--blue);
  background: var(--card); color: var(--ink); border: 3px solid var(--c);
  border-radius: 999px; padding: 8px 18px 8px 14px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
}
.chips button::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.chips li:nth-child(5n+2) button { --c: var(--leaf); }
.chips li:nth-child(5n+3) button { --c: var(--sun); }
.chips li:nth-child(5n+4) button { --c: var(--berry); }
.chips li:nth-child(5n+5) button { --c: #8a5cd6; }
.chips button[aria-current="true"] { background: var(--c); color: #fff; }
.chips button[aria-current="true"]::before { background: #fff; }
.chips .n { font-weight: 400; opacity: .75; }

.lesson-head { display: flex; gap: 12px; align-items: center; }
.title-input {
  flex: 1; font-family: "Baloo 2", system-ui, sans-serif; font-size: 1.7rem; font-weight: 800;
  border: 2px solid transparent !important; padding: 2px 8px !important; margin-left: -10px;
}
.title-input:hover { border-color: var(--line) !important; }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  margin-top: 20px; padding: 36px 16px; border: 3px dashed var(--blue); border-radius: var(--radius-big);
  background: #f7faff; cursor: pointer;
}
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop strong { font-size: 1.15rem; }
.drop span { color: var(--muted); }
.drop.over { background: #fff6dc; border-color: var(--sun); }
.drop:focus-within { outline: 3px solid var(--sun); outline-offset: 2px; }

.check { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; }
.check input { margin-top: 5px; width: 18px; height: 18px; }
.hint { color: var(--muted); font-size: .92rem; margin: 8px 0 0; }

.queue { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.queue li { background: #f7faff; border-radius: var(--radius-small); padding: 10px 12px; }
.queue .name { font-weight: 600; overflow-wrap: anywhere; }
.queue .status { color: var(--muted); font-size: .92rem; }
.queue progress { width: 100%; height: 8px; margin-top: 6px; accent-color: var(--blue); }
.queue li.ok .status { color: var(--leaf); }
.queue li.bad .status { color: var(--danger); }

.count { margin: 24px 0 8px; color: var(--muted); }
.items { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; counter-reset: slide; }
.items li { counter-increment: slide; background: #f7faff; border-radius: var(--radius-small); overflow: hidden; border: 2px solid var(--line); }
.thumb { position: relative; aspect-ratio: 16 / 9; background: #0e1726; display: grid; place-items: center; color: #fff; font-size: 2rem; }
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb::before {
  content: counter(slide); position: absolute; left: 8px; top: 8px; min-width: 28px; height: 28px;
  padding: 0 6px; border-radius: 14px; background: var(--sun); color: var(--ink);
  font: 800 .95rem/28px "Baloo 2", system-ui, sans-serif; text-align: center;
}
.items .meta { padding: 8px 10px; }
.items .t { font-size: .92rem; overflow-wrap: anywhere; }
.items .tools { display: flex; gap: 6px; margin-top: 6px; }
.items .tools .del { margin-left: auto; color: var(--danger); }

@media (max-width: 560px) {
  h1 { font-size: 2rem; }
  .row, .lesson-head { flex-wrap: wrap; }
  .row button { width: 100%; }
  .panel { padding: 18px; }
  .items { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.foot {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px 40px;
  text-align: center;
  font-size: .95rem;
}
.foot a { color: var(--muted); }
.foot a:hover { color: var(--blue); }
