/* Từng trang: bài học, trang chủ, phim nhạc, modal, phát âm, trò chơi, flashcard, shadowing, hội thoại, đệm từ */

/* ---------- Thẻ bài học ---------- */
.lesson-card { display: flex; gap: 14px; align-items: center; text-decoration: none !important; color: var(--text); position: relative; overflow: hidden; }
.lesson-card .big { font-size: 1.8rem; width: 54px; height: 54px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); flex: 0 0 54px; }
/* số bài trên bảng LED nhỏ (thay emoji của bài) */
.lesson-card .big.num { font-family: var(--font-led); font-size: 1.35rem; color: var(--led-on); background: var(--led-bg); border: 2px solid var(--ink-line); border-radius: 8px;
  background-image: radial-gradient(rgba(255, 255, 255, .06) 1px, transparent 1.3px); background-size: 3px 3px; letter-spacing: .04em; }
.lesson-card.is-done .big.num { color: var(--ok); background-color: var(--led-bg); }
.lesson-card .t { font-weight: 700; }
.lesson-card .z { font-family: var(--font-zh-serif); font-size: 1.15rem; color: var(--accent-2); }
.lesson-card .no { position: absolute; right: 12px; top: 8px; font-family: var(--font-led); font-size: .8rem; color: var(--faint); }
.lesson-card.is-done { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.lesson-card.is-done .big { background: color-mix(in srgb, var(--ok) 18%, var(--surface-2)); }
.lesson-card.is-today { border-color: var(--minibus-red); box-shadow: 0 0 0 2px color-mix(in srgb, var(--minibus-red) 45%, transparent), var(--shadow); }
.unit-head { display: flex; align-items: center; gap: 12px; margin: 26px 0 12px; }
.unit-head .badge { font-family: var(--font-sign); font-weight: 700; color: #fff; background: var(--line); border-radius: 8px; padding: 4px 12px; letter-spacing: .06em; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); white-space: nowrap; }
.unit-head h2 { margin: 0; }
.unit-head p { margin: 0; color: var(--muted); font-size: .9rem; }
.week { margin-bottom: 22px; }
.task { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.task + .task { margin-top: 8px; }
.task input { width: 22px; height: 22px; flex: 0 0 22px; }
.task.done .tt { text-decoration: line-through; color: var(--muted); }
.task a.go { margin-left: auto; }

/* ---------- Hero: biển neon + bảng LED minibus ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 24px 26px 22px; border: 1px solid #262a38;
  background: radial-gradient(600px 300px at 85% 0%, rgba(255, 46, 99, .22), transparent 70%), radial-gradient(500px 300px at 0% 100%, rgba(0, 209, 178, .14), transparent 70%), #0d0e14;
  color: #f4efe4;
}
:root[data-skin] .hero { background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: var(--shadow); }
.hero .muted { color: #b5b0a3; }
:root[data-skin] .hero .muted { color: var(--muted); }
.neon-sign { display: inline-block; padding: 6px 16px 10px; border-radius: 12px; border: 2px solid rgba(255, 46, 99, .85); box-shadow: var(--glow), inset 0 0 14px rgba(255, 46, 99, .35); }
.neon-sign .line-zh { font-family: var(--font-zh-serif); font-weight: 900; font-size: 2.3rem; line-height: 2; color: #fff; text-shadow: var(--glow); letter-spacing: .1em; animation: flicker 7s infinite; }
.neon-sign rt { text-shadow: none; letter-spacing: 0; }
:root[data-skin] .neon-sign { border-color: var(--accent); background: var(--sign-bg); box-shadow: none; }
:root[data-skin] .neon-sign .line-zh { color: var(--accent); text-shadow: none; animation: none; }
@keyframes flicker { 0%, 19%, 21%, 62%, 64%, 100% { opacity: 1; } 20%, 63% { opacity: .55; } }
/* bảng LED minibus: nền tối theo skin, chữ "NGÀY" đỏ cam, số 7 đoạn hổ phách, vạch "88" tắt mờ phía sau */
.led {
  display: inline-flex; align-items: baseline; gap: 8px; padding: 5px 12px 4px; border-radius: 6px;
  background-color: var(--led-bg); border: 2px solid var(--ink-line); color: var(--led-on);
  background-image: radial-gradient(rgba(255, 255, 255, .06) 1px, transparent 1.3px); background-size: 3px 3px;
  font-weight: 800; font-size: .8rem; letter-spacing: .08em; line-height: 1.2;
}
.led .lbl { color: var(--led-on-2); }
.led b { position: relative; z-index: 0; font-family: var(--font-led); font-weight: 700; font-size: 1.45rem; letter-spacing: .06em; text-shadow: 0 0 6px color-mix(in srgb, var(--led-on) 50%, transparent); }
.led b::before { content: attr(data-ghost); position: absolute; inset: 0; z-index: -1; color: var(--led-off); text-shadow: none; }
.led .of { opacity: .75; font-size: .95rem; }
.ring { width: 110px; height: 110px; flex: 0 0 110px; }
.ring circle { fill: none; stroke-width: 10; }
.ring .bgc { stroke: rgba(255, 255, 255, .12); }
:root[data-theme="light"] .ring .bgc { stroke: var(--surface-3); }
.ring .fg { stroke: url(#ringgrad); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .6s; }
.ring text { fill: currentColor; font-weight: 800; font-size: 26px; text-anchor: middle; font-family: var(--font-led); }
.ring .lbl { font-size: 11px; font-weight: 600; opacity: .7; font-family: var(--font); }

/* ---------- Phim / nhạc ---------- */
.quote { border-left: 5px solid var(--accent); }
.quote .who { font-size: .85rem; color: var(--muted); }
.words { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.word-pill { display: inline-flex; gap: 6px; align-items: baseline; padding: 5px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; font-size: .86rem; flex-wrap: wrap; }
.word-pill .z { font-family: var(--font-zh); font-size: 1rem; }
.film-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.film-chip { display: inline-flex; flex-direction: column; align-items: flex-start; padding: 6px 12px; border-radius: 10px; color: #fff; font-weight: 700; font-size: .9rem; text-decoration: none !important; cursor: pointer; border: 2px solid transparent; line-height: 1.2; font-family: var(--font-zh); }
.film-chip small { font-family: var(--font); font-weight: 600; color: rgba(255, 255, 255, .85); font-size: .7rem; }
.film-chip.active { border-color: var(--cream); box-shadow: 0 0 0 2px var(--accent); }
.album { width: 64px; height: 64px; border-radius: 50%; flex: 0 0 64px; display: grid; place-items: center; font-family: var(--font-zh-serif); font-size: 1.5rem; font-weight: 900; color: #fff; position: relative; box-shadow: 0 0 0 4px #111, 0 0 0 5px rgba(255, 255, 255, .15); }
.album::after { content: ''; position: absolute; width: 10px; height: 10px; border-radius: 50%; background: #111; }

/* ---------- Modal & toast ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(5, 6, 10, .7); padding: 16px; animation: fade .15s; }
.modal { width: min(560px, 100%); max-height: 90vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 22px; box-shadow: var(--shadow); position: relative; border-top: 6px solid var(--minibus-red); }
.modal .x { position: absolute; top: 10px; right: 10px; }
@keyframes fade { from { opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 200; background: #0b0b0d; color: var(--led); font-family: var(--font); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); border: 2px solid #2d2d2d; font-weight: 700; max-width: 92vw; animation: fade .2s; }
.big-zh { font-family: var(--font-zh-serif); font-size: 4rem; line-height: 1.1; text-align: center; letter-spacing: .1em; }
.big-jp { text-align: center; font-size: 1.4rem; margin-top: 4px; }

/* ---------- Phát âm ---------- */
.tone-card { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; }
.tone-svg { width: 96px; height: 70px; border-radius: 10px; background: var(--surface-2); }
.tone-svg path { fill: none; stroke-width: 5; stroke-linecap: round; }
.tone-svg line { stroke: var(--border); stroke-width: 1; }
.tone-num { font-weight: 800; font-size: 1.9rem; font-variant-numeric: tabular-nums; }
.ex-btn { display: inline-flex; flex-direction: column; align-items: center; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; min-width: 56px; }
.ex-btn .z { font-family: var(--font-zh-serif); font-size: 1.4rem; }
.ex-btn small { font-size: .72rem; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.tbl th, table.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.tbl th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; font-family: var(--font-sign); }
.tbl-wrap { overflow-x: auto; }

/* ---------- Trò chơi ---------- */
.game-card { text-decoration: none !important; color: var(--text); display: flex; flex-direction: column; gap: 6px; border-top: 4px solid var(--line, var(--accent)); }
.game-card .gi { font-size: 2rem; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 10px; }
.choice { padding: 14px; border-radius: 12px; background: var(--surface-2); border: 2px solid var(--border); cursor: pointer; text-align: left; font-size: 1rem; color: var(--text); }
.choice:hover { border-color: var(--accent-2); }
.choice.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.choice.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.choice .z { font-family: var(--font-zh); font-size: 1.3rem; }
.tone-choices { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.tone-choices .choice { text-align: center; font-size: 1.5rem; font-weight: 800; padding: 16px 0; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .tone-choices { grid-template-columns: repeat(3, 1fr); } }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-item { padding: 10px; border-radius: 12px; background: var(--surface-2); border: 2px solid var(--border); cursor: pointer; text-align: center; min-height: 64px; display: grid; place-items: center; }
.match-item.sel { border-color: var(--accent-2); }
.match-item.gone { opacity: 0; pointer-events: none; transition: opacity .3s; }
.match-item.bad { border-color: var(--bad); animation: shake .3s; }
.match-item .z { font-family: var(--font-zh-serif); font-size: 1.4rem; display: block; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.order-slot { min-height: 64px; padding: 10px; border-radius: 12px; border: 2px dashed var(--border); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.order-chip { padding: 8px 12px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border); cursor: pointer; font-family: var(--font-zh); font-size: 1.2rem; color: var(--text); line-height: 1.2; }
.order-chip small { font-family: var(--font); font-size: .7rem; }
.timer { font-family: var(--font-led); font-size: 2.2rem; color: var(--led-on); font-variant-numeric: tabular-nums; }
.score-big { font-family: var(--font-led); font-size: 3rem; text-align: center; color: var(--accent); }
:root[data-theme="light"] .score-big, :root[data-theme="light"] .timer { color: var(--accent); }

/* ---------- Flashcard ---------- */
.flash { min-height: 280px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; cursor: pointer; border-top: 6px solid var(--l-purple); }
.flash .front { font-family: var(--font-zh-serif); font-size: 3.6rem; }
.grade { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grade .btn { flex-direction: column; gap: 2px; min-height: 56px; }
.grade .btn small { font-weight: 500; font-size: .72rem; }

/* ---------- Phòng shadowing ---------- */
.studio { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 980px) { .studio { grid-template-columns: 1fr; } }
.player-box { position: relative; width: 100%; max-width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 14px; overflow: hidden; display: grid; place-items: center; border: 3px solid #1d1d1d; }
.player-box iframe, .player-box #yt { position: absolute; inset: 0; width: 100%; height: 100%; }
.player-ph { color: #9aa3b2; text-align: center; padding: 20px; }
.ab { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ab .val { font-family: var(--font-led); font-variant-numeric: tabular-nums; color: var(--accent); min-width: 56px; display: inline-block; }
:root[data-theme="light"] .ab .val { color: var(--accent); }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--bad); transition: width .05s; }
.syl-score { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.syl { padding: 4px 8px; border-radius: 8px; font-size: .9rem; border: 1px solid var(--border); display: inline-flex; flex-direction: column; align-items: center; min-width: 46px; }
.syl .z { font-family: var(--font-zh); font-size: 1.1rem; }
.syl.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.syl.tone { background: color-mix(in srgb, var(--warn) 14%, transparent); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.syl.miss { background: color-mix(in srgb, var(--bad) 12%, transparent); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }

/* ---------- Chứng nhận ---------- */
.cert { position: relative; border-radius: 18px; padding: 26px; overflow: hidden; color: #1b1d22; background: linear-gradient(135deg, #fff6e5, #ffe7e9 55%, #e3f7ef); border: 3px solid #c8102e; }
.cert .seal { position: absolute; right: 18px; top: 18px; width: 92px; height: 92px; border-radius: 50%; border: 4px solid #c8102e; color: #c8102e; display: grid; place-items: center; font-family: var(--font-zh-serif); font-weight: 900; font-size: 1.4rem; transform: rotate(-12deg); text-align: center; line-height: 1.1; }
.cert h2 { font-family: var(--font-zh-serif); color: #c8102e; font-size: 1.8rem; }

/* ---------- Khóa học: hội thoại ---------- */
.dialog { display: flex; flex-direction: column; gap: 12px; }
.dline { display: flex; gap: 10px; align-items: flex-start; }
.dline.me { flex-direction: row-reverse; }
.avatar { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-family: var(--font-zh-serif); font-weight: 900; font-size: 1.15rem; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25); text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.bubble { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px 16px 16px 16px; padding: 8px 14px 10px; max-width: min(660px, 86%); min-width: 0; transition: box-shadow .2s, border-color .2s; }
.dline.me .bubble { border-radius: 16px 4px 16px 16px; background: color-mix(in srgb, var(--minibus-green) 10%, var(--surface-2)); border-color: color-mix(in srgb, var(--minibus-green) 35%, transparent); }
.bubble .who { font-size: .8rem; font-weight: 700; color: var(--muted); }
.bubble .line-zh.sm { font-size: 1.35rem; }
.dline.playing .bubble { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent); }
@media (max-width: 560px) { .bubble { max-width: calc(100% - 52px); } .bubble .line-zh.sm { font-size: 1.2rem; } .avatar { width: 36px; height: 36px; flex-basis: 36px; font-size: 1rem; } }
.vocab-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 8px; }
.vrow { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; position: relative; color: var(--text); }
.vrow:hover { border-color: var(--accent-2); }
.vrow .z { grid-row: span 2; font-family: var(--font-zh-serif); font-size: 1.6rem; line-height: 1.1; }
.vrow .m { font-size: .9rem; color: var(--muted); }
.vrow .known { position: absolute; top: 6px; right: 10px; color: var(--ok); font-weight: 800; }
.vrow.playing { border-color: var(--accent); }
.gex { padding: 10px 0; border-top: 1px dashed var(--border); }
.finish-bar { border-color: color-mix(in srgb, var(--minibus-red) 40%, transparent); border-top: 4px solid var(--minibus-red); }

.toolbar .btn { font-size: .88rem; }
.fade-in { animation: fade .25s; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.mt { margin-top: 14px; } .mt2 { margin-top: 24px; } .mb { margin-bottom: 14px; }
.row > input[type=url], .row > input[type=text], .row > input[type=search] { flex: 1; width: auto; min-width: 160px; }

@media (max-width: 560px) {
  h1 { font-size: 1.5rem; }
  .hero { padding: 20px 16px 18px; }
  .hero .ring { width: 74px; height: 74px; flex-basis: 74px; }
  .neon-sign .line-zh { font-size: 1.7rem; }
  .toolbar .btn { padding: 6px 10px; min-height: 34px; font-size: .84rem; }
  .film-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
  .film-chip { flex: 0 0 auto; }
  .line-zh { font-size: 1.35rem; }
  .line-zh.lg { font-size: 1.6rem; }
  .card { padding: 14px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .tab { flex: 0 0 auto; }
}
@media (max-width: 560px) {
  .hero .ring { display: none; }
  .neon-sign { max-width: 100%; padding: 4px 10px 8px; }
  .neon-sign .line-zh { font-size: 1.55rem; letter-spacing: .04em; }
  .led { font-size: .95rem; padding: 4px 10px; }
}

/* ---------- Đệm từ ---------- */
ruby.ptc { background: color-mix(in srgb, var(--gold) 20%, transparent); border-radius: 5px; box-shadow: inset 0 -2px 0 var(--gold); cursor: pointer; padding: 0 2px; }
ruby.ptc:hover { background: color-mix(in srgb, var(--gold) 34%, transparent); }
.ptc-demo { background: color-mix(in srgb, var(--gold) 20%, transparent); box-shadow: inset 0 -2px 0 var(--gold); border-radius: 4px; padding: 0 4px; }
.pbig { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 78px; height: 86px; padding: 4px 8px; border-radius: 14px; cursor: pointer;
  font-family: var(--font-zh-serif); font-weight: 900; font-size: 2.3rem; line-height: 1.1; color: #fff; background: var(--l-pink); border: 0; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .25), 0 0 16px color-mix(in srgb, var(--l-pink) 45%, transparent); }
.pbig span { font-family: var(--font); font-size: .8rem; font-weight: 700; }
.pbig span .jp span { color: #fff !important; }
.pcard { border-top: 4px solid var(--l-pink); }
.lab-stage { border-radius: 14px; padding: 16px; background: var(--surface-2); border: 1px dashed var(--border); text-align: center; }
.pbtns { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.pbtn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border-radius: 12px; cursor: pointer; background: var(--surface-2); border: 2px solid var(--border); color: var(--text); }
.pbtn b { font-family: var(--font-zh-serif); font-size: 1.6rem; line-height: 1.1; }
.pbtn.on { border-color: var(--l-pink); background: color-mix(in srgb, var(--l-pink) 16%, var(--surface-2)); box-shadow: 0 0 14px color-mix(in srgb, var(--l-pink) 35%, transparent); }
.pcard .chip { white-space: normal; text-align: left; }
.tone-opt .jp { font-size: 1.15rem; letter-spacing: .02em; }
