:root {
  --ink: #1d1812;
  --paper: #f7dfaa;
  --paper-deep: #e0bd72;
  --felt: #163b35;
  --felt-light: #23675c;
  --accent: #d8532b;
  --accent-dark: #9f351e;
  --cream: #fff7df;
  --shadow: 0 16px 50px rgba(17, 28, 25, 0.24);
}

@font-face {
  font-family: "Cardinal";
  src: local("Georgia");
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Fredoka", "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 223, 147, 0.26), transparent 28rem),
    radial-gradient(circle at 82% 8%, rgba(216, 83, 43, 0.2), transparent 22rem),
    linear-gradient(135deg, #102f2b, var(--felt) 52%, #0c2422);
  background-attachment: fixed;
}

main {
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

textarea,
input,
select {
  width: 100%;
  border: 2px solid rgba(29, 24, 18, 0.18);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  background: rgba(255, 247, 223, 0.94);
  color: var(--ink);
}

textarea:focus,
input:focus,
select:focus {
  outline: 3px solid rgba(216, 83, 43, 0.25);
  border-color: var(--accent);
}

textarea.sample-text {
  color: rgba(29, 24, 18, 0.45);
  font-style: italic;
}

.hero {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
  gap: 4rem;
  align-items: center;
  padding: clamp(2rem, 6vw, 6rem);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 6%;
  background:
    linear-gradient(95deg, rgba(255, 247, 223, 0.05), rgba(255, 247, 223, 0.18)),
    repeating-linear-gradient(55deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.04) 2px, transparent 2px, transparent 12px);
  /* No border — a frame here looked like a box around the title */
  transform: rotate(-2deg);
  pointer-events: none;
}

.brand-block h1,
.game-title,
.game-title-block h1,
.game-header h1 {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  -webkit-text-stroke: 0;
  text-decoration: none;
}

.game-title-block {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.brand-block,
.setup-panel,
.game-header,
.join-panel,
.question-card,
.action-card,
.truth-reveal,
.score-strip,
.empty-state {
  position: relative;
  z-index: 1;
}

.brand-block {
  color: var(--cream);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 800;
  font-size: 0.78rem;
  margin: 0 0 0.75rem;
  color: #ffd37d;
}

h1,
h2,
h3 {
  font-family: Cardinal, Georgia, serif;
  line-height: 0.95;
  margin: 0 0 1rem;
}

h1 {
  font-size: clamp(4rem, 12vw, 9rem);
  max-width: 8ch;
  text-wrap: balance;
}

h2 {
  font-size: clamp(2rem, 5vw, 4rem);
}

.lede {
  max-width: 38rem;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  line-height: 1.45;
}

.setup-panel,
.join-panel,
.action-card,
.question-card,
.truth-reveal,
.score-strip,
.empty-state {
  background: linear-gradient(145deg, rgba(255, 247, 223, 0.97), rgba(247, 223, 170, 0.95));
  box-shadow: var(--shadow);
  border-radius: 22px;
  padding: 1.4rem;
}

.field {
  margin-bottom: 1rem;
}

label {
  display: block;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.hint,
.phase {
  color: rgba(29, 24, 18, 0.68);
}

.button {
  border: 0;
  border-radius: 12px;
  padding: 0.82rem 1.1rem;
  font-weight: 900;
  cursor: pointer;
  transform: translateY(0);
  transition: transform 160ms ease, filter 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-2px);
}

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

.primary {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}

.ghost {
  color: var(--cream);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.paper-ghost {
  color: var(--ink);
  background: rgba(22, 59, 53, 0.08);
  border-color: rgba(22, 59, 53, 0.16);
}

.paper-notice {
  color: var(--ink);
  background: rgba(45, 156, 115, 0.14);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
}

.invite-banner {
  color: var(--cream);
  background: rgba(0, 0, 0, 0.22);
  border: 1px dashed rgba(255, 247, 223, 0.45);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  word-break: break-all;
}

.you-are-banner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  background: color-mix(in srgb, var(--you-colour) 28%, rgba(0, 0, 0, 0.35));
  border: 2px solid var(--you-colour);
  color: var(--cream);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.you-are-avatar {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--you-colour);
  font-size: 1.6rem;
  border: 2px solid rgba(255, 255, 255, 0.65);
}

.you-are-name,
.you-are-score {
  margin: 0;
}

.you-are-name {
  font-size: 1.15rem;
}

.you-are-score {
  opacity: 0.92;
  margin-top: 0.2rem;
}

.inline-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(3rem, 1fr));
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.picker-item,
.colour-swatch {
  border: 2px solid rgba(29, 24, 18, 0.15);
  border-radius: 12px;
  min-height: 3rem;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
}

