:root {
  color-scheme: dark;
  --bg: #14171b;
  --panel: #20242b;
  --muted: #b4bac6;
  --accent: #9b3858;
  --line: #3c424d;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: #f4f2f4;
  font:
    16px/1.6 system-ui,
    sans-serif;
}
header,
footer {
  max-width: 1180px;
  margin: auto;
  padding: 28px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
header {
  border-bottom: 1px solid var(--line);
}
.brand {
  color: inherit;
  text-decoration: none;
  font-size: 27px;
  font-weight: 650;
  letter-spacing: -1px;
}
.brand > span {
  display: inline-grid;
  place-items: center;
  background: #64263b;
  border-radius: 12px;
  width: 44px;
  height: 44px;
  margin-right: 10px;
}
.brand small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 2px;
  margin-left: 59px;
}
.free,
footer {
  color: var(--muted);
  font-size: 13px;
}
main {
  max-width: 1100px;
  margin: 50px auto;
  padding: 0 30px;
  min-height: 65vh;
}
.eyebrow {
  color: #e2a2b7;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
}
h1 {
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1.12;
  letter-spacing: -2px;
  margin: 18px 0 24px;
}
h2 {
  font-size: 28px;
  line-height: 1.25;
}
h3 {
  margin: 0 0 12px;
}
p {
  color: var(--muted);
}
.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 60px;
  align-items: center;
}
.lead {
  font-size: 18px;
  max-width: 530px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 30px;
}
.art {
  min-height: 300px;
  display: grid;
  place-content: center;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 70%, #61283b 0, transparent 70%), #20242b;
}
.art strong {
  font-size: 90px;
  font-weight: 400;
  letter-spacing: 12px;
}
.art p {
  margin: 0;
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 32px 0;
}
.grid .panel {
  padding: 22px;
}
.number {
  color: #e8a7bb;
  font-size: 13px;
}
.form {
  max-width: 720px;
  margin: 50px auto;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 25px 0;
}
legend,
label {
  font-weight: 600;
}
label {
  display: block;
  margin: 12px 0;
}
input,
select {
  font: inherit;
  accent-color: var(--accent);
}
select {
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  width: 100%;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.chips label {
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 400;
}
button {
  font: inherit;
  color: #fff;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #2b303a;
  border-radius: 10px;
  padding: 13px 20px;
  min-height: 48px;
}
button:hover {
  border-color: #efb4c7;
  background: #3c3440;
}
.primary {
  background: #81304b;
  border-color: #ad526e;
  font-weight: 650;
}
.primary:hover {
  background: #9a3b5b;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #f4c06a;
  outline-offset: 4px;
}
.row {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}
.tag {
  background: #342b36;
  color: #f0b6c9;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
}
.lesson {
  max-width: 760px;
  margin: auto;
}
.japanese {
  font-size: 44px;
  line-height: 1.4;
  text-align: center;
  margin: 22px 0 0;
}
.reading {
  text-align: center;
  margin-top: 4px;
}
.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 25px 0;
}
.choices button {
  text-align: left;
}
.feedback {
  padding: 18px;
  border-left: 3px solid #dca1b5;
  background: #302831;
  margin: 20px 0;
}
.feedback p {
  margin: 4px 0;
  color: #eee;
}
.progress {
  height: 6px;
  background: #3b404a;
  border-radius: 10px;
  margin: 20px 0;
}
.progress > div {
  height: 100%;
  background: #d189a1;
  border-radius: 10px;
}
.muted {
  color: var(--muted);
  font-size: 14px;
}
.tokens {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.tokens small {
  display: block;
  color: #d4c9d2;
}
.answer {
  min-height: 70px;
  border: 1px dashed #7d6875;
  border-radius: 10px;
  padding: 12px;
}
.notice {
  font-size: 12px;
  color: #c3bac6;
  margin: 20px 0;
}
footer {
  border-top: 1px solid var(--line);
  gap: 15px;
  flex-wrap: wrap;
}
a {
  color: #f2b3c9;
}
dialog {
  background: var(--panel);
  color: white;
}
.error {
  color: #ffb6bd;
}
@media (max-width: 650px) {
  header,
  footer {
    padding: 20px;
  }
  .free {
    display: none;
  }
  main {
    margin: 30px auto;
    padding: 0 18px;
  }
  .hero {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .art {
    min-height: 210px;
  }
  .art strong {
    font-size: 64px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .panel {
    padding: 22px;
  }
  .choices {
    grid-template-columns: 1fr;
  }
  h1 {
    letter-spacing: -1px;
  }
  .form {
    margin: 25px 0;
  }
}
progress.progress {
  display: block;
  width: 100%;
  border: 0;
  appearance: none;
}
progress::-webkit-progress-bar {
  background: #3b404a;
  border-radius: 10px;
}
progress::-webkit-progress-value {
  background: #d189a1;
  border-radius: 10px;
}
progress::-moz-progress-bar {
  background: #d189a1;
}
.grid h2 {
  font-size: 20px;
  margin: 0 0 12px;
}
.lesson-title {
  font-size: 32px;
  letter-spacing: -0.5px;
}
button[aria-pressed="true"] {
  border-color: #f0b6c9;
  background: #64263b;
}
h1:focus,
h2:focus {
  outline: none;
}
.hero h1 {
  font-size: clamp(36px, 4.2vw, 54px);
}
.art strong {
  font-size: clamp(40px, 5.2vw, 68px);
  letter-spacing: 4px;
  white-space: nowrap;
}

/* Shared shell must wrap when public/account text is enlarged. */
header, footer { flex-wrap:wrap; gap:16px; overflow-wrap:anywhere; }
header > *, footer > * { min-width:0; max-width:100%; }
.brand small { margin-left:0; }
.public-page .hero > *, .public-page .public-plans > * { min-width:0; }
.public-page { overflow-wrap:anywhere; }

.public-page .art { grid-template-columns:minmax(0,1fr); }

.public-page .art strong { white-space:normal; }

.phrase-anatomy { display: grid; grid-template-columns: minmax(0,1fr); gap: .4rem; padding: 1.25rem; background: var(--bg); border: 1px solid var(--line); border-radius: 1rem; }
.phrase-anatomy dt { font-weight: 700; font-size: .85rem; }
.phrase-anatomy dd { margin: 0 0 .75rem; overflow-wrap: anywhere; }
.panel p { overflow-wrap: anywhere; }

.generated-lesson h1 { overflow-wrap: anywhere; }
