:root {
  color-scheme: dark;
  --ink: #f6f1e7;
  --muted: #b8c3bf;
  --panel: rgba(12, 15, 18, 0.62);
  --edge: rgba(246, 241, 231, 0.18);
  --gold: #ffd166;
  --cyan: #53d8fb;
  --coral: #ff6b6b;
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 18%, rgba(255, 209, 102, 0.16), transparent 24rem),
    radial-gradient(circle at 86% 78%, rgba(83, 216, 251, 0.15), transparent 22rem),
    #0b0d10;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 2.5vw, 22px);
}

.stage {
  position: relative;
  width: min(100%, 920px);
  height: min(720px, calc(100dvh - clamp(20px, 5vw, 44px)));
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: #0e1215;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.45);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#game:active {
  cursor: grabbing;
}

.hud {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.brand,
.meters span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--edge);
  background: var(--panel);
  backdrop-filter: blur(12px);
}

.brand {
  padding: 0 13px;
  border-left: 3px solid var(--gold);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
}

.meters {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.meters span {
  padding: 0 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.meters strong {
  margin-right: 2px;
  color: var(--gold);
  font-size: 16px;
}

body[data-play-state="weaving"] #status {
  color: var(--cyan);
}

body[data-play-state="stitched"] #status {
  color: var(--gold);
}

body[data-play-state="ended"] #status {
  color: var(--coral);
}

@media (max-width: 540px) {
  .shell {
    padding: 0;
  }

  .stage {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .hud {
    top: 10px;
    left: 10px;
    right: 10px;
  }

  .brand {
    max-width: 44vw;
    padding: 0 10px;
    font-size: 14px;
  }

  .meters {
    gap: 6px;
  }

  .meters span {
    min-height: 32px;
    padding: 0 8px;
    font-size: 11px;
  }
}
