:root {
  color-scheme: dark;
  --shell-height: 68px;
  --ink: #f7f2e8;
  --muted: #a9a29a;
  --bg: #11100f;
  --panel: #1b1917;
  --line: rgba(255, 255, 255, .09);
  --orange: #ff6b35;
  --lime: #d8ff5f;
  font-family: Inter, ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

body {
  display: grid;
  grid-template-rows: var(--shell-height) 1fr;
  color: var(--ink);
}

.game-shell-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  min-width: 0;
  height: var(--shell-height);
  padding: max(9px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 9px max(14px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: 43px 28px minmax(0, 1fr) 18px;
  gap: 10px;
  align-items: center;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  box-shadow: 0 8px 25px rgba(0, 0, 0, .28);
  isolation: isolate;
  transform: translateZ(0);
}

.home-button {
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, .045);
  -webkit-tap-highlight-color: transparent;
}

.home-button svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.home-button:active {
  background: rgba(255, 255, 255, .09);
  transform: scale(.94);
}

.home-button:focus-visible {
  outline: 3px solid rgba(216, 255, 95, .55);
  outline-offset: 2px;
}

.shell-brand {
  display: grid;
  place-items: center;
}

.shell-brand span {
  position: relative;
  width: 20px;
  height: 27px;
  border-radius: 5px 5px 9px 9px;
  background: var(--orange);
  transform: rotate(-10deg);
}

.shell-brand span::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 6px;
  width: 9px;
  height: 7px;
  border-radius: 3px 3px 1px 1px;
  background: var(--lime);
}

.game-title {
  min-width: 0;
  display: grid;
  line-height: 1.05;
}

.game-title small {
  margin-bottom: 5px;
  color: var(--lime);
  font-size: .59rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.game-title strong {
  overflow: hidden;
  font-size: .98rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 14px rgba(255, 107, 53, .72);
}

.game-frame-wrap {
  grid-row: 2;
  min-height: 0;
  position: relative;
  z-index: 1;
  background: var(--bg);
}

#game-frame {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: var(--bg);
}

.loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 17px;
  z-index: 1;
  color: var(--muted);
  background:
    radial-gradient(circle at 70% 10%, rgba(255, 107, 53, .13), transparent 35%),
    var(--bg);
}

.loader-bottle {
  position: relative;
  width: 48px;
  height: 68px;
  border-radius: 12px 12px 18px 18px;
  background: var(--orange);
  box-shadow: 0 15px 35px rgba(255, 107, 53, .18);
  animation: bottle-wobble .8s ease-in-out infinite alternate;
}

.loader-bottle::before {
  content: "";
  position: absolute;
  top: -19px;
  left: 15px;
  width: 18px;
  height: 24px;
  border-radius: 4px 4px 0 0;
  background: #ff8b60;
}

.loader-bottle i {
  position: absolute;
  top: -25px;
  left: 14px;
  z-index: 1;
  width: 20px;
  height: 9px;
  border-radius: 4px 4px 2px 2px;
  background: var(--lime);
}

.loader p {
  margin: 10px 0 0;
  font-size: .83rem;
  font-weight: 800;
}

.game-error {
  height: 100%;
  padding: 28px;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  background: radial-gradient(circle at 50% 16%, rgba(255, 107, 53, .12), transparent 42%), var(--bg);
}

.game-error > div {
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border-radius: 22px;
  color: #1b100b;
  background: var(--orange);
  font-size: 2rem;
  font-weight: 950;
  transform: rotate(-5deg);
}

.game-error h1 {
  margin: 25px 0 7px;
  font-size: 1.7rem;
}

.game-error p {
  max-width: 290px;
  margin: 0 0 22px;
  color: var(--muted);
}

.game-error a {
  min-height: 50px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  border-radius: 16px;
  color: #1b100b;
  background: var(--orange);
  font-weight: 900;
  text-decoration: none;
}

@keyframes bottle-wobble {
  to { transform: rotate(10deg) translateX(6px); }
}

@media (min-width: 700px) {
  :root { --shell-height: 70px; }
  .game-frame-wrap {
    width: min(100%, 1240px);
    margin: 0 auto;
    box-shadow: 0 0 55px rgba(0, 0, 0, .38);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loader-bottle { animation: none; }
}
