:root {
  --bg: #020308;
  --bg-elevated: #101218;
  --border-subtle: #333846;
  --text-main: #ffffff;
  --text-muted: #b6bccb;
  --accent: #00ffa8;
  --accent-muted: #00c07b;
}

/* Global reset */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-main);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

.hidden { display: none !important; }

button {
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  font-size: 16px;
}

button.primary {
  background: var(--accent);
  color: #000;
}
button.primary:hover { background: var(--accent-muted); }

button.secondary {
  background: #181b23;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}
button.secondary:hover { background: #222737; }

textarea, select, input {
  width: 100%;
  background: #05070d;
  border: 1px solid var(--border-subtle);
  padding: 10px;
  border-radius: 6px;
  color: var(--text-main);
  margin-top: 6px;
}

/* Editor */
#editorScreen {
  padding: 20px;
  max-width: 750px;
  margin: auto;
}

#editorScreen img {
  display: block;
  margin: 0 auto 20px;
  max-width: 160px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 20px 0;
}

.step-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 15px;
}

.step-header {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.step-meta-row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.step-meta-row label {
  font-size: 14px;
  color: var(--text-muted);
}

/* Street View preview in editor */
.streetview-section {
  margin-top: 10px;
}

.streetview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

button.small {
  padding: 6px 10px;
  font-size: 13px;
}

.streetview-preview {
  margin-top: 8px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.streetview-preview iframe {
  width: 100%;
  height: 140px;
  border: 0;
}

/* Driving screen */
#drivingScreen {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 20px 80px 20px;
  overflow-y: auto;
  position: relative;
}

/* Top buttons */
#returnEditor, #ttsToggle {
  position: fixed;
  top: 16px;
  z-index: 999;
  color: var(--text-main);
}
#returnEditor {
  left: 16px;
  background: #11141c;
  border: 1px solid var(--border-subtle);
}
#ttsToggle {
  right: 16px;
  font-size: 26px;
  background: none;
  border: none;
}

/* Driving content */
.fade-target {
  transition: opacity 0.25s ease;
}

#drivingSymbol {
  margin-top: 72px;
  margin-bottom: 10px;
  text-align: center;
  font-size: clamp(100px, 24vw, 180px); /* used for junction numbers */

  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  min-height: 180px;
}

/* Wrapper for SVG symbols */
.symbol-wrapper {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

/* Symbol image (roundabout / arrows) */
.symbol-img {
  display: block;
  width: clamp(120px, 40vw, 220px);
  height: auto;
}

/* Overlay number for roundabouts */
.symbol-overlay-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(32px, 6vw, 52px);
  line-height: 1;
  font-weight: 700;
  color: white;
  pointer-events: none;
  text-shadow: 0 0 6px rgba(0,0,0,0.85);
}

#drivingInstruction {
  font-size: clamp(26px, 6vw, 38px);
  font-weight: 600;
  text-align: center;
  margin-bottom: 6px;
}

#drivingNote {
  font-size: clamp(16px, 4vw, 22px);
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 4px;
}

#drivingNext {
  font-size: 14px;
  color: #8b92a3;
  text-align: center;
  margin-bottom: 4px;
}

/* Live distance line */
#drivingDistance {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 12px;
}

/* Countdown bar */
#countdownBarContainer {
  width: 85%;
  height: 14px;
  background: #171c26;
  border-radius: 7px;
  overflow: hidden;
  margin: 15px auto;
}

#countdownBar {
  height: 100%;
  width: 0%;
  background: var(--accent);
}

/* Driving controls */
#drivingControls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

#drivingControls button {
  flex: 1 1 120px;
  padding: 12px;
  font-size: 16px;
  border-radius: 8px;
}

/* Step progress */
#stepProgress {
  position: fixed;
  bottom: env(safe-area-inset-bottom, 10px);
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 100%;
  text-align: center;
  font-size: 16px;
  color: var(--text-muted);
  padding-bottom: 5px;
  background: rgba(0,0,0,0.35);
}

/* Mobile */
@media (max-width: 600px) {
  #drivingControls button {
    flex: 1 1 48%;
  }
}