.picker-item.selected,
.colour-swatch.selected {
  outline: 3px solid var(--accent);
}

.picker-item.taken,
.colour-swatch.taken {
  opacity: 0.35;
  filter: grayscale(1);
  cursor: not-allowed;
  position: relative;
}

.picker-item.taken::after {
  content: "taken";
  position: absolute;
  inset: auto 0 0.15rem;
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--ink);
}

.colour-swatch {
  background: var(--swatch);
}

.player-ring,
.spectator-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: center;
}

.spectator-rail {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed rgba(255, 247, 223, 0.3);
  color: var(--cream);
}

.shuffle-stage,
.reveal-stage {
  min-height: 420px;
}

.answer-grid.dimmed {
  opacity: 0.72;
  pointer-events: none;
}

.spectator-standings {
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px dashed rgba(29, 24, 18, 0.2);
}

.spectator-standings ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
}

.shuffle-pile {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  min-height: 160px;
}

.shuffle-card {
  animation: shuffleSpin 0.7s ease-in-out infinite alternate;
}

.shuffle-card:nth-child(2n) { animation-delay: 0.1s; }
.shuffle-card:nth-child(3n) { animation-delay: 0.18s; }

.high-score {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px dashed rgba(29, 24, 18, 0.2);
}

.confetti-layer {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.truth-reveal {
  position: relative;
}

.confetti-bit {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: confettiFall 1.4s linear forwards;
}

@keyframes shuffleSpin {
  from { transform: translateY(0) rotate(-8deg) scale(0.96); }
  to { transform: translateY(12px) rotate(10deg) scale(1.04); }
}

@keyframes confettiFall {
  to {
    transform: translateY(220px) rotate(420deg);
    opacity: 0;
  }
}

.question-lock {
  margin: -0.3rem 0 1rem;
}

.preview-list {
  margin: 0 0 1rem;
  padding: 0.8rem 1rem;
  background: rgba(22, 59, 53, 0.08);
  border-radius: 14px;
}

.chip {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.chip.set {
  background: rgba(45, 156, 115, 0.2);
}

.chip.waiting {
  background: rgba(242, 183, 5, 0.24);
}

.error {
  background: #ffe1d8;
  border-left: 5px solid var(--accent);
  padding: 0.8rem 1rem;
  border-radius: 10px;
}

.notice {
  color: var(--cream);
}

.game-shell {
  min-height: 100vh;
  padding: clamp(1rem, 4vw, 3rem);
  transition: background 280ms ease;
}

.game-shell.phase-writing {
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 140, 66, 0.38), transparent 24rem),
    radial-gradient(circle at 85% 80%, rgba(216, 83, 43, 0.22), transparent 20rem),
    linear-gradient(145deg, #4a2214 0%, #7a3a1c 42%, #2e1a12 100%);
}

.game-shell.phase-voting,
.game-shell.phase-reveal {
  background:
    radial-gradient(circle at 82% 10%, rgba(90, 190, 255, 0.36), transparent 24rem),
    radial-gradient(circle at 15% 85%, rgba(42, 120, 200, 0.24), transparent 20rem),
    linear-gradient(145deg, #0b2740 0%, #1a5a7a 42%, #0a1c2e 100%);
}

.game-shell.phase-shuffle {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 211, 125, 0.22), transparent 22rem),
    linear-gradient(135deg, #102f2b, #163b35 52%, #0c2422);
}

.game-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  color: var(--cream);
  margin-bottom: 1.5rem;
  border: 0;
  background: transparent;
}

