:root {
  color-scheme: light;
  font-family: "Inter", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: #25342c;
  background: #f3f2e9;
  --accent: #285540;
  --muted: #53655a;
}
* { box-sizing: border-box; }
body { margin: 0; }
.site-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.1rem max(1.3rem, calc((100% - 68rem) / 2));
  border-bottom: 1px solid #d8dfd5;
  background: #faf9f2;
  font-weight: 700;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: .6rem;
  background: var(--accent);
  color: white;
}
main { width: min(100% - 2rem, 38rem); margin: clamp(2rem, 7vw, 4.75rem) auto; }
.intro, .progress-row { display: flex; justify-content: space-between; align-items: end; gap: 1rem; }
h1 { margin: .25rem 0 0; font-size: clamp(2rem, 7vw, 3rem); letter-spacing: -.06em; }
.level, .mode { color: var(--accent); font-size: .85rem; font-weight: 700; margin: 0; }
.progress-row { margin: 1.75rem 0 .45rem; color: var(--muted); font-size: .875rem; }
progress { width: 100%; height: .5rem; display: block; border: 0; border-radius: 1rem; overflow: hidden; background: #dbe3d8; }
progress::-webkit-progress-bar { background: #dbe3d8; }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.card {
  margin-top: 1.3rem;
  border: 1px solid #d8dfd5;
  border-radius: 1.5rem;
  background: #fffef9;
  padding: clamp(1.25rem, 5vw, 2.5rem);
  box-shadow: 0 12px 40px #263f2d0b;
}
h2 { margin: .65rem 0 1.45rem; font-size: clamp(2rem, 8vw, 4rem); line-height: 1.2; }
[lang="ja"] { font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif; }
form label { display: block; margin-bottom: .6rem; font-weight: 600; }
input, button { font-size: 1rem; }
input { width: 100%; padding: .8rem 1rem; color: inherit; border: 1px solid #84978b; border-radius: .7rem; background: white; }
button { border: 0; border-radius: .7rem; padding: .8rem 1rem; min-height: 44px; cursor: pointer; color: white; background: var(--accent); font-weight: 700; }
button:hover { background: #1d4230; }
button.quiet { color: var(--accent); background: #eaf0e7; }
button.quiet:hover { background: #dce7da; }
:focus-visible { outline: 3px solid #a35825; outline-offset: 3px; }
.actions { display: flex; gap: .65rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 1.15rem; }
.verdict { font-weight: 700; color: var(--accent); }
.answer-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: .5rem 1rem; }
.answer-line strong { font-size: 1.45rem; }
.example { display: grid; gap: .4rem; background: #f2f4ed; border-radius: .7rem; padding: 1rem; }
.example span:last-child, .foot, #summary { color: var(--muted); }
.foot { font-size: .85rem; margin: 1rem 0; }
[hidden] { display: none !important; }

.example p { margin: 0; }
.example-help, #translation, #example-status { font-size: .875rem; color: var(--muted); }
#example { line-height: 2.5; }
.example-word {
  min-height: 44px;
  padding: .25rem .18rem;
  background: transparent;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: .25em;
}
.example-word:hover, .example-word[aria-pressed="true"] { background: #dce7da; }
#example-detail { padding-top: .7rem; border-top: 1px solid #d8dfd5; }
#save-example { margin: .55rem 0 .3rem; }

button:disabled { cursor: default; opacity: .65; }
#prompt { overflow-wrap: anywhere; }
#review-context, #supplement { line-height: 1.65; }
#dictionary {
  position: fixed;
  inset: auto 0 0;
  box-sizing: border-box;
  width: min(100%, 38rem);
  max-width: 100%;
  max-height: 85dvh;
  margin: 0 auto;
  padding: 1.25rem 1.25rem max(1.25rem, env(safe-area-inset-bottom));
  color: inherit;
  background: #fffef9;
  border: 1px solid #d8dfd5;
  border-radius: 1.5rem 1.5rem 0 0;
}
#dictionary::backdrop { background: #17271e66; }
.dictionary-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.dictionary-header h2 { margin: 0; font-size: 2rem; }
#dictionary-form:empty { display: none; }
.example-word { margin-inline-end: .18rem; }

#account-open { margin-inline-start: auto; white-space: nowrap; }
#account-dialog {
  width: min(calc(100% - 2rem), 29rem);
  max-height: 85dvh;
  padding: 1.25rem;
  border: 1px solid #d8dfd5;
  border-radius: 1rem;
  color: inherit;
  background: #fffef9;
}
#account-dialog::backdrop { background: #17271e66; }
#account-form label { margin: .9rem 0 .35rem; }
#account-status:empty { display: none; }

.brand-mark { display: block; flex: none; width: 36px; height: 36px; }
.home h2 { margin: 0 0 .7rem; font-size: clamp(1.8rem, 7vw, 2.6rem); }
#home-next { margin: 0 0 1.35rem; color: var(--muted); }
.home-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.home-actions button { padding-inline: .5rem; }
#review-total { margin-inline-start: .2rem; font-size: .85em; }
#home-back { margin-bottom: 1rem; }
#backup-status:empty { display: none; }

#book-select {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: .4rem 0 1rem;
  padding: .5rem .75rem;
  border: 1px solid #84978b;
  border-radius: .7rem;
  background: white;
  color: inherit;
  font: inherit;
}
