:root {
  color-scheme: dark;
  --bg: #171026;
  --panel: #281833;
  --panel-2: #3a2146;
  --text: #fff7fd;
  --muted: #ead0e6;
  --line: rgba(255, 255, 255, 0.18);
  --accent: #ff67ad;
  --accent-2: #ffe16a;
  --blue: #7ed7ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 103, 173, 0.25), transparent 26rem),
    radial-gradient(circle at 84% 16%, rgba(126, 215, 255, 0.2), transparent 24rem),
    linear-gradient(135deg, #130d1c 0%, #28162d 54%, #4b2245 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(100%, 1080px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  align-items: center;
}

.game-panel {
  width: 100%;
}

.game-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(27px, 5vw, 52px);
  line-height: 0.96;
  letter-spacing: 0;
}

.back-link,
.scene-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
}

.back-link {
  flex: 0 0 auto;
  padding: 10px 14px;
  text-decoration: none;
}

.scene-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.scene-button {
  cursor: pointer;
  padding: 10px 12px;
}

.scene-button.active {
  border-color: rgba(255, 225, 106, 0.95);
  background: linear-gradient(180deg, #ffef80, #ff8fca);
  color: #7b155f;
}

.back-link:hover,
.back-link:focus-visible,
.scene-button:hover,
.scene-button:focus-visible {
  outline: 3px solid rgba(126, 215, 255, 0.65);
  outline-offset: 2px;
}

.game-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: calc(100vh - 148px);
  min-height: 320px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.ruffle-player,
ruffle-player {
  display: block;
  width: 100%;
  height: 100%;
}

.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  background: linear-gradient(135deg, var(--panel), var(--panel-2));
}

.error {
  color: #ffd4df;
}

@media (max-width: 700px) {
  .shell {
    padding: 14px;
    align-items: start;
  }

  .game-header {
    align-items: flex-start;
    flex-direction: column;
    min-height: 0;
  }

  .back-link {
    width: 100%;
    text-align: center;
  }

  .scene-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-frame {
    max-height: none;
    min-height: 260px;
  }
}
