@import url('https://fonts.googleapis.com/css2?family=DotGothic16&display=swap');

:root {
  --bg-dark: #0f111a;          /* ゲーム筐体ダークブルー */
  --bg-game: #181d30;          /* ブラウン管内画面のベース色 */
  --neon-blue: #00f0ff;        /* 温泉ネオンブルー */
  --neon-pink: #ff0055;        /* 湯気ネオンピンク */
  --neon-gold: #ffcc00;        /* サウナゴールド */
  --neon-green: #39ff14;       /* パワーLEDグリーン */
  
  --font-pixel: 'DotGothic16', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-dark);
  color: #fff;
  font-family: var(--font-pixel);
  overflow-x: hidden;
  line-height: 1.6;
}

/* ==========================================================================
   1. CRT BROWN TUBE MONITOR EFFECT OVERLAYS
   ========================================================================== */
.crt-screen-effect {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  overflow: hidden;
}

/* 走査線 (Scanlines) */
.crt-scanlines {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.25) 50%
  ), linear-gradient(
    90deg,
    rgba(255, 0, 0, 0.06),
    rgba(0, 255, 0, 0.02),
    rgba(0, 0, 255, 0.06)
  );
  background-size: 100% 4px, 6px 100%;
}

/* ブラウン管の画面の明滅・ノイズ (Flicker) */
.crt-flicker {
  position: absolute;
  inset: 0;
  background: rgba(18, 16, 16, 0.03);
  opacity: 0.15;
  animation: crtFlickerAnim 0.15s infinite;
}

@keyframes crtFlickerAnim {
  0% { opacity: 0.15; }
  50% { opacity: 0.18; }
  100% { opacity: 0.14; }
}

/* 周辺減光 (Vignette) & 画面の湾曲フレーム */
.crt-vignette {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.8),
              inset 0 0 20px rgba(0, 0, 0, 0.9);
  background: radial-gradient(circle, transparent 65%, rgba(0,0,0,0.4) 100%);
}

/* ==========================================================================
   2. MAIN LAYOUT
   ========================================================================== */
.game-wrapper {
  max-width: 800px;
  margin: 0 auto;
  border-left: 6px double var(--neon-blue);
  border-right: 6px double var(--neon-blue);
  background-color: #121522;
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.15);
}

/* ==========================================================================
   3. HUD HEADER (RETRO HUD)
   ========================================================================== */
.hud-header {
  background-color: #0b0d16;
  border-bottom: 4px solid var(--neon-pink);
  padding: 12px 24px;
}

.hud-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-pixel {
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--neon-blue);
  text-shadow: 0 0 8px var(--neon-blue);
  letter-spacing: 2px;
}

.hud-stats {
  font-size: 0.9rem;
  color: #fff;
}

.hud-stats .label {
  color: var(--neon-gold);
}

.hud-stats .val {
  color: #fff;
}

.sound-toggle-btn {
  background-color: transparent;
  border: 2px solid var(--neon-pink);
  color: var(--neon-pink);
  font-family: var(--font-pixel);
  font-size: 0.75rem;
  padding: 6px 16px;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(255, 0, 85, 0.2);
  transition: all 0.15s ease;
}

.sound-toggle-btn.active {
  background-color: var(--neon-pink);
  color: #fff;
  box-shadow: 0 0 12px var(--neon-pink);
  text-shadow: 0 0 4px #fff;
}

/* ==========================================================================
   4. GAME SCREEN (CANVAS AREA)
   ========================================================================== */
