/* 英字の書体はこのサイトから配信する (CSP で外部を許可しないため)。日本語は端末の書体を使う。
   どちらも SIL Open Font License 1.1 (fonts/OFL-*.txt) */
@font-face { font-family: "Chakra Petch"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/chakra-petch-500.woff2") format("woff2"); }
@font-face { font-family: "Chakra Petch"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/chakra-petch-700.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/jetbrains-mono.woff2") format("woff2"); }

/* 金庫の画面とドキュメントで共通の配色と土台。
   ブラウザ (OS) の設定に合わせてライト / ダークを切り替える */
:root {
  color-scheme: dark;
  --bg: #0a0a0b;
  --grid: rgba(255, 255, 255, 0.07);
  --spot: rgba(255, 181, 71, 0.09);
  --panel: #121214;
  --steel: #1d1e21;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.16);
  --text: #eeeae2;
  --muted: #8d8a83;
  --brass: #ffb547;
  --brass-ink: #ffb547;
  --brass-hi: #ffc66b;
  --brass-lo: #e8902b;
  --on-brass: #1a1206;
  --ok: #8df0b0;
  --err: #ff5d5d;
  --shadow: rgba(0, 0, 0, 0.9);
  --rim-1: #2b2c30;
  --rim-2: #141517;
  --rim-stroke: #2c2d31;
  --tick: #5c5a55;
  --door-a: #2a2b2f;
  --door-b: #232427;
  --door-base: #26272b;
  --door-edge: #17181a;
  --door-ring-1: #1b1c1f;
  --door-ring-2: #3a3b40;
  --door-sheen: rgba(255, 255, 255, 0.16);
  --wheel: #4a4b50;
  --back-a: #1f2023;
  --back-b: #1b1c1f;
  --back-plate: rgba(0, 0, 0, 0.28);
  --bolt-a: #cfd0d4;
  --bolt-b: #84868c;
  --label: #8e8a80;
  --code-bg: #0c0b08;

  --display: "Chakra Petch", -apple-system, "Hiragino Sans", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --jp: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
  --spring: cubic-bezier(0.3, 1.5, 0.5, 1);
  --ease: cubic-bezier(0.7, 0, 0.2, 1);
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #efece5;
    --grid: rgba(40, 30, 10, 0.07);
    --spot: rgba(214, 137, 28, 0.12);
    --panel: #ffffff;
    --steel: #e7e3db;
    --line: rgba(40, 30, 10, 0.09);
    --line-2: rgba(40, 30, 10, 0.18);
    --text: #1d1b17;
    --muted: #6d685f;
    --brass: #e39a2d;
    --brass-ink: #9a5a05;
    --brass-hi: #f6b955;
    --brass-lo: #cf7f14;
    --on-brass: #2a1a04;
    --ok: #0f8a55;
    --err: #d12c2c;
    --shadow: rgba(60, 45, 20, 0.35);
    --rim-1: #f1eee8;
    --rim-2: #c9c4ba;
    --rim-stroke: #b9b3a8;
    --tick: #9a958b;
    --door-a: #dcd8d0;
    --door-b: #d0ccc3;
    --door-base: #d6d2ca;
    --door-edge: #a8a298;
    --door-ring-1: #bfbab0;
    --door-ring-2: #ece9e3;
    --door-sheen: rgba(255, 255, 255, 0.75);
    --wheel: #aaa49a;
    --back-a: #d3cec5;
    --back-b: #cdc8be;
    --back-plate: rgba(255, 255, 255, 0.55);
    --bolt-a: #ffffff;
    --bolt-b: #a7a299;
    --label: #6d685f;
    --code-bg: #1b1915;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--jp);
  line-height: 1.7;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 設計図のような方眼 + スポットライト */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(40vmax 40vmax at 72% 46%, var(--spot), transparent 70%),
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 56px 56px;
  -webkit-mask: radial-gradient(70vmax 60vmax at 60% 40%, #000 30%, transparent 85%);
  mask: radial-gradient(70vmax 60vmax at 60% 40%, #000 30%, transparent 85%);
}

button { font: inherit; color: inherit; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
::selection { background: var(--brass); color: var(--on-brass); }
a { color: var(--brass-ink); }

.top { display: flex; align-items: center; justify-content: space-between; max-width: 1200px; margin: 0 auto; padding: 22px 28px; }
.mark { display: flex; align-items: center; gap: 12px; font-family: var(--display); font-weight: 700; letter-spacing: 0.24em; font-size: 14px; color: var(--text); text-decoration: none; }
.mark svg { width: 28px; height: 28px; }
.mark .m1 { stroke: var(--brass); }
.mark .m2 { stroke: var(--text); }
.top-right { display: flex; align-items: center; gap: 22px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.online { display: flex; align-items: center; gap: 8px; }
.online i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); animation: blink 2.4s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.top-link { color: var(--text); text-decoration: none; padding: 7px 14px; border: 1px solid var(--line-2); border-radius: 6px; transition: border-color .2s, color .2s; }
.top-link:hover { border-color: var(--brass); color: var(--brass-ink); }
@media (max-width: 560px) { .online { display: none; } .top { padding: 18px; } }

.eyebrow { margin: 0 0 18px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.18em; color: var(--brass-ink); }
.eyebrow::before { content: ""; display: inline-block; width: 28px; height: 1px; margin-right: 12px; vertical-align: middle; background: var(--brass); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  background: var(--steel);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: border-color .2s, transform .15s;
}
.btn:hover { border-color: var(--brass); }
.btn:active { transform: scale(0.97); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 12px; }
.btn-brass {
  position: relative;
  min-height: 52px;
  padding: 0 26px;
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: 0.04em;
  color: var(--on-brass);
  background: linear-gradient(180deg, var(--brass-hi), var(--brass) 45%, var(--brass-lo));
  border: 0;
  box-shadow: 0 14px 40px -14px color-mix(in srgb, var(--brass-lo) 80%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  overflow: hidden;
}
.btn-brass::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%); transform: translateX(-120%); animation: shine 3.2s 1s infinite; }
@keyframes shine { 40%, 100% { transform: translateX(120%); } }
.btn-brass:disabled { filter: grayscale(0.5) brightness(0.85); cursor: progress; }

.footer { max-width: 1200px; margin: 0 auto; padding: 30px 28px 60px; display: flex; flex-wrap: wrap; gap: 8px 24px; font-family: var(--mono); font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--brass-ink); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* 404 */
.lost { max-width: 640px; margin: 12vh auto 0; padding: 0 28px; }
.lost h1 { margin: 0 0 12px; font-family: var(--display); font-size: clamp(30px, 5vw, 44px); }
.lost p { color: var(--muted); }
.lost .btn-brass { margin-top: 16px; }
