/* ゲート兵増やし — 夕暮れの石の橋。文字は DotGothic16（脱出ゲームと同じドットの字） */
:root {
  --bg: #120c22;
  --bg2: #1e1638;
  --text: #f3ecff;
  --sub: rgba(243, 236, 255, .62);
  --line: #3a2e5c;
  --btn: #2a2048;
  --btn-press: #3a2e60;
  --blue: #2a56c8;
  --blue-hi: #6f9cff;
  --gold: #ffd36a;
  --red: #ff6a6a;
  --ink: #0b1030;
  --font: "DotGothic16", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
}
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --bg: #120c22; } }
:root[data-theme="dark"] { --bg: #120c22; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); overflow: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
button, a { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#app {
  position: fixed; inset: 0; margin: 0 auto; max-width: 520px; display: flex; flex-direction: column;
  padding: max(2px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.top { display: flex; align-items: center; justify-content: space-between; height: 42px; flex: none; gap: 8px; }
.title { margin: 0; font-size: 18px; font-weight: 400; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tools { display: flex; gap: 2px; flex: none; }
.iconbtn { width: 44px; height: 44px; border: 0; background: none; padding: 11px; border-radius: 0; cursor: pointer; }
.iconbtn svg { width: 22px; height: 22px; display: block; fill: var(--text); }
.iconbtn svg .w { fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: square; }
.iconbtn .off { display: none; }
.iconbtn[aria-pressed="true"] .on { display: none; }
.iconbtn[aria-pressed="true"] .off { display: block; }
.iconbtn:focus-visible, .btn:focus-visible, .closebtn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.today { margin: 0 0 4px; font-size: 13px; color: var(--sub); flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today b { color: var(--gold); font-weight: 400; }

.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #1b3566; box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--line); }
#scene { position: absolute; left: 50%; top: 0; transform: translateX(-50%); display: block; touch-action: none; image-rendering: pixelated; image-rendering: crisp-edges; cursor: grab; }

/* 言葉はプレイ画面の外（すぐ下の帯）に出す＝画面の中はドット絵だけ */
.msgbar { position: absolute; left: 0; right: 0; bottom: 8px; height: 52px; pointer-events: none; z-index: 2; }
.cap, .hint, .alt, .toast {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; max-width: 100%; width: max-content; text-align: center; pointer-events: none;
  font-size: 15px; line-height: 1.35; padding: 6px 12px; background: #0b1030; color: var(--text);
  box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px #3a4a8a; white-space: pre-line; word-break: auto-phrase; text-wrap: balance;
}
.cap { background: #2a2622; box-shadow: 0 0 0 2px #111, inset 0 0 0 2px #77705f; }
.cap small { display: block; font-size: 12px; color: rgba(255, 255, 255, .7); }
.hint, .alt, .toast { opacity: 0; }   /* 入れ替わりで2行重ならないよう、フェードはしない */
.hint.on, .alt.on, .toast.on { opacity: 1; }
.alt.good { color: #bfe6ff; }
.alt.better { color: var(--gold); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px #8a6a20; }
.toast { font-size: 17px; color: #ffd0d0; background: #3c0810; box-shadow: 0 0 0 2px #1a0408, inset 0 0 0 2px #a02a3a; }
.fps { position: absolute; top: 4px; right: 4px; font: 11px/1.3 ui-monospace, monospace; background: rgba(0, 0, 0, .7); padding: 3px 6px; white-space: pre; text-align: right; pointer-events: none; }

.panel {
  position: absolute; left: 50%; top: 56%; transform: translate(-50%, -50%); width: min(300px, 88%); padding: 14px 16px 14px; text-align: center; z-index: 3;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 2px, transparent 2px 4px),
    #160f2c;
  box-shadow: 0 0 0 2px #0b1030, 0 0 0 4px #c8a040, 0 0 0 6px #0b1030, inset 0 0 0 2px #3a2e5c, 0 10px 0 6px rgba(0, 0, 0, .35);
}
.panel::before, .panel::after { content: ""; position: absolute; top: -8px; width: 10px; height: 10px; background: #ffd36a; box-shadow: 0 0 0 2px #0b1030; }
.panel::before { left: -8px; } .panel::after { right: -8px; }
.p-logo { font-size: 30px; line-height: 1.1; color: #ffd36a; letter-spacing: .04em; text-shadow: 3px 3px 0 #6a2a10, -2px 0 0 #0b1030, 2px 0 0 #0b1030, 0 -2px 0 #0b1030, 0 2px 0 #0b1030; margin: 2px 0 8px !important; }
.p-art { display: block; width: 264px; max-width: 100%; height: auto; margin: 0 auto 10px; image-rendering: pixelated; }
.panel p { margin: 0 0 10px; }
.p-lead { font-size: 15px; line-height: 1.6; text-wrap: pretty; word-break: auto-phrase; }
.p-course { font-size: 14px; color: var(--gold); }
.p-small { font-size: 12px; color: var(--sub); margin: 10px 0 0 !important; }
.e-kick { font-size: 18px; color: var(--gold); }
.panel.lose .e-kick { color: var(--red); }
.e-big { font-size: 44px; line-height: 1.1; letter-spacing: .02em; }
.e-big small { font-size: 20px; }
.e-sub { font-size: 17px; }
.e-note { font-size: 13px; color: var(--sub); line-height: 1.6; text-wrap: pretty; word-break: auto-phrase; }
.e-note b { color: #ffd0d0; font-weight: 400; }
.e-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.e-btns .btn { white-space: nowrap; padding: 0 8px; min-width: 0; }
.btn.wide { width: 100%; margin-top: 8px; }

.btn {
  min-height: 46px; padding: 0 16px; border: 0; border-radius: 0; background: var(--btn); color: var(--text); font-size: 16px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; touch-action: manipulation;
  box-shadow: 0 0 0 2px var(--ink), inset 0 -3px 0 rgba(0, 0, 0, .35), inset 0 2px 0 rgba(255, 255, 255, .12);
}
.btn:active { background: var(--btn-press); transform: translateY(1px); }
.btn.main { background: var(--blue); min-width: 150px; box-shadow: 0 0 0 2px var(--ink), inset 0 -3px 0 #16307a, inset 0 2px 0 var(--blue-hi); }
.btn.main:active { background: #2248a8; }

/* 結果カード */
.result { position: fixed; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--bg); z-index: 8; touch-action: pan-y; }
.rin { max-width: 480px; margin: 0 auto; padding: max(10px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); }
#card { display: block; height: auto; width: auto; max-width: 100%; max-height: calc(100vh - 170px); max-height: calc(100dvh - 170px); margin: 0 auto; image-rendering: pixelated; box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--line); }
.rside { margin-top: 12px; }
.actions { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px; }
.actions .btn { padding: 0 8px; font-size: 15px; min-width: 0; }
.actions .x { background: #000; color: #fff; }
.actions .x svg { width: 16px; height: 16px; fill: #fff; }
.tip { margin: 14px 2px 4px; font-size: 14px; line-height: 1.7; text-wrap: pretty; word-break: auto-phrase; }
.meta { margin: 10px 2px 8px; font-size: 13px; color: var(--sub); }
.more { text-align: center; margin: 18px 0 0; font-size: 14px; }
.more a { color: var(--sub); }
@media (orientation: landscape) and (max-height: 560px) {
  .rin { max-width: 900px; }
  .rmain { display: flex; gap: 16px; align-items: flex-start; }
  #card { max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); margin: 0; }
  .rside { flex: 1; margin-top: 0; }
}

/* 遊び方 */
.sheet-wrap { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: flex; align-items: flex-end; justify-content: center; z-index: 10; touch-action: pan-y; }
.sheet { width: 100%; max-width: 520px; max-height: 86vh; overflow-y: auto; background: var(--bg2); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--line); padding: 16px 18px max(18px, env(safe-area-inset-bottom)); font-size: 14px; line-height: 1.75; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet h2 { font-size: 16px; font-weight: 400; margin: 14px 0 6px; color: var(--gold); }
.sheet-head h2 { margin: 0; }
.sheet p { margin: 0 0 8px; color: rgba(243, 236, 255, .85); }
.howto { margin: 8px 0; padding-left: 1.3em; }
.howto li { margin-bottom: 4px; }
.foot { color: var(--sub) !important; font-size: 12px; }
.closebtn { min-height: 40px; padding: 0 14px; border: 0; background: var(--btn); cursor: pointer; font-size: 14px; box-shadow: 0 0 0 2px var(--ink); }

@media (max-height: 600px) {
  .top { height: 36px; }
  .e-big { font-size: 34px; }
  .panel { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) { .hint, .alt, .toast { transition: none; } }

/* × は太いゴシックで（ドットの字の × は x に見える） */
.mul { font-family: system-ui, -apple-system, "Hiragino Sans", sans-serif; font-weight: 800; font-size: 1.05em; }
