/* ScapeSkate – Web Edition  styles */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: #111;
  color: #eee;
  font-family: system-ui, sans-serif;
}
#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}
h1 { font-size: 2rem; margin-bottom: 0.5rem; }
#subtitle { color: #aaa; margin-bottom: 1.5rem; font-size: 0.9rem; }

#status-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: #222;
  padding: 0.35rem 1rem;
  font-size: 0.85rem;
  display: flex;
  gap: 1.5rem;
  z-index: 100;
}
#status-bar span { color: #ccc; }
#status-bar .val { color: #7ef; font-weight: bold; }

.menu {
  background: #1a1a2e;
  border: 1px solid #334;
  border-radius: 10px;
  padding: 1.5rem 2rem;
  min-width: 320px;
  text-align: center;
}
.menu h2 { margin-bottom: 1rem; color: #9bf; }
#menu-items { list-style: none; }
#menu-items li {
  padding: 0.55rem 0.8rem;
  margin: 0.25rem 0;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 1.05rem;
}
#menu-items li:hover { background: #2a3050; }
#menu-items li.selected {
  background: #1e3a6e;
  border: 2px solid #5af;
  color: #fff;
}

#game-ui {
  display: none;
  text-align: center;
  width: 100%;
  max-width: 700px;
}
#game-ui h2 { margin-bottom: 0.5rem; color: #9bf; }
#hud {
  display: flex;
  justify-content: space-between;
  background: #1a1a2e;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}
#hud .hud-item label { color: #888; font-size: 0.75rem; display: block; }
#hud .hud-item .value { font-size: 1.3rem; font-weight: bold; color: #7ef; }

#track-container {
  position: relative;
  height: 90px;
  background: linear-gradient(to bottom, #0a0d14 60%, #1a1208 100%);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.75rem;
  border: 1px solid #333;
}
/* Ground line */
#track-container::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: 20%;
  height: 2px;
  background: #444;
}
#player-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  background: #5af;
  border-radius: 50%;
  transition: left 0.05s linear;
  box-shadow: 0 0 8px #5af8;
  z-index: 2;
  opacity: 0.5;
}
#track-player-char {
  position: absolute;
  font-size: 1.4rem;
  transform: translate(-50%, -50%);
  transition: left 0.05s linear, top 0.12s ease-out;
  z-index: 3;
  pointer-events: none;
  user-select: none;
}
.wall-marker {
  position: absolute;
  top: 0; bottom: 18%;
  background: #6642;
  border-left: 2px solid #996;
  border-right: 2px solid #996;
}
.pipe-marker {
  position: absolute;
  top: 15%; bottom: 18%;
  background: #1a4a1a88;
  border: 1px solid #4a8a5a;
  border-radius: 3px;
}
.item-marker {
  position: absolute;
  bottom: 22%;
  width: 8px; height: 8px;
  background: #fd0;
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 4px #fd08;
}

#game-controls-hint {
  font-size: 0.78rem;
  color: #666;
  margin-top: 0.5rem;
}
#touch-hint {
  font-size: 0.8rem;
  color: #888;
  margin-top: 0.5rem;
  display: none;
}
@media (pointer: coarse) {
  #touch-hint { display: block; }
  #game-controls-hint { display: none; }
}

#game-action-bar {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.5rem;
}
#autopilot-btn[aria-pressed="true"] {
  background: #1a4a1a;
  border-color: #4a8;
  color: #4f8;
}

#msg-overlay {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: #111d;
  color: #fff;
  padding: 1rem 2rem;
  border-radius: 10px;
  font-size: 1.4rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 200;
}
#msg-overlay.show { opacity: 1; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#loading { text-align: center; color: #777; }
#loading p { margin-top: 0.5rem; }

#start-gate { text-align: center; display: none; }
#start-gate p { margin: 0.6rem 0 1rem; color: #888; font-size: 0.9rem; }

#start-button {
  background: #1e3a6e;
  border: 1px solid #5af;
  color: #fff;
  border-radius: 8px;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  cursor: pointer;
}
#start-button:disabled { opacity: 0.6; cursor: wait; }
#intro-skip {
  margin-left: 0.5rem;
  background: #2a2a2a;
  border: 1px solid #777;
  color: #fff;
  border-radius: 8px;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  cursor: pointer;
  display: none;
}

