/* The picture fills the whole screen; everything else is an overlay on top of it. */
:root {
  --sl: env(safe-area-inset-left, 0px);
  --sr: env(safe-area-inset-right, 0px);
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #f0e2be;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
body { position: fixed; inset: 0; }

#screen {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  width: 100dvw;
  height: 100dvh;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  background: #14100c;
  touch-action: none;
}

/* probe for the safe-area insets, read from JS */
#safe {
  position: fixed;
  visibility: hidden;
  pointer-events: none;
  padding: var(--st) var(--sr) var(--sb) var(--sl);
}

#touch {
  position: fixed;
  inset: 0;
  touch-action: none;
}
#stick, #fire { display: none; }
.touch #stick, .touch #fire { display: flex; }

/* stick: a brass-ringed dial that appears under the left thumb */
#stick {
  position: absolute;
  left: calc(var(--sl) + 13vw);
  top: 70vh;
  width: 124px;
  height: 124px;
  margin: -62px 0 0 -62px;
  border-radius: 50%;
  border: 5px solid rgba(214, 168, 84, 0.72);
  box-shadow: inset 0 0 0 2px rgba(60, 40, 16, 0.55), inset 0 0 18px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(40, 26, 10, 0.6);
  background:
    repeating-conic-gradient(from -1deg, rgba(240, 214, 150, 0.55) 0 2deg, transparent 2deg 30deg),
    radial-gradient(circle, rgba(20, 16, 12, 0.28) 0 62%, rgba(20, 16, 12, 0.05) 63%);
  align-items: center;
  justify-content: center;
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.15s;
}
#stick::before {
  /* hide the tick marks except near the rim */
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: rgba(24, 18, 12, 0.42);
}
#stick.on { opacity: 0.95; transition: none; }
#knob {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 232, 170, 0.9), rgba(196, 140, 60, 0.82) 45%, rgba(96, 62, 24, 0.85) 100%);
  border: 2px solid rgba(60, 40, 16, 0.8);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  will-change: transform;
}

/* FEUER: a brass push-button with a red cap */
#fire {
  position: absolute;
  right: calc(var(--sr) + 22px);
  bottom: calc(var(--sb) + 20px);
  width: clamp(88px, 27vh, 124px);
  height: clamp(88px, 27vh, 124px);
  border-radius: 50%;
  border: 7px solid rgba(214, 168, 84, 0.8);
  box-shadow: 0 0 0 2px rgba(50, 32, 12, 0.7), inset 0 0 0 2px rgba(50, 32, 12, 0.7), inset 0 -8px 14px rgba(0, 0, 0, 0.4), 0 3px 8px rgba(0, 0, 0, 0.45);
  background: radial-gradient(circle at 38% 30%, rgba(255, 150, 110, 0.72), rgba(190, 50, 30, 0.62) 55%, rgba(96, 20, 12, 0.7) 100%);
  color: rgba(255, 236, 200, 0.95);
  font-family: "Arial Black", Impact, "Helvetica Neue", system-ui, sans-serif;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.14em;
  text-shadow: 0 1px 0 rgba(60, 10, 0, 0.9);
  align-items: center;
  justify-content: center;
  touch-action: none;
  opacity: 0.8;
}
#fire.on {
  opacity: 1;
  transform: scale(0.94);
  background: radial-gradient(circle at 42% 38%, rgba(255, 190, 130, 0.9), rgba(230, 70, 36, 0.85) 55%, rgba(120, 26, 14, 0.85) 100%);
  box-shadow: 0 0 0 2px rgba(50, 32, 12, 0.7), inset 0 0 0 2px rgba(50, 32, 12, 0.7), inset 0 6px 14px rgba(0, 0, 0, 0.5);
}

