:root {
  --bg: #0f1519;
  --ink: #e9eef0;
  --muted: #9aa8ae;
  --glass: rgba(15, 21, 25, 0.72);
  --line: rgba(233, 238, 240, 0.12);
  --accent: #c0362c; /* International Orange */
  font-family:
    ui-sans-serif,
    -apple-system,
    "SF Pro Text",
    "Inter",
    "Segoe UI",
    system-ui,
    sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

#osd {
  position: fixed;
  inset: 0;
  background: var(--bg);
}

.fallback {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card,
.about,
.controls,
.credits {
  position: fixed;
  z-index: 2;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
}

.card {
  top: max(20px, env(safe-area-inset-top));
  left: max(20px, env(safe-area-inset-left));
  padding: 18px 22px 16px;
  border-radius: 16px;
  max-width: min(360px, calc(100vw - 40px));
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 1px;
}

h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.sub {
  margin: 6px 0 12px;
  color: var(--muted);
  font-size: 14px;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.about-toggle {
  padding: 7px 13px;
  font-size: 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(233, 238, 240, 0.06);
  transition: background 0.2s;
}

.about-toggle:hover,
.controls button:hover {
  background: rgba(233, 238, 240, 0.14);
}

.about {
  top: calc(max(20px, env(safe-area-inset-top)) + 158px);
  left: max(20px, env(safe-area-inset-left));
  width: min(360px, calc(100vw - 40px));
  max-height: calc(100vh - 260px);
  overflow: auto;
  padding: 18px 22px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
}

.about h2 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 600;
}

.about p {
  margin: 0 0 10px;
}

.muted {
  color: var(--muted);
}

.controls {
  right: max(20px, env(safe-area-inset-right));
  bottom: calc(max(20px, env(safe-area-inset-bottom)) + 44px);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
}

.controls button {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  font-size: 20px;
  line-height: 1;
}

.controls button + button {
  border-top: 1px solid var(--line);
}

.credits {
  left: 50%;
  transform: translateX(-50%);
  bottom: max(12px, env(safe-area-inset-bottom));
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  max-width: calc(100vw - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.credits a {
  color: var(--ink);
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 600px) {
  h1 {
    font-size: 24px;
  }
  .card {
    padding: 14px 16px 12px;
  }
  .credits {
    /* OSM's licence needs the attribution visible: wrap instead of truncating */
    white-space: normal;
    text-align: center;
    border-radius: 12px;
    width: calc(100vw - 24px);
  }
  .controls {
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + 64px);
  }
  .about {
    top: auto;
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + 64px);
    max-height: 55vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