.game-header h1,
.game-title {
  font-size: clamp(2.8rem, 8vw, 6rem);
  max-width: none;
  border: 0;
}

.game-header .phase {
  color: rgba(255, 255, 255, 0.92);
  max-width: 36rem;
  line-height: 1.4;
}

.phase-heading {
  display: inline-block;
  margin: 0.45rem 0 0.4rem;
  padding: 0.55rem 1.05rem;
  border-radius: 999px;
  background: rgba(255, 247, 223, 0.22);
  color: #fff3c8;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.95rem;
}

.round-meter {
  margin: 0.4rem 0 0;
  color: var(--cream);
  font-weight: 800;
}

.your-turn {
  margin: 0 0 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(216, 83, 43, 0.95), rgba(159, 53, 30, 0.95));
  color: white;
  font-weight: 900;
  font-size: 1.05rem;
  animation: pulseTurn 1.6s ease-in-out infinite;
}

.progress-line {
  font-weight: 800;
  color: rgba(29, 24, 18, 0.78);
}

.idle-nudge {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(255, 211, 125, 0.2);
  border: 1px dashed rgba(255, 211, 125, 0.65);
  color: var(--cream);
  font-weight: 700;
}

.role-picker {
  border: 0;
  margin: 0 0 1rem;
  padding: 0;
}

.role-picker legend {
  font-weight: 800;
  margin-bottom: 0.45rem;
}

.role-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.role-option {
  display: grid;
  gap: 0.2rem;
  text-align: left;
  padding: 0.75rem;
  border-radius: 12px;
  border: 2px solid rgba(29, 24, 18, 0.14);
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
}

.role-option span {
  font-size: 0.82rem;
  opacity: 0.8;
}

.role-option.selected {
  border-color: var(--accent);
  outline: 3px solid rgba(216, 83, 43, 0.2);
  background: rgba(255, 247, 223, 0.95);
}

.action-priority {
  order: -1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.code {
  padding: 0.6rem 0.8rem;
  border: 1px dashed rgba(255, 247, 223, 0.6);
  border-radius: 10px;
  color: var(--cream);
}

.table-layout,
.round-grid {
  display: grid;
  grid-template-columns: minmax(480px, 560px) 1fr;
  gap: 1.5rem;
}

.player-table {
  min-height: 620px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 247, 223, 0.16) 0 30%, transparent 31%),
    radial-gradient(circle, var(--felt-light), var(--felt));
  border: 14px solid rgba(78, 50, 24, 0.75);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  align-content: center;
  padding: 5rem;
}

.table-center {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--cream);
}

.player-card {
  background: var(--card-colour);
  color: white;
  border: 3px solid rgba(255, 255, 255, 0.55);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  animation: slap 280ms cubic-bezier(.17,.84,.44,1.3);
}

.player-card span {
  display: block;
  font-size: 2rem;
}

.spectator-card {
  opacity: 0.78;
  transform: scale(0.92);
}

.identity span {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  color: white;
}

.host-box {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 2px dashed rgba(29, 24, 18, 0.22);
}

