/* Game viewport and editor chrome. Loaded in the editor only. */
.sim-workbench #sim-anomaly-controls,.sim-workbench #sim-back-btn { display:none!important; }
.dbg-nav-icon { width:14px; height:14px; vertical-align:middle; margin-right:5px; filter:brightness(0) invert(1); }
.dbg-nav-back { transform:rotate(180deg); }
.dbg-navigation-note { margin:7px 0 0; color:var(--game-muted,#abb6c6); font-size:12px; line-height:1.6; }
.gs-game-window { margin:0; overflow:hidden; }
#sim-overlay.sim-in-window { position:fixed!important; inset:0!important; width:100%!important; height:100%!important; border:0!important; border-radius:0!important; }
.sim-in-window .floating-resize-handle,.sim-workbench button[hidden] { display:none!important; }
#sim-window-notice { position:fixed; left:50%; bottom:44px; transform:translateX(-50%); z-index:1900; display:flex; align-items:center; flex-wrap:wrap; gap:10px; max-width:calc(100vw - 32px); padding:10px 14px; background:#222c39; color:#edf1f7; border:1px solid #789fc6; border-radius:6px; box-shadow:0 4px 24px #0005; font:13px/1.5 var(--font-ui); }
#sim-window-notice[hidden] { display:none; }
#sim-window-notice button { padding:6px 10px; background:#354b65; color:#fff; border:1px solid #789fc6; border-radius:4px; white-space:nowrap; cursor:pointer; }
#sim-overlay.sim-workbench {
  --game-chrome:#22262e; --game-edge:#3d4552; --game-muted:#abb6c6; --game-text:#edf1f7;
  flex-direction:column; align-items:stretch; justify-content:flex-start; padding:0;
  background:#14171d; backdrop-filter:none; color:var(--game-text);
  font:13px/1.5 var(--font-ui); container-type:inline-size;
}
.sim-workbench :is(#sim-workbench-toolbar,#sim-view-toolbar,#sim-inspector,#sim-workbench-status) { box-sizing:border-box; }
#sim-workbench-toolbar { display:flex; flex:none; align-items:center; gap:14px; min-height:48px; padding:6px 14px; background:var(--game-chrome); border-bottom:1px solid var(--game-edge); }
.sim-workbench-caption { display:flex; align-items:center; gap:9px; font-size:14px; letter-spacing:0; }
.sim-workbench-caption img { width:18px; height:18px; filter:invert(1); opacity:.8; }
.sim-session-state { display:flex; align-items:center; gap:7px; font-size:11px; color:#b2dfc9; }
.sim-session-state::before { content:''; width:6px; height:6px; border-radius:50%; background:#69c9a0; }
.sim-workbench-controls { display:flex; align-items:center; gap:6px; margin-left:auto; }
#sim-view-toolbar { display:flex; flex:none; flex-wrap:wrap; align-items:center; gap:12px; min-height:44px; padding:6px 14px; background:#1c2027; border-bottom:1px solid var(--game-edge); }
.sim-resolution-control { display:flex; align-items:center; gap:9px; font-size:12px; color:var(--game-muted); }
#sim-scale-info { color:var(--game-muted); font-size:11px; font-variant-numeric:tabular-nums; min-width:62px; }
.sim-workbench :is(#sim-workbench-toolbar,#sim-view-toolbar,#sim-inspector) :is(button,select) {
  box-sizing:border-box; position:static; display:inline-flex; align-items:center; justify-content:center; gap:7px;
  height:32px; min-height:32px; width:auto; margin:0; padding:5px 10px; border:1px solid var(--game-edge);
  border-radius:4px; background:#2b313c; color:var(--game-text); font:12px/1.4 var(--font-ui); white-space:nowrap; cursor:pointer;
}
.sim-workbench :is(#sim-workbench-toolbar,#sim-view-toolbar,#sim-inspector) button:hover:not(:disabled) { background:#384457; border-color:#8095af; }
.sim-workbench :is(button,select):focus-visible { outline:2px solid #91c8ff; outline-offset:2px; }
.sim-workbench .floating-tool-btn img { width:16px; height:16px; filter:invert(1); flex:none; }
#sim-workbench-toolbar .sim-close-btn { background:#71323c; border-color:#ae5e6b; color:#fff; min-width:76px; }
#sim-workbench-toolbar .sim-close-btn:hover { background:#90424e; border-color:#dd8b98; }
.sim-stop-icon { width:10px; height:10px; border-radius:1px; background:currentColor; }
#sim-view-toolbar #sim-values-toggle { margin-left:auto; }
#sim-view-toolbar #sim-view-size { min-width:170px; max-width:230px; display:block; padding-right:24px; }
.sim-workbench button[aria-expanded=true],.sim-workbench button[aria-pressed=true] { background:#294662!important; border-color:#789fc6!important; }
.sim-workbench button:disabled { opacity:.55; cursor:default; }
#sim-workbench-body { display:flex; flex:1; min-height:0; min-width:0; overflow:hidden; }
#sim-game-stage { position:relative; flex:1; min-height:0; min-width:0; overflow:hidden; background:#111419; outline:none; }
#sim-game-stage:focus-visible { box-shadow:inset 0 0 0 1px #6488ab; }
#sim-game-stage #sim-screen {
  position:absolute; top:50%; left:50%; flex:none; max-width:none!important; max-height:none!important;
  margin:0!important; border:0; border-radius:0; box-shadow:0 0 0 1px #3d455255;
  transform:translate(-50%,-50%) scale(var(--sim-scale,1)); transform-origin:center; animation:none;
  color:#edf1f7; background:#141c29; font-family:var(--font-ui);
  --text:#edf1f7; --text-muted:#b1bfd0; --border:#536175; --surface:#182231; --surface-2:#253246;
}
#sim-overlay.sim-workbench.sim-floating { position:fixed; inset:auto; left:var(--float-left); top:var(--float-top); width:var(--float-width); height:var(--float-height); min-width:0; min-height:0; border:1px solid #6c7c91; border-radius:7px; box-shadow:0 18px 70px #0009; z-index:2000; }
#sim-inspector { width:300px; flex:0 0 300px; overflow-y:auto; overscroll-behavior:contain; background:#20252d; border-left:1px solid var(--game-edge); }
#sim-inspector[hidden] { display:none; }
.sim-inspector-heading { display:flex; align-items:center; justify-content:space-between; padding:12px 16px; border-bottom:1px solid var(--game-edge); }
#sim-inspector .sim-inspector-heading button { width:26px; height:26px; min-height:26px; padding:4px; background:transparent; }
.sim-current-info { display:flex; flex-direction:column; gap:6px; padding:16px; border-bottom:1px solid var(--game-edge); }
.sim-current-info small,#sim-current-id { color:var(--game-muted); font-size:11px; }
#sim-current-node { font-size:15px; font-weight:650; line-height:1.5; overflow-wrap:anywhere; }
.sim-node-tools { display:flex; align-items:center; gap:6px; margin-top:6px; }
#sim-live-values { padding:16px; border-bottom:1px solid var(--game-edge); }
.sim-values-heading { font-size:12px; font-weight:650; margin-bottom:12px; }
.sim-values-heading small { display:block; color:var(--game-muted); font-weight:400; font-size:11px; margin-top:4px; }
.sim-values-grid { display:grid; gap:6px; }
.sim-value-item { display:grid; grid-template-columns:38px minmax(0,1fr) auto; gap:7px; align-items:center; padding:9px; border:1px solid #3d4552; border-radius:4px; background:#191e26; font-size:12px; }
.sim-value-item small { color:var(--game-muted); font-size:10px; }
.sim-value-item span { overflow-wrap:anywhere; }
.sim-value-item strong { color:#a7d5ff; font-size:13px; font-variant-numeric:tabular-nums; }
.sim-value-item.value-changed { background:#423821; border-color:#c6a35f; }
.sim-values-grid p { color:var(--game-muted); font-size:12px; margin:0; }
.sim-history-section { padding:16px; }
.sim-history-section h3 { font-size:12px; margin:0 0 9px; }
#sim-inspector #sim-history { display:flex; flex-wrap:wrap; gap:4px; padding:0; margin:0; max-height:150px; overflow:auto; border:0; background:transparent; font-size:11px; }
#sim-inspector #sim-debug-toggle { display:flex; width:calc(100% - 32px); margin:0 16px 16px; }
#sim-debug-toggle kbd { margin-left:auto; color:var(--game-muted); font:10px var(--font-ui); }
#sim-inspector #sim-debug-panel { position:static!important; width:100%!important; height:auto!important; max-height:none; min-width:0; transform:none; box-shadow:none; border:0; border-top:1px solid var(--game-edge); font-size:12px; }
#sim-workbench-status { display:flex; align-items:center; justify-content:space-between; gap:16px; flex:none; min-height:28px; padding:5px 16px; background:var(--game-chrome); border-top:1px solid var(--game-edge); color:var(--game-muted); font-size:11px; }
#sim-workbench-status>span:first-child { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#sim-workbench-status>span:last-child { white-space:nowrap; }
body.sim-visualizing #sim-debug-hint { display:none!important; }
/* The game surface: clear title/menu hierarchy, readable ADV and choices. */
.sim-workbench #sim-top-bar { min-height:38px; background:#0b111c66; border-bottom:1px solid #ffffff12; }
.sim-workbench #sim-top-bar.sim-hud-empty { display:none; }
#sim-game-stage #sim-screen[data-view-type="Title"] { background:radial-gradient(ellipse at 50% 25%,#253650,#121a28 72%); }
.sim-workbench #sim-screen[data-view-type="Title"] #sim-scene { flex:1 1 40%; justify-content:flex-end; padding:32px 24px 20px; }
.sim-workbench #sim-screen[data-view-type="Title"] #sim-node-card { max-width:680px; padding:0; text-align:center; border:0; background:none; }
.sim-workbench #sim-screen[data-view-type="Title"] #sim-type-badge { display:none; }
.sim-workbench #sim-screen[data-view-type="Title"] #sim-title { font-size:clamp(28px,4cqw,52px); font-weight:650; letter-spacing:.035em; margin:0 0 12px; overflow-wrap:anywhere; }
.sim-workbench #sim-screen[data-view-type="Title"] #sim-text { font-family:var(--font-ui); font-size:15px; }
.sim-workbench #sim-screen[data-view-type="Title"] #sim-actions-wrap { flex:1 1 60%; display:flex; align-items:flex-start; justify-content:center; padding:8px 24px 36px; background:transparent; border:0; overflow:auto; }
.sim-workbench #sim-screen[data-view-type="Title"] #sim-actions { display:flex; flex-direction:column; gap:9px; width:min(360px,100%); }
.sim-workbench .sim-title-btn { min-height:46px; margin:0; padding:11px 20px; font:500 15px/1.5 var(--font-ui); letter-spacing:.02em; color:#e5edf9; background:#26374d; border:1px solid #617792; border-radius:5px; }
.sim-workbench .sim-title-btn:first-child { background:#d4e8ff; color:#16263b; border-color:#d4e8ff; font-weight:650; }
.sim-workbench .sim-title-btn:hover:not(:disabled) { background:#3d5573; border-color:#b2d4ff; color:white; }
.sim-workbench .sim-title-btn-subinfo { color:inherit; font-size:11px; opacity:.8; margin-top:3px; }
.sim-workbench #sim-adv-text { font-family:var(--font-ui); font-size:18px; line-height:1.85; }
.sim-workbench #sim-adv-body { border-top:1px solid #7698c260; background:#111c2bef; padding:24px 32px; }
.sim-workbench #sim-adv-speaker { font-family:var(--font-ui); font-weight:650; color:#d2e6ff; }
.sim-workbench #sim-node-card { border-radius:7px; border-color:#5c749255; background:#192637bb; }
.sim-workbench #sim-actions-wrap { border-color:#51678155; background:#101a28; }
.sim-workbench .sim-choice-btn { min-height:44px; font-size:15px; border-radius:5px; border-color:#617792; background:#26374d; }
.sim-workbench .sim-choice-btn:hover { padding-left:18px; background:#3d5573; color:#fff; border-color:#b2d4ff; }
.sim-workbench .sim-next-btn { min-height:44px; font-size:14px; border-radius:5px; background:#c5e1ff; color:#152b44; }
@container (max-width:900px) {
  #sim-inspector { width:260px; flex-basis:260px; }
  #sim-view-toolbar { gap:8px; }
  .sim-resolution-control>span { display:none; }
}
@container (max-width:700px) {
  #sim-workbench-body { flex-direction:column; }
  #sim-inspector { width:100%; flex:0 0 42%; max-height:42%; border-left:0; border-top:1px solid var(--game-edge); }
  .sim-current-info { padding:10px 14px; }
  #sim-live-values { padding:12px 14px; }
  .sim-values-grid { grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); }
  #sim-view-toolbar,#sim-workbench-toolbar { padding-left:10px; padding-right:10px; }
  #sim-scale-info { display:none; }
}

#canvas .node.sim-executing { outline:3px solid #73c5ff!important; outline-offset:5px; animation:sim-node-pulse 1.3s ease-in-out infinite; }
#canvas .node.sim-recent:not(.sim-executing) { outline:2px solid #73c5ff; outline-offset:4px; box-shadow:0 0 15px #73c5ff70; }
.sim-execution-label { position:absolute; left:0; top:-30px; background:#87cfff; color:#0d2034; border-radius:4px; padding:3px 9px; font:750 11px/1.4 var(--font-ui); letter-spacing:.1em; pointer-events:none; }
.sim-flow-pulse { pointer-events:none; stroke-dasharray:12 88; animation:sim-flow-travel .85s linear infinite; filter:drop-shadow(0 0 4px #71bfff); }
@keyframes sim-node-pulse { 0%,100% { box-shadow:0 0 0 7px #65bbff15,0 8px 22px #0005; } 50% { box-shadow:0 0 0 10px #65bbff40,0 8px 22px #0005; } }
@keyframes sim-flow-travel { from { stroke-dashoffset:100; } to { stroke-dashoffset:0; } }
@media(prefers-reduced-motion:reduce) { #canvas .node.sim-executing,.sim-flow-pulse { animation:none; } .sim-flow-pulse { stroke-dasharray:4 4; } }

/* Make a terminal anomaly state distinguishable from a stalled live game. */
#sim-anomaly-mode-hint[role="status"] {
  top: 52px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  box-sizing: border-box;
  width: min(560px, calc(100% - 32px));
  padding: 16px 20px;
  border: 1px solid #e4b86b;
  border-radius: 6px;
  background: #29251dee;
  color: #ffe1ac;
  font-size: 14px;
  line-height: 1.7;
  text-align: left;
}

/* 表示: 開発 / 本番(v0.35.0)と 実行情報の「UI が未設定」 */
.sim-viewmode-switch { display:inline-flex; align-items:center; }
.sim-workbench #sim-workbench-toolbar .sim-viewmode-switch button { height:26px; min-height:26px; padding:2px 10px; border-radius:0; font-size:12px; background:#1c2027; color:var(--game-muted); }
.sim-workbench #sim-workbench-toolbar .sim-viewmode-switch button + button { margin-left:-1px; }
.sim-workbench #sim-workbench-toolbar .sim-viewmode-switch button[aria-pressed="true"] { background:#354b65; color:#fff; border-color:#789fc6; position:relative; }
.sim-fallback-section { padding:8px 12px; border-bottom:1px solid var(--game-edge); font-size:12px; line-height:1.4; }
.sim-fallback-section h3 { margin:0 0 4px; font-size:12px; font-weight:650; }
.sim-fallback-section h3 small { display:block; margin-top:2px; color:#00e5ff; font-weight:400; font-size:11px; }
.sim-fallback-sub { margin:6px 0 2px; color:var(--game-muted); font-size:11px; }
.sim-fallback-section p { margin:0; color:var(--game-muted); }
.sim-fallback-table { width:100%; border-collapse:collapse; }
.sim-fallback-table :is(th,td) { padding:2px 4px; border:1px solid var(--game-edge); text-align:left; vertical-align:top; font-size:12px; font-weight:400; overflow-wrap:anywhere; }
.sim-fallback-table tbody th { color:#00e5ff; width:38%; }
.sim-fallback-table thead :is(th,td) { color:var(--game-muted); font-size:11px; }
.sim-fallback-table .sim-fallback-count { width:28px; text-align:right; font-variant-numeric:tabular-nums; }
