:root {
  color-scheme: dark;
  --ink: #12120f;
  --ink-soft: rgba(18, 18, 15, 0.78);
  --panel: rgba(31, 29, 23, 0.78);
  --panel-strong: rgba(36, 34, 28, 0.94);
  --text: #f7efe1;
  --muted: #bdb3a1;
  --gold: #f4b84a;
  --gold-hot: #ffe18c;
  --teal: #55d7ca;
  --coral: #ef765e;
  --line: rgba(247, 239, 225, 0.18);
  --shadow: rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 520px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 22%, rgba(85, 215, 202, 0.16), transparent 34%),
    radial-gradient(circle at 80% 76%, rgba(239, 118, 94, 0.12), transparent 35%),
    #12120f;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.hud {
  position: absolute;
  z-index: 2;
  left: clamp(14px, 2vw, 28px);
  right: clamp(14px, 2vw, 28px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--text);
  text-shadow: 0 1px 10px var(--shadow);
  pointer-events: none;
}

.hud-top {
  top: clamp(12px, 2vh, 24px);
}

.hud-bottom {
  bottom: clamp(12px, 2vh, 24px);
  align-items: flex-end;
}

.brand-block {
  max-width: min(700px, 72vw);
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink-soft);
  backdrop-filter: blur(14px);
}

h1 {
  margin: 0 0 6px;
  font-size: clamp(1.4rem, 2.4vw, 2.5rem);
  line-height: 1;
  letter-spacing: 0;
}

p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.9rem, 1.15vw, 1rem);
  line-height: 1.42;
}

.readouts {
  display: flex;
  gap: 10px;
}

.readout {
  min-width: 98px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  text-align: right;
}

.readout-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.1;
}

.readout strong {
  display: block;
  margin-top: 3px;
  color: var(--gold-hot);
  font-size: 1.2rem;
  line-height: 1;
}

.seam-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
  width: min(720px, 66vw);
}

.seam-meter {
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(14px);
}

.seam-meter header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1;
}

.meter-track {
  position: relative;
  width: 100%;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(247, 239, 225, 0.14);
}

.meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--teal));
  box-shadow: 0 0 18px rgba(244, 184, 74, 0.52);
}

.seam-meter.complete .meter-fill {
  background: linear-gradient(90deg, var(--gold-hot), #ffffff);
}

.controls {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.controls button {
  min-width: 94px;
  min-height: 44px;
  border: 1px solid rgba(247, 239, 225, 0.26);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  box-shadow: 0 12px 34px var(--shadow);
  cursor: pointer;
}

.controls button:hover,
.controls button:focus-visible {
  border-color: rgba(244, 184, 74, 0.75);
  outline: none;
  background: rgba(54, 48, 36, 0.96);
}

.controls button:active {
  transform: translateY(1px);
}

.toast {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: clamp(94px, 13vh, 130px);
  transform: translateX(-50%);
  max-width: min(620px, calc(100vw - 28px));
  padding: 11px 14px;
  border: 1px solid rgba(244, 184, 74, 0.32);
  border-radius: 8px;
  background: rgba(28, 24, 16, 0.82);
  color: var(--gold-hot);
  font-size: 0.95rem;
  line-height: 1.3;
  text-align: center;
  opacity: 0.98;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.toast.is-quiet {
  opacity: 0;
}

@media (max-width: 820px) {
  .game-shell {
    min-height: 620px;
  }

  .hud {
    align-items: stretch;
  }

  .hud-top,
  .hud-bottom {
    flex-direction: column;
  }

  .brand-block,
  .seam-list {
    width: 100%;
    max-width: none;
  }

  .readouts,
  .controls {
    width: 100%;
  }

  .readout,
  .controls button {
    flex: 1;
  }

  .seam-list {
    grid-template-columns: 1fr;
  }

  .toast {
    bottom: 216px;
  }
}
