/* 昭和レトロ10円ゲーム「カーレース」 スタイル */

:root {
  --cabinet-orange: #d84315;
  --cabinet-dark: #bf360c;
  --cabinet-border: #3e2723;
  --gold: #ffb300;
  --bg-dark: #141414;
}

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

body {
  background-color: var(--bg-dark);
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-x: hidden;
  touch-action: pan-y;
}

/* ゲーム全体ラッパー */
.game-container {
  width: 100%;
  max-width: 460px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #24140e;
  border-left: 3px solid #3e2723;
  border-right: 3px solid #3e2723;
  position: relative;
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.9);
}

/* 上部ヘッダー */
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: linear-gradient(180deg, #3e2723 0%, #21110a 100%);
  border-bottom: 2px solid #5d4037;
}

.header-title {
  font-size: 15px;
  font-weight: 900;
  color: #ffe082;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-buttons {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: #4e342e;
  color: #ffe0b2;
  border: 1px solid #8d6e63;
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.icon-btn:active {
  transform: scale(0.95);
  background: #3e2723;
}

.icon-btn.muted {
  background: #2e1c18;
  color: #9e9e9e;
  border-color: #555;
}

/* メイン筐体エリア */
.cabinet-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  background: radial-gradient(circle at center, #2e170e 0%, #120805 100%);
}

.cabinet-frame {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: linear-gradient(135deg, #e64a19 0%, #d84315 50%, #bf360c 100%);
  border: 4px solid #2d1810;
  border-radius: 10px;
  box-shadow: 
    inset 0 0 10px rgba(255, 255, 255, 0.25),
    inset 0 0 20px rgba(0, 0, 0, 0.7),
    0 8px 24px rgba(0, 0, 0, 0.8);
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* キャンバス */
#gameCanvas {
  width: 100%;
  height: auto;
  aspect-ratio: 460 / 780;
  display: block;
  border-radius: 6px;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.6);
  touch-action: none;
  cursor: pointer;
}

/* ガイドメッセージバー */
.status-bar {
  width: 100%;
  max-width: 440px;
  margin-top: 6px;
  background: #141414;
  border: 2px solid #ffb300;
  border-radius: 6px;
  padding: 7px 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
  color: #ffea00;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.blink {
  animation: pulseBlink 1.1s infinite;
}

@keyframes pulseBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.98); }
}

/* 下部コントロール操作パネル */
.controls-panel {
  width: 100%;
  padding: 10px 12px 16px;
  background: linear-gradient(180deg, #24140e 0%, #120805 100%);
  border-top: 2px solid #5d4037;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* チャージゲージ */
.charge-container {
  width: 100%;
}
.charge-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #ffcc80;
  font-weight: 900;
  margin-bottom: 4px;
}
.charge-track {
  width: 100%;
  height: 12px;
  background: #1a1a1a;
  border: 1.5px solid #666;
  border-radius: 6px;
  overflow: hidden;
}
.charge-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #4caf50 0%, #ffeb3b 60%, #ff1744 100%);
  transition: width 0.05s linear;
}

/* 操作ボタン群 */
.btn-row {
  display: flex;
  gap: 10px;
}

