@font-face {
  font-family: 'BebasNeue';
  src: url('BebasNeue-Regular.ttf') format('truetype');
  font-display: block;
}
@font-face {
  font-family: 'ShareTechMono';
  src: url('ShareTechMono-Regular.ttf') format('truetype');
  font-display: block;
}

:root {
  --bg: #000000;
  --fg: #f3e4c8;
  --accent: #c4452f;
  --border: #2a2a2a;
  --muted: #9aa6b8;
  --surface: #141414;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  position: fixed;
  top: 0;
  left: 0;
  overflow: hidden;
  background: var(--bg);
  /* no scroll bounce, no rubber banding, no selection, no long-press callout */
  overscroll-behavior: none;
  -webkit-overflow-scrolling: auto;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

/* The game fills the safe area exactly: the same framing as the desktop window,
   with nothing hidden behind the Dynamic Island, the rounded corners or the home bar. */
#app {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* follows the visible viewport as Safari's bars change */
  background: var(--bg);
  overflow: hidden;
}

#frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding:
    env(safe-area-inset-top, 0px)
    env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px)
    env(safe-area-inset-left, 0px);
  background: var(--bg);
  overflow: hidden;
}

#unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--bg);
  outline: none;
  touch-action: none;
  image-rendering: auto;
}

/* ---------------------------------------------------------------- loading */
#boot {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(24px, env(safe-area-inset-top, 0px))
    max(24px, env(safe-area-inset-right, 0px))
    max(24px, env(safe-area-inset-bottom, 0px))
    max(24px, env(safe-area-inset-left, 0px));
  background: #000;
  z-index: 20;
  transition: opacity 280ms ease-out;
  overflow: hidden;
}
#boot.gone { opacity: 0; pointer-events: none; }

.boot-inner {
  width: min(320px, 100%);
  max-width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.boot-logo {
  display: block;
  width: 112px;
  height: 112px;
  margin: 0 0 16px 0;
  border-radius: 24px;
  object-fit: cover;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.wordmark {
  font-family: 'BebasNeue', Impact, 'Arial Narrow', sans-serif;
  font-size: clamp(28px, 8vw, 44px);
  line-height: 1.02;
  letter-spacing: 2px;
  color: var(--fg);
  text-transform: uppercase;
  margin: 0 0 18px 0;
}

.bar {
  position: relative;
  height: 6px;
  width: 100%;
  max-width: 320px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}
.bar .fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 280ms ease-out;
}

.status {
  font-family: 'ShareTechMono', 'Courier New', monospace;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--muted);
  margin-top: 12px;
  min-height: 15px;
}

/* One tap anywhere on a phone: it unlocks the sound, and it is the gesture
   Safari wants before it will go fullscreen. It never blocks the loading. */
#tap {
  display: none;
  margin: 26px auto 0;
  width: 190px;
  padding: 13px 0;
  font-family: 'ShareTechMono', 'Courier New', monospace;
  font-size: 15px;
  letter-spacing: 3px;
  text-align: center;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  animation: pulse 1.8s ease-in-out infinite;
}
#tap.show { display: block; }
#tap.gone { display: none; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font-family: 'ShareTechMono', 'Courier New', monospace;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--muted);
  padding: 0 24px;
  display: none;
}
.hint.show { display: block; }

/* ---------------------------------------------------------------- messages */
#warn {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 10px calc(10px + env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) calc(10px + env(safe-area-inset-left, 0px));
  font-family: 'ShareTechMono', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.35;
  color: var(--fg);
}
#warn.show { display: flex; }
#warn div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 8px 10px;
  word-break: break-word;
}

@media (max-height: 500px) {
  .boot-logo { width: 72px; height: 72px; margin-bottom: 10px; border-radius: 16px; }
  .wordmark { margin-bottom: 12px; }
  #tap { margin-top: 16px; }
  .hint { display: none; }
}
@media (max-width: 360px) {
  .boot-logo { width: 88px; height: 88px; }
}