.game-screen-area {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: var(--bg-game);
  overflow: hidden;
  border-bottom: 4px solid var(--neon-blue);
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ==========================================================================
   5. RPG MESSAGE BOX
   ========================================================================== */
.rpg-message-box {
  position: absolute;
  top: 16px;
  left: 5%;
  right: 5%;
  background-color: rgba(11, 13, 22, 0.95);
  border: 4px solid #fff;
  outline: 4px solid #000;
  border-radius: 4px;
  padding: 12px 20px;
  z-index: 10;
  box-shadow: 0 8px 0 rgba(0,0,0,0.4);
  pointer-events: none;
}

.rpg-message-box::before {
  content: "";
  position: absolute;
  inset: 1px;
  border: 2px solid #888;
  pointer-events: none;
}

.speaker-name {
  font-size: 0.85rem;
  color: var(--neon-gold);
  margin-bottom: 6px;
  font-weight: bold;
}

.message-text {
  font-size: 0.95rem;
  color: #fff;
  min-height: 48px;
}

.blink-arrow {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 0.8rem;
  color: var(--neon-blue);
  animation: blinkArrowAnim 0.8s infinite steps(2);
}

@keyframes blinkArrowAnim {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

/* ==========================================================================
   6. JOB SELECT OVERLAY (DIAGNOSTIC POPUP)
   ========================================================================== */
.job-select-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(15, 17, 26, 0.85);
  backdrop-filter: blur(4px);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.job-select-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

.job-select-box {
  width: 90%;
  max-width: 480px;
  background-color: #0b0d16;
  border: 4px solid var(--neon-gold);
  border-radius: 4px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 0 20px rgba(255, 204, 0, 0.3);
}

.pixel-title {
  font-size: 1.25rem;
  color: var(--neon-gold);
  text-shadow: 0 0 6px var(--neon-gold);
  margin-bottom: 16px;
}

.pixel-question {
  font-size: 0.9rem;
  color: #fff;
  margin-bottom: 24px;
  line-height: 1.5;
}

.job-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.job-opt-btn {
  background-color: #1c2136;
  border: 3px solid #fff;
  color: #fff;
  font-family: var(--font-pixel);
  font-size: 0.85rem;
  padding: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.job-opt-btn:hover {
  border-color: var(--neon-blue);
  color: var(--neon-blue);
  background-color: #0f1220;
  transform: translateX(4px);
}

.job-opt-btn:active {
  transform: translateX(1px) translateY(1px);
}

/* ==========================================================================
   7. VIRTUAL GAMEPAD (CONTROLLER UI)
   ========================================================================== */
.virtual-pad {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #1c1f2e;
  border-bottom: 4px solid var(--neon-pink);
  padding: 20px 32px;
  user-select: none;
}

/* 十字キー (D-pad) */
.pad-dpad {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pad-btn {
  background-color: #0a0b12;
  border: 3px solid #5a5f75;
  color: #8c92a6;
  font-family: var(--font-pixel);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 0 #000;
  transition: all 0.1s ease;
}

.pad-left, .pad-right {
  width: 44px;
  height: 40px;
  position: absolute;
}

.pad-left {
  left: 6px;
  border-radius: 4px 0 0 4px;
}

.pad-right {
  right: 6px;
  border-radius: 0 4px 4px 0;
}

.pad-left:active, .pad-right:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #000;
  color: var(--neon-blue);
  border-color: var(--neon-blue);
}

.pad-dpad-center {
  width: 40px;
  height: 40px;
  background-color: #0a0b12;
  border: 3px solid #5a5f75;
  z-index: 2;
}

/* 中央ブランドラベル & 電源ランプ */
.pad-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.brand-text {
  font-size: 0.65rem;
  letter-spacing: 3px;
  color: #5a5f75;
  font-weight: bold;
}

.power-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--neon-green);
  box-shadow: 0 0 8px var(--neon-green);
}

/* アクションボタン (A/B) */
.pad-action-btns {
  display: flex;
  gap: 16px;
}

.action-a, .action-b {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: bold;
  border-color: #5a5f75;
  color: #fff;
  text-shadow: 0 2px 0 #000;
}

.action-b {
  background-color: var(--neon-pink);
  border-color: #9c0033;
}

.action-a {
  background-color: var(--neon-blue);
  border-color: #008fa6;
}

.action-b:active, .action-a:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #000;
  opacity: 0.9;
}

/* ==========================================================================
   8. MANUAL CONTENT (INSTRUCTION STYLE)
   ========================================================================== */
.manual-content {
  padding: 40px 24px;
  background-color: #121522;
}

