:root {
  color-scheme: light;
  --bg: #f7f4ed;
  --ink: #17202a;
  --muted: #68737d;
  --panel: #ffffff;
  --line: #d8d2c7;
  --red: #cf2e2e;
  --red-dark: #a92020;
  --blue: #1d6d9f;
  --green: #287d5b;
  --shadow: 0 20px 60px rgba(23, 32, 42, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(207, 46, 46, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(29, 109, 159, 0.13), transparent 35%),
    var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  color: white;
  background: var(--red);
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--red-dark);
}

button.secondary {
  color: var(--ink);
  background: #e8e1d5;
}

button.secondary:hover {
  background: #ddd3c4;
}

button.ghost {
  min-height: 40px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
}

button.code-button {
  min-height: 42px;
  color: var(--ink);
  background: white;
  border: 1px dashed var(--red);
  letter-spacing: 2px;
}

.app-shell {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 18px;
}

.panel,
.round-panel,
.lobby-panel,
.players-panel,
.topbar,
.modal-card {
  background: var(--panel);
  border: 1px solid rgba(23, 32, 42, 0.08);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.intro {
  display: grid;
  gap: 22px;
  margin-top: 24px;
  padding: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 12vw, 4rem);
  line-height: 0.95;
}

h2 {
  margin-bottom: 0;
  line-height: 1.15;
}

.lede {
  max-width: 32rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
}

.stack {
  display: grid;
  gap: 14px;
}

.game-options {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.game-options legend {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.option-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffdf9;
  color: var(--ink);
}

.option-card:has(input:checked) {
  border-color: var(--red);
  box-shadow: inset 0 0 0 1px var(--red);
}

.option-card input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--red);
}

.option-card span {
  display: grid;
  gap: 4px;
}

.option-card small {
  color: var(--muted);
  line-height: 1.35;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--ink);
  background: #fffdf9;
}

textarea {
  resize: vertical;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 750;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.game-view {
  display: grid;
  gap: 16px;
  padding-top: 12px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
}

.round-panel,
.lobby-panel {
  padding: 24px;
}

.round-panel h2,
.lobby-panel h2 {
  font-size: clamp(1.8rem, 8vw, 3.5rem);
}

.target-image {
  display: block;
  width: 100%;
  max-height: 420px;
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
  object-fit: contain;
}

#role-text,
.lobby-panel p:not(.eyebrow) {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.start-button {
  width: 100%;
  margin-top: 20px;
  min-height: 62px;
  font-size: 1.15rem;
}

.players-panel {
  padding: 16px;
}

.found-button {
  min-height: 74px;
  width: 100%;
  border: 0;
  color: white;
  background: var(--red);
  font-size: 1.45rem;
  box-shadow: var(--shadow);
}

.found-button:hover {
  background: var(--red-dark);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-heading h2 {
  font-size: 1.15rem;
}

.section-heading span {
  min-width: 34px;
  border-radius: 999px;
  padding: 6px 10px;
  color: white;
  background: var(--green);
  text-align: center;
  font-weight: 900;
}

ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fffdf9;
  font-weight: 750;
}

li span {
  color: var(--muted);
  font-size: 0.8rem;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  max-width: 480px;
  margin: 0 auto;
  border-radius: 8px;
  padding: 12px 14px;
  color: white;
  background: var(--ink);
  text-align: center;
  box-shadow: var(--shadow);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  align-items: end;
  padding: 16px;
  background: rgba(23, 32, 42, 0.42);
}

.modal-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 16px;
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 22px;
}

.modal-card h2 {
  font-size: clamp(1.55rem, 8vw, 2.4rem);
}

.modal-card p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.confetti span {
  position: absolute;
  top: -18px;
  width: 9px;
  height: 15px;
  border-radius: 2px;
  animation: confetti-fall 1.4s ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    opacity: 0;
    transform: translateY(0) rotate(0deg);
  }

  12% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translateY(260px) rotate(460deg);
  }
}

.hidden {
  display: none !important;
}

@media (min-width: 680px) {
  .app-shell {
    padding-top: 42px;
  }

  .intro {
    padding: 34px;
  }

  .toast {
    left: auto;
  }

  .modal-backdrop {
    align-items: center;
  }
}
