:root {
  color-scheme: light;
  --paper: #f7f8f1;
  --surface: #fffef9;
  --ink: #263d32;
  --green: #345c47;
  --green-deep: #244b36;
  --muted: #5a695e;
  --line: #dfe5d9;
  --mint: #e7efde;
  --gold: #eac770;
  --terra: #914735;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --jp: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, "Noto Sans CJK JP", sans-serif;
  --mincho: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif CJK JP", serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.65 var(--sans); }
button, input, select { font: inherit; }
button { border: 0; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .46; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid #39725a; outline-offset: 4px; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
[lang="ja"] { font-family: var(--jp); }
.wrap { width: min(1120px, calc(100% - 96px)); margin-inline: auto; }
.visually-hidden, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 20; top: 12px; left: 12px; padding: 10px 16px; background: white; color: var(--ink); }
.topbar { height: 83px; display: grid; grid-template-columns: 1fr auto 1fr; gap: 22px; align-items: center; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 11px; width: fit-content; font-size: 17px; font-weight: 750; letter-spacing: .055em; line-height: 1.2; }
.brand-mark { background: #e5edda; color: #45694d; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 25px; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: .11em; }
.topnav { display: flex; gap: 23px; align-self: stretch; }
.topnav button { position: relative; background: transparent; padding: 0 9px; font-size: 13px; color: var(--muted); }
.topnav button[aria-current] { font-weight: 700; color: var(--green-deep); }
.topnav button[aria-current]::after { content: ""; position: absolute; bottom: 15px; left: calc(50% - 2px); height: 4px; width: 4px; border-radius: 50%; background: var(--green); }
.kana-link { justify-self: end; display: inline-flex; align-items: center; gap: 8px; border: 1px solid #d5dfd1; border-radius: 8px; padding: 9px 13px; color: var(--green); min-height: 42px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.kana-link:hover, .soft-button:hover, .topic:hover, .text-button:hover { background: var(--mint); }
.hero { min-height: 389px; padding: 40px 28px 40px 24px; display: grid; grid-template-columns: 1.15fr 1fr; gap: 27px; align-items: center; }
.eyebrow { display: flex; align-items: center; gap: 9px; color: var(--green); letter-spacing: .10em; font-size: 12px; font-weight: 690; }
.eyebrow span { width: 7px; height: 7px; background: #80a262; border-radius: 50%; }
.hero h1 { font-size: clamp(35px, 4.75vw, 65px); font-weight: 760; letter-spacing: .018em; line-height: 1.2; margin-top: 13px; }
.hero h1 span { color: var(--green); position: relative; z-index: 0; white-space: nowrap; }
.hero h1 span::after { content: ""; position: absolute; z-index: -1; left: 0; right: 0; bottom: .075em; height: .16em; background: #ebd68b; border-radius: 58% 41% 43% 39%; transform: rotate(-2deg); }
.hero-desc { color: var(--muted); font-size: 14px; margin: 19px 0 22px; max-width: 400px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.primary, .soft-button, .text-button { display: inline-flex; justify-content: center; align-items: center; gap: 9px; min-height: 44px; border-radius: 9px; padding: 8px 15px; font-size: 13px; font-weight: 660; transition: background .16s, box-shadow .16s, transform .16s; }
.primary { background: var(--green); color: #fff; padding-inline: 17px; }
.primary:hover:not(:disabled) { background: var(--green-deep); }
.primary:active:not(:disabled) { transform: translateY(1px); }
.soft-button { background: var(--surface); border: 1px solid #d9e1d6; color: var(--green-deep); }
.soft-button[aria-pressed="true"] { background: #f7eccb; border-color: #ddc98f; color: #6b511b; }
.text-button { background: transparent; color: var(--green-deep); }
.hero-art { position: relative; width: min(100%, 435px); justify-self: center; height: 296px; isolation: isolate; }
.art-field { position: absolute; inset: 26px 24px 22px 21px; border-radius: 50% 43% 48% 46%; background: #e8eedc; transform: rotate(-7deg); }
.art-grid { position: absolute; width: 121px; height: 112px; top: 38px; left: 8%; background: radial-gradient(#a5b492 1px, transparent 1.5px) 0 0 / 12px 12px; opacity: .65; mask-image: linear-gradient(135deg, #000 40%, transparent 91%); }
.art-back, .art-front { position: absolute; width: 157px; height: 207px; border-radius: 16px; border: 2px solid #fffdf0; box-shadow: 0 7px 0 -2px #54674724, 0 15px 23px #24382620; }
.art-back { background: #efdb9c; color: #735c27; left: 49%; top: 44px; transform: rotate(13deg); display: flex; align-items: flex-end; flex-direction: column; padding: 22px 15px; gap: 9px; }
.art-back span { writing-mode: vertical-rl; font-family: var(--mincho); font-size: 24px; font-weight: 700; }
.art-back i { width: 11px; height: 32px; border-right: 1px solid #a18a51; margin-right: 12px; }
.art-front { background: #fffaf0; color: #324c3a; left: 24%; top: 45px; transform: rotate(-9deg); display: flex; flex-direction: column; align-items: center; padding: 12px 10px 9px; }
.apple-art { width: 114px; height: 116px; position: relative; }
.apple-art img { width: 100%; height: 100%; display: block; object-fit: contain; }
.art-front strong { font-family: var(--mincho); font-size: 32px; line-height: 1.32; letter-spacing: .04em; }
.art-front small { color: #6a665a; font-size: 12px; letter-spacing: .16em; margin-top: 4px; }
.art-flower, .art-spark { position: absolute; }
.art-flower { color: #b36b55; top: 58px; left: 6%; font-size: 31px; transform: rotate(-15deg); }
.art-spark { color: #728752; right: 2%; bottom: 52px; font-size: 42px; line-height: 1; }
.study { border-top: 1px solid var(--line); padding: 25px 0 0; }
.section-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 13px; }
.section-head h2, .mode-head h2 { font-size: 23px; letter-spacing: .025em; line-height: 1.35; }
.section-head p { color: var(--muted); font-size: 12px; }
.grades { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.grade { display: flex; align-items: center; gap: 12px; padding: 10px 12px; text-align: left; min-height: 69px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); transition: background .18s, border-color .18s; }
.grade[aria-pressed="true"] { border-color: #7f9b74; box-shadow: inset 0 0 0 1px #7f9b74; background: #eef4e6; }
.grade:hover { border-color: #7f9b74; }
.grade-number { display: grid; place-items: center; flex: 0 0 35px; height: 35px; background: var(--grade-color); border-radius: 50%; font: 700 18px/1 Georgia, serif; color: #344c36; }
.grade strong, .grade small { display: block; }
.grade strong { font-size: 14px; white-space: nowrap; }
.grade small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 251px; align-items: start; gap: 24px; margin-top: 24px; }
.study-main { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; min-width: 0; }
.mode-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.mode-switch { display: flex; background: #edf1e7; padding: 3px; border-radius: 9px; white-space: nowrap; }
.mode-switch button { min-height: 38px; background: transparent; padding: 4px 15px; border-radius: 7px; font-size: 12px; color: var(--muted); }
.mode-switch button[aria-pressed="true"] { background: #fffefb; color: var(--green-deep); font-weight: 720; box-shadow: 0 1px 4px #24382617; }
.filters { display: flex; gap: 9px; align-items: stretch; }
.search { display: flex; flex: 1; min-width: 0; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid #dce4d8; background: #f8faf4; border-radius: 9px; color: #617463; }
.search:focus-within { outline: 2px solid #668b6d; outline-offset: 1px; }
.search input { min-width: 0; width: 100%; border: 0; background: transparent; color: var(--ink); outline: 0; min-height: 43px; font-size: 14px; }
.search input::placeholder { color: #68786b; }
#favorites-filter { flex-shrink: 0; }
#favorites-filter span { font-size: 18px; line-height: 1; }
.topics { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 11px; }
.topic { min-height: 37px; color: var(--muted); font-size: 12px; border-radius: 18px; background: transparent; padding: 4px 11px; }
.topic[aria-pressed="true"] { background: #e5efdb; color: var(--green-deep); font-weight: 700; }
.result-count { margin: 10px 0 8px; color: var(--muted); font-size: 11px; }
.word-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.word-card { position: relative; min-width: 0; border-radius: 11px; border: 1px solid #e1e7dc; background: #f5f7ee; transition: border-color .17s, background .17s; }
.word-card:nth-child(3n + 2) { background: #fbf5e7; border-color: #efe5d0; }
.word-card:nth-child(3n + 3) { background: #eff4f5; border-color: #e0e9eb; }
.word-card:hover { border-color: #8ba180; }
.word-open { width: 100%; min-height: 122px; text-align: left; background: transparent; border-radius: 11px; padding: 11px 12px 12px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.word-open .word-topic { padding-right: 35px; }
.word-topic, .dialog-topic { color: #526956; font-size: 11px; font-weight: 650; letter-spacing: .04em; }
.word-open strong { margin-top: 4px; font-size: clamp(20px, 2.2vw, 29px); line-height: 1.22; overflow-wrap: anywhere; }
.word-reading { font-size: 12px; margin-top: 2px; color: #526956; }
.word-meaning { margin-top: 3px; color: #3f5347; font-size: 12px; }
.icon-button { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: transparent; color: var(--green-deep); font-size: 21px; line-height: 1; }
.icon-button:hover { background: #ffffffac; }
.icon-button[aria-pressed="true"] { color: #846115; }
.word-favorite { position: absolute; top: 2px; right: 2px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 11px; margin-top: 15px; font-size: 12px; color: var(--muted); }
.pagination:empty { display: none; }
.empty { grid-column: 1 / -1; border: 1px dashed var(--line); border-radius: 10px; padding: 34px 12px; text-align: center; color: var(--muted); font-size: 13px; }
.progress-card { background: #e8efdd; border: 1px solid #dce6d2; border-radius: 16px; padding: 17px 18px; }
.progress-head { display: flex; gap: 9px; align-items: center; }
.progress-icon { color: #54774d; font-size: 20px; line-height: 1; }
.progress-head h2 { font-size: 15px; }
.progress-number { display: flex; align-items: baseline; gap: 5px; margin-top: 10px; color: var(--green-deep); font-size: 12px; }
.progress-number strong { font: 700 34px/1.3 Georgia, serif; }
.progress-card progress { appearance: none; width: 100%; height: 7px; border: 0; border-radius: 8px; overflow: hidden; display: block; margin-top: 6px; background: #d4e0c7; }
.progress-card progress::-webkit-progress-bar { background: #d4e0c7; border-radius: 8px; }
.progress-card progress::-webkit-progress-value { background: #60874f; border-radius: 8px; }
.progress-card progress::-moz-progress-bar { background: #60874f; border-radius: 8px; }
.progress-details { margin: 16px 0 10px; }
.progress-details div { display: flex; justify-content: space-between; align-items: baseline; padding: 5px 0; border-bottom: 1px solid #d9e3d1; font-size: 12px; }
.progress-details dd { margin: 0; font-weight: 730; }
.progress-card p, .local-note { color: #526551; font-size: 11px; }
.local-note { margin: 9px 2px; }
.footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 15px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 40px; padding: 18px 0 24px; font-size: 11px; }
.footer a { color: var(--green); font-weight: 700; }
.footer span { font-size: 15px; margin-right: 4px; }
.word-dialog { width: min(510px, calc(100% - 28px)); max-height: calc(100% - 28px); padding: 0; border: 1px solid var(--line); border-radius: 19px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 75px #1b302c42; }
.word-dialog::backdrop { background: #20382c77; }
.dialog-inner { padding: 23px 27px 14px; text-align: center; position: relative; }
.dialog-close { position: absolute; right: 7px; top: 5px; font-size: 26px; }
.dialog-inner h2 { margin: 5px 0 0; font-size: clamp(34px, 8vw, 53px); line-height: 1.25; }
.dialog-reading { color: var(--green); font-size: 17px; }
.dialog-meaning { font-size: 15px; margin-top: 7px; }
.dialog-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; margin-top: 15px; }
.example-box { margin-top: 18px; text-align: left; background: #edf2e6; border-radius: 11px; padding: 8px 13px 12px; }
.example-header { display: flex; justify-content: space-between; align-items: center; color: var(--green); font-weight: 680; font-size: 12px; }
.example-header .text-button { padding-inline: 7px; font-size: 12px; }
#dialog-example { font-size: 16px; font-weight: 610; }
#dialog-example-zh { color: var(--muted); margin-top: 5px; font-size: 13px; }
.dialog-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; color: var(--muted); font-size: 12px; }
.dialog-nav .text-button { padding-inline: 7px; }
.quiz-intro, .quiz-question, .quiz-results { padding: 16px; border-radius: 11px; background: #f2f6eb; }
.quiz-intro h3, .quiz-results h3 { margin: 0 0 6px; font-size: 21px; }
.quiz-intro p, .quiz-results p { color: var(--muted); font-size: 13px; }
.quiz-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.quiz-fields label { display: flex; flex-direction: column; font-size: 12px; font-weight: 650; gap: 5px; }
.quiz-fields select { width: 100%; min-height: 44px; padding: 6px 8px; border: 1px solid #d2ddd0; border-radius: 8px; color: var(--ink); background: var(--surface); }
.quiz-step { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; }
.quiz-step .text-button { font-size: 12px; }
.quiz-question h3 { font-size: clamp(25px, 4vw, 40px); margin: 5px 0 12px; line-height: 1.35; }
.quiz-question .quiz-prompt { color: var(--green); font-size: 13px; }
.quiz-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.quiz-option { display: flex; align-items: center; text-align: left; gap: 8px; min-height: 48px; border: 1px solid #d9e2d3; border-radius: 8px; padding: 8px 9px; background: var(--surface); }
.quiz-option:hover:not([aria-disabled="true"]) { border-color: #759770; }
.quiz-option .option-letter { color: #576e54; font-size: 12px; }
.quiz-option.is-right { background: #e0efd6; border-color: #719668; }
.quiz-option.is-wrong { background: #f8e3d9; border-color: #b97963; }
.quiz-option[aria-disabled="true"] { cursor: default; }
.quiz-feedback { margin-top: 11px; min-height: 26px; font-size: 13px; }
.quiz-feedback.good { color: var(--green-deep); }
.quiz-feedback.bad { color: var(--terra); }
.quiz-next { margin-top: 8px; }
.quiz-results ol { list-style: none; padding: 0; margin: 14px 0; }
.quiz-results li + li { margin-top: 5px; }
.quiz-results li button { justify-content: flex-start; width: 100%; text-align: left; }
.quiz-result-actions { margin-top: 13px; display: flex; flex-wrap: wrap; gap: 8px; }
.audio-status { position: fixed; z-index: 10; left: 50%; bottom: 14px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 26px); border-radius: 8px; background: var(--green-deep); color: #fff; padding: 8px 12px; font-size: 13px; }
body:has(.word-dialog[open]) { overflow: hidden; }
@media (max-width: 1000px) {
  .wrap { width: calc(100% - 60px); }
  .hero { padding-inline: 10px; }
  .workspace { grid-template-columns: minmax(0, 1fr) 212px; gap: 16px; }
  .grade { gap: 8px; padding-inline: 9px; }
}
@media (max-width: 760px) {
  .wrap { width: calc(100% - 36px); }
  .topbar { height: 65px; grid-template-columns: 1fr auto; gap: 9px; }
  .topnav { display: none; }
  .hero { gap: 8px; padding: 23px 0; min-height: 320px; }
  .hero-art { transform: scale(.77); transform-origin: center right; width: 108%; justify-self: end; }
  .hero-desc { margin-block: 14px 15px; }
  .grades { gap: 6px; }
  .grade { flex-direction: column; gap: 4px; padding: 6px 4px; text-align: center; }
  .grade-number { flex: 0 0 28px; width: 28px; height: 28px; font-size: 16px; }
  .grade small { display: none; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .progress-card { padding: 10px 13px; display: grid; gap: 5px 13px; grid-template-columns: 1fr auto; }
  .progress-number { margin: 0; }
  .progress-number strong { font-size: 25px; }
  .progress-card progress { grid-column: 1 / -1; margin-top: 0; }
  .progress-details { margin: 0; display: flex; gap: 10px; flex-wrap: wrap; grid-column: 1 / -1; }
  .progress-details div { gap: 6px; border: 0; padding: 0; }
  .progress-card p { grid-column: 1 / -1; }
  .local-note { margin-bottom: 0; }
}
@media (max-width: 490px) {
  .hero { grid-template-columns: minmax(0, 1fr) 112px; gap: 4px; min-height: 0; padding: 22px 0; position: relative; }
  .hero h1 { font-size: clamp(29px, 8vw, 37px); }
  .hero-desc { font-size: 13px; margin: 12px 0 14px; }
  .hero-art { width: 255px; height: 247px; transform: scale(.48); }
  .art-front { left: 17%; }
  .art-back { left: 36%; }
  .art-flower { left: 1%; }
  .art-spark { right: 0; }
  .hero-actions { gap: 4px; width: max-content; max-width: calc(100vw - 36px); }
  .hero-actions button { padding-inline: 9px; font-size: 12px; }
  .section-head { gap: 9px; }
  .section-head h2, .mode-head h2 { font-size: 19px; }
  .section-head p { font-size: 11px; }
  .study { padding-top: 17px; }
  .workspace { margin-top: 14px; gap: 12px; }
  .study-main { padding: 12px; }
  .mode-head { margin-bottom: 11px; }
  .mode-switch button { padding-inline: 10px; }
  .search input { font-size: 16px; }
  .search input::placeholder { font-size: 12px; }
  #favorites-filter { padding-inline: 7px; font-size: 12px; }
  .topic { padding-inline: 9px; }
  .word-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .word-open { padding-inline: 8px; }
  .word-favorite { top: 0; right: 0; }
  .dialog-inner { padding-inline: 15px; }
  .quiz-intro, .quiz-question, .quiz-results { padding: 11px; }
  .quiz-options { grid-template-columns: minmax(0, 1fr); }
  .footer { margin-top: 26px; }
}
@media (max-width: 350px) {
  .wrap { width: calc(100% - 24px); }
  .hero { grid-template-columns: minmax(0, 1fr) 75px; }
  .hero-art { transform: scale(.36); }
  .hero h1 { font-size: 26px; }
  .section-head p { font-size: 10px; }
  .grade strong { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