#corner {
  position: fixed;
  top: calc(var(--st) + 6px);
  right: calc(var(--sr) + 6px);
  display: flex;
  gap: 6px;
}
#corner button {
  width: 34px;
  height: 34px;
  padding: 6px;
  border-radius: 5px;
  border: 2px solid rgba(206, 160, 80, 0.85);
  box-shadow: inset 0 0 0 1px rgba(40, 26, 10, 0.8), 0 1px 3px rgba(0, 0, 0, 0.5);
  background:
    radial-gradient(circle at 4px 4px, rgba(240, 210, 140, 0.9) 0 1.2px, transparent 1.6px),
    radial-gradient(circle at calc(100% - 4px) 4px, rgba(240, 210, 140, 0.9) 0 1.2px, transparent 1.6px),
    radial-gradient(circle at 4px calc(100% - 4px), rgba(240, 210, 140, 0.9) 0 1.2px, transparent 1.6px),
    radial-gradient(circle at calc(100% - 4px) calc(100% - 4px), rgba(240, 210, 140, 0.9) 0 1.2px, transparent 1.6px),
    rgba(30, 24, 18, 0.62);
  color: inherit;
  touch-action: none;
  cursor: pointer;
}
#corner svg { width: 100%; height: 100%; fill: rgba(246, 222, 160, 0.9); stroke: rgba(246, 222, 160, 0.9); stroke-width: 0; }
#mute .cross { display: none; }
#mute.off .waves { display: none; }
#mute.off .cross { display: inline; }

/* radio subtitle: a riveted steel plate with amber lettering */
#funk {
  position: fixed;
  left: 50%;
  bottom: calc(var(--sb) + 10px);
  transform: translateX(-50%);
  max-width: min(56vw, 560px);
  padding: 7px 14px 8px 12px;
  border: 2px solid rgba(206, 160, 80, 0.9);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(40, 26, 10, 0.9), 0 2px 8px rgba(0, 0, 0, 0.5);
  background:
    radial-gradient(circle at 5px 5px, rgba(240, 210, 140, 0.9) 0 1.3px, transparent 1.8px),
    radial-gradient(circle at calc(100% - 5px) 5px, rgba(240, 210, 140, 0.9) 0 1.3px, transparent 1.8px),
    radial-gradient(circle at 5px calc(100% - 5px), rgba(240, 210, 140, 0.9) 0 1.3px, transparent 1.8px),
    radial-gradient(circle at calc(100% - 5px) calc(100% - 5px), rgba(240, 210, 140, 0.9) 0 1.3px, transparent 1.8px),
    rgba(26, 20, 15, 0.8);
  color: #ffe2a6;
  font-family: "Courier New", ui-monospace, Menlo, Consolas, monospace;
  font-size: clamp(12px, 4.1vh, 18px);
  line-height: 1.25;
  font-weight: 700;
  text-align: left;
  pointer-events: none;
  text-shadow: 0 1px 2px #000;
}
#funk[hidden] { display: none; }
#funk .tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
  padding: 1px 6px 1px 4px;
  border-radius: 2px;
  background: #e8a53c;
  color: #1c140c;
  font-family: "Arial Black", Impact, system-ui, sans-serif;
  font-size: 0.68em;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-shadow: none;
  vertical-align: 0.12em;
  animation: funk 0.9s steps(2, start) infinite;
}
#funk .tag svg { width: 1.3em; height: 1.3em; fill: currentColor; }
@keyframes funk { 50% { opacity: 0.6; } }

#rotate {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px;
  background: radial-gradient(circle at 50% 35%, #5a3c1c, #14100c 70%);
  text-align: center;
  z-index: 10;
}
#rotate[hidden] { display: none; }
#rotate p { margin: 0; color: #cdb48a; }
#rotate .big { margin-top: 26px; font-size: 26px; font-weight: 800; color: #f4c86a; letter-spacing: 0.06em; text-transform: uppercase; font-family: "Arial Black", Impact, system-ui, sans-serif; }
#rotate .phone {
  width: 64px;
  height: 112px;
  border: 4px solid #d6a854;
  border-radius: 12px;
  position: relative;
  animation: turn 2.4s ease-in-out infinite;
}
#rotate .phone::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 16px;
  height: 3px;
  margin-left: -8px;
  border-radius: 2px;
  background: #d6a854;
}
@keyframes turn {
  0%, 20% { transform: rotate(0deg); }
  55%, 85% { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}

#loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #14100c;
  color: #f4c86a;
  font-weight: 800;
  letter-spacing: 0.2em;
  z-index: 5;
}
#loading[hidden] { display: none; }
