:root {
  color-scheme: light;
  --ink: #25313a;
  --muted: #68747c;
  --cream: #fbf7ef;
  --paper: #fffdf9;
  --rose: #dc6f78;
  --rose-dark: #b94f5b;
  --rose-soft: #f8e2e2;
  --sage: #678f82;
  --sage-soft: #dcebe5;
  --sun: #f1c96a;
  --blue: #749caf;
  --line: #e9e1d5;
  --shadow: 0 14px 40px rgba(73, 56, 42, 0.08);
  --radius: 22px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--cream);
  font-family: "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 12px max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(233, 225, 213, 0.85);
  background: rgba(251, 247, 239, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-mark, .auth-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px 14px 14px 4px;
  color: white;
  background: var(--rose);
  font: 600 24px/1 "Vazirmatn", sans-serif;
  box-shadow: 0 6px 16px rgba(220, 111, 120, 0.25);
}

nav { display: flex; gap: 8px; }
.nav-link {
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.nav-link:hover, .nav-link.active { color: var(--ink); background: var(--paper); }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 38px 0 80px; }
.view[hidden] { display: none; }

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  min-height: 260px;
  overflow: hidden;
  padding: 48px 56px;
  border-radius: 32px;
  background: #e4eee9;
}

.hero::before {
  position: absolute;
  inset: auto auto -120px -80px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,.35);
  content: "";
}

