:root {
  --bg-top: #f9d27b;
  --bg-mid: #f47f56;
  --bg-bottom: #201526;
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #fff6df;
  --muted: #f8cc9e;
  --accent: #8df0c2;
  --hot: #ffed77;
  --shadow: rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Avenir Next Condensed", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255, 245, 185, 0.42), transparent 32%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 42%, var(--bg-bottom) 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(circle at 15% 18%, rgba(255, 255, 255, 0.22), transparent 18%),
    radial-gradient(circle at 82% 11%, rgba(255, 218, 162, 0.18), transparent 16%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.05), transparent 55%);
}

body::after {
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.25) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, transparent, black 15%, black 85%, transparent);
}

.shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.titlebar,
.notes,
.control-strip {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.72rem;
  color: var(--hot);
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0.02em;
}

h1 {
  font-size: clamp(2.1rem, 5vw, 4.4rem);
  line-height: 0.92;
}

h2 {
  font-size: clamp(1.55rem, 3vw, 2.4rem);
  line-height: 0.94;
}

.meta,
.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: end;
}

.meta span,
.notes p,
.player-chip,
.post-game-panel,
.hud-button,
.field-row input {
  border: 1px solid var(--panel-border);
  box-shadow: 0 10px 30px var(--shadow);
  backdrop-filter: blur(18px);
}

.meta span,
.notes p,
.player-chip {
  margin: 0;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(17, 11, 27, 0.48);
  color: var(--muted);
}

.game-frame {
  margin: 20px 0 14px;
  padding: 18px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.03)),
    rgba(21, 16, 33, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 24px 80px rgba(11, 8, 18, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.canvas-wrap {
  position: relative;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(72vh, 720px);
  margin: 0 auto;
  border-radius: 20px;
  touch-action: manipulation;
  background: linear-gradient(180deg, #ffd88c 0%, #f78d5b 50%, #261627 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.rotate-notice {
  position: absolute;
  inset: 12px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: rgba(12, 8, 18, 0.82);
  text-align: center;
}

.rotate-notice p {
  margin: 0;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  color: #fff7e0;
  background: rgba(255, 255, 255, 0.06);
}

.control-strip {
  align-items: center;
  margin-bottom: 14px;
}

.player-chip {
  font-size: 1rem;
}

.hud-button {
  appearance: none;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(17, 11, 27, 0.58);
  color: #fff6df;
  font: inherit;
  cursor: pointer;
  transition:
    transform 120ms ease,
    background 120ms ease,
    opacity 120ms ease;
}

.hud-button:hover:not(:disabled),
.hud-button:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  background: rgba(34, 24, 46, 0.74);
}

.hud-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.hud-button.accent {
  background: rgba(141, 240, 194, 0.2);
  color: #edfff6;
}

.post-game-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)),
    rgba(16, 11, 26, 0.62);
}

.post-game-panel.is-hidden,
.player-form.is-hidden,
.share-tools.is-hidden {
  display: none;
}

.panel-copy,
.share-tools,
.player-form {
  display: grid;
  gap: 8px;
}

.post-summary,
.save-status,
.field-note {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.save-status[data-state="saved"] {
  color: var(--accent);
}

.save-status[data-state="error"] {
  color: #ffd0c0;
}

.player-form label,
.share-tools label {
  color: #fff7e0;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.field-row input {
  width: 100%;
  min-width: 0;
  padding: 11px 14px;
  border-radius: 14px;
  background: rgba(17, 11, 27, 0.58);
  color: #fff7e0;
  font: inherit;
}

.spread {
  justify-content: start;
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 18px, 1120px);
    padding-top: 16px;
  }

  .titlebar,
  .notes,
  .control-strip {
    align-items: start;
    flex-direction: column;
  }

  .game-frame {
    padding: 10px;
    border-radius: 20px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .button-row {
    justify-content: start;
  }
}

@media (max-width: 900px) and (orientation: portrait) {
  .rotate-notice {
    display: flex;
  }
}
