/* 定時サバイバー — オフィスの床と若葉色。mn.css の変数を上書き */
:root {
  --bg: #eef1f4; --surface: #ffffff; --surface-2: #e4e8ee; --text: #1a1d24; --text-sub: #5c6472; --line: #d6dbe3;
  --accent: #1f8a5b; --accent-ink: #ffffff; --accent-soft: #dcf2e6;
  --ts-floor: #e7ebf0; --ts-floor-line: #d5dbe3; --ts-desk: #d9cfbf; --ts-hud: #1a1d24; --ts-hud-shadow: rgba(255,255,255,.85);
  --ts-xp: #2fbf71; --ts-hp: #e5484d; --ts-mail: #3b4a6b; --ts-chat: #2fa84f; --ts-task: #9b6b3d; --ts-clock: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1318; --surface: #171c23; --surface-2: #212833; --text: #eef1f5; --text-sub: #a2abb8; --line: #2b3340;
    --accent: #4cc48b; --accent-ink: #0f1318; --accent-soft: #17322a;
    --ts-floor: #1a2029; --ts-floor-line: #232b36; --ts-desk: #2a2f38; --ts-hud: #f2f4f7; --ts-hud-shadow: rgba(0,0,0,.75);
    --ts-xp: #4cd68a; --ts-hp: #ff6b6f; --ts-mail: #9fb0d6; --ts-chat: #4cc46a; --ts-task: #c08a55; --ts-clock: #212833;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1318; --surface: #171c23; --surface-2: #212833; --text: #eef1f5; --text-sub: #a2abb8; --line: #2b3340;
  --accent: #4cc48b; --accent-ink: #0f1318; --accent-soft: #17322a;
  --ts-floor: #1a2029; --ts-floor-line: #232b36; --ts-desk: #2a2f38; --ts-hud: #f2f4f7; --ts-hud-shadow: rgba(0,0,0,.75);
  --ts-xp: #4cd68a; --ts-hp: #ff6b6f; --ts-mail: #9fb0d6; --ts-chat: #4cc46a; --ts-task: #c08a55; --ts-clock: #212833;
}

