/* ==========================================================================
   y4ttaze 打鍵部屋 (Retro Web Rhythm Game) - 90s/00s Flash Game Style
   ========================================================================== */
:root {
  --bg-color: #f4f4f0;
  --panel-bg: #ffffff;
  --border-dark: #333333;
  --border-light: #999999;
  --text-main: #222222;
  --text-muted: #666666;
  --accent-red: #cc0000;
  --accent-blue: #0044cc;
  --accent-gold: #b8860b;
  --mono-font: "Courier New", Courier, "MS Gothic", "Osaka-mono", monospace;
  --serif-font: "Hiragino Mincho ProN", "Yu Mincho", "MS PMincho", serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--mono-font);
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 10px 40px 10px;
}

/* Outer Window Frame (Windows 95 / Personal Site Container) */
.game-window {
  width: 100%;
  max-width: 860px;
  background-color: var(--panel-bg);
  border: 2px solid var(--border-dark);
  box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.2);
  padding: 14px;
}

/* Header */
.game-header {
  border-bottom: 2px solid var(--border-dark);
  padding-bottom: 8px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.game-title {
  font-family: var(--serif-font);
  font-size: 20px;
  font-weight: 900;
  color: var(--accent-red);
  letter-spacing: 0.05em;
}

.game-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.back-link {
  font-size: 12px;
  color: #0033cc;
  text-decoration: underline;
}
.back-link:hover {
  color: #cc0000;
}

/* Song Info & Score Board (Retro Table style) */
.game-status-board {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
  border: 1px solid var(--border-light);
  background-color: #fafafa;
}

.game-status-board td {
  padding: 5px 10px;
  border: 1px solid var(--border-light);
  font-size: 12px;
}

.game-status-board td.label {
  background-color: #eaeaea;
  font-weight: bold;
  width: 15%;
  text-align: center;
}

.stat-value {
  font-family: var(--mono-font);
  font-size: 14px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  display: inline-block;
  min-width: 45px;
  text-align: right;
}

/* Canvas Container */
.canvas-container {
  position: relative;
  width: 100%;
  background: #000000;
  border: 3px inset #ffffff;
  box-shadow: inset 2px 2px 5px rgba(0,0,0,0.8);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 200px;
  background: #1e1e24;
}

/* Overlay Screen (Dialog / Modal) */
.overlay-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
  padding: 14px;
}

.retro-dialog {
  background: #e4e0d8;
  border: 3px outset #ffffff;
  box-shadow: 3px 3px 10px rgba(0,0,0,0.6);
  padding: 18px 24px;
  text-align: center;
  max-width: 440px;
  width: 100%;
}

.dialog-title {
  font-family: var(--serif-font);
  font-size: 18px;
  font-weight: bold;
  color: #8b0000;
  border-bottom: 2px dashed #999;
  padding-bottom: 6px;
  margin-bottom: 12px;
}

.dialog-text {
  font-size: 12px;
  color: #333333;
  margin-bottom: 14px;
  line-height: 1.6;
}

/* Retro Push Buttons (Windows 95 style) */
.retro-push-btn {
  display: inline-block;
  padding: 8px 24px;
  font-size: 15px;
  font-weight: bold;
  font-family: var(--mono-font);
  background: #d4d0c8;
  border: 2px outset #ffffff;
  color: #000000;
  cursor: pointer;
  box-shadow: 1px 1px 0px #000000;
  margin: 4px;
}
.retro-push-btn:active {
  border: 2px inset #ffffff;
  box-shadow: none;
  transform: translate(1px, 1px);
}

.btn-start {
  background: #ffd700;
  color: #8b0000;
  border-color: #fff2a3;
  font-size: 16px;
  padding: 10px 30px;
}

/* Controls & Instruction section */
.controls-panel {
  margin-top: 14px;
  border: 1px solid var(--border-light);
  background: #fdfdfd;
  padding: 12px;
}

.instruction-title {
  font-size: 12px;
  font-weight: bold;
  color: #8b0000;
  margin-bottom: 6px;
}

.instruction-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 12px;
}

.instruction-table th, .instruction-table td {
  border: 1px solid #ddd;
  padding: 4px 8px;
}

.instruction-table th {
  background: #eee;
  width: 25%;
}

.key-badge {
  display: inline-block;
  padding: 1px 6px;
  background: #ffffff;
  border: 1px solid #777;
  box-shadow: 1px 1px 0px #333;
  font-weight: bold;
  margin: 0 2px;
}


/* Touch Controller Wrapper (Directly under Canvas) */
.touch-controller-wrapper {
  margin-top: 8px;
  margin-bottom: 12px;
  width: 100%;
}

.touch-controller {
  display: flex;
  gap: 6px;
  width: 100%;
  max-width: 830px;
  margin: 0 auto;
  height: 80px;
}

.touch-hit-btn {
  flex: 1;
  border: 3px outset #ffffff;
  font-family: var(--mono-font);
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  touch-action: none; /* CRITICAL: 0ms delay, disable all browser tap-delays */
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform, filter;
  color: #ffffff;
  text-shadow: 1px 1px 2px #000000;
  box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}
.touch-hit-btn:active {
  border: 3px inset #ffffff;
  transform: translate(1px, 1px);
}

.btn-ka {
  background: linear-gradient(180deg, #0088dd, #0055aa);
}
.btn-don {
  background: linear-gradient(180deg, #dd2211, #aa1100);
}

.touch-sub {
  font-size: 11px;
  font-weight: normal;
  opacity: 0.9;
  margin-top: 2px;
}

/* Mobile Responsiveness (Screen fitting) */
@media (max-width: 600px) {
  body {
    padding: 6px 4px 20px 4px;
  }
  .game-window {
    padding: 8px 6px;
  }
  .game-header {
    margin-bottom: 6px;
    padding-bottom: 4px;
  }
  .game-title {
    font-size: 16px;
  }
  .game-status-board {
    margin-bottom: 6px;
    font-size: 11px;
  }
  .game-status-board td {
    padding: 3px 4px;
  }
  #game-canvas {
    height: 170px;
  }
  .touch-controller {
    height: 88px;
    gap: 4px;
  }
  .touch-hit-btn {
    font-size: 16px;
  }
  .controls-panel {
    margin-top: 8px;
    padding: 8px;
  }
}

/* Song Selection Buttons */
.song-select-btn {
  background: #e8e8e8;
  border: 2px outset #ffffff;
  color: #333333;
  cursor: pointer;
  transition: all 0.1s;
}
.song-select-btn:hover {
  background: #dedede;
}
.song-select-btn.active {
  background: #ffeb3b !important;
  border: 2px inset #ffffff !important;
  color: #8b0000 !important;
  font-weight: bold;
  box-shadow: inset 1px 1px 2px rgba(0,0,0,0.3);
}
