:root {
  --ink: #1b2838;
  --ink-soft: #314153;
  --parchment: rgba(248, 241, 228, 0.88);
  --parchment-edge: rgba(95, 77, 54, 0.18);
  --crimson: #ab4133;
  --crimson-dark: #842d24;
  --navy: #24446d;
  --gold: #d0ad62;
  --shadow: rgba(18, 27, 40, 0.22);
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(180, 220, 255, 0.6), transparent 45%),
    linear-gradient(180deg, #8bc8f7 0%, #dce9f1 55%, #b1c1ce 100%);
  font-family: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
}

h1,
h2,
.kicker {
  font-family: Baskerville, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#scene.is-dragging {
  cursor: grabbing;
}

.hud {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(20rem, 29rem);
  align-content: start;
  gap: 0.95rem;
  padding: 1.1rem;
  pointer-events: none;
}

.panel {
  pointer-events: auto;
  padding: 1rem 1.05rem;
  border-radius: 1.35rem;
  border: 1px solid var(--parchment-edge);
  background: var(--parchment);
  backdrop-filter: blur(10px);
  box-shadow:
    0 20px 50px var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.title-panel h1,
.info-panel h2,
.win-panel h2 {
  margin: 0;
  line-height: 0.95;
}

.title-panel h1 {
  font-size: clamp(2rem, 3vw, 2.8rem);
}

.info-panel h2,
.win-panel h2 {
  font-size: clamp(1.65rem, 2.4vw, 2.25rem);
}

.kicker {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--crimson-dark);
}

.subtle,
.hint,
#figureDescription,
.phase-label {
  margin: 0.65rem 0 0;
  color: var(--ink-soft);
  line-height: 1.4;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--crimson-dark);
  margin-bottom: 0.75rem;
}

.phase-label {
  font-weight: 700;
  color: var(--navy);
}

.button-row {
  display: flex;
  gap: 0.75rem;
}

.camera-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.85rem;
  margin-top: 0.95rem;
}

button {
  flex: 1 1 0;
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.9rem 1rem;
  background: linear-gradient(180deg, #c54f3f 0%, #983629 100%);
  color: #fff8f1;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow:
    0 16px 28px rgba(122, 42, 31, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    filter 180ms ease,
    opacity 180ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow:
    0 18px 30px rgba(122, 42, 31, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button.secondary {
  background: linear-gradient(180deg, #345884 0%, #213a5b 100%);
  box-shadow:
    0 16px 28px rgba(24, 43, 70, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

button.tertiary {
  flex: 0 0 auto;
  padding-inline: 1rem;
  background: linear-gradient(180deg, #f3ebda 0%, #deceb0 100%);
  color: var(--ink);
  box-shadow:
    0 12px 22px rgba(93, 76, 50, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

button:disabled {
  cursor: default;
  opacity: 0.45;
  filter: saturate(0.6);
  transform: none;
}

.camera-hint {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.win-banner {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  pointer-events: none;
}

.win-panel {
  max-width: 28rem;
  text-align: center;
}

.hidden {
  display: none;
}

@media (max-width: 900px) {
  .hud {
    grid-template-columns: 1fr;
    padding: 0.8rem;
    gap: 0.75rem;
  }

  .panel {
    padding: 0.9rem;
    border-radius: 1.15rem;
  }

  .button-row {
    flex-direction: column;
  }

  .camera-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  button {
    width: 100%;
  }
}