.checkbox {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.checkbox input {
  width: auto;
}

.face-down-row,
.answer-grid {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.podium {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.back-card,
.answer-card {
  min-width: 180px;
  min-height: 130px;
  padding: 1rem;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.back-card {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.24), rgba(255,255,255,0.24) 6px, transparent 6px, transparent 12px),
    var(--card-colour);
  display: grid;
  place-items: center;
  color: white;
  font-size: 2rem;
}

.stamp {
  animation: slap 240ms cubic-bezier(.17,.84,.44,1.3);
}

.voting-stage,
.summary-stage,
.podium-stage {
  display: grid;
  gap: 1.5rem;
}

.answer-card {
  border: 0;
  background: linear-gradient(145deg, #fff6d8, var(--paper));
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-family: "Fredoka", "Trebuchet MS", "Segoe UI", sans-serif;
  font-weight: 600;
  font-style: normal;
  font-size: 1.15rem;
  line-height: 1.4;
}

.answer-card.picked {
  outline: 5px solid var(--accent);
}

.answer-card.truth,
.truth-reveal {
  animation: tada 650ms ease both;
}

.rules-card {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 2px dashed rgba(29, 24, 18, 0.2);
}

.rules-card h3 {
  font-size: 1.35rem;
  margin: 0 0 0.55rem;
}

.rules-card ol,
.rules-card ul {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
}

.rules-card li {
  margin-bottom: 0.45rem;
  line-height: 1.35;
}

.vote-markers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 1rem;
}

.vote-markers span {
  background: rgba(22, 59, 53, 0.1);
  padding: 0.35rem 0.5rem;
  border-radius: 999px;
}

.score-strip {
  max-width: 720px;
}

.podium-place {
  background: var(--paper);
  border-radius: 18px;
  padding: 1rem;
  min-width: min(100%, 280px);
  width: min(100%, 420px);
  animation: jumpIn 480ms ease both;
  text-align: center;
}

.podium-place.place-1 { order: 1; width: min(100%, 440px); }
.podium-place.place-2 { order: 2; width: min(100%, 360px); }
.podium-place.place-3 { order: 3; width: min(100%, 300px); }

.noise-box {
  display: grid;
  gap: 0.45rem;
  justify-items: center;
  margin: 0.5rem 0 1rem;
}

.noise-button {
  min-width: min(100%, 320px);
  font-size: 1.15rem;
  padding: 1rem 1.4rem;
  color: white;
  border: 3px solid rgba(255, 255, 255, 0.55);
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--noise-colour, #2a9dcc) 88%, white),
    var(--noise-colour, #2a9dcc)
  );
  box-shadow: 0 10px 24px color-mix(in srgb, var(--noise-colour, #2a9dcc) 35%, transparent);
  animation: noiseShake 1.7s ease-in-out infinite;
}

.noise-button:hover:not(:disabled) {
  filter: brightness(1.06);
}

.noise-button:active {
  transform: scale(0.97);
  animation: none;
}

@keyframes noiseShake {
  0%, 100% { transform: rotate(0deg) translateX(0); }
  12% { transform: rotate(-2.2deg) translateX(-2px); }
  24% { transform: rotate(2.2deg) translateX(2px); }
  36% { transform: rotate(-1.6deg) translateX(-1px); }
  48% { transform: rotate(1.6deg) translateX(1px); }
  60%, 100% { transform: rotate(0deg) translateX(0); }
}

.podium-place span {
  display: block;
  font-size: 3rem;
  font-family: Cardinal, Georgia, serif;
}

@keyframes pulseTurn {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.015); filter: brightness(1.08); }
}

@keyframes slap {
  0% { transform: translateY(-35px) rotate(-8deg) scale(1.18); opacity: 0; }
  70% { transform: translateY(5px) rotate(2deg) scale(0.98); opacity: 1; }
  100% { transform: translateY(0) rotate(0) scale(1); opacity: 1; }
}

@keyframes tada {
  0% { transform: scale(0.9) rotate(-1deg); }
  35% { transform: scale(1.08) rotate(1deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes jumpIn {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 860px) {
  .hero,
  .table-layout,
  .round-grid {
    grid-template-columns: 1fr;
  }

  .round-grid {
    display: flex;
    flex-direction: column;
  }

  .action-priority {
    order: -1;
  }

  .role-options {
    grid-template-columns: 1fr;
  }

  .player-table {
    border-radius: 30px;
    min-height: auto;
    padding: 1.5rem;
  }

  .game-header {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}
