﻿/* PW50 Championship Racing Stylesheet */

:root {
  --yamaha-blue: #0044cc;
  --yamaha-dark: #002277;
  --yamaha-light: #0088ff;
  --retro-yellow: #ffcc00;
  --dirt-orange: #e65c00;
  --bg-dark: #0f111a;
  --card-bg: #1a1d29;
  --card-border: #2a3045;
  --text-main: #f0f4f8;
  --text-muted: #8e9bb0;
  --accent-cyan: #00ffcc;
  --accent-red: #ff3344;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* CRT Scanlines Overlay */
.crt-overlay {
  pointer-events: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
              linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 255, 0, 0.03));
  background-size: 100% 3px, 4px 100%;
  z-index: 999;
}

.hidden {
  display: none !important;
}

/* Header & Nav */
header {
  width: 100%;
  max-width: 1000px;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--card-border);
  background: rgba(15, 17, 26, 0.95);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-title h1 {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: linear-gradient(90deg, #ffcc00, #ff6600, #0088ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.btn-toggle {
  background: #252a3d;
  color: var(--text-main);
  border: 1px solid var(--card-border);
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-toggle:hover {
  background: var(--yamaha-blue);
  border-color: var(--accent-cyan);
}

/* Main Container */
main {
  width: 100%;
  max-width: 1000px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 16px;
}

/* Game Container & Canvas */
.game-container {
  width: 100%;
  max-width: 960px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#gameCanvas {
  width: 100%;
  max-width: 960px;
  height: auto;
  aspect-ratio: 16 / 9;
  background-color: #0b0c10;
  border: 3px solid var(--card-border);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  display: block;
}

/* Menu Overlay on Top of Canvas */
.menu-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-height: 540px;
  background: rgba(10, 12, 18, 0.82);
  backdrop-filter: blur(3px);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 20px;
}

.menu-content {
  width: 100%;
  max-width: 620px;
  text-align: center;
}

.hero-banner {
  margin-bottom: 18px;
}

.hero-tag {
  color: var(--retro-yellow);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 900;
  margin: 4px 0;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 3px 3px 0px var(--yamaha-blue), 5px 5px 0px #000000;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.4;
  margin: 0 auto;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
  margin: 0 auto 16px auto;
}

.btn-menu {
  padding: 12px 18px;
  font-size: 1.05rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, #ffcc00, #ff6600);
  color: #000000;
  box-shadow: 0 4px 15px rgba(255, 102, 0, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 102, 0, 0.6);
}

.btn-secondary {
  background: #252b40;
  color: var(--text-main);
  border: 1px solid var(--card-border);
}

.btn-secondary:hover {
  background: var(--yamaha-blue);
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

.controls-help {
  background: rgba(0, 0, 0, 0.5);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.controls-help kbd {
  background: #2b324b;
  color: #fff;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid #444f77;
  font-weight: 700;
}

/* Mobile / On-Screen Touch Controls */
.touch-controls {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 960px;
  margin-top: 10px;
  padding: 0 4px;
  gap: 12px;
}

.touch-cluster {
  display: flex;
  gap: 6px;
}

.touch-btn {
  width: 64px;
  height: 50px;
  background: #252b40;
  border: 2px solid var(--card-border);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.touch-btn:active {
  background: var(--yamaha-blue);
  border-color: var(--accent-cyan);
}

.touch-turbo {
  background: linear-gradient(135deg, #ff3344, #ff8800);
  color: #fff;
  border-color: #ffaa00;
  width: 84px;
}

.touch-gas {
  background: linear-gradient(135deg, #00cc44, #008822);
  width: 76px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 12, 18, 0.88);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-content {
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: 12px;
  max-width: 840px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--card-border);
  padding-bottom: 12px;
  margin-bottom: 18px;
}

.modal-header h2 {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--retro-yellow);
  text-transform: uppercase;
}

.btn-close {
  background: #252b40;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
}

/* Garage Styles */
.garage-header-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #12141f;
  padding: 12px 18px;
  border-radius: 8px;
  margin-bottom: 18px;
}

.cash-badge {
  font-size: 1.5rem;
  font-weight: 900;
  color: #00ff88;
  text-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.bike-meters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  width: 60%;
}

.meter-group label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.meter-bar {
  width: 100%;
  height: 8px;
  background: #2b324b;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}

.meter-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--yamaha-light), var(--accent-cyan));
  width: 25%;
  transition: width 0.3s ease;
}

.garage-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  border-bottom: 2px solid var(--card-border);
  padding-bottom: 10px;
  margin-bottom: 18px;
}

.garage-tab {
  background: #252b40;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.garage-tab.active {
  background: var(--yamaha-blue);
  color: #fff;
  border-color: var(--accent-cyan);
}

.garage-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.store-card {
  background: #131622;
  border: 2px solid var(--card-border);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.store-card.equipped {
  border-color: #00ff88;
  background: #112218;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.card-header h4 {
  font-size: 1rem;
  font-weight: 800;
}

.price-tag {
  background: #ffcc00;
  color: #000;
  font-weight: 900;
  font-size: 0.8rem;
  padding: 2px 5px;
  border-radius: 4px;
}

.owned-tag {
  background: #252b40;
  color: var(--accent-cyan);
  font-weight: 800;
  font-size: 0.72rem;
  padding: 2px 5px;
  border-radius: 4px;
}

.card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.store-action-btn {
  padding: 8px 12px;
  font-weight: 800;
  font-size: 0.82rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
}

.btn-buy {
  background: linear-gradient(135deg, #ffcc00, #ff6600);
  color: #000;
}

.btn-equip {
  background: var(--yamaha-blue);
  color: #fff;
}

.btn-equipped {
  background: #00aa55;
  color: #fff;
  cursor: default;
}

.btn-disabled {
  background: #2b324b;
  color: #667292;
  cursor: not-allowed;
}

/* Track Select Grid */
.track-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.track-card {
  background: #131622;
  border: 2px solid var(--card-border);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.track-card:hover {
  border-color: var(--retro-yellow);
  transform: translateY(-2px);
  background: #1d2238;
}

.track-num {
  font-weight: 900;
  color: var(--accent-cyan);
  font-size: 0.78rem;
}

.track-loc {
  font-size: 0.78rem;
  color: var(--retro-yellow);
  margin-bottom: 4px;
}

.track-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.track-prize {
  font-size: 0.82rem;
  font-weight: 800;
  color: #00ff88;
}

/* Trophy Room */
.trophy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.trophy-card {
  background: #131622;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.trophy-badge {
  font-size: 1.6rem;
}

.trophy-info h5 {
  font-size: 0.9rem;
  font-weight: 800;
}

.trophy-info p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Results Screen */
.results-box {
  text-align: center;
  padding: 18px;
}

.results-title {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--retro-yellow);
  margin-bottom: 8px;
  text-shadow: 2px 2px 0px #000;
}

.results-stat {
  font-size: 1.05rem;
  margin: 6px 0;
  color: var(--text-main);
}

.results-cash-pill {
  display: inline-block;
  background: rgba(0, 255, 136, 0.15);
  border: 1px solid #00ff88;
  color: #00ff88;
  font-weight: 900;
  font-size: 1.3rem;
  padding: 6px 16px;
  border-radius: 20px;
  margin: 12px 0;
}

.results-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

/* Footer */
footer {
  width: 100%;
  max-width: 1000px;
  padding: 12px 16px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--card-border);
}