/* 10円を入れるボタン */
.btn-coin {
  flex: 1.1;
  background: linear-gradient(180deg, #ffd54f 0%, #ffb300 50%, #f57f17 100%);
  color: #3e2723;
  border: 2px solid #fff9c4;
  border-radius: 10px;
  padding: 12px 6px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #b78103, 0 6px 14px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.1s;
}

.btn-coin.pulse {
  animation: coinGlow 1.2s infinite alternate;
}

@keyframes coinGlow {
  0% { box-shadow: 0 4px 0 #b78103, 0 0 10px #ffd54f; }
  100% { box-shadow: 0 4px 0 #b78103, 0 0 25px #ffab00; transform: translateY(-1px); }
}

.btn-coin .coin-sub {
  font-size: 10px;
  color: #5d4037;
  font-weight: bold;
}

.btn-coin:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #b78103;
}

.btn-coin:disabled {
  background: #424242;
  color: #9e9e9e;
  border-color: #616161;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.5;
}

/* レバーを倒す（引く）アクションボタン */
.btn-action {
  flex: 1.4;
  background: linear-gradient(180deg, #ff5722 0%, #e64a19 50%, #bf360c 100%);
  color: #ffffff;
  border: 2px solid #ffccbc;
  border-radius: 10px;
  padding: 12px 8px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #870000, 0 6px 14px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
}

.btn-action.active-pulse {
  animation: actionPulse 1s infinite alternate;
}

@keyframes actionPulse {
  0% { border-color: #ffccbc; }
  100% { border-color: #ffff00; box-shadow: 0 4px 0 #870000, 0 0 15px #ff5722; }
}

.btn-action .sub {
  font-size: 10px;
  font-weight: normal;
  color: #ffebee;
  margin-top: 2px;
}

.btn-action:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #870000;
}

.btn-action:disabled {
  background: #424242;
  color: #9e9e9e;
  border-color: #616161;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.5;
}

/* 遊び方ミニガイド（直感図解） */
.quick-guide {
  background: rgba(0, 0, 0, 0.4);
  border: 1px dashed #8d6e63;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 11px;
  color: #d7ccc8;
  display: flex;
  justify-content: space-around;
  text-align: center;
}

.guide-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.guide-step span:first-child {
  font-size: 14px;
}

/* モーダル共通 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease-out;
}

.modal-overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: #212121;
  border: 3px solid #ffb300;
  border-radius: 12px;
  width: 100%;
  max-width: 380px;
  padding: 20px 16px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9);
}

.modal-header {
  font-size: 20px;
  font-weight: 900;
  color: #ffd54f;
  margin-bottom: 14px;
}

/* 当たりカード表示 */
.card-view {
  margin: 12px auto 18px;
  width: 200px;
  height: 290px;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  position: relative;
}

.card-white {
  background: linear-gradient(135deg, #ffffff 0%, #eceff1 100%);
  color: #263238;
  border: 4px solid #78909c;
}

.card-red {
  background: linear-gradient(135deg, #ef5350 0%, #c62828 100%);
  color: #ffffff;
  border: 4px solid #ffcdd2;
}

.card-blue {
  background: linear-gradient(135deg, #42a5f5 0%, #1565c0 100%);
  color: #ffffff;
  border: 4px solid #bbdefb;
}

.card-gold {
  background: linear-gradient(135deg, #fff176 0%, #fbc02d 50%, #f57f17 100%);
  color: #3e2723;
  border: 4px solid #fffde7;
  animation: glow 1.5s infinite alternate;
}

@keyframes glow {
  from { box-shadow: 0 0 10px #ffd54f; }
  to { box-shadow: 0 0 25px #ffab00; }
}

.card-header-label {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1px;
}

.card-value-display {
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
}

.card-desc-text {
  font-size: 12px;
  font-weight: bold;
  line-height: 1.4;
}

.modal-btn {
  background: #ffb300;
  color: #212121;
  border: none;
  border-radius: 6px;
  padding: 11px 26px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

.modal-btn:active {
  transform: scale(0.96);
}

/* アルバム */
.album-scroll-area {
  max-height: 380px;
  overflow-y: auto;
  margin: 12px 0 16px;
  padding: 4px;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.album-card-item {
  border-radius: 8px;
  padding: 10px 6px;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

.card-mini-title {
  font-size: 11px;
  font-weight: bold;
}
.card-mini-val {
  font-size: 20px;
  font-weight: 900;
  margin: 4px 0;
}
.card-mini-date {
  font-size: 9px;
  opacity: 0.8;
}

.empty-album {
  grid-column: span 2;
  padding: 40px 10px;
  color: #9e9e9e;
  font-size: 13px;
  line-height: 1.6;
}
