:root {
  --bg-dark: #111318;
  --panel-bg: #1c2029;
  --gold: #ffd700;
  --red: #e60012;
  --pink: #ff2a85;
}

* {
  box-sizing: border-box;
  user-select: none;
}

body {
  margin: 0;
  background: radial-gradient(circle at center, #232834 0%, #0d0f13 100%);
  color: #fff;
  font-family: "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 12px;
}

.machine {
  width: 100%;
  max-width: 440px;
  background: linear-gradient(180deg, #2b303c 0%, #171a21 100%);
  border: 4px solid #4a5162;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8), inset 0 0 15px rgba(255,255,255,0.1);
  padding: 16px;
  transition: box-shadow 0.08s;
}

.machine.flash {
  box-shadow: 0 0 60px #ff2a85, inset 0 0 40px #ff2a85;
}

/* データカウンター */
.counter {
  background: #0a0c10;
  border: 2px solid #383e4c;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 14px;
}

.counter-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: #9aa4b8;
}

.top-btns {
  display: flex;
  gap: 6px;
}

.btn-mini, .btn-quit {
  background: #333a48;
  color: #fff;
  border: 1px solid #555e70;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}

.btn-quit {
  background: #472830;
  border-color: #803d4d;
}

.btn-mini:hover { background: #465063; }
.btn-quit:hover { background: #633440; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  text-align: center;
}

.stat-box {
  background: #141820;
  border-radius: 6px;
  padding: 6px 2px;
}

.stat-label {
  font-size: 10px;
  color: #8c96aa;
}

.stat-val {
  font-size: 16px;
  font-weight: bold;
  color: #00f0ff;
  margin-top: 2px;
}

.stat-sub {
  font-size: 10px;
  color: #aab4c8;
}

/* リール窓 */
.reel-frame {
  background: #000;
  border: 5px solid #c5a059;
  border-radius: 10px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  position: relative;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.9);
}

.reel-col {
  background: linear-gradient(180deg, #c8cdd6 0%, #f8fafc 22%, #ffffff 50%, #f8fafc 78%, #c8cdd6 100%);
  border-radius: 6px;
  overflow: hidden;
  height: 186px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  position: relative;
  box-shadow: inset 0 8px 12px rgba(0,0,0,0.25), inset 0 -8px 12px rgba(0,0,0,0.25);
}

.symbol {
  height: 58px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
}

.symbol svg {
  width: 82px;
  height: 52px;
  display: block;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25));
}

.spinning .symbol svg {
  filter: blur(3px);
  transform: scaleY(1.25);
}

.payline {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 50%;
  height: 2px;
  background: rgba(230, 0, 18, 0.35);
  pointer-events: none;
  z-index: 5;
}

/* 下部パネル（GOGOランプ＆情報） */
.lower-panel {
  display: grid;
  grid-template-columns: 136px 1fr;
  gap: 10px;
  margin-top: 14px;
  align-items: center;
}

.gogo-box {
  background: #07080a;
  border: 3px solid #3a3f4d;
  border-radius: 12px;
  height: 94px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.gogo-text {
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 26px;
  letter-spacing: 1px;
  color: #191c22;
  line-height: 1;
  transition: all 0.05s;
}

.gogo-sub {
  font-size: 13px;
  font-weight: bold;
  color: #191c22;
  letter-spacing: 2px;
  margin-top: 3px;
}

.gogo-box.lit {
  background: radial-gradient(circle, #3a0022 0%, #0d001a 100%);
  border-color: #ff4da6;
  box-shadow: 0 0 25px #ff1a8c, inset 0 0 20px #ff1a8c;
}

.gogo-box.lit .gogo-text {
  color: #ff66b3;
  text-shadow: 0 0 8px #fff, 0 0 18px #ff1a8c, 0 0 30px #ff1a8c;
}

.gogo-box.lit .gogo-sub {
  color: #66e0ff;
  text-shadow: 0 0 8px #fff, 0 0 15px #00ccff;
}

.status-panel {
  background: #10131a;
  border: 2px solid #2e3442;
  border-radius: 10px;
  padding: 8px 10px;
  height: 94px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.coin-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: bold;
}

.coin-num {
  color: var(--gold);
  font-size: 17px;
}

.invest-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #9aa4b8;
  border-top: 1px solid #232836;
  padding-top: 3px;
}

.invest-row strong {
  color: #f87171;
}

.msg-box {
  font-size: 12px;
  color: #e2e8f0;
  background: #1a1f2b;
  padding: 5px 6px;
  border-radius: 6px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 操作ボタン */
.controls {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stop-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.btn-stop {
  height: 54px;
  border-radius: 50%;
  border: 4px solid #881111;
  background: radial-gradient(circle at 35% 35%, #ff4d4d, #b30000);
  color: #fff;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 5px 0 #550000;
}

.btn-stop:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #550000;
}

.btn-stop:disabled {
  background: #3a3f4b;
  border-color: #252830;
  box-shadow: 0 4px 0 #181a20;
  color: #777;
  cursor: not-allowed;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-insert {
  height: 50px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(180deg, #10b981 0%, #047857 100%);
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 0 #064e3b;
}

.btn-insert:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #064e3b;
}

.btn-lever {
  height: 50px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
  color: #fff;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 0 #1e3a8a;
}

.btn-lever:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #1e3a8a;
}

.btn-lever:disabled {
  background: #333;
  box-shadow: none;
  color: #777;
  cursor: not-allowed;
}

.hint {
  text-align: center;
  font-size: 11px;
  color: #7e889c;
  margin-top: 8px;
}

/* モーダル */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  justify-content: center;
  align-items: center;
  padding: 16px;
  z-index: 100;
}

.modal-card {
  background: #1e232e;
  border: 2px solid var(--gold);
  border-radius: 14px;
  padding: 22px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}

.setting-badge {
  font-size: 28px;
  font-weight: bold;
  color: var(--gold);
  margin: 10px 0 4px;
}

.yen-result {
  font-size: 24px;
  font-weight: bold;
  padding: 8px;
  border-radius: 8px;
  background: #12161f;
  margin: 8px 0;
}

.yen-plus { color: #4ade80; }
.yen-minus { color: #f87171; }

.btn-restart {
  margin-top: 12px;
  background: var(--gold);
  color: #111;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  width: 100%;
}