/* Nihongo Online のデザイン（4ページ共通） */
:root {
  --ai: #1c2a5c;          /* 藍 */
  --shu: #d9452c;         /* 朱 */
  --bg: #f5f4f0;
  --surface: #ffffff;
  --ink: #1b1d24;
  --muted: #555a66;
  --line: #e2e0da;
  --tag-bg: #fdf0dc;
  --tag-ink: #8a5300;
  --shadow: 0 1px 2px rgba(20,30,60,.06), 0 4px 14px rgba(20,30,60,.06);
  --shadow-hi: 0 2px 4px rgba(20,30,60,.08), 0 12px 28px rgba(20,30,60,.14);
  --sans: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1424;
    --surface: #182038;
    --ink: #eceef4;
    --muted: #aab0c2;
    --line: #2a3350;
    --tag-bg: rgba(242,181,68,.15);
    --tag-ink: #f2c46b;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    --shadow-hi: 0 8px 24px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  font-size: 16px;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
rt { font-size: .5em; font-weight: 400; }
html:not(.show-furigana) rt { visibility: hidden; }
:focus-visible { outline: 3px solid #f2b544; outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: 1040px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
@media (min-width: 720px) { .wrap { padding-left: 32px; padding-right: 32px; } }

/* ---------- header ---------- */
.masthead { background: var(--ai); color: #fff; }
.bar {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
  padding-top: 14px; padding-bottom: 14px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px;
  background: var(--shu); color: #fff; font-size: 16px; font-weight: 700;
}
#furigana-toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font: 500 14px var(--sans); color: #fff; padding: 6px 12px; min-height: 36px;
  border-radius: 999px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2);
}
.switch { position: relative; width: 28px; height: 16px; border-radius: 999px; background: rgba(255,255,255,.3); transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: transform .2s; }
#furigana-toggle[aria-pressed="true"] .switch { background: #f2b544; }
#furigana-toggle[aria-pressed="true"] .switch::after { transform: translateX(12px); }
.langs {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  padding: 4px; border-radius: 10px; background: rgba(0,0,0,.2);
}
.langs a {
  text-align: center; font-size: 14px; padding: 7px 4px; border-radius: 7px;
  color: rgba(255,255,255,.8); min-height: 36px; line-height: 22px;
}
.langs a:hover { color: #fff; background: rgba(255,255,255,.08); }
.langs a.active { background: #fff; color: var(--ai); font-weight: 700; }
@media (min-width: 720px) {
  .bar { grid-template-columns: 1fr auto auto; gap: 16px; padding-top: 18px; padding-bottom: 18px; }
  .langs { grid-column: auto; grid-row: 1; grid-column-start: 2; display: flex; border-radius: 999px; }
  .langs a { padding: 6px 14px; border-radius: 999px; }
}
.intro { padding-top: 18px; padding-bottom: 28px; border-top: 1px solid rgba(255,255,255,.12); }
.intro h1 { font-size: 24px; font-weight: 700; letter-spacing: .01em; line-height: 1.4; }
.intro p { margin-top: 6px; color: rgba(255,255,255,.85); font-size: 15px; line-height: 2; }
@media (min-width: 720px) {
  .intro { padding-top: 28px; padding-bottom: 40px; }
  .intro h1 { font-size: 30px; }
  .intro p { font-size: 16px; }
}

/* ---------- resources ---------- */
main { padding-top: 28px; padding-bottom: 48px; }
.section-title {
  font-size: 19px; font-weight: 700; line-height: 1.8; margin-bottom: 16px;
  padding-left: 12px; border-left: 4px solid var(--shu);
}
.grid { list-style: none; display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 720px) {
  main { padding-top: 40px; }
  .section-title { font-size: 21px; margin-bottom: 22px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
}
.card {
  display: flex; flex-direction: column; height: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow); transition: box-shadow .2s, border-color .2s, transform .2s;
}
.card:hover { box-shadow: var(--shadow-hi); border-color: var(--shu); transform: translateY(-2px); }
.thumb { aspect-ratio: 16 / 9; overflow: hidden; background: var(--line); border-bottom: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.body { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 18px; flex: 1; }
.meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tag { font-size: 12.5px; font-weight: 700; padding: 1px 10px; border-radius: 999px; color: var(--tag-ink); background: var(--tag-bg); line-height: 2; }
.host { font-size: 12.5px; color: var(--muted); }
.card h3 { font-size: 18px; font-weight: 700; line-height: 1.75; color: var(--ink); }
.card p { color: var(--muted); font-size: 15px; line-height: 1.95; flex: 1; }
.open {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  font-weight: 700; font-size: 14px; color: #fff; background: var(--shu);
  padding: 6px 16px; border-radius: 999px; min-height: 36px;
}

.about { margin-top: 40px; padding: 20px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.about h2 { font-size: 15px; font-weight: 700; margin-bottom: 4px; line-height: 2; }
.about p { color: var(--muted); font-size: 15px; line-height: 2; }

.footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; padding: 20px 0 28px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
