/* =========================================================
   サイバー避難訓練 — 共通スタイル
   ========================================================= */

:root {
  --bg: #fbf8f1;
  --bg-2: #f3eee2;
  --surface: #ffffff;
  --surface-2: #f7f4ec;
  --ink: #1d1f24;
  --ink-2: #4a4f5a;
  --ink-3: #737987;
  --line: #e2dccd;
  --brand: #ff5a1f;        /* 警報オレンジ */
  --brand-ink: #ffffff;
  --brand-soft: #ffe6da;
  --safe: #0f9f8f;         /* 安全ティール */
  --safe-soft: #d6f3ee;
  --warn: #f5b700;         /* ハザードイエロー */
  --warn-soft: #fff3c4;
  --danger: #d7263d;
  --danger-soft: #fbdde1;
  --info: #2f6fde;
  --info-soft: #dde8fb;
  --shadow: 0 1px 2px rgba(29, 31, 36, .06), 0 6px 24px rgba(29, 31, 36, .07);
  --shadow-lg: 0 2px 6px rgba(29, 31, 36, .08), 0 20px 50px rgba(29, 31, 36, .12);
  --radius: 18px;
  --radius-sm: 10px;
  --font: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
  --font-body: "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --max: 1080px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111318;
    --bg-2: #171a21;
    --surface: #1b1f27;
    --surface-2: #222733;
    --ink: #eef0f4;
    --ink-2: #b9bfcc;
    --ink-3: #8a91a1;
    --line: #2d3340;
    --brand: #ff7a45;
    --brand-ink: #1a0d07;
    --brand-soft: #3a2117;
    --safe: #2bc4b1;
    --safe-soft: #12332f;
    --warn: #ffcb3d;
    --warn-soft: #3a3015;
    --danger: #ff5a6e;
    --danger-soft: #3d1a20;
    --info: #6b9cff;
    --info-soft: #182540;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, .35), 0 20px 50px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111318;
  --bg-2: #171a21;
  --surface: #1b1f27;
  --surface-2: #222733;
  --ink: #eef0f4;
  --ink-2: #b9bfcc;
  --ink-3: #8a91a1;
  --line: #2d3340;
  --brand: #ff7a45;
  --brand-ink: #1a0d07;
  --brand-soft: #3a2117;
  --safe: #2bc4b1;
  --safe-soft: #12332f;
  --warn: #ffcb3d;
  --warn-soft: #3a3015;
  --danger: #ff5a6e;
  --danger-soft: #3d1a20;
  --info: #6b9cff;
  --info-soft: #182540;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .35), 0 20px 50px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.85;
  letter-spacing: .02em;
  overflow-x: hidden;
}
body.big-text { font-size: 20px; }

img, svg { max-width: 100%; }
a { color: var(--info); text-underline-offset: 3px; }
a:hover { color: var(--brand); }
h1, h2, h3, h4 { font-family: var(--font); line-height: 1.35; letter-spacing: .03em; margin: 0 0 .6em; }
h1 { font-size: clamp(1.9rem, 5vw, 3.1rem); font-weight: 800; }
h2 { font-size: clamp(1.45rem, 3.6vw, 2.05rem); font-weight: 800; margin-top: 0; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.4em; margin: 0 0 1em; }
li { margin-bottom: .3em; }
code, kbd, .mono { font-family: var(--mono); font-size: .92em; }
code { background: var(--surface-2); padding: .1em .4em; border-radius: 6px; border: 1px solid var(--line); word-break: break-all; }
kbd { background: var(--surface); border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 6px; padding: 0 .4em; }
strong { font-weight: 700; }
mark { background: linear-gradient(transparent 55%, var(--warn-soft) 55%); color: inherit; padding: 0 .1em; }
hr { border: 0; border-top: 1px dashed var(--line); margin: 2.5rem 0; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--brand); color: var(--brand-ink); padding: .5em 1em; z-index: 1000; }
.skip-link:focus { left: 8px; top: 8px; }
:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; border-radius: 4px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- layout ---------- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }
section.block { padding: 56px 0; }
section.block.tint { background: var(--bg-2); }
.grid { display: grid; gap: 18px; }
@media (min-width: 640px) { .grid.g2 { grid-template-columns: repeat(2, 1fr); } .grid.g3 { grid-template-columns: repeat(2, 1fr); } .grid.g4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .grid.g3 { grid-template-columns: repeat(3, 1fr); } .grid.g4 { grid-template-columns: repeat(4, 1fr); } }
.center { text-align: center; }
.muted { color: var(--ink-3); }
.small { font-size: .86em; }
.lead { font-size: 1.12em; color: var(--ink-2); }
.stack > * + * { margin-top: 1rem; }