/* タイトル */
.ts-hero { text-align: center; padding: 6px 0 2px; }
.ts-hero-art svg { width: 220px; height: auto; display: block; margin: 0 auto 2px; }
.ts-ic-mail rect { fill: var(--surface); stroke: var(--ts-mail); stroke-width: 2.4; }
.ts-ic-mail path { stroke: var(--ts-mail); stroke-width: 2.4; }
.ts-ic-chat path { fill: var(--ts-chat); }
.ts-ic-chat circle { fill: #fff; }
.ts-ic-task rect { fill: var(--ts-task); }
.ts-ic-task rect + rect { fill: var(--text-sub); }
.ts-ic-task path { stroke: #fff; stroke-width: 2.4; }
.ts-ic-clock { fill: var(--ts-clock); stroke: var(--accent); stroke-width: 6; }
.ts-ic-hand { stroke: var(--text); stroke-width: 5; stroke-linecap: round; }
.ts-ic-time { fill: var(--accent); font: 900 15px var(--font); }
.ts-logo { font-size: clamp(38px, 12vw, 56px); font-weight: 900; letter-spacing: .04em; margin: 0; line-height: 1.15; }
.ts-today { border: 2px solid var(--accent); }
.ts-today h2 { font-size: 24px; margin: 2px 0 4px; }
.ts-mini { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; gap: 6px; padding: 12px 8px; }
.ts-mini b { display: block; font-size: 24px; color: var(--accent); line-height: 1.2; }
.ts-mini span { font-size: 12px; color: var(--text-sub); }
.ts-zukan { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.ts-zukan > div { background: var(--surface-2); border-radius: 10px; padding: 8px 4px; text-align: center; font-size: 12px; font-weight: 700; line-height: 1.35; cursor: pointer; }
.ts-zukan > div.no { opacity: .5; cursor: default; }
.ts-zukan .big { display: block; font-size: 24px; line-height: 1.3; }

/* プレイ画面 */
.mn-app.ts-playing { padding-top: 8px; padding-bottom: 8px; }
.ts-stage { position: relative; width: 100%; max-width: 560px; margin: 0 auto; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.ts-canvas { display: block; width: 100%; border-radius: 14px; touch-action: none; background: var(--ts-floor); box-shadow: var(--shadow); }
.ts-pause { position: absolute; right: 10px; bottom: 10px; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 18px; cursor: pointer; opacity: .9; }
.ts-pause svg { fill: var(--text); display: block; margin: auto; }
.ts-hint { margin: 6px 0 0; }
.ts-over { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 14px; background: rgba(10, 14, 22, .55); border-radius: 14px; }
.ts-over[hidden] { display: none; }
.ts-over-in { width: 100%; max-width: 420px; background: var(--surface); border-radius: 16px; padding: 16px 14px; box-shadow: var(--shadow); }
.ts-over-in h3 { margin: 0 0 10px; }
.ts-over-in > * + * { margin-top: 8px; }
.ts-choices { display: grid; gap: 8px; }
.ts-choice { display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; padding: 12px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; opacity: .55; transition: opacity .2s, border-color .15s; }
.ts-over.armed .ts-choice { opacity: 1; }
.ts-choice:hover { border-color: var(--accent); }
.ts-choice .ic { font-size: 30px; line-height: 1; flex: none; width: 40px; text-align: center; }
.ts-choice .tx { min-width: 0; }
.ts-choice b { font-size: 17px; }
.ts-choice em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 99px; padding: 1px 8px; margin-left: 6px; }
.ts-choice small { display: block; color: var(--text-sub); font-size: 13px; line-height: 1.45; margin-top: 2px; }

/* 結果 */
.ts-result { border: 2px solid var(--line); }
.ts-result.ok { border-color: var(--accent); }
.ts-result-big { font-size: clamp(34px, 10vw, 48px); font-weight: 900; line-height: 1.2; margin: 4px 0 8px; }
.ts-result.ok .ts-result-big { color: var(--accent); }
.ts-title-badge { display: inline-block; font-weight: 800; background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 4px 14px; }
.ts-rate { display: grid; gap: 4px; margin-top: 8px; font-size: 13px; }
.ts-rate > div { display: grid; grid-template-columns: 8.5em 1fr 3em; gap: 8px; align-items: center; }
.ts-rate i { display: block; height: 10px; border-radius: 99px; background: var(--line); }
.ts-rate > .me i { background: var(--accent); }
.ts-rate > .me span:first-child { font-weight: 800; color: var(--accent); }

/* タイトルの行進（Gemini で作った人形のコマ送り） */
.ts-hero-art svg { width: 150px; }
.ts-parade { display: flex; align-items: flex-end; justify-content: center; gap: 4px; margin: 4px auto 6px; height: 100px; overflow: hidden; }
.ts-parade .ts-gap { width: 18px; }
.ts-spr { display: inline-block; flex: none; background-repeat: no-repeat; background-position: 0 0; animation-name: ts-frames; animation-iteration-count: infinite; }
@keyframes ts-frames { from { background-position-x: 0; } to { background-position-x: var(--to); } }

/* ステージ・スキルツリー */
.ts-stagecard { border: 2px solid var(--accent); }
.ts-stagecard h2 { font-size: 24px; margin: 2px 0 4px; }
.ts-stagecard > * + * { margin-top: 8px; }
.ts-treebtn { gap: 6px; }
.ts-sp { font-size: 12px; font-weight: 800; color: var(--accent); background: var(--accent-soft); border-radius: 99px; padding: 1px 8px; }
.ts-tier { margin-top: 6px; }
.ts-tier h3 { font-size: 18px; margin: 0 0 8px; }
.ts-tier h3 small { font-size: 12px; font-weight: 500; color: var(--text-sub); }
.ts-tier.locked { opacity: .55; }
.ts-days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ts-day { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 92px; padding: 8px 2px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; text-align: center; line-height: 1.3; }
.ts-day b { font-size: 22px; }
.ts-day span { font-size: 11px; font-weight: 700; color: var(--text-sub); }
.ts-day small { font-size: 10px; color: var(--text-sub); }
.ts-day.cl { border-color: var(--good); background: var(--good-soft); }
.ts-day.cl span { color: var(--good); }
.ts-day.now { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ts-day.lk { cursor: default; background: var(--surface-2); }
.ts-day:disabled { opacity: .7; }
.ts-spcard { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.ts-spcard b { font-size: 30px; color: var(--accent); }
.ts-spcard small { flex-basis: 100%; color: var(--text-sub); font-size: 12px; }
.ts-branch h3 { margin: 0 0 8px; }
.ts-nodes { display: grid; gap: 8px; }
.ts-node { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "tx btn" "pips btn"; gap: 4px 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.ts-node-tx { grid-area: tx; min-width: 0; }
.ts-node-tx b { font-size: 15px; }
.ts-node-tx small { display: block; color: var(--text-sub); font-size: 12px; line-height: 1.4; }
.ts-lv { margin-left: 6px; font-size: 12px; font-weight: 700; color: var(--accent); }
.ts-pips { grid-area: pips; display: flex; gap: 3px; }
.ts-pips i { width: 14px; height: 6px; border-radius: 3px; background: var(--line); }
.ts-pips i.on { background: var(--accent); }
.ts-node > .mn-btn, .ts-node > .mn-tag { grid-area: btn; white-space: nowrap; min-height: 40px; padding: 6px 12px; font-size: 14px; }
.ts-node.locked { opacity: .55; }
.ts-node.max { box-shadow: inset 0 0 0 2px var(--good-soft); }
.ts-spgain { border: 2px solid var(--accent); }
.ts-spgain b { font-size: 22px; color: var(--accent); }
.ts-reroll { margin-top: 8px; min-height: 40px; }
@media (max-width: 380px) { .ts-day small { display: none; } .ts-day { min-height: 70px; } }

.ts-col { flex-direction: column; gap: 2px; line-height: 1.25; flex-basis: 0; }
.ts-col small { font-size: 11px; color: var(--text-sub); font-weight: 600; }

/* v4：プレイ中は画面いっぱい（天守攻めの戦場と同じ）＋ 終了ボタン */
.ts-quit { position: absolute; right: 62px; bottom: 10px; height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 800 14px var(--font); cursor: pointer; opacity: .9; white-space: nowrap; }
.ts-quit:hover, .ts-pause:hover { opacity: 1; border-color: var(--accent); }
body.ts-full { overflow: hidden; overscroll-behavior: none; }
body.ts-full .mn-header, body.ts-full .mn-about, body.ts-full .mn-footer, body.ts-full noscript { display: none !important; }
body.ts-full #app.mn-app { position: fixed; inset: 0; max-width: none; margin: 0; padding: 0; z-index: 20; background: var(--bg); }
body.ts-full #app.mn-app > div { height: 100%; }
body.ts-full .ts-stage { position: absolute; inset: 0; max-width: none; margin: 0; display: flex; align-items: center; justify-content: center; touch-action: none; }
body.ts-full .ts-canvas { border-radius: 0; box-shadow: none; flex: none; }
body.ts-full .ts-over { border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
body.ts-full .ts-hint { display: none; }
body.ts-full .ts-stage { background: var(--bg); }
body.ts-full .ts-canvas { box-shadow: var(--shadow); }
body.ts-full .ts-pause, body.ts-full .ts-quit { bottom: calc(10px + max(var(--ts-oy, 0px), env(safe-area-inset-bottom))); }
body.ts-full .ts-pause { right: calc(10px + max(var(--ts-ox, 0px), env(safe-area-inset-right))); }
body.ts-full .ts-quit { right: calc(62px + max(var(--ts-ox, 0px), env(safe-area-inset-right))); }
body.ts-full .mn-toast { bottom: auto; top: 72px; }

/* v5：スキル・アイテムのアイコン（Gemini・透過） */
.ts-icon { display: block; width: 40px; height: 40px; object-fit: contain; }
.ts-zukan .big .ts-icon { width: 36px; height: 36px; margin: 0 auto; }

/* v5：本当の全画面 */
.ts-fs { position: absolute; right: 139px; bottom: 10px; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; opacity: .9; display: flex; align-items: center; justify-content: center; }
.ts-fs:hover { opacity: 1; border-color: var(--accent); }
body.ts-full .ts-fs { bottom: calc(10px + max(var(--ts-oy, 0px), env(safe-area-inset-bottom))); right: calc(139px + max(var(--ts-ox, 0px), env(safe-area-inset-right))); }
.fs-exit { display: none; position: fixed; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 60; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 8px 14px; font: 700 13px var(--font); box-shadow: var(--shadow); cursor: pointer; }
body.is-fs:not(.ts-full) .fs-exit { display: block; }
body.is-fs { overflow-y: auto; }
body.is-fs.ts-full { overflow: hidden; }

/* v15：スマホでモーダルの×が画面外に出ないように（画面の高さに収め、×は上に貼り付け）。引っぱって再読み込みも防ぐ */
.mn-modal-bg { overscroll-behavior: contain; }
.mn-modal { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px - env(safe-area-inset-top)); overscroll-behavior: contain; }
.mn-modal-x { position: sticky; top: -16px; float: right; margin: -16px -10px 0 4px; z-index: 3; background: var(--surface); border-radius: 50%; }
html:has(body.ts-full), body.ts-full { overscroll-behavior: none; }
