/* =============================================================
   VRコアルーム「ロベリア拷問ゲーム」モック（Claude版）
   816x624 固定ステージ + MZ風ウィンドウ + ハッキングコンソール
   ============================================================= */

:root {
  --cyan: #19f2dc;
  --cyan-dim: rgba(25, 242, 220, 0.55);
  --font-game: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  --font-dot: "DotGothic16", "Meiryo", monospace;
  --font-term: "Share Tech Mono", "DotGothic16", Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  background: #04050d radial-gradient(1200px 800px at 50% 40%, #0b0d22 0%, #04050d 70%);
  overflow: hidden;
  font-family: var(--font-game);
  user-select: none;
  -webkit-user-select: none;
}

/* ---------------- ステージ（整数スケール） ---------------- */
#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 816px;
  height: 624px;
  margin: -312px 0 0 -408px;
  transform-origin: 50% 50%;
  background: #000;
  box-shadow: 0 0 90px rgba(20, 40, 120, 0.35);
}
#view {
  position: absolute;
  inset: 0;
  image-rendering: pixelated;
}
#ui {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* ---------------- MZ風メッセージウィンドウ ---------------- */
.msg-window {
  position: absolute;
  left: 16px;
  right: 248px; /* 右サイドコンソールを避ける */
  bottom: 14px;
  height: 148px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(24, 40, 82, 0.93), rgba(9, 15, 40, 0.95));
  border: 2px solid rgba(232, 238, 255, 0.88);
  box-shadow: 0 0 0 2px rgba(10, 18, 46, 0.85), inset 0 0 26px rgba(80, 120, 255, 0.14);
  padding: 14px 24px 12px;
  color: #fff;
  font-size: 22px;
  line-height: 1.55;
  z-index: 40;
}
.msg-name {
  position: absolute;
  top: -36px;
  left: 6px;
  min-width: 130px;
  text-align: center;
  padding: 4px 18px;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(24, 40, 82, 0.95), rgba(9, 15, 40, 0.96));
  border: 2px solid rgba(232, 238, 255, 0.88);
  box-shadow: 0 0 0 2px rgba(10, 18, 46, 0.85);
  font-size: 17px;
  color: #ffce73;
}
.msg-text {
  white-space: pre-wrap;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6);
}
.msg-pause {
  position: absolute;
  bottom: 4px;
  left: 50%;
  margin-left: -7px;
  color: #fff;
  font-size: 14px;
  animation: pause-bounce 0.7s ease-in-out infinite;
}
@keyframes pause-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* ---------------- ト書きナレーション帯 ---------------- */
.narration {
  position: absolute;
  left: 0;
  right: 0;
  top: 37%;
  background: rgba(2, 4, 14, 0.78);
  border-top: 1px solid rgba(190, 210, 255, 0.4);
  border-bottom: 1px solid rgba(190, 210, 255, 0.4);
  padding: 24px 30px 14px;
  text-align: center;
  color: #dbe4ff;
  font-family: var(--font-dot);
  font-size: 20px;
  z-index: 45;
}
.narration-cue {
  margin-top: 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  animation: pause-bounce 0.7s ease-in-out infinite;
}

/* ---------------- ハッキングコンソール（右サイド縦パネル） ---------------- */
.console {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 232px;
  background:
    repeating-linear-gradient(0deg, rgba(0, 255, 230, 0.025) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, rgba(3, 12, 16, 0.9), rgba(1, 7, 10, 0.96));
  border-left: 1px solid var(--cyan-dim);
  box-shadow: -6px 0 30px rgba(0, 255, 230, 0.08);
  color: #79f7e8;
  font-family: var(--font-term);
  z-index: 30;
  transition: opacity 0.35s;
  display: flex;
  flex-direction: column;
}
.console.busy { opacity: 0.42; pointer-events: none; }
.console.closing { opacity: 0; transition: opacity 1.8s; pointer-events: none; }

