:root {
  --bg: #f4f6fb;
  --ink: #1d2433;
  --muted: #6b7385;
  --card: #ffffff;
  --accent: #4f6bed;
  --bio: #2f9e6b;
  --geo: #2f7de1;
  --his: #d98a1f;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", Meiryo, sans-serif;
  line-height: 1.8;
  color: var(--ink);
  background: var(--bg);
}
a { color: inherit; text-decoration: none; }

.hero {
  position: relative;
  overflow: hidden;
  padding: 72px 20px 96px;
  text-align: center;
  color: #fff;
  background: linear-gradient(135deg, #4f6bed 0%, #8a5cf6 55%, #e86fb0 100%);
}
.hero::before, .hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}
.hero::before { width: 320px; height: 320px; top: -120px; left: -80px; }
.hero::after { width: 240px; height: 240px; bottom: -100px; right: -60px; }
.hero > * { position: relative; z-index: 1; }
.hero .eyebrow {
  display: inline-block;
  padding: 4px 14px;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 999px;
  font-size: .8rem;
  letter-spacing: .12em;
}
.hero h1 {
  margin: 18px 0 10px;
  font-size: clamp(1.9rem, 6vw, 3rem);
  letter-spacing: .04em;
}
.hero p { margin: 0; opacity: .92; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 20px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: -56px;
  position: relative;
  z-index: 2;
}
.card {
  display: block;
  padding: 28px 24px;
  background: var(--card);
  border-radius: 20px;
  border-top: 6px solid var(--c);
  box-shadow: 0 10px 30px rgba(30, 40, 90, .10);
  transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-6px); box-shadow: 0 16px 36px rgba(30, 40, 90, .16); }
.card .icon {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  border-radius: 16px;
  font-size: 1.8rem;
  background: color-mix(in srgb, var(--c) 14%, white);
}
.card h2 { margin: 16px 0 4px; font-size: 1.35rem; }
.card p { margin: 0; color: var(--muted); font-size: .92rem; }
.card .go { display: inline-block; margin-top: 14px; color: var(--c); font-weight: 700; }
.bio { --c: var(--bio); }
.geo { --c: var(--geo); }
.his { --c: var(--his); }

.notice {
  margin: 40px 0 0;
  padding: 18px 22px;
  background: #fff;
  border-radius: 14px;
  color: var(--muted);
  font-size: .92rem;
  text-align: center;
}

footer { padding: 48px 20px; text-align: center; color: var(--muted); font-size: .82rem; }

/* subject page */
.subject-hero {
  padding: 48px 20px 56px;
  color: #fff;
  text-align: center;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #000));
}
.subject-hero h1 { margin: 8px 0 0; font-size: clamp(1.7rem, 5vw, 2.4rem); }
.back { display: inline-block; margin-bottom: 8px; font-size: .88rem; opacity: .9; }
.back:hover { text-decoration: underline; }
.panel {
  margin: -28px auto 0;
  max-width: 800px;
  padding: 28px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(30, 40, 90, .10);
  position: relative;
}
.panel h2 { margin-top: 0; }