/* ---------- hazard stripe ---------- */
.hazard {
  height: 10px;
  background: repeating-linear-gradient(-45deg, var(--warn) 0 14px, #1d1f24 14px 28px);
}

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .bar { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-family: var(--font); font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.logo svg { width: 34px; height: 34px; flex: none; }
.logo small { display: block; font-size: .62rem; font-weight: 500; color: var(--ink-3); letter-spacing: .08em; line-height: 1.1; }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  height: 38px; min-width: 38px; border-radius: 999px; cursor: pointer; font: inherit; font-size: .85rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 10px;
}
.icon-btn:hover { border-color: var(--brand); }
.icon-btn svg { width: 18px; height: 18px; }
.level-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.level-switch button { white-space: nowrap; appearance: none; border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: .8rem; padding: 0 10px; height: 36px; cursor: pointer; font-family: var(--font); font-weight: 700; }
.level-switch button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
@media (max-width: 520px) { .level-switch button { padding: 0 7px; font-size: .74rem; } .logo .logo-text small { display: none; } .logo .logo-text { font-size: .92rem; } }
@media (max-width: 440px) { .logo .logo-text { display: none; } .header-tools { gap: 4px; } }

.nav-drawer { display: none; border-top: 1px solid var(--line); background: var(--bg); max-height: calc(100vh - 60px); overflow: auto; }
.nav-drawer.open { display: block; }
.nav-drawer .wrap { padding-top: 16px; padding-bottom: 24px; }
.nav-group h4 { font-size: .78rem; color: var(--ink-3); letter-spacing: .12em; margin: 12px 0 6px; }
.nav-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
@media (min-width: 640px) { .nav-links { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .nav-links { grid-template-columns: repeat(3, 1fr); } }
.nav-links a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); font-family: var(--font); font-weight: 700; font-size: .95rem; }
.nav-links a:hover { border-color: var(--brand); color: var(--ink); }
.nav-links a[aria-current="page"] { border-color: var(--brand); background: var(--brand-soft); }
.nav-links .ico { font-size: 1.25rem; width: 1.6em; text-align: center; }
.nav-links .done { margin-left: auto; color: var(--safe); font-size: .8rem; }

