/* Mini Golf Day World Tour — Paris prototype
   Design goal: make the whole app feel like a playable travel postcard
   running through a Commodore 64 monitor, while keeping the Canvas game
   readable on modern desktop and mobile browsers. */

:root {
  --c64-blue: #40318d;
  --c64-light: #7869c4;
  --ink: #f7f1c6;
  --night: #111027;
  --panel: rgba(11, 14, 38, 0.86);
  --accent: #ffd84e;
  --mint: #61d394;
  --pink: #ff6fb1;
  --danger: #ff595e;
  --cyan: #69d2e7;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background:
    radial-gradient(circle at 50% 35%, rgba(120,105,196,.24), transparent 35%),
    linear-gradient(180deg, #0b0d22, #090914 70%);
  color: var(--ink);
  font-family: "Courier New", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow: auto;
}

button {
  font: inherit;
  color: var(--ink);
  background: #262055;
  border: 2px solid var(--c64-light);
  box-shadow: 3px 3px 0 #050512;
  padding: .55rem .75rem;
  cursor: pointer;
  letter-spacing: .04em;
}

button:hover, button:focus-visible {
  outline: none;
  border-color: var(--accent);
  color: white;
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #050512;
}

.screen {
  position: fixed;
  inset: 0;
}

.hidden { display: none !important; }

.boot-screen {
  background: var(--c64-blue);
  color: var(--c64-light);
  display: grid;
  place-items: center;
  text-transform: uppercase;
}

.crt {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.04) 0 2px, rgba(0,0,0,.05) 2px 4px),
    radial-gradient(circle at center, transparent 0 60%, rgba(0,0,0,.32) 100%);
  mix-blend-mode: screen;
}

.boot-text {
  width: min(900px, 88vw);
  min-height: 68vh;
  margin: 0;
  padding: 2rem;
  background: var(--c64-light);
  color: var(--c64-blue);
  border: 14px solid var(--c64-blue);
  box-shadow: 0 0 0 12px var(--c64-light), 0 0 44px rgba(0,0,0,.45);
  font-weight: 700;
  font-size: clamp(1rem, 2.7vw, 1.65rem);
  line-height: 1.23;
  white-space: pre-wrap;
  image-rendering: pixelated;
}

.game-screen {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: .7rem;
  padding: clamp(.6rem, 1.5vw, 1rem);
  overflow: auto;
}

.topbar, .controls, .legend, .modal {
  background: var(--panel);
  border: 2px solid #3b3f79;
  box-shadow: 0 0 0 2px rgba(255,255,255,.04) inset, 5px 5px 0 rgba(0,0,0,.45);
}

.topbar {
  position: relative;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: .75rem .9rem;
}

h1 {
  margin: 0;
  font-size: clamp(1.05rem, 2.4vw, 1.8rem);
  color: var(--accent);
  text-shadow: 2px 2px 0 #b33b72;
}

.topbar p { margin: .25rem 0 0; color: #c7c1f4; }

.hud {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .5rem;
  min-width: 260px;
}

.hud span {
  background: #171739;
  border: 1px solid #5358a8;
  padding: .35rem .5rem;
  color: var(--mint);
}

#gameCanvas {
  position: relative;
  z-index: 1;
  width: 100%;
  height: min(62vh, 600px);
  display: block;
  background: #101735;
  border: 3px solid #4c4f9f;
  box-shadow: 0 0 0 3px #11142e, 0 18px 44px rgba(0,0,0,.55);
  image-rendering: pixelated;
  touch-action: none;
}

.controls {
  position: relative;
  z-index: 50;
  display: flex;
  gap: .65rem;
  padding: .65rem;
  flex-wrap: wrap;
}

.legend {
  position: relative;
  right: auto;
  bottom: auto;
  z-index: 50;
  width: 100%;
  padding: .55rem .7rem;
}

.legend:not(.open) #legendContent { display: none; }
.legend:not(.open) { width: auto; padding: .35rem; }

#legendToggle {
  float: right;
  padding: .1rem .35rem;
  min-width: 2rem;
}

.legend h2 {
  margin: 0 2rem .5rem 0;
  color: var(--accent);
  font-size: 1rem;
}

.legend p {
  margin: 0 0 .65rem;
  color: #ddd8ff;
  font-size: .9rem;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: .28rem 0;
  font-size: .85rem;
}

.swatch {
  width: 1.25rem;
  height: .85rem;
  display: inline-block;
  border: 1px solid rgba(255,255,255,.45);
}
.fairway { background: #2fbf71; }
.rough { background: #1d6f4a; }
.water { background: #2990d0; }
.bumper { background: #f6c85f; }
.cup { background: #111; border-radius: 50%; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.62);
  padding: 1rem;
}

.modal {
  width: min(680px, 94vw);
  max-height: 88vh;
  overflow: auto;
  padding: 1.2rem;
  color: #f8f3cb;
}

.modal h2 { margin-top: 0; color: var(--accent); }
.modal a { color: var(--cyan); }
.close { float: right; font-size: 1.3rem; line-height: 1; }

@media (max-width: 720px) {
  .screen { position: relative; min-height: 100vh; }
  .game-screen { min-height: 100vh; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .hud { justify-content: flex-start; min-width: 0; }
  #gameCanvas { height: 58vh; }
  .legend { width: 100%; }
}

.share-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.share-grid a {
  text-decoration: none;
  background: #352879;
  border: 3px solid #7869c4;
  color: #f7f1c6;
  padding: 12px;
  text-align: center;
  font-weight: bold;
  image-rendering: pixelated;
}

.share-grid a:hover {
  background: #6c5eb5;
}

.share-modal {
  max-width: 420px;
}

.boot-text {
  overflow: hidden;
  height: 70vh;
}
/* Compact scorecard used inside the minimizable legend once the World Tour
   architecture tracks all nine score slots. */
.score-mini {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  margin: 10px 0 12px;
  font-size: 0.78rem;
}
.score-mini div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed rgba(247, 241, 198, 0.22);
  padding-bottom: 4px;
}
.score-mini span {
  color: var(--accent);
}


/* Keep information panels off the world-map postcard. Very C64: one main screen, controls below. */
.legend #legendContent {
  clear: both;
}
.legend .legend-row {
  display: inline-flex;
  margin-right: 1rem;
}
