:root {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #17283d;
  background: #f5f7fa;
  font-synthesis: none;
  --ink: #17283d;
  --muted: #5c697b;
  --line: #dbe2eb;
  --accent: #245be2;
  --green: #13734c;
  --red: #b52940;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.6;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #7299fa;
  outline-offset: 4px;
}
button {
  border: 0;
  background: none;
  color: inherit;
}
a {
  color: inherit;
}
header {
  height: 100px;
  padding: 0 4%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid var(--line);
  gap: 16px;
}
.brand {
  text-decoration: none;
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.8px;
}
.brand-mark {
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  border-radius: 14px;
  width: 50px;
  height: 50px;
  font-size: 32px;
  font-weight: 500;
}
.brand small {
  display: block;
  font-size: 12px;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin-top: 4px;
}
.shell {
  display: grid;
  grid-template-columns: 230px 1fr;
  max-width: 1600px;
  margin: auto;
}
aside {
  padding: 36px 24px;
  min-height: calc(100vh - 100px);
  border-right: 1px solid var(--line);
}
.nav-label,
.eyebrow {
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 1.5px;
  color: var(--muted);
}
nav {
  margin-top: 20px;
  display: grid;
  gap: 6px;
}
nav button {
  text-align: left;
  padding: 13px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  gap: 14px;
  align-items: center;
}
nav button span {
  font-size: 23px;
  width: 26px;
  text-align: center;
  font-weight: 400;
}
nav button:hover {
  background: #e9edf4;
}
nav button.active {
  background: #e4ebff;
  color: #204fc6;
}
hr {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  margin: 20px 0;
}
.aside-note {
  margin: 70px 16px 0;
  border-top: 2px solid var(--ink);
  padding-top: 22px;
}
.aside-note > span {
  font-size: 27px;
  letter-spacing: 3px;
}
.aside-note p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
}
main {
  padding: 38px 44px 70px;
  min-width: 0;
}
.page-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
h1 {
  font-size: 36px;
  letter-spacing: -1.5px;
  margin: 6px 0 10px;
}
h2 {
  letter-spacing: -0.7px;
}
p {
  line-height: 1.65;
  color: var(--muted);
  margin: 8px 0;
}
.primary,
.secondary {
  padding: 11px 17px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
}
.primary {
  background: var(--accent);
  color: white;
}
.primary:hover {
  background: #1948bc;
}
.secondary {
  background: #fff;
  border: 1px solid var(--line);
}
.secondary:hover {
  border-color: #9baac0;
}
.text-button {
  color: var(--accent);
  padding: 10px;
}
.session-strip {
  display: flex;
  align-items: center;
  gap: 30px;
  background: var(--ink);
  color: #fff;
  border-radius: 12px;
  padding: 22px 26px;
  margin: 26px 0;
}
.session-stat strong {
  display: block;
  font-size: 27px;
  line-height: 1.2;
}
.session-stat span {
  font-size: 12px;
  color: #c0cbdc;
}
.progress-wrap {
  margin-left: auto;
  width: 35%;
  font-size: 13px;
  color: #c0cbdc;
}
.progress-wrap > div {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}
progress {
  display: block;
  width: 100%;
  height: 6px;
  appearance: none;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #41516a;
}
progress::-webkit-progress-bar {
  background: #41516a;
}
progress::-webkit-progress-value {
  background: #82b5ff;
}
progress::-moz-progress-bar {
  background: #82b5ff;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.filter {
  display: flex;
  align-items: center;
  gap: 7px;
  background: white;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.filter:has(input:checked) {
  background: #e9efff;
  border-color: #b4c8ff;
  color: #1b47b2;
}
.filter input {
  accent-color: var(--accent);
  margin: 0;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin: 24px 0 14px;
}
.section-title h2 {
  font-size: 17px;
  margin: 0;
}
.section-title span {
  font-size: 13px;
  color: var(--muted);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
  gap: 12px;
}
.kana-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 12px 10px;
  position: relative;
  min-width: 0;
  transition: border-color 0.15s;
}
.kana-card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #245be214;
}
.kana-symbol {
  display: block;
  font-family: "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif;
  font-size: 43px;
  line-height: 1.65;
  text-align: center;
  margin-bottom: 8px;
}
.kana-card input {
  width: 100%;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 6px;
  padding: 9px 4px;
  text-align: center;
  font-size: 16px;
  color: var(--ink);
  outline: none;
}
.kana-card input:focus {
  border-color: var(--accent);
  background: white;
}
.feedback {
  font-size: 12px;
  min-height: 20px;
  margin: 6px 0 0;
  text-align: center;
  line-height: 1.5;
  color: var(--muted);
}
.kana-card.wrong {
  border-color: #e6a3ad;
}
.wrong .feedback {
  color: var(--red);
}
.kana-card.done {
  background: #eff7f3;
  border-color: #c7e4d6;
}
.done .kana-symbol {
  color: #325d48;
}
.reading {
  text-align: center;
  color: var(--green);
  font-weight: 600;
  font-size: 15px;
  padding: 9px 0;
}
.saved-note {
  font-size: 13px;
  margin-top: 13px;
}
.saved-note button {
  color: var(--accent);
  text-decoration: underline;
  padding: 0;
}
.help {
  font-size: 14px;
  margin: 18px 0;
  color: var(--muted);
}
details {
  background: #edf1f7;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 18px 0;
  font-size: 14px;
}
summary {
  cursor: pointer;
  font-weight: 600;
}
.sentence-list {
  display: grid;
  gap: 14px;
}
.sentence-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
}
.sentence-card .kana-symbol {
  text-align: left;
  font-size: 26px;
  overflow-wrap: anywhere;
}
.sentence-entry {
  display: flex;
  gap: 10px;
}
.sentence-entry input {
  flex: 1;
  min-width: 0;
  text-align: left;
  padding: 12px;
}
.sentence-card .feedback {
  text-align: left;
}
.sentence-card .reading {
  text-align: left;
}
.translation {
  padding: 8px 0;
}
.translation button {
  padding: 0;
  color: var(--accent);
  font-size: 14px;
}
.empty {
  padding: 40px;
  background: #fff;
  border: 1px dashed #c7d1e0;
  border-radius: 12px;
  text-align: center;
  margin: 24px 0;
}
.empty h2 {
  margin: 0;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 26px 0;
}
.metric {
  padding: 22px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.metric strong {
  display: block;
  font-size: 30px;
  margin: 10px 0;
}
.metric span {
  color: var(--muted);
  font-size: 14px;
}
.table-wrap {
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}
th {
  background: #edf1f7;
  color: var(--muted);
  font-weight: 600;
}
th,
td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
tr:last-child td {
  border: 0;
}
.mini-kana {
  font-size: 24px;
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  margin: 22px 0;
}
.panel h2 {
  font-size: 19px;
  margin: 0 0 8px;
}
.panel label {
  font-size: 14px;
}
.inline-form {
  display: flex;
  gap: 8px;
  margin-top: 15px;
}
.inline-form input {
  min-width: 0;
  flex: 1;
}
.code {
  font-family: monospace;
  font-size: 20px;
  letter-spacing: 1px;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.friend-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.friend-row:last-child {
  border: 0;
}
.friend-row p {
  font-size: 14px;
}
#notice {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 14px 20px;
  border-radius: 10px;
  max-width: 90%;
  box-shadow: 0 4px 20px #0002;
  z-index: 5;
}
#notice:empty {
  display: none;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px;
  max-width: 430px;
  width: calc(100% - 32px);
  color: var(--ink);
}
dialog::backdrop {
  background: #15233899;
}
dialog h2 {
  font-size: 30px;
  margin: 14px 0;
}
dialog label {
  display: block;
  margin-top: 16px;
  font-size: 14px;
  font-weight: 600;
}
input {
  border: 1px solid #c5cfdd;
  border-radius: 7px;
  padding: 11px;
  background: #fff;
  outline-color: var(--accent);
}
dialog input {
  display: block;
  width: 100%;
  margin-top: 6px;
}
dialog .primary {
  width: 100%;
  margin-top: 8px;
}
dialog .text-button {
  width: 100%;
  margin-top: 10px;
}
.dialog-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dialog-top button {
  font-size: 27px;
}
#auth-error {
  color: var(--red);
  font-size: 14px;
}
#account {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 14px;
}
[hidden] {
  display: none !important;
}
.success-banner {
  background: #e7f4ec;
  color: #17643d;
  border: 1px solid #bddcc9;
  padding: 20px;
  border-radius: 10px;
  margin: 16px 0;
}
@media (min-width: 1400px) {
  .grid {
    grid-template-columns: repeat(7, 1fr);
  }
}
@media (max-width: 1050px) {
  main {
    padding: 30px 24px;
  }
  .shell {
    grid-template-columns: 190px 1fr;
  }
  aside {
    padding: 30px 12px;
  }
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .split {
    grid-template-columns: 1fr;
  }
  .session-strip {
    gap: 20px;
  }
  .progress-wrap {
    width: 30%;
  }
}
@media (max-width: 720px) {
  header {
    height: 80px;
    padding: 0 18px;
  }
  .brand {
    font-size: 20px;
  }
  .brand small {
    display: none;
  }
  .brand-mark {
    width: 42px;
    height: 42px;
  }
  .shell {
    display: block;
  }
  aside {
    border: 0;
    min-height: 0;
    padding: 12px 14px;
    background: white;
    border-bottom: 1px solid var(--line);
  }
  .nav-label,
  .aside-note,
  nav hr {
    display: none;
  }
  nav {
    display: flex;
    margin: 0;
    gap: 4px;
    overflow: auto;
  }
  nav button {
    flex-shrink: 0;
    padding: 10px;
    font-size: 14px;
  }
  nav button span {
    display: none;
  }
  main {
    padding: 26px 18px 60px;
  }
  h1 {
    font-size: 30px;
  }
  .page-top {
    align-items: flex-start;
  }
  .page-top p {
    font-size: 14px;
  }
  .session-strip {
    padding: 18px;
    gap: 18px;
    flex-wrap: wrap;
  }
  .session-stat strong {
    font-size: 24px;
  }
  .progress-wrap {
    width: 100%;
    margin: 0;
  }
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
  }
  .kana-card {
    padding: 10px 8px 6px;
  }
  .kana-symbol {
    font-size: 36px;
  }
  .filter {
    font-size: 13px;
    padding: 8px;
  }
  .sentence-card {
    padding: 18px;
  }
  .sentence-card .kana-symbol {
    font-size: 23px;
  }
  .metric {
    padding: 16px;
  }
  .metric strong {
    font-size: 26px;
  }
  .inline-form {
    flex-wrap: wrap;
  }
  .friend-row {
    align-items: flex-start;
  }
  .section-title span {
    font-size: 12px;
  }
  #account {
    gap: 4px;
  }
  #account > span {
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Shared surfaces support both color schemes, including forms and feedback. */
:root {
  color-scheme: light;
  --page: #f5f7fa;
  --surface: #ffffff;
  --subtle: #edf1f7;
  --field: #f8fafc;
  --selected: #e4ebff;
  --selected-ink: #204fc6;
  --success-bg: #eff7f3;
  --success-line: #c7e4d6;
  --success-ink: #325d48;
  --error-line: #e6a3ad;
  color: var(--ink);
  background: var(--page);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #101722;
  --surface: #192332;
  --subtle: #222f42;
  --field: #121c2a;
  --ink: #e8eef8;
  --muted: #a9b8cc;
  --line: #344358;
  --accent: #99baff;
  --green: #8bd8ae;
  --red: #ff9eac;
  --selected: #253c67;
  --selected-ink: #c1d5ff;
  --success-bg: #17382d;
  --success-line: #32634e;
  --success-ink: #b1e5c6;
  --error-line: #b76675;
}
header,
.secondary,
.kana-card,
.sentence-card,
.metric,
.table-wrap,
.panel,
.empty,
dialog,
input,
select {
  background: var(--surface);
}
input,
select {
  color: var(--ink);
  border-color: var(--line);
}
input::placeholder {
  color: var(--muted);
  opacity: 1;
}
nav button:hover,
details,
th {
  background: var(--subtle);
}
nav button.active {
  background: var(--selected);
  color: var(--selected-ink);
}
.filter {
  background: var(--surface);
}
.filter:has(input:checked) {
  background: var(--selected);
  color: var(--selected-ink);
  border-color: var(--accent);
}
.kana-card input {
  background: var(--field);
}
.kana-card input:focus {
  background: var(--surface);
}
.kana-card {
  transition:
    background-color 220ms ease,
    border-color 220ms ease,
    box-shadow 150ms ease;
}
.kana-card.done {
  background: var(--success-bg);
  border-color: var(--success-line);
}
.done .kana-symbol {
  color: var(--success-ink);
}
.kana-card.wrong {
  border-color: var(--error-line);
}
.success-banner {
  background: var(--success-bg);
  border-color: var(--success-line);
  color: var(--green);
}
.primary {
  background: #245be2;
  color: #fff;
}
.primary:hover {
  background: #1948bc;
}
.brand-mark,
.session-strip,
#notice {
  background: #17283d;
  color: #fff;
}
[data-theme="dark"] .brand-mark,
[data-theme="dark"] .session-strip,
[data-theme="dark"] #notice {
  background: #263956;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sentence-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 18px 0;
}
.set-select {
  color: var(--muted);
  font-size: 14px;
}
.set-select select {
  padding: 9px;
  margin-left: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
.set-count {
  width: 100%;
  font-size: 14px;
  color: var(--muted);
}
.explanation {
  margin-top: 18px;
  border-top: 1px solid var(--success-line);
  padding-top: 18px;
  outline-offset: 5px;
}
.explanation h3 {
  margin: 0;
  font-size: 16px;
}
.sentence-meaning {
  font-size: 18px;
  color: var(--ink);
}
.word-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 18px 0;
}
.word-part {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 135px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 9px;
  min-width: 0;
}
.word-part.particle {
  border-top: 3px solid var(--accent);
}
.word-kana {
  font-size: 23px;
  overflow-wrap: anywhere;
  color: var(--ink);
}
.word-romaji {
  font-size: 14px;
  color: var(--green);
  overflow-wrap: anywhere;
}
.word-meaning {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}
.grammar-note {
  background: var(--surface);
  border-left: 3px solid var(--green);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--ink);
}
.sentence-pager button:disabled {
  cursor: default;
}
@media (max-width: 720px) {
  aside {
    background: var(--surface);
  }
  header {
    height: auto;
    min-height: 80px;
    flex-wrap: wrap;
    padding: 14px 18px;
  }
  .header-actions {
    margin-left: auto;
    gap: 6px;
  }
  .header-actions .secondary {
    padding: 9px 11px;
  }
  .sentence-pager {
    gap: 8px;
  }
  .sentence-pager .secondary {
    padding: 9px;
  }
  .word-part {
    flex-basis: 115px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .kana-card {
    transition: none;
  }
}

.sentence-card ruby {
  ruby-align: center;
  ruby-position: over;
}
.sentence-card rt {
  font-size: 0.5em;
  color: var(--muted);
  font-weight: 500;
}
.sentence-card .kana-symbol:has(ruby) {
  line-height: 2.2;
}