/* ---------- footer ---------- */
.site-footer { margin-top: 40px; background: #16181d; color: #c9cdd6; padding: 40px 0 60px; font-size: .9rem; }
.site-footer a { color: #ffb08f; }
.site-footer .slogan { font-family: var(--font); font-weight: 800; font-size: 1.3rem; color: #fff; margin-bottom: .5em; }
.site-footer .cols { display: grid; gap: 24px; }
@media (min-width: 760px) { .site-footer .cols { grid-template-columns: 1.3fr 1fr; } }
.site-footer ul { list-style: none; padding: 0; }
.site-footer li { margin-bottom: .4em; }

/* ---------- page hero ---------- */
.page-hero { padding: 44px 0 30px; position: relative; overflow: hidden; }
.page-hero .kicker { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font); font-weight: 800; font-size: .82rem; letter-spacing: .14em; color: var(--brand); background: var(--brand-soft); padding: 4px 12px; border-radius: 999px; margin-bottom: 14px; }
.page-hero h1 { margin-bottom: .3em; }
.page-hero .lead { max-width: 46em; }
.page-hero .meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ---------- chips / badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font); font-size: .76rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chip.play { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.chip.learn { background: var(--info-soft); color: var(--info); border-color: transparent; }
.chip.pro { background: #1d1f24; color: #ffd166; border-color: transparent; }
.chip.safe { background: var(--safe-soft); color: var(--safe); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: #8a6400; border-color: transparent; }
:root[data-theme="dark"] .chip.warn { color: var(--warn); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.warn { color: var(--warn); } }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card h3 { margin-bottom: .4em; }
.card.link-card { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 8px; transition: transform .2s ease, box-shadow .2s ease, border-color .2s; position: relative; }
.card.link-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--brand); color: var(--ink); }
.card.link-card .ico { font-size: 2rem; line-height: 1; }
.card.link-card p { color: var(--ink-2); font-size: .93rem; margin: 0; }
.card.link-card .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.card.link-card .stamp-mark { position: absolute; top: 14px; right: 14px; width: 46px; height: 46px; border: 3px solid var(--danger); color: var(--danger); border-radius: 50%; display: none; align-items: center; justify-content: center; font-family: var(--font); font-weight: 800; font-size: .7rem; transform: rotate(-14deg); opacity: .85; }
.card.link-card.done .stamp-mark { display: flex; }

.callout { border-radius: var(--radius-sm); padding: 16px 18px; border: 1px solid var(--line); background: var(--surface); display: flex; gap: 12px; align-items: flex-start; margin: 1.2em 0; }
.callout > .ico { font-size: 1.4rem; line-height: 1.4; flex: none; }
.callout > div > :last-child { margin-bottom: 0; }
.callout.info { background: var(--info-soft); border-color: transparent; }
.callout.safe { background: var(--safe-soft); border-color: transparent; }
.callout.warn { background: var(--warn-soft); border-color: transparent; }
.callout.danger { background: var(--danger-soft); border-color: transparent; }

/* ---------- level-gated content ---------- */
.lv2, .lv3 { display: none; }
body[data-level="2"] .lv2, body[data-level="3"] .lv2, body[data-level="3"] .lv3 { display: block; }
body[data-level="2"] span.lv2, body[data-level="3"] span.lv2, body[data-level="3"] span.lv3 { display: inline; }
body[data-level="2"] .lv1-only, body[data-level="3"] .lv1-only { display: none; }
.lvbox { border-left: 4px solid var(--info); padding: 14px 18px; background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 1.2em 0; }
.lvbox.lv3 { border-left-color: #1d1f24; background: var(--surface-2); }
.lvbox > .tag { display: inline-block; font-family: var(--font); font-weight: 800; font-size: .72rem; letter-spacing: .1em; margin-bottom: 6px; color: var(--info); }
.lvbox.lv3 > .tag { color: var(--ink); }
.lvbox > :last-child { margin-bottom: 0; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font); font-weight: 800; font-size: 1rem; letter-spacing: .04em;
  padding: 12px 22px; border-radius: 999px; border: 2px solid var(--ink); background: var(--ink); color: var(--bg);
  cursor: pointer; text-decoration: none; transition: transform .12s ease, box-shadow .12s ease, background .2s;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--ink) 40%, transparent);
}
.btn:hover { transform: translateY(-1px); color: var(--bg); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 40%, transparent); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); box-shadow: 0 4px 0 color-mix(in srgb, var(--brand) 55%, #000); }
.btn.primary:hover { color: var(--brand-ink); }
.btn.safe { background: var(--safe); border-color: var(--safe); color: #fff; box-shadow: 0 4px 0 color-mix(in srgb, var(--safe) 55%, #000); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.small { padding: 7px 14px; font-size: .88rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 1em 0; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 1em; }
.field label { font-weight: 700; font-size: .92rem; }
.input {
  font: inherit; font-family: var(--mono); font-size: 1.1rem; padding: 14px 16px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink); width: 100%;
}
.input:focus { outline: none; border-color: var(--info); }
.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row .input { flex: 1; min-width: 0; }
input[type="range"] { width: 100%; accent-color: var(--brand); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); width: 1.1em; height: 1.1em; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.check input { margin-top: .4em; flex: none; }
.check:hover { border-color: var(--brand); }

/* ---------- meters ---------- */
.meter { height: 14px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.meter > span { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--brand); transition: width .5s cubic-bezier(.2, .8, .2, 1), background .3s; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; background: var(--surface); font-size: .93rem; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--surface-2); font-family: var(--font); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

/* ---------- details / accordion ---------- */
details.acc { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); margin-bottom: 10px; }
details.acc > summary { cursor: pointer; padding: 14px 18px; font-family: var(--font); font-weight: 700; list-style: none; display: flex; gap: 10px; align-items: center; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after { content: "＋"; margin-left: auto; color: var(--brand); font-weight: 800; }
details.acc[open] > summary::after { content: "－"; }
details.acc > .body { padding: 0 18px 16px; }
details.acc > .body > :last-child { margin-bottom: 0; }

/* ---------- reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .8, .2, 1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------- next / prev ---------- */
.next-steps { display: grid; gap: 14px; margin-top: 20px; }
@media (min-width: 720px) { .next-steps { grid-template-columns: repeat(2, 1fr); } }

/* ---------- stamp toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); z-index: 400;
  background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 999px; font-family: var(--font); font-weight: 700;
  box-shadow: var(--shadow-lg); transition: transform .4s cubic-bezier(.2, .8, .2, 1); display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px);
}
.toast.show { transform: translate(-50%, 0); }
.toast .st { width: 30px; height: 30px; border: 2px solid var(--danger); color: var(--danger); background: #fff; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .6rem; transform: rotate(-12deg); flex: none; }

/* ---------- mascot ---------- */
.mascot-bubble { display: flex; gap: 14px; align-items: flex-start; margin: 1.4em 0; }
.mascot-bubble svg.mascot { width: 64px; height: 64px; flex: none; }
.mascot-bubble .bubble { background: var(--surface); border: 2px solid var(--ink); border-radius: 18px; padding: 12px 16px; position: relative; font-family: var(--font); font-weight: 500; }
.mascot-bubble .bubble::before { content: ""; position: absolute; left: -10px; top: 20px; border: 8px solid transparent; border-right-color: var(--ink); border-left: 0; }
.mascot-bubble .bubble > :last-child { margin-bottom: 0; }

@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.mascot .eye { transform-origin: center; transform-box: fill-box; animation: blink 4s infinite; }
.bob { animation: bob 3s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .bob, .mascot .eye { animation: none; } }

/* ---------- utilities ---------- */
.big-num { font-family: var(--font); font-weight: 800; font-size: clamp(2.2rem, 7vw, 3.6rem); line-height: 1.1; }
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; }
.kbd-hint { font-size: .8rem; color: var(--ink-3); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

@media print {
  .site-header, .site-footer, .no-print, .toast, .hazard { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .card { box-shadow: none; border-color: #999; }
  .lv2, .lv3 { display: block !important; }
}