/* password gate */
.gate {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #4f6bed, #8a5cf6 60%, #e86fb0);
}
.gate-box {
  width: min(380px, 100%);
  padding: 32px 26px;
  text-align: center;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
.gate-box .lock { font-size: 2.2rem; }
.gate-box h2 { margin: 8px 0 4px; font-size: 1.2rem; }
.gate-box p { margin: 0 0 18px; color: var(--muted); font-size: .88rem; }
.gate-box input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  border: 2px solid #dfe3ee;
  border-radius: 12px;
  outline: none;
}
.gate-box input:focus { border-color: var(--accent); }
.gate-box button {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}
.gate-box button:hover { filter: brightness(1.08); }
.gate-error { min-height: 1.4em; margin-top: 10px; color: #d93a5b; font-size: .85rem; }
.gate-box .gate-back { display: inline-block; margin-top: 8px; color: var(--muted); font-size: .82rem; }
[hidden] { display: none !important; }

/* ---- english / quiz ---- */
.eng { --c: #e0527a; }
.card.eng { --c: #e0527a; }
.quiz h2 { margin-top: 0; }
.field { margin: 22px 0; }
.field-label { display: block; margin-bottom: 8px; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .chip-radio span, .mode span {
  display: inline-block;
  padding: 8px 14px;
  border: 2px solid #dfe3ee;
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: .92rem;
  cursor: pointer;
}
.chip:hover { border-color: var(--c); }
.chip-radio input, .mode input { position: absolute; opacity: 0; pointer-events: none; }
.chip-radio, .mode { position: relative; }
.chip-radio input:checked + span, .mode input:checked + span {
  color: #fff; background: var(--c); border-color: var(--c);
}
.chip-radio input:focus-visible + span, .mode input:focus-visible + span { outline: 3px solid #4f6bed55; }
.modes { display: flex; flex-wrap: wrap; gap: 8px; }
.range-row { margin-top: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range-row input {
  width: 84px; padding: 9px 10px; font-size: 1rem;
  border: 2px solid #dfe3ee; border-radius: 10px;
}
.muted { color: var(--muted); font-size: .9rem; }
button.primary, button.ghost {
  display: inline-block; margin: 8px 8px 0 0; padding: 12px 22px;
  font: inherit; font-weight: 700; border-radius: 12px; cursor: pointer;
}
button.primary { color: #fff; background: var(--c); border: 0; }
button.primary:hover { filter: brightness(1.08); }
button.ghost { color: var(--muted); background: #fff; border: 2px solid #dfe3ee; }
.list { margin-top: 28px; }
.list summary { cursor: pointer; color: var(--muted); }
.table-wrap { overflow-x: auto; margin-top: 10px; }
.quiz table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.quiz th, .quiz td { padding: 6px 10px; border-bottom: 1px solid #e8ebf3; text-align: left; }
.quiz th { color: var(--muted); font-weight: 600; }

.progress { height: 8px; background: #eceff6; border-radius: 99px; overflow: hidden; }
.progress .bar { height: 100%; width: 0; background: var(--c); transition: width .25s; }
.meta { display: flex; justify-content: space-between; margin: 8px 0 0; color: var(--muted); font-size: .88rem; }
.question { margin: 26px 0 18px; text-align: center; }
.qno { display: block; color: var(--muted); font-size: .85rem; }
.qtext { display: block; font-size: clamp(1.5rem, 6vw, 2.2rem); font-weight: 700; line-height: 1.4; }
.ans { display: block; margin: 12px 0; }
.ans span { display: block; margin-bottom: 4px; color: var(--muted); font-size: .85rem; }
.ans input {
  width: 100%; padding: 12px 14px; font-size: 1.2rem;
  border: 2px solid #dfe3ee; border-radius: 12px; outline: none;
}
.ans input:focus { border-color: var(--c); }
.ans input.ok { border-color: #2f9e6b; background: #eefaf3; }
.ans input.ng { border-color: #d93a5b; background: #fff0f3; }
.feedback { margin: 14px 0 4px; padding: 12px 14px; border-radius: 12px; font-weight: 700; }
.feedback.good { color: #1f7a50; background: #eefaf3; }
.feedback.bad { color: #b02a47; background: #fff0f3; }
.score { text-align: center; margin: 12px 0 20px; font-size: 1.2rem; }
.score .big { font-size: 3rem; font-weight: 800; color: var(--c); }
.score .pct { color: var(--muted); }
.perfect { text-align: center; font-size: 1.2rem; font-weight: 700; }
.actions { margin-top: 18px; }

.choice-group { margin: 12px 0; }
.choice-cap { display: block; margin-bottom: 6px; color: var(--muted); font-size: .85rem; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice {
  padding: 14px 10px; font: inherit; font-size: 1.1rem; font-weight: 600;
  background: #fff; border: 2px solid #dfe3ee; border-radius: 12px; cursor: pointer;
}
.choice:hover:not(:disabled) { border-color: var(--c); }
.choice.sel { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, white); }
.choice.ok { border-color: #2f9e6b; background: #eefaf3; }
.choice.ng { border-color: #d93a5b; background: #fff0f3; }
.choice:disabled { cursor: default; }
.gate-box p.gate-warn { color: #d33; font-weight: 700; font-size: .82rem; margin: -8px 0 16px; }
/* countdown */
.cd { margin: 26px auto 0; max-width: 460px; }
.cd-label { font-size: .85rem; letter-spacing: .12em; opacity: .9; margin-bottom: 10px; }
.cd-label small { margin-left: 6px; padding: 2px 9px; border-radius: 99px; background: rgba(255,255,255,.22); letter-spacing: .05em; }
.cd-row { display: flex; gap: 10px; justify-content: center; }
.cd-box { flex: 1; min-width: 0; padding: 12px 4px 9px; border-radius: 16px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.35); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 8px 24px rgba(20,30,80,.18); }
.cd-box b { display: block; font-size: 2rem; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; }
.cd-box span { font-size: .72rem; opacity: .85; letter-spacing: .1em; }
.cd-now { font-size: 1.05rem; font-weight: 700; }
@media (max-width: 420px) { .cd-box b { font-size: 1.6rem; } .cd-row { gap: 7px; } }
.jpn { --c: #c0392b; }
.card.jpn { --c: #c0392b; }
.ear { --c: #8e5bd6; }
.card.ear { --c: #8e5bd6; }
.mat { --c: #0e9aa7; }
.card.mat { --c: #0e9aa7; }
/* svg icons */
.card .icon svg { color: var(--c); width: 30px; height: 30px; }
.subject-hero h1 { display: flex; align-items: center; gap: 12px; }
.h-ico { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.35); }
.h-ico svg { width: 30px; height: 30px; }

/* document link card */
.doc-card { display: flex; align-items: center; gap: 14px; margin: 18px 0 8px; padding: 16px 18px; border-radius: 16px; border: 1px solid #dfe3ee; background: #fff; box-shadow: 0 6px 18px rgba(30,40,90,.08); transition: transform .2s, box-shadow .2s; }
.doc-card:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(30,40,90,.14); }
.doc-ico { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: color-mix(in srgb, var(--c) 14%, white); color: #e0393e; }
.doc-body { flex: 1; min-width: 0; line-height: 1.5; }
.doc-body b { display: block; font-size: 1.05rem; }
.doc-body small { color: var(--muted); }
.doc-go { flex: none; color: var(--c); font-weight: 700; }
.doc-note { margin: 0; color: var(--muted); font-size: .85rem; }
@media (max-width: 480px) { .doc-go { display: none; } }
/* biology quiz */
.qtext.qlong { font-size: clamp(1.15rem, 4.5vw, 1.5rem); }
.choices.one { grid-template-columns: 1fr; }
.choices.one .choice { text-align: left; font-size: 1rem; }
#self { margin-top: 8px; }
.wrong-item { padding: 10px 0; border-bottom: 1px solid #e8ebf3; }
.wrong-item .wq { font-weight: 600; }
.wrong-item .wa { color: #d93a5b; margin-top: 2px; }
