/* KhmerPod101 course-app design system — "the brand, grown up".
   Extends the proven landing-page identity (blue #0174c7 / yellow #fcd42f / Open Sans)
   into the course/lesson/WOTD app, closing the seam with the old navy/gold style.css.
   Mobile-first, vanilla, no build step. Yellow = action/positive ONLY. */

:root {
  --blue: #0174c7;
  --blue-deep: #015a9b;
  --yellow: #fcd42f;
  --yellow-deep: #e9be12;
  --ink: #1c232d;
  --muted: #5c6670;
  --bg: #f5f8fb;          /* cool, blue-tinted — signals "inside the app" */
  --card: #ffffff;
  --line: #e3eaf1;
  --good: #1f9d57;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 42, 67, .06), 0 6px 20px rgba(16, 42, 67, .05);
  --tap: 44px;            /* min touch target */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Khmer script is the visual hero — large, with a Khmer-capable font stack. */
.km {
  font-family: "Noto Sans Khmer", "Khmer OS", "Khmer UI", "Battambang", system-ui, sans-serif;
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 680px; margin: 0 auto; padding: 1rem 1.1rem 4rem; }

/* ---------- top app bar ---------- */
.appbar {
  background: var(--blue);
  color: #fff;
  position: sticky; top: 0; z-index: 30;
  box-shadow: 0 1px 8px rgba(1, 116, 199, .25);
}
.appbar-in {
  max-width: 680px; margin: 0 auto;
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem 1.1rem;
}
.appbar img.logo { height: 30px; width: auto; border-radius: 5px; display: block; }
.appbar .brand { font-weight: 700; color: #fff; font-size: 1.05rem; letter-spacing: .2px; }
.appbar nav { margin-left: auto; display: flex; gap: .25rem; align-items: center; }
.appbar nav a {
  color: #eaf4fc; font-size: .9rem; font-weight: 600;
  padding: .4rem .55rem; border-radius: 8px;
}
.appbar nav a:hover { background: rgba(255,255,255,.14); text-decoration: none; }
.appbar nav a.cta { background: var(--yellow); color: var(--ink); }
.appbar nav a.cta:hover { background: var(--yellow-deep); }
@media (max-width: 460px) {
  .appbar .brand { display: none; }
  .appbar nav a:not(.cta) { padding: .4rem .4rem; }
}

/* ---------- cards & sections ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; margin: 1rem 0; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 .75rem; font-size: 1.15rem; }
.section-label { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--blue); margin: 1.5rem 0 .5rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border: 0; border-radius: 11px; cursor: pointer; font: inherit; font-weight: 700;
  padding: .85rem 1.4rem; min-height: var(--tap); text-decoration: none;
  transition: background .12s, transform .04s;
}
.btn:active { transform: translateY(1px); }
.btn-yellow { background: var(--yellow); color: var(--ink); }
.btn-yellow:hover { background: var(--yellow-deep); text-decoration: none; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-deep); text-decoration: none; }
.btn-ghost { background: #eef4fa; color: var(--blue); }
.btn-ghost:hover { background: #e2edf7; text-decoration: none; }
.btn-block { width: 100%; }
.btn-lg { font-size: 1.1rem; padding: 1rem 1.5rem; }

/* ---------- progress ---------- */
.progress { background: #e7eef5; border-radius: 99px; height: 9px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--yellow); border-radius: 99px; transition: width .4s; }

/* ---------- audio pill ---------- */
.audio-pill {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); min-width: var(--tap);
  border: 1px solid var(--line); background: #fff; color: var(--blue);
  border-radius: 50%; cursor: pointer; font-size: 1.15rem; line-height: 1;
  transition: background .12s, color .12s, border-color .12s;
}
.audio-pill:hover { border-color: var(--blue); }
.audio-pill.playing { background: var(--yellow); border-color: var(--yellow-deep); color: var(--ink); }
.audio-pill.slow { font-size: 1rem; width: 38px; height: 38px; min-width: 38px; }
.audio-pill[disabled] { opacity: .3; cursor: default; }

/* ---------- word card (vocab / WOTD) ---------- */
.wordcard {
  display: flex; align-items: center; gap: 1rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem 1rem; margin: .6rem 0; box-shadow: var(--shadow);
}
.wordcard .body { flex: 1; min-width: 0; }
.wordcard .km { font-size: 1.9rem; }
.wordcard .rom { color: var(--blue); font-style: italic; font-size: 1.02rem; }
.wordcard .en { color: var(--muted); font-size: .95rem; }
.wordcard .pos { display: inline-block; font-size: .72rem; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 .35rem; margin-left: .4rem; vertical-align: middle; }
.wordcard .controls { display: flex; flex-direction: column; gap: .4rem; align-items: center; }

/* ---------- dialogue ---------- */
.dline { display: flex; gap: .75rem; align-items: flex-start; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.dline:last-child { border-bottom: 0; }
.dline.active { background: #fffbe6; border-radius: 10px; margin: 0 -.5rem; padding: .7rem .5rem; }
.dline .spk { font-weight: 700; color: var(--blue); flex: 0 0 1.4rem; }
.dline .km { font-size: 1.5rem; }
.dline .rom { color: var(--blue); font-style: italic; font-size: .98rem; }
.dline .en { color: var(--muted); font-size: .92rem; }

/* ---------- lesson grid (dashboard) ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.tile {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 1rem .9rem; display: flex; flex-direction: column; gap: .3rem;
  color: var(--ink); box-shadow: var(--shadow);
}
.tile:hover { border-color: var(--blue); text-decoration: none; }
.tile .n { font-size: .75rem; color: var(--muted); font-weight: 700; }
.tile .t { font-weight: 700; line-height: 1.25; }
.tile .badge { position: absolute; top: .6rem; right: .7rem; font-size: .95rem; }
.tile.locked { opacity: .62; }
.tile.done { border-color: var(--good); }
.tile.done .badge { color: var(--good); }

/* ---------- sticky mini player ---------- */
.mini {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--ink); color: #fff;
  display: none; align-items: center; gap: .8rem;
  padding: .6rem 1rem; box-shadow: 0 -2px 14px rgba(0,0,0,.2);
}
.mini.show { display: flex; }
.mini .label { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mini .label .km { font-size: 1.15rem; }
.mini button {
  background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 8px;
  min-width: 40px; height: 40px; cursor: pointer; font-size: 1rem; font-weight: 700;
}
.mini button.on { background: var(--yellow); color: var(--ink); }

/* ---------- hero band (dashboard / wotd) ---------- */
.band {
  position: relative; border-radius: var(--radius); overflow: hidden;
  color: #fff; padding: 1.4rem 1.25rem; margin: 1rem 0;
  background: linear-gradient(120deg, rgba(1,90,155,.92), rgba(1,116,199,.86)), var(--band-img, none);
  background-size: cover; background-position: center;
}
.band h1 { margin: 0 0 .3rem; font-size: 1.5rem; }
.band .sub { color: #eaf4fc; font-size: .98rem; }
.band .avatar { width: 46px; height: 46px; border-radius: 50%; border: 2px solid #fff; object-fit: cover; vertical-align: middle; margin-right: .5rem; }

.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none; }
.pill-tag { display: inline-block; background: #eef4fa; color: var(--blue); font-weight: 700; font-size: .8rem; padding: .2rem .6rem; border-radius: 99px; }
.coverage { font-weight: 700; color: var(--good); }
