:root {
  color-scheme: dark;
  --ink: #f8eee5;
  --muted: #b7a59a;
  --red: #e83b29;
  --gold: #e5b34f;
  --panel: rgba(24, 15, 14, .88);
  --line: rgba(229, 179, 79, .25);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  font-family: system-ui, -apple-system, "Noto Sans JP", sans-serif;
  background:
    radial-gradient(circle at 85% 0%, rgba(232,59,41,.22), transparent 30rem),
    radial-gradient(circle at 10% 55%, rgba(229,179,79,.1), transparent 28rem),
    #0d0909;
}
button, input { font: inherit; }
.eyebrow { color: var(--gold); font-size: .72rem; font-weight: 800; letter-spacing: .2em; }
.site-header {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 4rem); border-bottom: 1px solid var(--line);
  background: rgba(13,9,9,.82); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 10;
}
.site-header h1 { margin: .2rem 0 0; font-size: clamp(1.15rem, 3vw, 1.5rem); }
.ghost-button, .text-button { background: transparent; color: var(--muted); border: 1px solid #584943; }
.ghost-button { border-radius: 999px; padding: .65rem 1rem; }
.portal { width: min(1120px, calc(100% - 2rem)); margin: auto; padding: 3rem 0 5rem; }
.hero {
  min-height: 21rem; display: grid; align-content: center; position: relative;
  padding: clamp(2rem, 6vw, 5rem); overflow: hidden; border: 1px solid var(--line);
  border-radius: 1.4rem; background: linear-gradient(135deg, rgba(69,20,13,.85), rgba(19,13,13,.94));
}
.hero::after { content: "鬼"; position: absolute; right: 4%; bottom: -24%; font: 900 22rem serif; color: rgba(229,179,79,.055); }
.hero .kicker { color: var(--gold); }
.hero h2 { margin: .2rem 0 1rem; font-family: serif; font-size: clamp(2.4rem, 7vw, 5rem); line-height: 1.08; }
.summary { display: flex; align-items: baseline; gap: .65rem; margin-top: 1rem; }
.summary strong { font-size: 1.8rem; color: var(--gold); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 2rem; margin: 4rem 0 1.5rem; }
.section-heading h2 { margin: .2rem 0 0; font-size: 2rem; }
.section-heading > p { color: var(--muted); }
.unit-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.resource-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.resource-card {
  min-height: 16rem; padding: 1.6rem; border: 1px solid rgba(229,179,79,.55);
  border-radius: 1rem; color: var(--ink); text-decoration: none;
  background: linear-gradient(145deg, rgba(99,27,17,.9), rgba(24,15,14,.95));
  display: flex; flex-direction: column; transition: transform .2s ease, border-color .2s ease;
}
.resource-card:hover { transform: translateY(-3px); border-color: var(--gold); }
.resource-index { color: var(--gold); font-size: .72rem; font-weight: 900; letter-spacing: .12em; }
.resource-card h3 { margin: .65rem 0; font: 700 clamp(1.8rem, 4vw, 2.5rem) serif; }
.resource-card p { margin: 0; color: var(--muted); line-height: 1.7; }
.resource-open { margin-top: auto; color: var(--gold); font-weight: 900; }
.unit-card { min-height: 14rem; padding: 1.5rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--panel); display: flex; flex-direction: column; }
.unit-card.done { border-color: rgba(229,179,79,.7); }
.unit-number { color: var(--red); font-size: .72rem; font-weight: 900; letter-spacing: .16em; }
.unit-card h3 { margin: .5rem 0; font: 700 2rem serif; }
.unit-card p { margin: 0; color: var(--muted); }
.unit-meta { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: auto; padding-top: 1rem; border-top: 1px solid #392c28; color: var(--muted); font-size: .85rem; }
.unit-action { color: var(--gold); font-weight: 800; text-decoration: none; }
.unit-action.disabled { color: #74645c; }
footer { padding: 2rem; color: #74645c; text-align: center; border-top: 1px solid var(--line); }
.login-page {
  display: grid; place-items: center; padding: 2rem 1rem;
  color: #18181b; background: #fafafa; color-scheme: light;
}
.login-shell { width: min(100%, 46rem); }
.login-brand {
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  margin: 0 0 2.4rem; color: #09090b; font-size: clamp(1.55rem, 5vw, 2.35rem); font-weight: 800;
}
.login-brand-mark {
  display: grid; place-items: center; width: 3.4rem; height: 3.4rem;
  border: .22rem solid #09090b; border-radius: 50%; font: 800 1.65rem/1 serif;
}
.login-card {
  padding: clamp(2rem, 7vw, 3.8rem); border: 1px solid #dedede; border-radius: .75rem;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.02); text-align: left;
}
.login-site { margin: 0 0 2rem; color: #71717a; font-size: 1rem; font-weight: 600; }
.login-card h1 { margin: 0; font: 750 clamp(1.75rem, 5vw, 2.3rem)/1.25 system-ui, sans-serif; letter-spacing: -.025em; }
.login-description { margin: .8rem 0 0; color: #27272a; font-size: 1rem; line-height: 1.6; }
.login-notice {
  margin: 1.5rem 0 .8rem; padding: 1rem 1.25rem; border: 1px solid #e4e4e7;
  border-radius: .55rem; color: #27272a; background: #f4f4f5; line-height: 1.5;
}
form { display: grid; gap: .75rem; margin-top: 2rem; text-align: left; }
.login-card form { margin-top: 0; }
.login-card label { margin-top: .65rem; color: #27272a; font-size: .95rem; font-weight: 600; }
.login-card input {
  width: 100%; padding: 1rem; color: #18181b; background: #fff;
  border: 1px solid #d4d4d8; border-radius: .65rem; font-size: 1.05rem; outline: none;
}
.login-card input:focus { border-color: #0867d5; box-shadow: 0 0 0 2px #0867d5; }
.turnstile-wrap { display: flex; justify-content: center; margin: .95rem 0; min-height: 65px; }
.login-card #code {
  text-align: center; font-size: 1.65rem; letter-spacing: .38em; font-variant-numeric: tabular-nums;
}
.login-card form > button[type="submit"] {
  padding: 1rem; color: #fff; font-size: 1.05rem; font-weight: 600; border: 1px solid #0867d5;
  border-radius: .65rem; background: linear-gradient(#3485f4, #0874ee); box-shadow: inset 0 1px rgba(255,255,255,.22);
}
.login-card form > button[type="submit"]:hover { background: #0867d5; }
.link-button {
  display: inline; padding: 0; color: #1649d8; border: 0; background: none;
  font: inherit; text-decoration: none; cursor: pointer;
}
.login-links { margin: 1rem 0 0; color: #71717a; }
.change-email { justify-self: start; margin-top: -.15rem; font-size: .9rem; }
.login-card a.change-email { margin-top: .5rem; }
.message { min-height: 1.4rem; margin: 1.2rem 0 0; color: #b42318; font-size: .88rem; }
@media (max-width: 700px) {
  .portal { width: min(100% - 1rem, 40rem); padding-top: .5rem; }
  .hero { min-height: 24rem; border-radius: 1rem; padding: 2rem 1.4rem; }
  .hero::after { font-size: 14rem; }
  .unit-grid { grid-template-columns: 1fr; }
  .resource-grid { grid-template-columns: 1fr; }
  .section-heading { display: block; margin-top: 3rem; }
  .site-header .eyebrow { display: none; }
}

/* August library — light portal */
.library-page {
  --teal: #087a76;
  --teal-soft: #eaf8f6;
  --paper: #fffdfa;
  --library-ink: #171310;
  --library-muted: #756e67;
  color: var(--library-ink);
  background: radial-gradient(circle at 95% 0%, rgba(8,123,120,.12), transparent 34%), linear-gradient(180deg,#fffaf2 0%,#f7f3eb 100%);
  color-scheme: light;
}
.library-page .site-header {
  position: sticky; width: min(100%, 520px); margin: 0 auto; padding: 1.1rem 1rem; color: var(--library-ink);
  border-bottom: 1px solid #dedbd6; background: rgba(255,253,250,.95); backdrop-filter: none;
}
.site-brand { display: flex; align-items: center; gap: 1rem; }
.site-brand-mark {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; flex: 0 0 auto;
  border-radius: .75rem; color: #fff; background: linear-gradient(135deg,#045d5a,var(--teal)); font: 900 1.15rem/1 serif;
}
.library-page .site-header h1 { margin: 0; font-size: 1.18rem; letter-spacing: 0; }
.library-page .site-header .eyebrow { margin: .2rem 0 0; color: var(--library-muted); font-size: .64rem; }
.library-page .ghost-button {
  padding: .55rem .8rem; color: #625b55; border-color: #d8d3cd; background: #fff; font-size: .75rem;
}
.library-page .portal {
  width: min(100%, 520px); margin: auto; padding: 1.1rem .65rem 2rem;
  background: rgba(255,253,250,.94); box-shadow: 0 0 0 1px rgba(35,28,20,.08);
}
.library-page .hero {
  display: block; min-height: 0; padding: 0; overflow: visible; border: 0; border-radius: 0; background: none;
}
.library-page .hero::after { display: none; }
.library-page .hero > img {
  display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  border: 1px solid rgba(35,28,20,.14); border-radius: .9rem; box-shadow: 0 18px 44px rgba(35,28,20,.12);
}
.hero-copy { padding: 1.15rem .35rem 1.2rem; border-bottom: 1px solid #ddd9d3; }
.library-page .hero h2 {
  margin: 0 0 .65rem; font: 950 1.9rem/1.25 system-ui, sans-serif; letter-spacing: -.04em;
}
.hero-copy > p { margin: 0; color: var(--library-muted); font-size: .94rem; font-weight: 750; line-height: 1.8; }
.content-panel {
  display: grid; gap: .75rem; margin-top: 1.1rem; padding: 1rem;
  border: 1px solid rgba(35,28,20,.14); border-radius: 1rem; background: rgba(255,255,255,.92); box-shadow: 0 14px 34px rgba(35,28,20,.08);
}
.library-page .resource-grid { display: grid; grid-template-columns: 1fr; gap: .75rem; }
.library-page .resource-card {
  display: grid; grid-template-columns: 3.25rem minmax(0,1fr) auto; align-items: center; gap: .9rem;
  min-height: 5.4rem; padding: .95rem; border: 1px solid rgba(8,123,120,.44); border-radius: 1rem;
  color: var(--library-ink); background: linear-gradient(135deg,#f2fffb,#fff); box-shadow: 0 14px 34px rgba(8,123,120,.18);
}
.library-page .resource-card:hover { transform: translateY(-2px); border-color: var(--teal); }
.resource-icon {
  display: grid; place-items: center; width: 3.25rem; height: 3.25rem;
  border-radius: 1rem; color: #fff; background: linear-gradient(135deg,#045d5a,var(--teal)); font-size: 1.3rem; font-weight: 950;
}
.resource-copy { min-width: 0; }
.resource-copy strong { display: block; font-size: 1.3rem; line-height: 1.35; font-weight: 950; }
.resource-copy small { display: block; margin-top: .18rem; color: var(--library-muted); font-size: .8rem; font-weight: 800; line-height: 1.45; }
.library-page .resource-open { margin: 0; color: var(--teal); font-size: 2rem; }
.library-page .resource-card.locked {
  border-color: rgba(35,28,20,.1); color: #777069; background: #f3f1ed; box-shadow: none; opacity: .86; cursor: default;
}
.library-page .resource-card.locked .resource-icon { background: #aaa6a1; }
.library-page .resource-card.locked small::before { content: "🔒 "; }
.lock-label { color: #8e8983; font-size: .78rem; font-weight: 750; white-space: nowrap; }
.library-page .section-heading { margin: 3.5rem .25rem 1.2rem; }
.library-page .section-heading h2 { color: var(--library-ink); }
.library-page .section-heading > p { color: var(--library-muted); }
.library-page .eyebrow { color: var(--teal); }
.library-page .unit-grid { grid-template-columns: 1fr; gap: .85rem; }
.library-page .unit-card {
  display: grid; grid-template-columns: 5rem minmax(0,1fr) auto; align-items: center; gap: 1rem;
  min-height: 8rem; padding: 1.25rem; border: 1px solid #d8d4cf; border-radius: 1rem;
  color: var(--library-ink); background: #fff;
}
.library-page .unit-card.locked { color: #928d87; background: #f5f3f0; }
.library-page .unit-number {
  display: grid; place-items: center; width: 4.4rem; height: 4.4rem; border-radius: 1.2rem;
  color: #fff; background: #aaa6a1; font-size: .72rem; text-align: center;
}
.library-page .unit-card.done .unit-number { background: var(--teal); }
.library-page .unit-card h3 { margin: 0; font: 800 1.35rem/1.25 system-ui, sans-serif; }
.library-page .unit-card p { margin-top: .35rem; color: inherit; font-size: .85rem; }
.library-page .unit-meta {
  display: grid; justify-items: end; gap: .25rem; margin: 0; padding: 0; border: 0; font-size: .75rem;
}
.library-page footer { width: min(100%,520px); margin: auto; color: #918b84; border-top-color: #ddd9d3; background: #f6f3ed; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
@media (max-width: 700px) {
  .library-page .portal { width: 100%; padding-top: .7rem; }
  .library-page .site-header { padding: .9rem .8rem; }
  .site-brand { gap: .7rem; }
  .site-brand-mark { width: 2.9rem; height: 2.9rem; border-radius: .85rem; font-size: 1.25rem; }
  .library-page .hero > img { border-radius: .85rem; }
  .hero-copy { padding: 1.5rem .25rem 1.8rem; }
  .content-panel { padding: 1rem; border-radius: 1rem; }
  .library-page .resource-card { grid-template-columns: 3.25rem minmax(0,1fr); gap: .85rem; padding: .95rem; }
  .resource-icon { width: 3.25rem; height: 3.25rem; border-radius: 1rem; font-size: 1.3rem; }
  .library-page .resource-open { display: none; }
  .library-page .unit-card { grid-template-columns: 3.6rem minmax(0,1fr); padding: 1rem; }
  .library-page .unit-number { width: 3.6rem; height: 3.6rem; border-radius: 1rem; font-size: .62rem; }
  .library-page .unit-meta { grid-column: 2; justify-items: start; }
}
