:root {
  color-scheme: light;
  --bg: #f4f0e8;
  --ink: #111315;
  --muted: #686f73;
  --line: rgba(21, 24, 27, 0.12);
  --surface: rgba(255, 253, 248, 0.92);
  --surface-strong: #fffdf8;
  --green: #16664f;
  --green-soft: #dcefe6;
  --blue: #2e5e8f;
  --blue-soft: #dbe9f7;
  --amber: #a56416;
  --amber-soft: #f6e2bd;
  --rose: #a84747;
  --shadow: 0 20px 52px rgba(28, 24, 18, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(244, 240, 232, 0.94), rgba(232, 239, 236, 0.94)),
    repeating-linear-gradient(90deg, rgba(17, 19, 21, 0.03) 0 1px, transparent 1px 96px);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  cursor: pointer;
  min-height: 40px;
  padding: 0 13px;
}

button:hover {
  border-color: rgba(22, 102, 79, 0.45);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.62);
  padding: 18px 12px;
  backdrop-filter: blur(16px);
}

.brand-mark,
.rail-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  font-weight: 900;
}

.brand-mark {
  background: var(--ink);
  color: #fffdf8;
  margin-bottom: 8px;
}

.rail-button {
  padding: 0;
  color: var(--muted);
}

.rail-button.active {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

.stage {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow,
.label,
.hero-kicker {
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  margin-bottom: 7px;
  text-transform: uppercase;
}

h1 {
  font-size: 38px;
  line-height: 1;
  margin-bottom: 0;
}

.status {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  min-height: 40px;
  padding: 10px 13px;
}

.hero-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  min-height: 154px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(255, 253, 248, 0.94), rgba(220, 239, 230, 0.82)),
    linear-gradient(90deg, transparent, rgba(46, 94, 143, 0.08));
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 18px;
}

.hero-strip h2 {
  max-width: 720px;
  font-size: 30px;
  line-height: 1.16;
  margin-bottom: 0;
}

.pulse-card {
  display: grid;
  gap: 4px;
  min-width: 150px;
  border: 1px solid rgba(22, 102, 79, 0.22);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.72);
  padding: 16px;
}

.pulse-card.listening {
  border-color: rgba(22, 102, 79, 0.5);
  box-shadow: 0 16px 40px rgba(22, 102, 79, 0.18);
}

.pulse-card span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.pulse-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 7px rgba(22, 102, 79, 0.12);
}

.pulse-card.listening .pulse-dot {
  animation: pulse 1.2s ease-in-out infinite;
}

.capture-toggle {
  width: 100%;
  margin-top: 8px;
  background: var(--ink);
  color: #fffdf8;
  border-color: var(--ink);
  font-weight: 850;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 5px rgba(22, 102, 79, 0.14);
  }
  70% {
    box-shadow: 0 0 0 13px rgba(22, 102, 79, 0);
  }
  100% {
    box-shadow: 0 0 0 5px rgba(22, 102, 79, 0);
  }
}

.workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: start;
}

.surface {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px;
  backdrop-filter: blur(16px);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-head h3 {
  font-size: 18px;
  margin-bottom: 0;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  margin-bottom: 14px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefb;
  color: var(--ink);
  outline: none;
  padding: 12px;
}

textarea {
  min-height: 330px;
  resize: vertical;
  line-height: 1.52;
}

input:focus,
textarea:focus {
  border-color: rgba(22, 102, 79, 0.62);
  box-shadow: 0 0 0 4px rgba(22, 102, 79, 0.12);
}

.primary {
  width: 100%;
  background: var(--green);
  color: #ffffff;
  border-color: var(--green);
  font-weight: 850;
}

.secondary {
  background: var(--green-soft);
  color: var(--green);
  border-color: rgba(22, 102, 79, 0.28);
  font-weight: 850;
}

.ghost {
  color: var(--green);
  font-weight: 800;
}

.capture-tools {
  display: grid;
  gap: 8px;
  margin: -4px 0 14px;
}

.capture-tools span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.tabs {
  display: flex;
  gap: 6px;
}

.tabs button {
  min-height: 34px;
  font-size: 13px;
  font-weight: 750;
}

.tabs button.active {
  background: var(--green-soft);
  border-color: rgba(22, 102, 79, 0.35);
  color: var(--green);
}

.cards {
  display: grid;
  gap: 10px;
}

.card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 251, 0.82);
  padding: 15px;
}

.card-main {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
  padding: 5px 8px;
}

.level {
  background: var(--amber-soft);
  color: var(--amber);
}

.sentence {
  font-size: 18px;
  line-height: 1.38;
  font-weight: 850;
  word-break: break-word;
}

.meaning,
.why {
  color: var(--muted);
  line-height: 1.48;
}

.correction,
.pattern {
  border-radius: 8px;
  line-height: 1.45;
  padding: 10px 11px;
}

.correction {
  background: var(--green-soft);
  color: #124936;
  font-weight: 780;
}

.correction span {
  display: block;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.pattern {
  background: rgba(46, 94, 143, 0.09);
  color: var(--blue);
  font-size: 13px;
}

.why {
  font-size: 13px;
}

.review-actions {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
}

.review-actions button {
  min-height: 38px;
  padding: 0 8px;
  font-weight: 780;
}

.again {
  color: var(--rose);
}

.good {
  color: var(--blue);
}

.easy {
  color: var(--green);
}

.coach-panel {
  display: grid;
  gap: 18px;
}

.compact {
  padding-bottom: 8px;
}

.stats {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.stats div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  padding: 8px 0 12px;
}

.stats strong {
  font-size: 30px;
}

.stats span {
  color: var(--muted);
}

.companion {
  background: #16231f;
  color: #f8f3e8;
}

.companion .label {
  color: #9ad4bd;
}

.companion p:last-child {
  color: rgba(248, 243, 232, 0.82);
  line-height: 1.58;
  margin-bottom: 0;
}

.empty {
  border: 1px dashed rgba(21, 24, 27, 0.22);
  border-radius: 8px;
  color: var(--muted);
  min-height: 190px;
  display: grid;
  place-items: center;
  padding: 28px;
  text-align: center;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 350px minmax(0, 1fr);
  }

  .coach-panel {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
    flex-direction: row;
    justify-content: center;
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
  }

  .stage {
    padding: 16px;
  }

  .topbar,
  .hero-strip,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 34px;
  }

  .hero-strip h2 {
    font-size: 24px;
  }

  .workspace,
  .coach-panel {
    grid-template-columns: 1fr;
  }

  .tabs {
    width: 100%;
  }

  .tabs button {
    flex: 1;
  }

  .card {
    grid-template-columns: 1fr;
  }

  .review-actions {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto;
  }
}
