:root {
  --cacao: #29211e;
  --cacao-2: #3a302c;
  --rose: #baa48a;
  --taupe: #91806d;
  --rose-soft: #ded2c3;
  --cream: #ebe5dd;
  --paper: #f8f5f1;
  --ink: #29211e;
  --muted: #706358;
  --line: #d6cabe;
  --success: #91806d;
  --shadow: 0 18px 50px rgba(41, 33, 30, .11);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% -8%, rgba(186,164,138,.24), transparent 30rem),
    var(--cream);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
  padding-bottom: 11rem;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: .85rem;
  min-height: 74px;
  padding: .8rem max(1rem, calc((100vw - 1180px) / 2));
  background: rgba(41,33,30,.98);
  color: white;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 30px rgba(41,33,30,.18);
}
.topbar::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url("brand/pattern.webp") center 48% / 540px auto;
  opacity: .045;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 50%;
  background: rgba(255,255,255,.03);
}
.brand-mark img { display: block; width: 23px; height: 29px; object-fit: contain; }
.topbar h1 { margin: .1rem 0 0; font-family: Georgia, serif; font-size: 1.2rem; font-weight: 500; }
.eyebrow { margin: 0; color: #baa48a; font-size: .66rem; font-weight: 800; letter-spacing: .14em; }
.eyebrow.dark { color: var(--rose); }

main { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; }
.dashboard-head {
  display: grid;
  grid-template-columns: 1.5fr .7fr;
  gap: 2rem;
  align-items: end;
  padding: 3.2rem 0 1.8rem;
}
.dashboard-head h2 {
  max-width: 720px;
  margin: .55rem 0 .7rem;
  color: var(--cacao);
  font-family: Georgia, serif;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1.02;
  font-weight: 500;
}
.intro { max-width: 680px; margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.65; }
.brand-signature {
  width: min(390px, 100%);
  margin-top: 1.15rem;
  overflow: hidden;
  border-radius: 14px;
  background: #29211e;
  box-shadow: 0 12px 35px rgba(41,33,30,.13);
}
.brand-signature img { display: block; width: 100%; height: auto; }
.progress-card {
  position: relative;
  overflow: hidden;
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(248,245,241,.88);
}
.progress-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("brand/pattern.webp") center / 340px auto;
  opacity: .035;
  pointer-events: none;
}
.progress-card > * { position: relative; }
.progress-copy { display: flex; justify-content: space-between; gap: 1rem; font-size: .85rem; color: var(--muted); }
.progress-copy strong { color: var(--cacao); }
.progress-track { height: 8px; margin-top: .8rem; overflow: hidden; border-radius: 99px; background: var(--rose-soft); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--rose); transition: width .25s ease; }

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.search-box { flex: 1 1 260px; display: grid; gap: .45rem; color: var(--cacao); font-size: .76rem; font-weight: 800; letter-spacing: .04em; }
.search-box input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 1rem;
  color: var(--ink);
  background: var(--cream);
  outline: none;
}
.search-box input:focus { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(186,164,138,.18); }
.filters { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .1rem; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter {
  min-height: 42px;
  padding: 0 .9rem;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--paper);
  color: var(--muted);
  font-size: .83rem;
  font-weight: 700;
}
.filter.active { border-color: var(--cacao); background: var(--cacao); color: var(--cream); }

.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding: 1.4rem 0; }
.module {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 10px 35px rgba(41,33,30,.07);
}
.module-top { padding: 1.2rem; }
.module-meta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .7rem; }
.module-number { color: var(--rose); font-size: .72rem; font-weight: 900; letter-spacing: .12em; }
.status { color: var(--muted); font-size: .75rem; }
.module h3 { margin: 0; color: var(--cacao); font-family: Georgia, serif; font-size: 1.45rem; font-weight: 500; line-height: 1.15; }
.module-actions { display: flex; gap: .55rem; margin-top: 1rem; }
.listen, .toggle, .complete {
  min-height: 43px;
  border-radius: 12px;
  padding: 0 .9rem;
  border: 1px solid var(--line);
  background: white;
  color: var(--cacao);
  font-weight: 800;
  font-size: .84rem;
}
.listen { border-color: var(--rose); background: var(--rose); color: var(--cacao); }
.listen.playing { border-color: var(--cacao); background: var(--cacao); }
.toggle { margin-left: auto; }
.phrases { display: none; margin: 0; padding: .15rem 1.2rem 1.2rem; list-style: none; counter-reset: phrase; }
.module.open .phrases { display: grid; }
.phrases li {
  counter-increment: phrase;
  position: relative;
  padding: .85rem .2rem .85rem 2.3rem;
  border-top: 1px solid var(--line);
  font-size: 1rem;
  line-height: 1.55;
}
.phrases li::before {
  content: counter(phrase, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: .95rem;
  color: var(--rose);
  font-size: .69rem;
  font-weight: 900;
}
.module-footer { display: flex; justify-content: flex-end; padding: .8rem 1.2rem 1.1rem; border-top: 1px solid var(--line); background: #fcf8f6; }
.complete[aria-pressed="true"] { border-color: var(--success); background: var(--success); color: white; }
.empty { padding: 4rem 1rem; text-align: center; color: var(--muted); }

.player {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  width: min(760px, calc(100% - 2rem));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .75rem 1rem;
  align-items: center;
  padding: .9rem 1rem;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 20px;
  background: rgba(41,33,30,.98);
  color: white;
  box-shadow: 0 24px 70px rgba(41,33,30,.34);
  backdrop-filter: blur(18px);
}
.player-info { min-width: 0; display: grid; gap: .25rem; }
.player-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: Georgia, serif; font-weight: 500; }
.player-kicker { color: #baa48a; font-size: .63rem; font-weight: 900; letter-spacing: .12em; }
.player-controls { display: flex; align-items: center; gap: .65rem; }
.play-main { min-width: 76px; min-height: 42px; border: 0; border-radius: 12px; background: var(--rose); color: var(--cacao); font-weight: 900; }
.speed-label { display: grid; gap: .2rem; color: #d7c8c3; font-size: .62rem; font-weight: 700; }
.speed-label select { border: 1px solid rgba(255,255,255,.2); border-radius: 8px; padding: .25rem .4rem; background: #3a302c; color: white; }
.timeline-row { grid-column: 1 / -1; display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; gap: .5rem; color: #dacbc7; font-size: .68rem; }
.timeline { width: 100%; }
#timeline { width: 100%; accent-color: var(--rose); }

@media (max-width: 760px) {
  body { padding-bottom: 12.5rem; }
  .topbar { padding: .75rem 1rem; }
  main { width: min(100% - 1rem, 720px); }
  .dashboard-head { grid-template-columns: 1fr; gap: 1.2rem; padding: 2rem .5rem 1.2rem; }
  .dashboard-head h2 { font-size: 2.35rem; }
  .controls { position: sticky; top: 78px; z-index: 15; border-radius: 18px; padding: .8rem; }
  .filters { width: 100%; }
  .module-grid { grid-template-columns: 1fr; gap: .75rem; }
  .module-top { padding: 1.05rem; }
  .module h3 { font-size: 1.32rem; }
  .module-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .toggle { margin-left: 0; }
  .phrases { padding-inline: 1rem; }
  .player { bottom: max(.5rem, env(safe-area-inset-bottom)); width: calc(100% - 1rem); border-radius: 18px; }
  .player-info { grid-column: 1 / -1; }
  .player-controls { grid-column: 1 / -1; justify-content: space-between; }
  .play-main { flex: 1; }
}

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