:root {
  color-scheme: light;
  --paper: #f8f7ef;
  --surface: #fffefa;
  --ink: #292e21;
  --soft: #5d6555;
  --green: #3d5538;
  --line: #dfdfd1;
  --tint: #ebeedf;
  --serif: "Songti SC", "Noto Serif CJK SC", "SimSun", "Georgia", serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--paper); color: var(--ink); font: 1rem/1.65 var(--sans); }
a { color: var(--green); text-underline-offset: .22em; }
a:hover { color: #253923; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .66; }
:focus-visible { outline: 2px solid #537348; outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1, h2, .diary-card h3, .brand strong { font-family: var(--serif); }
h1 { font-size: clamp(2.3rem, 5vw, 4rem); line-height: 1.13; letter-spacing: -.055em; }
h2 { font-size: clamp(1.55rem, 2.3vw, 2rem); line-height: 1.3; letter-spacing: -.015em; }
h3 { line-height: 1.4; }
svg { width: 1.35rem; height: 1.35rem; flex: none; }
[lang="ja"] { font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans CJK JP", Meiryo, var(--sans); }
.shell, .header-inner { width: min(1184px, calc(100% - 6rem)); margin-inline: auto; }
main.shell { flex: 1; padding-bottom: 4rem; }
main:focus { outline: none; }
.muted { color: var(--soft); font-size: .9rem; }
.sr-only { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.site-header { border-bottom: 1px solid var(--line); }
.header-inner { min-height: 5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--ink); }
.brand-icon { display: grid; place-items: center; border-radius: 50%; width: 2.55rem; height: 2.55rem; background: #e8ecdb; color: var(--green); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.2rem; line-height: 1.25; letter-spacing: .04em; }
.brand small { color: var(--soft); font-size: .78rem; margin-top: .15rem; }
.main-nav { display: flex; align-items: center; gap: clamp(.25rem, 1.5vw, 1.15rem); flex-wrap: wrap; }
.main-nav a { text-decoration: none; color: var(--soft); padding: .4rem .78rem; border-radius: 2rem; font-size: .925rem; }
.main-nav a:hover { background: #efefe5; color: var(--green); }
.main-nav a[aria-current] { background: #e6ebd9; color: #33482d; font-weight: 600; }

.hero { display: grid; grid-template-columns: 1.02fr 1fr; background: #eeefe1; border: 1px solid #e2e4d4; border-radius: 1rem; overflow: hidden; margin: 2.3rem 0 2.65rem; min-height: 22.5rem; }
.hero-copy { align-self: center; padding: clamp(2rem, 4vw, 4rem); }
.hero-mark { display: flex; align-items: center; gap: .55rem; color: #475a41; font-size: .94rem; margin-bottom: 1.1rem; }
.hero-mark svg { width: 1.1rem; height: 1.1rem; }
.hero h1 { font-size: clamp(2.15rem, 4.1vw, 3.55rem); color: #293b26; }
.hero-intro { color: #4f5d47; font-size: clamp(1rem, 1.4vw, 1.12rem); margin: 1.1rem 0 1.9rem; }
.hero-art { width: 100%; height: 100%; min-height: 0; object-fit: cover; display: block; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; border-radius: .5rem; border: 1px solid var(--green); background: var(--green); padding: .63rem 1.15rem; text-decoration: none; color: white; font-weight: 600; font-size: .93rem; min-height: 2.65rem; }
.button:hover { color: white; background: #30462d; }
.button.secondary { background: #f6f7ed; color: #3b5234; border-color: #cdd6bf; }
.button.secondary:hover:not(:disabled) { background: #e3ead8; }
.button[aria-pressed="true"] { background: #e3ead8; }

.home-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(14rem, 25%); gap: 1.4rem; align-items: start; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.diary-grid, .content-grid, .practice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.diary-card, .expression-card, .practice-card, .reading-pane { background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; padding: clamp(1.1rem, 2.25vw, 1.65rem); min-width: 0; overflow-wrap: anywhere; }
.diary-card { display: flex; flex-direction: column; min-height: 14.4rem; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem .75rem; color: var(--soft); font-size: .82rem; }
.tag { color: #465840; background: #ebeedf; border-radius: 1rem; padding: .12rem .55rem; white-space: nowrap; }
.diary-card h3 { font-size: clamp(1.32rem, 2.2vw, 1.8rem); margin-top: .68rem; }
.diary-card h3 a { text-decoration: none; color: var(--ink); }
.diary-card h3 a:hover { text-decoration: underline; }
.jp-subtitle { color: #54684d; line-height: 1.5; }
.diary-card .jp-subtitle { font-size: .93rem; margin-top: .18rem; }
.card-summary { margin-block: .82rem 1.15rem; color: #51594a; }
.card-bottom { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; justify-content: space-between; margin-top: auto; font-size: .86rem; padding-top: .72rem; border-top: 1px solid #e8e7dd; color: var(--soft); }
.text-link { font-weight: 600; }
.home-aside { margin-top: 3.2rem; border: 1px solid #dfe4d2; background: #eff1e5; border-radius: .75rem; padding: clamp(1.12rem, 2.1vw, 1.55rem); }
.aside-icon { display: grid; place-items: center; border-radius: 50%; width: 2.45rem; height: 2.45rem; color: var(--green); background: #e1e7d4; margin-bottom: .68rem; }
.home-aside h2 { font-size: 1.45rem; }
.home-aside p { color: #505c49; margin-top: .55rem; }
.review-count { display: block; font-size: .88rem; color: #4d6144; margin: 1rem 0 .6rem; }
.home-aside .button { width: 100%; }

.site-footer { border-top: 1px solid var(--line); color: var(--soft); font-size: .86rem; padding-block: 1.3rem; }
.site-footer .shell { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1rem; }
.site-footer [lang="ja"] { font-weight: 600; color: var(--green); }

.page-heading { margin-block: 3.25rem 1.8rem; }
.page-heading h1 { font-size: clamp(2.15rem, 5vw, 3.5rem); }
.page-heading p { color: var(--soft); margin-top: .8rem; }
.lesson { max-width: 66rem; margin-inline: auto; }
.lesson .back-link { display: inline-block; margin-top: 2rem; }
.lesson-heading { margin-top: 1.6rem; }
.lesson-heading .card-meta { margin-bottom: .55rem; }
.lesson-heading .jp-subtitle { font-size: 1.23rem; color: var(--green); }
.lesson-nav { display: flex; gap: .42rem .85rem; flex-wrap: wrap; padding: .62rem 0; border-block: 1px solid var(--line); }
.lesson-nav button { border: 0; background: transparent; color: var(--green); padding: .44rem .5rem; font-weight: 600; border-radius: .2rem; }
.lesson-nav button:hover { background: var(--tint); }
.lesson-section { margin-top: 2.4rem; scroll-margin-top: 1.4rem; }
.lesson-section > h2 { margin-bottom: .85rem; }
.reading-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.reading-pane h3 { font-size: 1.04rem; color: var(--green); margin-bottom: .8rem; }
.reading-pane p { line-height: 1.95; }
.reading-pane p + p { margin-top: .75rem; }
.japanese { background: #f0f2e7; }
.japanese p { line-height: 2.1; }
rt { font-size: .7em; color: #4a6243; }
.no-readings rt { display: none; }
.focus-line { margin-bottom: 1rem; color: var(--soft); }
.focus-line span { color: var(--green); }
.expression-card { display: flex; flex-direction: column; gap: .5rem; scroll-margin-top: 1.4rem; }
.expression-card h3 { font-size: 1.18rem; color: #374e30; }
.expression-card .text-link { margin-top: auto; padding-top: .3rem; font-size: .9rem; align-self: flex-start; }
.expression-card.selected { border-color: #657b59; box-shadow: 0 0 0 2px #d8e3cd; }
.meaning { font-weight: 600; }
.example { display: grid; gap: .15rem; border-inline-start: 2px solid #bdc9b4; padding-inline-start: .7rem; margin-block: .35rem; }
.example span + span { color: var(--soft); font-size: .9rem; }
table { width: 100%; background: var(--surface); border-collapse: collapse; font-size: .98rem; }
th, td { padding: .65rem .85rem; border-bottom: 1px solid var(--line); text-align: start; overflow-wrap: anywhere; }
th { background: var(--tint); color: var(--green); }
.usage-note { margin-top: 1rem; color: var(--soft); }
.search-form { display: flex; align-items: center; gap: .65rem; max-width: 30rem; border: 1px solid #cfd6c5; border-radius: .5rem; background: var(--surface); padding: .45rem .8rem; }
.search-form:focus-within { outline: 2px solid #537348; outline-offset: 2px; }
.search-form label { display: flex; align-items: center; color: var(--green); }
.search-form input { width: 100%; appearance: none; border: none; background: transparent; outline: none; }
#search-count { margin-block: .8rem; }
.practice-grid { margin-top: 1rem; align-items: start; }
.practice-card h3 { font-size: 1.04rem; }
.practice-card textarea { display: block; width: 100%; min-height: 4.6rem; resize: vertical; margin-block: .7rem .6rem; padding: .55rem .7rem; border: 1px solid #d3d8ca; border-radius: .4rem; background: #fcfcf8; }
.answer summary { color: var(--green); font-weight: 600; cursor: pointer; }
.answer .model-answer { color: #304a29; margin-block: .6rem .35rem; }
.answer p { margin-bottom: .6rem; }
.ratings { display: flex; gap: .5rem; flex-wrap: wrap; }
.ratings .button { font-size: .88rem; min-height: 2.35rem; padding: .38rem .65rem; }
.feedback:not(:empty) { margin-top: .55rem; }
#storage-notice { margin-top: .85rem; }
.review-status { display: flex; align-items: center; gap: .85rem; flex-wrap: wrap; }
progress { height: .65rem; accent-color: var(--green); }
.growth-table small { display: block; color: var(--soft); margin-top: .2rem; font-size: .87rem; }
.growth-table th:last-child { width: 32%; }
.related { display: grid; margin-top: 2.4rem; padding-top: 1rem; border-top: 1px solid var(--line); justify-items: start; }
.empty { margin-block: 2rem; }
.empty .button { margin-top: .7rem; }

@media (max-width: 980px) {
  .shell, .header-inner { width: min(100% - 3.5rem, 1184px); }
  .hero { min-height: 19rem; }
  .home-columns { grid-template-columns: minmax(0, 1fr); }
  .home-aside { margin-top: 0; }
  .home-aside .button { width: auto; }
}

@media (max-width: 620px) {
  .shell, .header-inner { width: calc(100% - 2rem); }
  .header-inner { display: grid; justify-items: start; gap: .5rem; padding-block: .8rem .52rem; }
  .main-nav { gap: .22rem; }
  .main-nav a { padding: .34rem .61rem; font-size: .875rem; }
  .hero { grid-template-columns: 1fr; margin-block: 1.25rem 1.65rem; }
  .hero-copy { padding: 1.6rem 1.15rem; }
  .hero-art { max-height: 15rem; aspect-ratio: 16 / 9; }
  .hero-intro { margin-bottom: 1.1rem; }
  .hero-mark { margin-bottom: .8rem; }
  .diary-grid, .reading-grid, .content-grid, .practice-grid { grid-template-columns: 1fr; }
  .diary-card { min-height: 0; }
  .page-heading { margin-top: 2rem; }
  th, td { padding-inline: .5rem; }
}
