* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #12181f;
  color: #eee;
  overflow: hidden;
}
#app { width: 100%; height: 100%; position: relative; }
.screen { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.hidden { display: none !important; }

.panel {
  background: #1c2531;
  border-radius: 16px;
  padding: 32px 40px;
  max-width: 640px;
  width: 90%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  max-height: 92vh;
  overflow-y: auto;
}
.panel.wide { max-width: 820px; }

h1 { margin: 0 0 6px; font-size: 26px; }
.subtitle { color: #9db1c7; font-size: 14px; margin-bottom: 20px; }
.fineprint { color: #6b7c8f; font-size: 11px; margin-top: 16px; line-height: 1.5; }

.customizer-layout { display: flex; gap: 24px; align-items: flex-start; }
.preview-box {
  background: #0e141c; border-radius: 12px; padding: 10px;
  flex-shrink: 0;
}
.customizer-controls { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.customizer-controls label { font-size: 13px; color: #b8c6d6; font-weight: 600; }
.customizer-controls input {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid #33465c;
  background: #0e141c; color: #eee; font-size: 14px; margin-top: 4px;
}
.swatch-row { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch {
  width: 28px; height: 28px; border-radius: 6px; cursor: pointer;
  border: 2px solid transparent;
}
.swatch.selected { border-color: #fff; box-shadow: 0 0 0 2px #4a90d9; }
.swatch.style-swatch {
  width: auto; height: auto; padding: 6px 10px; background: #0e141c;
  color: #cdd; font-size: 12px; border: 1px solid #33465c;
}
.swatch.style-swatch.selected { border-color: #4a90d9; color: #fff; }

.btn-primary, .btn-secondary, .btn-hud {
  border: none; border-radius: 10px; cursor: pointer; font-weight: 600;
  transition: transform 0.1s ease;
}
.btn-primary { background: #f4a935; color: #221400; padding: 12px 22px; font-size: 15px; margin-top: 18px; width: 100%; }
.btn-primary.btn-gold { background: linear-gradient(135deg, #ffd76b, #f4a935); }
.btn-secondary { background: #2c3b4e; color: #dce6f0; padding: 10px 18px; font-size: 14px; }
.btn-hud { background: rgba(0,0,0,0.5); color: #fff; padding: 8px 12px; font-size: 13px; }
.btn-primary:hover, .btn-secondary:hover, .btn-hud:hover { transform: translateY(-1px); }

/* Resort/world map */
#resort-list { display: flex; flex-direction: column; gap: 18px; margin: 16px 0; }
.resort-block h2 { margin: 0 0 8px; font-size: 18px; color: #f4a935; }
.park-cards { display: flex; gap: 14px; flex-wrap: wrap; }
.park-card {
  background: #10161f; border: 1px solid #2c3b4e; border-radius: 12px;
  padding: 14px; width: 220px; cursor: pointer;
}
.park-card:hover { border-color: #f4a935; }
.park-card h3 { margin: 0 0 4px; font-size: 15px; }
.park-card p { margin: 0 0 8px; font-size: 12px; color: #9db1c7; }
.park-card .progress-line { font-size: 12px; color: #7ee787; }
.hours-line { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.hours-text { font-size: 11px; color: #7d8fa3; }
.status-badge {
  font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 20px;
  letter-spacing: 0.03em;
}
.status-badge.open { background: rgba(126,231,135,0.18); color: #7ee787; }
.status-badge.closed { background: rgba(231,126,126,0.18); color: #e78585; }
.status-badge.early { background: rgba(244,211,94,0.18); color: #f4d35e; }

/* HUD */
#hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px;
  padding: 8px 14px; background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0));
  font-size: 14px; flex-wrap: wrap;
}
.hud-item { display: flex; align-items: center; gap: 6px; }
.hud-hours-badge {
  font-size: 10px; font-weight: 700; padding: 4px 9px; border-radius: 20px; letter-spacing: 0.03em;
}
.hud-hours-badge.open { background: rgba(126,231,135,0.22); color: #7ee787; }
.hud-hours-badge.closed { background: rgba(231,126,126,0.22); color: #e78585; }
.hud-hours-badge.early { background: rgba(244,211,94,0.22); color: #f4d35e; }
.hunger-wrap { display: flex; align-items: center; gap: 6px; }
.bar { width: 90px; height: 10px; background: #333; border-radius: 6px; overflow: hidden; }
.bar.big { width: 100%; height: 16px; margin: 10px 0; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #7ee787, #f4a935, #e74c3c); width: 100%; transition: width 0.2s; }
#hud > * { margin-left: 0; }
#btn-map, #btn-exit { margin-left: auto; }
#btn-exit { margin-left: 8px; }

#game-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; touch-action: none; }

/* Touch controls */
#touch-controls { position: absolute; inset: 0; pointer-events: none; z-index: 12; }
#dpad {
  position: absolute; bottom: 24px; left: 18px;
  display: grid; grid-template-columns: 58px 58px 58px; grid-template-rows: 58px 58px 58px;
  pointer-events: none;
}
.dpad-btn, #btn-touch-action {
  pointer-events: auto; border: none; border-radius: 14px;
  background: rgba(20, 28, 40, 0.55); color: #fff; font-size: 20px; font-weight: 700;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.dpad-btn:active, #btn-touch-action:active { background: rgba(74, 144, 217, 0.7); }
#dpad-up { grid-column: 2; grid-row: 1; }
#dpad-left { grid-column: 1; grid-row: 2; }
#dpad-right { grid-column: 3; grid-row: 2; }
#dpad-down { grid-column: 2; grid-row: 3; }
#btn-touch-action {
  position: absolute; bottom: 52px; right: 26px;
  width: 76px; height: 76px; border-radius: 50%; font-size: 26px;
  background: rgba(244, 169, 53, 0.75); color: #221400;
}

/* Mobile layout */
@media (max-width: 760px) {
  .panel { padding: 20px 16px; }
  .customizer-layout { flex-direction: column; align-items: center; }
  .park-card { width: 100%; }
  .modal { padding: 18px 16px; }
  #hud { gap: 8px; font-size: 12px; padding: 6px 8px; }
  .bar { width: 60px; }
  .btn-hud { padding: 6px 8px; font-size: 11px; }
  #hud-day { display: none; }
}

#toast {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(15,20,28,0.95); border: 1px solid #3a4d63; color: #fff;
  padding: 12px 20px; border-radius: 10px; font-size: 14px; max-width: 80vw;
  text-align: center; z-index: 15; opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
#toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Modals */
#modal-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center; z-index: 20;
}
.modal {
  background: #1c2531; border-radius: 14px; padding: 26px 30px;
  width: 420px; max-width: 90vw; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}
.modal.wide { width: 640px; }
.modal h2 { margin-top: 0; }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.modal-actions button { flex: 1; min-width: 120px; }

.ride-row, .lb-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; border-radius: 8px; background: #10161f; margin-bottom: 6px; font-size: 13px;
}
.ride-row.done { color: #7ee787; }
.lb-row .rank { color: #f4a935; font-weight: 700; width: 24px; }
#parkmap-list h3 { font-size: 13px; color: #9db1c7; margin: 10px 0 8px; text-transform: uppercase; letter-spacing: 0.04em; }
#parkmap-list h3:first-child { margin-top: 0; }

.photo-frame { display: flex; justify-content: center; margin: 6px 0 10px; }
.photo-frame canvas { border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,0.4); }
.character-greeting { font-style: italic; color: #cdd6e0; text-align: center; }