.console-head {
  padding: 10px 12px 8px;
  border-bottom: 1px dashed rgba(25, 242, 220, 0.25);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #34e8d2;
}
.c-title { text-shadow: 0 0 8px rgba(0, 255, 230, 0.6); white-space: nowrap; }
.c-stat { margin-top: 4px; }
.c-stat b { color: #b8fff6; }
.c-sep { margin: 0 7px; opacity: 0.4; }
.c-cursor { margin-left: 7px; animation: cursor-blink 1s steps(1) infinite; }
@keyframes cursor-blink { 50% { opacity: 0; } }

.console-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 12px 10px;
  min-height: 0;
}
.c-cmd {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.c-prompt {
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1.6;
  color: #9bfdf0;
  min-height: 20px;
}
.c-prompt b { color: #eafffb; }
.c-prompt .dim { opacity: 0.55; }
.c-btns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  align-content: start;
}
.c-btn {
  font-family: var(--font-dot);
  font-size: 18px;
  color: #aefcf1;
  background: rgba(0, 40, 38, 0.45);
  border: 1px solid rgba(25, 242, 220, 0.5);
  border-radius: 3px;
  padding: 11px 4px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
}
.c-btn:hover {
  background: rgba(0, 255, 230, 0.18);
  color: #fff;
  box-shadow: 0 0 12px rgba(0, 255, 230, 0.35), inset 0 0 8px rgba(0, 255, 230, 0.2);
}
.c-btn:active { transform: translateY(1px); }
.c-btn .key {
  font-family: var(--font-term);
  font-size: 11px;
  color: var(--cyan);
  border: 1px solid rgba(25, 242, 220, 0.6);
  border-radius: 2px;
  padding: 1px 5px;
}
.c-btn.back {
  grid-column: span 2;
  padding: 5px;
  font-size: 13px;
  background: transparent;
  border-style: dashed;
  opacity: 0.8;
}
.c-log {
  flex: 1;
  min-height: 0;
  font-size: 12px;
  line-height: 1.55;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: #4fd9c8;
  border-top: 1px dashed rgba(25, 242, 220, 0.2);
  padding-top: 8px;
}
.c-line { white-space: normal; word-break: break-all; opacity: 0.5; margin-bottom: 4px; }
.c-line:last-child {
  opacity: 1;
  color: #aefcf1;
  text-shadow: 0 0 6px rgba(0, 255, 230, 0.35);
}

/* ---------------- 侵入ログ（遷移演出） ---------------- */
.intrude {
  position: absolute;
  left: 18px;
  top: 44px;
  z-index: 46;
  font-family: var(--font-term);
  font-size: 14px;
  line-height: 1.75;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0, 255, 230, 0.7);
  pointer-events: none;
}

/* ---------------- 仮テキスト注記 ---------------- */
.temp-badge {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 50;
  font-family: var(--font-dot);
  font-size: 12px;
  color: rgba(255, 235, 235, 0.85);
  background: rgba(10, 6, 16, 0.55);
  border: 1px solid rgba(255, 160, 160, 0.35);
  border-radius: 4px;
  padding: 3px 8px;
  pointer-events: none;
}

/* ---------------- ゲームから開始 ---------------- */
.start-btn {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 50;
  font-family: var(--font-dot);
  font-size: 14px;
  color: #aefcf1;
  background: rgba(2, 16, 18, 0.78);
  border: 1px solid rgba(25, 242, 220, 0.55);
  border-radius: 4px;
  padding: 8px 14px;
  cursor: pointer;
}
.start-btn:hover {
  background: rgba(0, 255, 230, 0.16);
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 255, 230, 0.3);
}

/* ---------------- デバッグ表示 ---------------- */
.debug {
  position: absolute;
  left: 10px;
  top: 42px;
  z-index: 60;
  font-family: var(--font-term);
  font-size: 12px;
  line-height: 1.6;
  color: #d9fef8;
  background: rgba(2, 8, 10, 0.82);
  border: 1px solid rgba(25, 242, 220, 0.4);
  border-radius: 4px;
  padding: 10px 12px;
  white-space: pre;
  pointer-events: none;
}

/* ---------------- FIN ---------------- */
.fin {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: radial-gradient(circle at 50% 42%, rgba(8, 10, 30, 0.25), rgba(4, 5, 16, 0.78));
  opacity: 0;
  transition: opacity 1.2s;
}
.fin.visible { opacity: 1; }
.fin-title {
  font-family: var(--font-dot);
  font-size: 74px;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: #fff;
  text-shadow: 0 0 26px rgba(160, 200, 255, 0.8);
}
.fin-sub {
  font-family: var(--font-dot);
  font-size: 16px;
  color: #cfd9f5;
  margin-bottom: 18px;
}
.fin-btns { display: flex; gap: 18px; }
.fin-btn {
  font-family: var(--font-game);
  font-size: 18px;
  color: #fff;
  background: linear-gradient(180deg, rgba(24, 40, 82, 0.93), rgba(9, 15, 40, 0.95));
  border: 2px solid rgba(232, 238, 255, 0.88);
  border-radius: 6px;
  box-shadow: 0 0 0 2px rgba(10, 18, 46, 0.85);
  padding: 10px 30px;
  cursor: pointer;
}
.fin-btn:hover {
  color: #bfe0ff;
  box-shadow: 0 0 0 2px rgba(120, 180, 255, 0.7), 0 0 18px rgba(120, 180, 255, 0.5);
}

/* ---------------- フラッシュ / ローディング ---------------- */
.flash {
  position: absolute;
  inset: 0;
  z-index: 80;
  background: #eafcff;
  opacity: 0;
  pointer-events: none;
}
.flash.on { animation: flash-fade 0.5s ease-out; }
@keyframes flash-fade {
  0% { opacity: 0.95; }
  100% { opacity: 0; }
}

.loading {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #04050d;
  color: #9fb4e8;
  font-family: var(--font-term);
  font-size: 16px;
  letter-spacing: 0.2em;
  animation: load-pulse 1.2s ease-in-out infinite;
}
@keyframes load-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
