@font-face {
  font-family: "Taman Kanak-Kanak";
  src:
    url("../font/Font-Tali-Pusar.otf") format("opentype"),
    url("../font/Font-Tali-Pusar.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #080000;
  --fg: #f5d15d;
  --fg-soft: #fff4a8;
  --line: rgba(255, 244, 168, 0.55);
}

* {
  box-sizing: border-box;
  touch-action: manipulation;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: radial-gradient(circle at 50% 42%, #2b1000 0%, #120300 42%, var(--bg) 100%);
  color: var(--fg);
  font-family: "Taman Kanak-Kanak", Impact, Haettenschweiler, "Arial Narrow Bold", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

body {
  display: grid;
  place-items: center;
}

.square-stage {
  position: relative;
  width: min(100vw, 100vh);
  height: min(100vw, 100vh);
  max-width: 100vmin;
  max-height: 100vmin;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #070000;
  border: 1px solid var(--line);
  box-shadow: 0 0 28px rgba(245, 209, 93, 0.18), inset 0 0 64px rgba(255, 0, 0, 0.14);
}

#panicroom {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 210, 0, 0.08) 0%, rgba(255, 65, 0, 0.08) 32%, rgba(0, 0, 0, 0.56) 72%),
    url("../img/the-melting-land-00.gif"),
    #070000;
  background-repeat: no-repeat;
  background-position: center top;
  background-size: cover;
}

#canvasWrap {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
}

.overlay-title {
  position: absolute;
  top: clamp(10px, 3vmin, 28px);
  left: clamp(10px, 3vmin, 28px);
  right: clamp(10px, 3vmin, 28px);
  z-index: 4;
  pointer-events: none;
  text-align: center;
  color: var(--fg-soft);
  text-transform: uppercase;
  letter-spacing: 0.035em;
  line-height: 0.92;
  font-size: clamp(20px, 6.8vmin, 64px);
  text-shadow: 0 3px 0 #000, 0 0 18px rgba(255, 45, 0, 0.92);
}

.overlay-subtitle {
  position: absolute;
  left: clamp(10px, 3vmin, 28px);
  right: clamp(10px, 3vmin, 28px);
  bottom: clamp(70px, 13vmin, 118px);
  z-index: 4;
  pointer-events: none;
  text-align: center;
  color: #fff;
  font-family: "Taman Kanak-Kanak", Impact, Haettenschweiler, "Arial Narrow Bold", Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(10px, 2vmin, 18px);
  letter-spacing: 0.1em;
  line-height: 1.25;
  text-transform: uppercase;
  text-shadow: 0 2px 0 #000, 0 0 14px rgba(245, 209, 93, 0.75);
}

.sound-note {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: clamp(58px, 10vmin, 92px);
  z-index: 5;
  pointer-events: none;
  text-align: center;
  color: rgba(255, 255, 255, 0.72);
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(9px, 1.55vmin, 13px);
  line-height: 1.25;
}

.control-row {
  flex: 0 0 auto;
  width: 100%;
  padding: clamp(8px, 2vmin, 16px);
  z-index: 5;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.92), rgba(0, 0, 0, 0.12));
}

.chaos-button {
  width: 100%;
  min-height: clamp(44px, 8vmin, 74px);
  border: 1px solid var(--line);
  border-radius: 0;
  background: linear-gradient(180deg, #ffe173 0%, #bd7a0a 100%);
  color: #080000;
  cursor: pointer;
  font-family: "Taman Kanak-Kanak", Impact, Haettenschweiler, "Arial Narrow Bold", Arial, sans-serif;
  font-size: clamp(18px, 4.4vmin, 42px);
  letter-spacing: 0.045em;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 0 0 18px rgba(245, 209, 93, 0.3);
}

.chaos-button:active {
  transform: translateY(1px);
  filter: brightness(0.9);
}