@font-face {
  font-family: 'ForFuture Sans';
  src: url('assets/fonts/ForFutureSans-Regular.ttf') format('truetype');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'ForFuture Sans';
  src: url('assets/fonts/ForFutureSans-Bold.ttf') format('truetype');
  font-weight: 700; font-display: swap;
}

:root {
  --ink: #001923;
  --petrol: #004254;
  --light: #00B0BD;          /* light and gradients only */
  --stone: #AAAA9F;
  --sand: #E3E2DA;
  --line: rgba(227, 226, 218, .18);
  --cut: 12px;
  --ease: cubic-bezier(.2, .7, .1, 1);
  --chamfer: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  height: 100dvh; overflow: hidden;
  background: var(--ink); color: var(--sand);
  font: 400 16px/1.5 'ForFuture Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: 0; touch-action: none; }

/* ---------------------------------------------------------------- bar */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 5;
  display: flex; align-items: center; gap: 18px;
  height: 64px; padding: 0 max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
  padding-top: env(safe-area-inset-top);
  background: linear-gradient(rgba(0, 25, 35, .78), rgba(0, 25, 35, 0));
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.logo img { display: block; height: 22px; width: auto; }
.where { flex: 1; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--stone); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang { display: flex; border: 1px solid var(--line); }
.lang button { padding: 6px 11px; font-size: 12px; letter-spacing: .1em; color: var(--stone); }
.lang button[aria-pressed="true"] { background: var(--sand); color: var(--ink); }

/* ------------------------------------------------------------- places */
.places {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; gap: 8px; align-items: center;
  padding: 26px max(20px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  overflow-x: auto; scrollbar-width: none;
  background: linear-gradient(rgba(0, 25, 35, 0), rgba(0, 25, 35, .82));
}
.places::-webkit-scrollbar { display: none; }
.places .tag { flex: none; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--stone); padding: 0 6px 0 10px; }
.places .tag:first-child { padding-left: 0; }
.places button {
  flex: none; padding: 9px 15px; font-size: 14px; white-space: nowrap;
  background: rgba(0, 25, 35, .72); border: 1px solid var(--line);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: background .2s, color .2s;
}
.places button:hover { background: var(--petrol); }
.places button[aria-current="true"] { background: var(--sand); color: var(--ink); }

.keys {
  position: fixed; right: 20px; bottom: 76px; z-index: 4;
  font-size: 12px; letter-spacing: .04em; color: var(--stone);
  text-shadow: 0 1px 6px rgba(0, 25, 35, .9);
  pointer-events: none;
}

#view { cursor: grab; }
#view.drag { cursor: grabbing; }
.keys { transition: opacity .8s; }
body.moved .keys { opacity: 0; }
.fade { position: fixed; inset: 0; z-index: 3; background: var(--ink); opacity: 0; pointer-events: none; transition: opacity .2s; }
.fade.on { opacity: 1; }

/* ------------------------------------------------------------------ map */
.mapbox { position: fixed; z-index: 5; top: calc(72px + env(safe-area-inset-top)); right: max(20px, env(safe-area-inset-right)); width: 200px; }
.map { position: relative; aspect-ratio: 19.75 / 15; cursor: pointer; border: 1px solid var(--line); background: rgba(0, 25, 35, .6); }
.map-img { position: absolute; inset: 0; overflow: hidden; opacity: .9; }
.map-img img { position: absolute; width: 141.04%; left: -20.45%; top: -2.6%; display: block; }
#dot { position: absolute; width: 0; height: 0; left: 50%; top: 100%; pointer-events: none; }
#dot::before { content: ''; position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(0, 25, 35, .75), 0 0 14px 4px rgba(0, 176, 189, .9); }
#dot::after { content: ''; position: absolute; left: -6px; top: -21px; border: 6px solid transparent; border-bottom: 10px solid #fff; filter: drop-shadow(0 0 2px rgba(0, 25, 35, .9)); }
.swap { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 8px; padding: 9px 12px; font-size: 13px; background: rgba(0, 25, 35, .72); border: 1px solid var(--line); clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); transition: background .2s; }
.swap:hover { background: var(--petrol); }
.swap svg { transition: transform .3s var(--ease); }
.swap.down svg { transform: rotate(180deg); }
body.loading .mapbox { display: none; }
body.failed .progress { visibility: hidden; }

/* ------------------------------------------------------------- joystick */
.stick {
  position: fixed; z-index: 4; width: 112px; height: 112px; margin: -56px 0 0 -56px;
  border: 1px solid rgba(227, 226, 218, .4); border-radius: 50%;
  background: rgba(0, 25, 35, .3);
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
.stick.on { opacity: 1; }
.stick.idle { opacity: .5; }
.stick i {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border-radius: 50%; background: rgba(227, 226, 218, .85);
}

/* ---------------------------------------------------------------- gate */
.gate {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(120% 90% at 70% 110%, rgba(0, 176, 189, .22), rgba(0, 25, 35, 0) 60%), var(--ink);
  transition: opacity .7s var(--ease), visibility .7s;
}
body.live .gate { opacity: 0; visibility: hidden; }
.gate-in { width: min(560px, 100%); }
.eyebrow { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--stone); }
.gate h1 { margin: 14px 0 12px; font-size: clamp(38px, 7vw, 64px); line-height: 1.02; font-weight: 700; letter-spacing: -.01em; color: #fff; }
.lead { font-size: 18px; color: var(--sand); max-width: 34em; }
.progress { margin: 34px 0 22px; height: 2px; background: var(--line); }
.progress i { display: block; height: 100%; width: 0; background: var(--sand); transition: width .3s; }
.cta {
  display: inline-flex; align-items: center; gap: 14px; padding: 15px 24px;
  font-size: 16px; font-weight: 700; background: var(--sand); color: var(--ink);
  clip-path: var(--chamfer); transition: opacity .3s, background .2s;
}
.cta:hover { background: #fff; }
.cta[disabled] { opacity: .35; cursor: default; }
.howto { list-style: none; padding: 0; margin: 30px 0 0; display: grid; gap: 8px; font-size: 14px; color: var(--stone); }
.howto b { font-weight: 400; color: var(--sand); display: inline-block; min-width: 9.5em; }

body.loading .bar .where, body.loading .places, body.loading .keys, body.loading .stick { display: none; }
body.touch .keys { display: none; }
body:not(.touch) .stick { display: none; }

@media (max-width: 640px) {
  .bar { height: 56px; gap: 12px; }
  .logo img { height: 18px; }
  .places { padding-top: 20px; }
  .places button { padding: 9px 13px; }
  .lead { font-size: 16px; }
  .mapbox { width: 128px; top: calc(62px + env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
  .swap { padding: 8px 9px; font-size: 12px; gap: 6px; }
}
@media (max-height: 460px) {
  .mapbox { width: 120px; }
  .gate h1 { font-size: 34px; margin: 8px 0; }
  .progress { margin: 16px 0 14px; }
  .howto { margin-top: 14px; grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