.manual-inner {
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.manual-banner {
  border: 4px dashed var(--neon-blue);
  padding: 24px;
  text-align: center;
  background-color: rgba(0, 240, 255, 0.03);
}

.manual-banner h2 {
  font-size: 1.35rem;
  color: var(--neon-blue);
  margin-bottom: 12px;
}

.manual-banner p {
  font-size: 0.88rem;
  color: var(--text-sand, #ebdcb9);
}

.manual-section {
  background-color: #181d30;
  border: 3px solid var(--border-fine, rgba(255,255,255,0.08));
  padding: 32px;
  border-radius: 4px;
  position: relative;
  transition: all 0.3s ease;
}

.manual-section.active-area {
  border-color: var(--neon-blue);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.1);
  transform: translateY(-2px);
}

.section-tag {
  font-size: 0.75rem;
  color: var(--neon-gold);
  font-weight: bold;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.manual-section h3 {
  font-size: 1.2rem;
  margin-bottom: 4px;
}

.role-desc {
  font-size: 0.8rem;
  color: var(--neon-blue);
  font-weight: bold;
  margin-bottom: 16px;
}

.manual-section p:not(.role-desc) {
  font-size: 0.9rem;
  color: #b5bbd0;
  line-height: 1.7;
}

/* ==========================================================================
   9. STATUS SECTION (RPG SCREEN)
   ========================================================================== */
.status-section {
  background-color: #0b0d16;
  border: 4px solid var(--neon-pink);
  border-radius: 4px;
  padding: 32px;
  box-shadow: 0 0 15px rgba(255, 0, 85, 0.1);
}

.status-section h3 {
  font-size: 1.2rem;
  color: var(--neon-pink);
  margin-bottom: 24px;
  text-align: center;
  text-shadow: 0 0 6px var(--neon-pink);
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 32px;
  align-items: center;
}

/* アバター */
.avatar-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background-color: #121522;
  border: 3px solid #5a5f75;
  padding: 20px;
}

.pixel-avatar-placeholder {
  width: 96px;
  height: 96px;
  border: 2px solid #fff;
  image-rendering: pixelated;
  background-color: #000;
  background-size: cover;
  background-position: center;
}

.avatar-card h4 {
  font-size: 0.9rem;
  color: var(--neon-gold);
}

/* パラメーターリスト */
.stats-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.stats-list li {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
}

.stats-list li span {
  width: 140px;
  color: var(--neon-blue);
}

.stat-bar {
  flex-grow: 1;
  height: 12px;
  background-color: #121522;
  border: 1px solid #5a5f75;
  border-radius: 2px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-pink), var(--neon-blue));
  transition: width 0.8s ease;
}

.status-summary {
  font-size: 0.85rem;
  color: #8c92a6;
  line-height: 1.6;
}

.cta-action-wrap {
  margin-top: 32px;
  text-align: center;
}

.cta-submit-btn {
  background-color: var(--neon-gold);
  border: 3px solid #fff;
  outline: 3px solid #000;
  color: #000;
  font-family: var(--font-pixel);
  font-size: 1.05rem;
  font-weight: bold;
  padding: 16px 32px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cta-submit-btn:hover {
  background-color: #fff;
  box-shadow: 0 0 15px rgba(255, 204, 0, 0.4);
}

.cta-submit-btn:active {
  transform: translateY(2px);
}

/* ==========================================================================
   10. FOOTER
   ========================================================================== */
.footer {
  background-color: #0b0d16;
  padding: 24px;
  border-top: 4px solid var(--neon-blue);
  font-size: 0.8rem;
  color: #5a5f75;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer a {
  color: var(--neon-blue);
  text-decoration: none;
  border-bottom: 1px dashed var(--neon-blue);
}

.footer a:hover {
  color: #fff;
  border-bottom-color: #fff;
}

/* ==========================================================================
   11. RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
  .game-wrapper {
    border-left: none;
    border-right: none;
  }
  .hud-header {
    padding: 8px 16px;
  }
  .logo-pixel {
    font-size: 1.1rem;
  }
  .virtual-pad {
    padding: 12px 16px;
  }
  .pad-dpad {
    width: 100px;
    height: 100px;
  }
  .pad-left, .pad-right {
    width: 36px;
    height: 32px;
  }
  .action-a, .action-b {
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
  }
  .status-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}