.spinner {
  width: 40px; height: 40px;
  border: 4px solid #333;
  border-top-color: #5af;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  display: none; z-index: 300;
  background: rgba(0,0,0,0.75);
  align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal-sheet {
  background: #1a1a2e;
  border: 1px solid #445;
  border-radius: 10px;
  width: min(640px, 95vw);
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.2rem 1.4rem;
}
.modal-sheet h2 { color: #9bf; margin-bottom: 1rem; }
.modal-close {
  margin-top: 1rem;
  background: #1e3a6e;
  border: 1px solid #5af;
  color: #fff;
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
}

/* Settings */
.setting-row {
  display: flex; align-items: center; gap: 0.6rem;
  margin: 0.55rem 0; font-size: 0.9rem; color: #bbb;
}
.setting-row label { min-width: 140px; }
.setting-row input[type="range"] { flex: 1; }
.setting-row .val { min-width: 3.5rem; text-align: right; color: #7ef; font-weight: bold; }
.settings-group { margin-bottom: 1rem; }
.settings-group h3 {
  color: #8cf; font-size: 0.85rem; margin-bottom: 0.4rem;
  border-bottom: 1px solid #334; padding-bottom: 0.2rem;
}
.tts-mode-btns { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.tts-mode-btn {
  background: #222; border: 1px solid #444; color: #bbb;
  border-radius: 6px; padding: 0.4rem 0.8rem; cursor: pointer; font-size: 0.9rem;
}
.tts-mode-btn.active { background: #1e3a6e; border-color: #5af; color: #fff; }
.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.3rem; }
.action-btn {
  background: #1a2a3a; border: 1px solid #557; color: #bcd;
  border-radius: 6px; padding: 0.4rem 0.8rem; cursor: pointer; font-size: 0.88rem;
}
.action-btn:hover { background: #2a3a5a; }

/* Map editor */
#editor-ui { display: none; width: 100%; max-width: 700px; }
#editor-ui h2 { color: #9bf; margin-bottom: 0.5rem; text-align: center; }
#editor-hud {
  display: flex; flex-wrap: wrap;
  background: #1a1a2e; border-radius: 8px;
  padding: 0.5rem 1rem; margin-bottom: 0.5rem;
  font-size: 0.85rem; color: #aaa; gap: 0.6rem;
}
#editor-hud span strong { color: #7ef; }
#editor-controls {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.4rem; margin-bottom: 0.5rem;
}
.editor-btn {
  background: #1a2a3a; border: 1px solid #557; color: #bcd;
  border-radius: 6px; padding: 0.5rem 0.5rem; cursor: pointer;
  font-size: 0.83rem; text-align: center;
}
.editor-btn:hover { background: #2a3a5a; }
.editor-btn .key {
  display: inline-block; background: #333; border: 1px solid #666;
  border-radius: 3px; padding: 0 4px; font-size: 0.72rem;
  margin-right: 4px; font-family: monospace;
}
#editor-hint { font-size: 0.78rem; color: #666; text-align: center; margin-top: 0.4rem; }
#editor-status { font-size: 0.82rem; color: #fa4; text-align: center; min-height: 1.2em; margin: 0.2rem 0; }

#touch-overlay {
  display: none; position: fixed; inset: 0; z-index: 50; pointer-events: none;
}
#touch-left-zone, #touch-right-zone {
  position: absolute; top: 0; bottom: 0; width: 50%;
  pointer-events: none; -webkit-tap-highlight-color: transparent;
}
#touch-left-zone { left: 0; }
#touch-right-zone { right: 0; }

#touch-hook {
  display: none; position: fixed; inset: 0; z-index: 250;
  background: rgba(0,0,0,0); pointer-events: auto;
}

/* Toolbar above menus – must sit above z-index:50 touch zones */
#main-toolbar {
  position: relative;
  z-index: 60;
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

/* TTS voice selector */
.tts-voice-select {
  flex: 1;
  background: #111;
  color: #eee;
  border: 1px solid #446;
  padding: 0.2rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* Let's Fly description hint */
.setting-hint {
  font-size: 0.78rem;
  color: #888;
  margin-top: 0.2rem;
  line-height: 1.4;
}