.hero-copy { position: relative; z-index: 1; align-self: center; }
.eyebrow, .section-kicker {
  margin: 0 0 10px;
  color: var(--rose-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.eyebrow span { margin-left: 4px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 16px; max-width: 700px; font-size: clamp(38px, 5vw, 62px); line-height: 1.02; letter-spacing: -.055em; }
.hero-text { max-width: 570px; margin: 0; color: #53635f; font-size: 18px; line-height: 1.6; }

.hero-art { position: relative; min-height: 170px; }
.sun { position: absolute; top: 6px; right: 34px; width: 72px; height: 72px; border-radius: 50%; background: var(--sun); box-shadow: 0 0 0 14px rgba(241, 201, 106, .18); }
.rainbow { position: absolute; right: 20px; bottom: -105px; width: 235px; height: 235px; border: 24px solid #de8e8b; border-bottom-color: transparent; border-radius: 50%; transform: rotate(4deg); }
.rainbow span:nth-child(1) { position: absolute; inset: 14px; border: 22px solid #ecc973; border-bottom-color: transparent; border-radius: 50%; }
.rainbow span:nth-child(2) { position: absolute; inset: 49px; border: 22px solid #85aa9e; border-bottom-color: transparent; border-radius: 50%; }
.cloud { position: absolute; z-index: 2; width: 66px; height: 25px; border-radius: 30px; background: rgba(255,255,255,.85); }
.cloud::before { position: absolute; left: 14px; bottom: 9px; width: 30px; height: 30px; border-radius: 50%; background: inherit; content: ""; }
.cloud-one { top: 30px; left: 35px; transform: scale(.75); }
.cloud-two { right: 6px; bottom: 46px; transform: scale(.56); }

.lesson-toolbar { margin: 34px 0; }
.level-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.level-tab {
  display: flex;
  gap: 14px;
  align-items: center;
  min-height: 82px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: var(--paper);
  text-align: left;
  cursor: pointer;
}
.level-tab.active { border-color: var(--sage); box-shadow: 0 0 0 2px rgba(103,143,130,.12); }
.level-tab.locked { opacity: .62; cursor: not-allowed; }
.level-tab svg { width: 18px; margin-left: auto; fill: none; stroke: currentColor; stroke-width: 1.7; }
.level-number { display: grid; flex: 0 0 auto; place-items: center; width: 43px; height: 43px; border-radius: 14px; background: var(--sage-soft); color: #3d7261; font-weight: 700; }
.level-tab strong, .level-tab small { display: block; }
.level-tab strong { margin-bottom: 3px; font-size: 15px; }
.level-tab small { color: var(--muted); }
.category-filter { display: flex; gap: 8px; margin-top: 22px; overflow-x: auto; padding-bottom: 3px; }
.filter-chip { flex: 0 0 auto; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: transparent; cursor: pointer; }
.filter-chip:hover, .filter-chip.active { border-color: var(--ink); color: var(--paper); background: var(--ink); }

.lesson-intro, .studio-toolbar { display: flex; align-items: end; justify-content: space-between; margin: 44px 0 18px; }
.lesson-intro h2, .studio-toolbar h2 { margin: 0; font-size: 28px; letter-spacing: -.035em; }
.lesson-intro > p { margin-bottom: 4px; color: var(--muted); font-size: 14px; }

.phrase-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.phrase-card {
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 142px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 5px 20px rgba(73,56,42,.035);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.phrase-card:hover { transform: translateY(-2px); border-color: #d8cdbf; box-shadow: var(--shadow); }
.play-button {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  color: white;
  background: var(--rose);
  box-shadow: 0 8px 20px rgba(220,111,120,.28);
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.play-button:hover { transform: scale(1.05); background: var(--rose-dark); }
.play-button:active { transform: scale(.96); }
.play-button svg { width: 28px; height: 28px; fill: currentColor; }
.play-button.playing svg { animation: pulse .8s ease-in-out infinite alternate; }
.phrase-copy { min-width: 0; }
.english { margin: 0 0 7px; font-weight: 600; }
.farsi { margin: 0 0 5px; font: 600 25px/1.4 "Vazirmatn", sans-serif; }
.pronunciation { margin: 0; color: var(--muted); font-size: 13px; font-style: italic; }
.category-dot { align-self: start; width: 9px; height: 9px; margin-top: 3px; border-radius: 50%; background: var(--sage); }
.category-dot.routine { background: var(--sun); }
.category-dot.comfort { background: var(--blue); }
.category-dot.lullaby { background: #9a83b8; }
.unrecorded { border-style: dashed; box-shadow: none; }
.unrecorded .play-button { color: #9b8f85; background: #eee7dd; box-shadow: none; cursor: default; }
.not-recorded { grid-column: 2 / 4; margin: -7px 0 0; color: #a06b64; font-size: 12px; }
.empty-state { padding: 64px 24px; border: 1px dashed #d8cdbf; border-radius: var(--radius); background: var(--paper); text-align: center; }
.empty-state > span { color: var(--rose); font-size: 38px; }
.empty-state h3 { margin: 10px 0 6px; }
.empty-state p { color: var(--muted); }

.admin-view { max-width: 980px; margin: 0 auto; }
.admin-hero { display: flex; align-items: center; justify-content: space-between; padding: 30px 0 34px; }
.admin-hero h1 { max-width: 680px; margin-bottom: 12px; font-size: clamp(36px, 5vw, 54px); }
.admin-hero p:last-child { max-width: 640px; color: var(--muted); }
.mic-badge { display: grid; flex: 0 0 auto; place-items: center; width: 100px; height: 100px; border-radius: 50%; color: var(--rose); background: var(--rose-soft); }
.mic-badge svg { width: 44px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.6; }

.auth-card { display: grid; grid-template-columns: auto 1fr; gap: 20px 22px; max-width: 640px; margin: 28px auto; padding: 32px; border: 1px solid var(--line); border-radius: 26px; background: var(--paper); box-shadow: var(--shadow); }
.auth-card h2 { margin-bottom: 7px; }
.auth-card p { color: var(--muted); }
.auth-card form { grid-column: 1 / -1; }
label { display: grid; gap: 7px; color: #536069; font-size: 13px; font-weight: 600; }
input, select { width: 100%; padding: 12px 13px; border: 1px solid #dcd2c5; border-radius: 12px; color: var(--ink); background: white; outline: 0; }
input:focus, select:focus { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(103,143,130,.13); }
.password-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.form-message { min-height: 18px; margin: 8px 0 0; color: var(--rose-dark) !important; font-size: 13px; }

.button { display: inline-flex; align-items: center; justify-content: center; padding: 11px 17px; border: 1px solid transparent; border-radius: 12px; font-weight: 600; text-decoration: none; cursor: pointer; }
.button.primary { color: white; background: var(--rose); }
.button.primary:hover { background: var(--rose-dark); }
.button.secondary { border-color: var(--sage); color: #426f61; background: #eff7f3; }
.button.quiet { border-color: var(--line); color: var(--muted); background: transparent; }
.studio-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.privacy-note { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 14px; color: #4b6b61; background: var(--sage-soft); }
.privacy-note svg { flex: 0 0 auto; width: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.privacy-note p { margin: 0; font-size: 13px; }
.migration-note { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 12px; padding: 16px 18px; border: 1px solid #e6cf99; border-radius: 14px; background: #fff6dc; }
.migration-note p { margin: 3px 0 0; color: #75674b; font-size: 13px; }
.recording-list { display: grid; gap: 28px; margin-top: 26px; }
.recording-category { display: grid; gap: 10px; }
.recording-category-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.recording-category-heading > div { display: flex; gap: 9px; align-items: center; }
.recording-category-heading .category-dot { margin: 0; }
.recording-category-heading h3 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.category-count { color: var(--muted); font-size: 12px; }
.recording-category-list { display: grid; gap: 10px; }
.recording-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 18px; align-items: center; padding: 18px 20px; border: 1px solid var(--line); border-radius: 17px; background: var(--paper); }
.recording-row .phrase-copy { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr); gap: 6px 22px; align-items: center; }
.recording-row .english { margin: 0; }
.recording-row .farsi { margin: 0; font-size: 21px; }
.recording-row .pronunciation { grid-column: 1 / -1; }
.phrase-admin-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-top: 3px; }
.phrase-admin-meta label { display: flex; gap: 7px; align-items: center; font-size: 11px; }
.phrase-admin-meta select { width: auto; min-width: 128px; padding: 6px 28px 6px 9px; border-radius: 8px; font-size: 12px; }
.priority-label { padding: 4px 8px; border-radius: 99px; color: #536069; background: #f0ede7; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.record-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.priority-controls { display: flex; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: white; }
.priority-button { width: 36px; height: 40px; border: 0; color: var(--ink); background: white; font-size: 18px; cursor: pointer; }
.priority-button + .priority-button { border-left: 1px solid var(--line); }
.priority-button:hover:not(:disabled) { color: var(--rose-dark); background: var(--rose-soft); }
.priority-button:disabled { color: #cfc7bc; cursor: not-allowed; }
.record-button { min-width: 102px; }
.record-button.recording { color: white; background: var(--rose); animation: softPulse 1.2s ease infinite; }
.preview-button, .delete-button { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: white; cursor: pointer; }
.preview-button svg, .delete-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.preview-button svg { fill: currentColor; stroke: none; }
.status-pill { display: inline-block; margin-top: 7px; padding: 4px 8px; border-radius: 99px; color: #9a685d; background: #faece8; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.status-pill.ready { color: #3d7261; background: var(--sage-soft); }

dialog { width: min(520px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 24px; background: var(--paper); box-shadow: 0 28px 90px rgba(32,24,18,.25); }
dialog::backdrop { background: rgba(37,49,58,.42); backdrop-filter: blur(3px); }
dialog form { display: grid; gap: 16px; padding: 26px; }
.dialog-heading, .dialog-actions { display: flex; align-items: center; justify-content: space-between; }
.dialog-heading h2 { margin: 0; }
.dialog-actions { justify-content: flex-end; gap: 8px; margin-top: 4px; }
.icon-button { border: 0; color: var(--muted); background: transparent; font-size: 28px; cursor: pointer; }

@keyframes pulse { from { opacity: .65; transform: scale(.92); } to { opacity: 1; transform: scale(1.08); } }
@keyframes softPulse { 50% { box-shadow: 0 0 0 5px rgba(220,111,120,.15); } }

@media (max-width: 760px) {
  main { width: min(100% - 24px, 1180px); padding-top: 18px; }
  .site-header { min-height: 66px; padding: 10px 16px; }
  .brand span:last-child { display: none; }
  .hero { grid-template-columns: 1fr; min-height: 380px; padding: 34px 28px; }
  .hero-art { position: absolute; right: 0; bottom: 0; width: 240px; height: 180px; opacity: .8; }
  .level-tabs, .phrase-grid { grid-template-columns: 1fr; }
  .level-tab { min-height: 70px; }
  .lesson-intro { align-items: start; }
  .lesson-intro > p { max-width: 110px; text-align: right; }
  .admin-hero { align-items: start; }
  .mic-badge { width: 68px; height: 68px; }
  .mic-badge svg { width: 30px; }
  .studio-toolbar { align-items: start; gap: 18px; }
  .studio-actions { flex-direction: column; }
  .migration-note { align-items: flex-start; flex-direction: column; }
  .recording-row { grid-template-columns: 1fr; }
  .recording-row .phrase-copy { grid-template-columns: 1fr; }
  .recording-row .pronunciation { grid-column: auto; }
  .phrase-admin-meta { grid-column: auto; }
  .record-controls { justify-content: flex-end; }
}

@media (max-width: 450px) {
  .nav-link { padding: 9px 11px; }
  h1 { font-size: 40px; }
  .hero { padding: 28px 23px; }
  .phrase-card { grid-template-columns: 54px minmax(0,1fr) auto; gap: 13px; padding: 18px 15px; }
  .play-button { width: 52px; height: 52px; }
  .farsi { font-size: 22px; }
  .auth-card { grid-template-columns: 1fr; padding: 24px; }
  .auth-card form { grid-column: auto; }
  .password-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
