* {
  box-sizing: border-box;
}

body {
  font-family: 'Archivo Black', 'Arial Black', Arial, sans-serif;
  max-width: 400px;
  margin: 0 auto;
  padding: 30px 20px;
  text-align: center;
  background: var(--theme-bg, #FFF9C4);
  color: var(--theme-text, #222);
}

h1 {
  font-size: 1.8rem;
  margin-bottom: 20px;
  color: var(--theme-heading, inherit);
}

p {
  font-size: 1.25rem;
  color: var(--theme-text, #666);
}

section {
  margin-top: 20px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

section:not(.active) {
  display: none;
}

section.active {
  opacity: 1;
  transform: none;
}

/* --- Juice: submitted confirmation gets a happy bounce --- */

#submitted-section.active h1,
#vote-submitted-section.active h1 {
  animation: juiceBounceIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes juiceBounceIn {
  0%   { transform: scale(0.6); opacity: 0; }
  70%  { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  section {
    transition: none;
    transform: none;
  }
  #submitted-section.active h1,
  #vote-submitted-section.active h1 {
    animation: none;
  }
}

/* --- Buzz: one giant button --- */

.buzz-tap {
  display: block;
  width: min(70vw, 280px);
  height: min(70vw, 280px);
  margin: 30px auto;
  border-radius: 50%;
  border: 6px solid var(--theme-border, #000);
  background: var(--theme-danger, #FF2D2D);
  color: white;
  font-family: inherit;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.35);
}

.buzz-tap:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.buzz-tap:disabled {
  background: #999;
  box-shadow: none;
  cursor: not-allowed;
}

.buzz-player-status {
  min-height: 1.5em;
  font-weight: bold;
}

/* --- Estimate: number input --- */

.estimate-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 10px;
}

.estimate-input-row input {
  flex: 1;
  font-size: 1.6rem;
  text-align: center;
  margin: 0;
}

.estimate-unit {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--theme-text, #444);
}

.estimate-player-status {
  min-height: 1.5em;
}

.estimate-answer {
  font-size: 1.6rem;
  margin: 16px 0;
}

.estimate-stats {
  color: var(--theme-text, #666);
}

/* Inputs */
input, textarea {
  display: block;
  width: 100%;
  font-size: 1.25rem;
  padding: 18px;
  margin-bottom: 15px;
  border: 3px solid var(--theme-border, #000);
  border-radius: 10px;
  text-align: center;
  background: var(--theme-surface, white);
  color: var(--theme-text, #222);
  font-family: inherit;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--theme-accent, #4a90d9);
}

.char-counter {
  text-align: right;
  font-size: 0.85rem;
  color: #777;
  margin: -8px 0 12px;
}

.response-notice {
  background: #FFE0E0;
  border: 3px solid #FF2D2D;
  border-radius: 10px;
  color: #B00000;
  font-weight: bold;
  padding: 12px;
  margin-bottom: 12px;
  text-align: center;
}

.response-notice[hidden] {
  display: none;
}

#room-code-input {
  font-size: 2rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: bold;
}

#name-input {
  text-align: left;
}

input::placeholder,
textarea::placeholder {
  color: #aaa;
  font-weight: 400;
}

/* Join form labels — permanent labels beat long clipped placeholders
   (2026-07-26 UI review: the old name placeholder didn't fit a narrow screen). */
.join-label {
  display: block;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #555;
  margin: 14px 0 6px;
}

.join-hint {
  text-align: left;
  font-size: 0.8rem;
  color: #777;
  margin: 6px 0 14px;
}

textarea {
  text-align: left;
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
}

/* Buttons */
button {
  display: block;
  width: 100%;
  font-size: 1.4rem;
  padding: 18px;
  margin-top: 10px;
  cursor: pointer;
  border: 3px solid var(--theme-border, #000);
  border-radius: 12px;
  background: var(--theme-button, #FF4081);
  color: var(--theme-button-text, white);
  font-family: inherit;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

button:hover {
  opacity: 0.85;
}

button:active {
  opacity: 0.75;
}

button:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 1;
}

/* display:block above would override the hidden attribute (recurring bug —
   see ask-ai-modal, carousel arrows). Hidden buttons must actually hide. */
button[hidden] {
  display: none;
}

#submit-btn {
  background: var(--theme-success, #5cb85c);
}

/* Pass button (collect steps with passAllowed) — quieter than Submit so it
   reads as a no-pressure option, not the main action. */
.pass-btn {
  background: var(--theme-surface, white);
  color: var(--theme-text, #555);
  font-size: 1.1rem;
  padding: 12px;
  text-transform: none;
  letter-spacing: 0;
}

/* One Voice (cooperative counting) */
.one-voice-tap {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  margin: 24px auto;
  font-size: 4rem;
  font-weight: 900;
  background: var(--theme-button, #FF4081);
  color: var(--theme-button-text, white);
  border: 4px solid var(--theme-border, #000);
}

.one-voice-tap:active:not(:disabled) {
  transform: scale(0.94);
}

.one-voice-status {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--theme-text, #444);
  min-height: 1.4em;
}

/* Merge (think-pair-share) */
.merge-members {
  font-size: 0.95rem;
  color: var(--theme-text, #555);
  margin: 8px 0;
  font-weight: bold;
}

.merge-seeds-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--theme-text, #777);
  margin: 12px 0 6px;
}

.merge-seed {
  background: var(--theme-surface, white);
  border: 2px solid var(--theme-border, #000);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  text-align: left;
  font-size: 1rem;
}

#merge-draft-input {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  font-size: 1.1rem;
  font-family: inherit;
  border: 3px solid var(--theme-border, #000);
  border-radius: 10px;
  resize: vertical;
}

.merge-status {
  font-size: 0.95rem;
  color: var(--theme-text, #555);
  margin: 8px 0 0;
}

#merge-agree-btn {
  background: var(--theme-success, #5cb85c);
}

/* Error message */
#error-message {
  color: var(--theme-danger, #d9534f);
  margin-top: 15px;
  font-weight: bold;
}

/* Prompt display */
.prompt {
  font-size: 1.3rem;
  color: var(--theme-text, #222);
  margin: 20px 0;
  padding: 15px;
  background: var(--theme-surface, white);
  border-radius: 10px;
  border: 3px solid var(--theme-border, #000);
}

/* Status sections */
#waiting-section h1,
#submitted-section h1 {
  color: var(--theme-success, #5cb85c);
}

#reveal-section h1 {
  color: var(--theme-accent, #4a90d9);
}

#end-section h1 {
  color: var(--theme-success, #5cb85c);
}

/* AI result */
.ai-result {
  font-size: 1.25rem;
  color: var(--theme-text, #333);
  padding: 15px;
  background: var(--theme-surface, white);
  border-radius: 8px;
  border: 2px solid var(--theme-border, transparent);
  white-space: pre-wrap;
  text-align: left;
}

.ai-result.chart {
  font-family: "Courier New", Consolas, monospace;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Eliminated banner */
#eliminated-banner {
  background: var(--theme-danger, #f2dede);
  color: var(--theme-button-text, #a94442);
  padding: 12px;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: bold;
  opacity: 0.9;
}

/* Multi-field inputs */
.multi-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
}

.field-label {
  font-weight: bold;
  font-size: 0.95rem;
  color: var(--theme-text, #333);
  margin-top: 4px;
}

.field-input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--theme-accent, #5bc0de);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  box-sizing: border-box;
}

.field-input:focus {
  outline: none;
  border-color: var(--theme-accent, #0057FF);
  box-shadow: 0 0 0 2px rgba(0, 87, 255, 0.2);
}

/* Choice buttons (collect-choice) */
.choice-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.choice-btn {
  background: var(--theme-accent, #5bc0de);
  color: var(--theme-bg, white);
  border: none;
  border-radius: 8px;
  padding: 16px 20px;
  font-size: 1.15rem;
  font-weight: bold;
  text-align: left;
  cursor: pointer;
  word-wrap: break-word;
  white-space: normal;
}

.choice-btn:hover {
  opacity: 0.85;
}

.choice-btn:active {
  opacity: 0.75;
}

/* Vote section */
.vote-btn {
  background: var(--theme-accent, #5bc0de);
  text-align: left;
  padding: 18px 20px;
  font-size: 1.25rem;
  margin-bottom: 8px;
  word-wrap: break-word;
  white-space: normal;
}

.vote-btn:hover {
  opacity: 0.85;
}

.vote-btn:active {
  opacity: 0.75;
}

.vs-label {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--theme-text, #999);
  margin: 5px 0;
  opacity: 0.6;
}

#vote-progress {
  font-size: 1rem;
  color: var(--theme-text, #999);
  margin-bottom: 15px;
  opacity: 0.6;
}

#vote-submitted-section h1 {
  color: var(--theme-success, #5cb85c);
}

/* Elimination results */
#elimination-results-section h1 {
  color: var(--theme-danger, #d9534f);
}

/* Mic button visuals live in shared/design.css; this rule is player-only:
   the mic hides whenever its text box does (choice/drawing/fields modes). */
#response-input[hidden] + .mic-btn { display: none; }

/* Winner section */
#winner-section h1 {
  color: var(--theme-accent, #f0ad4e);
}

#winner-details {
  font-size: 1.5rem;
  color: var(--theme-text, #333);
}

/* What they won for — the winning entry */
.winner-entry {
  background: var(--theme-surface, white);
  border: 2px solid var(--theme-accent, #f0ad4e);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 12px 0;
}

.winner-entry[hidden] { display: none; }

.winner-entry-quote {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--theme-text, #333);
}

.winner-entry-by {
  font-size: 0.95rem;
  margin-top: 4px;
  color: var(--theme-text, #555);
  opacity: 0.75;
}

#standings-list {
  text-align: left;
  margin-top: 15px;
  padding: 15px;
  background: var(--theme-surface, white);
  border-radius: 8px;
  border: 2px solid var(--theme-border, transparent);
}

#standings-list p {
  margin: 8px 0;
  font-size: 1.1rem;
  color: var(--theme-text, #333);
}

/* Screen template (custom content from game config) */
.screen-template {
  white-space: pre-wrap;
  padding: 12px 0;
  font-size: 1.25rem;
  color: var(--theme-text, #333);
  text-align: left;
}

/* Timer bar */
.timer-bar-wrapper {
  margin: 12px 0;
  text-align: center;
}

.timer-bar-text {
  display: block;
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--theme-timer, #4a90d9);
  margin-bottom: 6px;
}

.timer-bar-wrapper.timer-warning .timer-bar-text {
  color: var(--theme-danger, #d9534f);
}

.timer-bar {
  width: 100%;
  height: 6px;
  background: var(--theme-border, #e0e0e0);
  border-radius: 3px;
  overflow: hidden;
}

.timer-bar-fill {
  height: 100%;
  background: var(--theme-timer, #4a90d9);
  border-radius: 3px;
  width: 100%;
  transition: width 1s linear;
}

.timer-bar-wrapper.timer-warning .timer-bar-fill {
  background: var(--theme-danger, #d9534f);
}

/* Leaderboard section */
#leaderboard-rank {
  color: var(--theme-accent, #f0ad4e);
}

#leaderboard-score {
  font-size: 1.3rem;
  color: var(--theme-text, #333);
  margin-bottom: 15px;
}

#leaderboard-standings {
  text-align: left;
  margin-top: 15px;
  padding: 15px;
  background: var(--theme-surface, white);
  border-radius: 8px;
  border: 2px solid var(--theme-border, transparent);
}

#leaderboard-standings p {
  margin: 8px 0;
  font-size: 1.1rem;
  color: var(--theme-text, #333);
}

.leaderboard-highlight {
  background: var(--theme-accent, #FFD600);
  color: var(--theme-button-text, #000);
  font-weight: bold;
  border-radius: 4px;
  padding: 2px 8px;
}

/* Reveal-one section */
.reveal-one-item {
  font-size: 1.2rem;
  padding: 12px 16px;
  margin: 8px 0;
  background: var(--theme-surface, white);
  border: 2px solid var(--theme-border, #eee);
  border-radius: 8px;
  text-align: left;
  animation: revealSlideIn 0.3s ease;
}

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

/* Team-split */
.team-card {
  background: var(--theme-surface, white);
  border: 2px solid var(--theme-border, #ddd);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 8px 0;
  text-align: center;
}

.team-card h3 {
  color: var(--theme-accent, #4a90d9);
  margin: 0 0 6px 0;
}

.team-card p {
  margin: 3px 0;
  font-size: 1rem;
}

.team-highlight {
  font-weight: bold;
  color: var(--theme-accent, #FFD600);
}

/* Rank items */
.rank-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin: 6px 0;
  background: var(--theme-surface, white);
  border: 2px solid var(--theme-border, #ddd);
  border-radius: 8px;
  cursor: grab;
  user-select: none;
  transition: box-shadow 0.1s, opacity 0.1s;
}

.rank-item.rank-dragging {
  opacity: 0.5;
  cursor: grabbing;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.rank-item.rank-drag-over {
  border-color: var(--theme-button, #4a90d9);
  box-shadow: 0 0 0 2px var(--theme-button, #4a90d9);
}

.rank-handle {
  font-size: 1.2rem;
  color: #aaa;
  cursor: grab;
  padding: 0 4px;
  flex-shrink: 0;
}

.rank-item-label {
  flex: 1;
  text-align: left;
  font-size: 1.1rem;
  cursor: grab;
}

.rank-arrow {
  width: 36px;
  height: 36px;
  padding: 0;
  margin: 0;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--theme-button, #4a90d9);
  color: var(--theme-button-text, white);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.rank-arrow:disabled {
  opacity: 0.3;
  background: var(--theme-border, #ccc);
}

/* Drawing pad (collect inputType:"drawing") + drawing renders */
.draw-pad {
  display: block;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  background: #fff;
  border: 3px solid var(--theme-border, #000);
  border-radius: 12px;
  cursor: crosshair;
}

.draw-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 10px 0;
  flex-wrap: wrap;
}

.draw-colors {
  display: flex;
  gap: 6px;
}

.draw-swatch {
  display: inline-block;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  border: 2px solid var(--theme-border, #000);
  border-radius: 50%;
}

.draw-swatch-active {
  outline: 3px solid var(--theme-accent, #FFD600);
}

.draw-tool-btn {
  display: inline-block;
  width: auto;
  font-size: 0.9rem;
  padding: 8px 14px;
  margin: 0;
  background: var(--theme-surface, white);
  color: var(--theme-text, #222);
}

.assigned-drawing {
  display: block;
  width: 100%;
  max-width: 420px;
  margin: 0 auto 10px;
  background: #fff;
  border: 3px solid var(--theme-border, #000);
  border-radius: 12px;
}

/* display:block above overrides the hidden attribute (the recurring bug) */
.assigned-drawing[hidden],
.draw-pad[hidden],
.reveal-drawing[hidden] {
  display: none;
}

/* appendOnly: a classmate's inherited lines, shown read-only above the box */
.inherited-block {
  width: 100%;
  margin: 0 0 10px;
  padding: 12px 14px;
  background: var(--theme-surface, #FFFDE7);
  border: 3px solid var(--theme-border, #000);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.reveal-drawing {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 6px auto 0;
  background: #fff;
  border: 2px solid var(--theme-border, #ddd);
  border-radius: 8px;
}

.reveal-drawing-caption {
  margin: 0 0 4px;
  font-weight: 900;
}

/* Team-split choice mode: tap the team you want */
.team-pick-hint {
  font-size: 0.9rem;
  opacity: 0.7;
  margin: 4px 0 8px;
}

.team-pick-option {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  text-align: left;
  font-size: 1rem;
  padding: 12px 16px;
}

.team-pick-option:disabled {
  opacity: 0.55;
}

.team-pick-mine {
  outline: 4px solid var(--theme-success, #00C853);
}

.team-pick-title {
  font-weight: 900;
  font-size: 1.15rem;
}

.team-pick-names {
  font-weight: 400;
  font-size: 0.9rem;
  opacity: 0.85;
}

/* Sort phase: tap a bucket for every item */
.sort-item {
  padding: 10px 12px;
  margin: 8px 0;
  background: var(--theme-surface, white);
  border: 2px solid var(--theme-border, #ddd);
  border-radius: 8px;
  text-align: left;
}

.sort-item-text {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.sort-bucket-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sort-bucket-btn {
  display: inline-block;
  width: auto;
  flex: 1;
  min-width: 90px;
  font-size: 0.95rem;
  padding: 8px 10px;
  margin: 0;
  border-radius: 16px;
  background: var(--theme-canvas, #f4f0e5);
  color: var(--theme-text, #222);
  border-width: 2px;
}

.sort-bucket-btn.sort-bucket-chosen {
  background: var(--theme-button, #FF4081);
  color: var(--theme-button-text, white);
}

/* Checklist phase: shared group to-do list */
.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  margin: 8px 0;
  background: var(--theme-surface, white);
  color: var(--theme-text, #222);
  border: 2px solid var(--theme-border, #ddd);
  border-radius: 8px;
  text-align: left;
  font-size: 1.05rem;
}

.checklist-item[hidden] { display: none; }

.checklist-item-done {
  background: var(--theme-canvas, #f4f0e5);
}

.checklist-item-done .checklist-item-text {
  text-decoration: line-through;
  opacity: 0.6;
}

.checklist-box {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  line-height: 22px;
  text-align: center;
  border: 2px solid var(--theme-border, #222);
  border-radius: 6px;
  background: var(--theme-surface, white);
  font-weight: bold;
}

.checklist-item-done .checklist-box {
  background: var(--theme-button, #FF4081);
  color: var(--theme-button-text, white);
  border-color: var(--theme-button, #FF4081);
}

.checklist-item-text { flex: 1 1 auto; }

.checklist-item-by {
  flex: 0 0 auto;
  font-size: 0.8rem;
  opacity: 0.6;
}

/* Match phase: left column fixed, right column drag-to-swap */
.match-hint {
  font-size: 0.9rem;
  opacity: 0.7;
  margin: 4px 0 8px;
}

.match-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.match-left {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  background: var(--theme-canvas, #f4f0e5);
  border: 2px solid var(--theme-border, #ddd);
  border-radius: 8px;
  text-align: left;
  font-size: 1rem;
}

.match-arrow-glyph {
  flex-shrink: 0;
  opacity: 0.5;
}

.match-right {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: var(--theme-surface, white);
  border: 2px solid var(--theme-border, #ddd);
  border-radius: 8px;
  cursor: grab;
  user-select: none;
  transition: box-shadow 0.1s, opacity 0.1s;
}

.match-right.rank-dragging {
  opacity: 0.5;
  cursor: grabbing;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.match-row.rank-drag-over .match-right {
  border-color: var(--theme-button, #4a90d9);
  box-shadow: 0 0 0 2px var(--theme-button, #4a90d9);
}

.match-right-label {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-size: 1rem;
  overflow-wrap: break-word;
}

.match-my-score {
  font-size: 1.2rem;
  margin: 12px 0;
}

.match-answer-list p {
  padding: 8px 12px;
  margin: 6px 0;
  background: var(--theme-surface, white);
  border: 2px solid var(--theme-border, #ddd);
  border-radius: 8px;
  text-align: left;
}

/* Phase image (shared across announce/collect/reveal/collect-choice) */
.phase-image {
  display: block;
  max-width: 100%;
  max-height: 50vh;
  margin: 10px auto;
  border: 2px solid var(--theme-border, #000);
  border-radius: 6px;
  object-fit: contain;
  background: var(--theme-surface, white);
}

/* Rate */
.rate-scale {
  margin: 16px 0;
  padding: 14px;
  background: var(--theme-surface, white);
  border: 2px solid var(--theme-border, #ddd);
  border-radius: 8px;
}

.rate-scale-label {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.rate-scale-endlabels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--theme-muted, #666);
  margin-bottom: 6px;
  padding: 0 4px;
}

.rate-scale-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.rate-btn {
  flex: 1;
  min-width: 44px;
  padding: 12px 0;
  font-size: 1.1rem;
  background: var(--theme-button, #4a90d9);
  color: var(--theme-button-text, white);
  border-radius: 6px;
  border: 2px solid transparent;
}

.rate-btn-selected {
  background: var(--theme-success, #5cb85c);
  border-color: var(--theme-success-border, #449d44);
  transform: scale(1.05);
}

/* --- Averages bar chart --- */
.rate-avg-section,
.rate-dist-section {
  margin: 14px 0;
  text-align: left;
}

.rate-avg-section h4,
.rate-dist-section h4 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--theme-muted, #555);
}

.rate-avg-bars {
  background: var(--theme-surface, white);
  border: 1px solid var(--theme-border, #ddd);
  border-radius: 6px;
  padding: 10px 12px;
}

.rate-avg-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  font-size: 0.9rem;
}

.rate-avg-label {
  flex: 0 0 90px;
  font-weight: 600;
}

.rate-avg-bar-track {
  flex: 1;
  height: 14px;
  background: var(--theme-border, #eee);
  border-radius: 3px;
  overflow: hidden;
}

.rate-avg-bar-fill {
  height: 100%;
}

.rate-avg-value {
  flex: 0 0 60px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--theme-muted, #555);
  font-size: 0.85rem;
}

/* --- Pies --- */
.rate-pies {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.rate-pie-card {
  background: var(--theme-surface, white);
  border: 1px solid var(--theme-border, #ddd);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 130px;
  min-width: 130px;
}

.rate-pie-title {
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.rate-pie {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 2px solid var(--theme-border, #000);
}

.rate-pie-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--theme-border, #eee);
  color: var(--theme-muted, #777);
  font-size: 0.75rem;
}

.rate-pie-legend {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
  gap: 2px 6px;
  width: 100%;
}

.rate-pie-legend-row {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.rate-pie-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex: 0 0 10px;
}

.rate-pie-legend-val {
  font-weight: 600;
  color: var(--theme-muted, #555);
}

.rate-pie-legend-count {
  color: var(--theme-muted, #777);
}

/* Wager */
.wager-option-btn {
  background: var(--theme-accent, #5bc0de);
  text-align: left;
  padding: 14px 18px;
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.wager-option-btn.selected {
  background: var(--theme-success, #5cb85c);
  border-color: var(--theme-success, #5cb85c);
}

#wager-amount-section {
  margin: 12px 0;
}

#wager-amount-input {
  text-align: center;
  font-size: 1.5rem;
  padding: 12px;
}

/* Relay */
#relay-shared-display {
  text-align: left;
  padding: 12px;
  margin: 12px 0;
  background: var(--theme-surface, white);
  border: 2px solid var(--theme-border, #ddd);
  border-radius: 8px;
  min-height: 40px;
}

#relay-shared-display p {
  margin: 4px 0;
  font-size: 1rem;
}

#relay-input {
  min-height: 60px;
}

#relay-submit-btn {
  background: var(--theme-success, #5cb85c);
}

/* --- Turn (charades / describe-it) --- */
.turn-role-label { font-size: 1.4em; margin: 12px 0 8px; text-align: center; font-weight: bold; }
.turn-role-label.role-describer { color: #D84315; }
.turn-role-label.role-teammate  { color: #2E7D32; }
.turn-role-label.role-audience  { color: #555; font-weight: normal; font-size: 1.1em; }
.turn-instruction { text-align: center; color: #555; margin: 4px 0 12px; font-style: italic; }
.turn-item { font-size: 1.8em; padding: 24px 16px; text-align: center; margin: 12px 0; background: #FFF59D; border: 3px solid #000; border-radius: 12px; font-weight: bold; min-height: 60px; word-wrap: break-word; }
.turn-team-line { text-align: center; color: #666; margin: 8px 0 16px; }
.turn-remaining { text-align: center; color: #999; font-size: 0.9em; margin-top: 12px; }
#turn-controls { display: flex; gap: 12px; margin-top: 16px; }
.turn-got-btn { flex: 2; background: var(--theme-success, #2E7D32); color: white; font-size: 1.3em; padding: 18px; border-radius: 12px; border: 3px solid #000; cursor: pointer; font-weight: bold; }
.turn-got-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.turn-skip-btn { flex: 1; background: var(--theme-warn, #FB8C00); color: white; font-size: 1.1em; padding: 18px; border-radius: 12px; border: 3px solid #000; cursor: pointer; }
.turn-skip-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* CSS display beats the hidden attribute — same stray-dot fix as host */
.phase-image[hidden], .phase-video[hidden], .screen-template[hidden] { display: none; }

/* Projector-style message formatting, scaled for a Chromebook screen */
.msg-headline {
  display: block;
  font-size: 1.15em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.msg-body {
  display: block;
  text-align: left;
  white-space: pre-line;
  max-width: 40ch;
  margin: 0 auto;
  font-family: 'Nunito', Arial, sans-serif;
  font-weight: 700;
  font-size: 0.72em;
  line-height: 1.5;
}

.msg-list { display: flex; flex-direction: column; gap: 8px; max-width: 44ch; margin: 0 auto; }
.msg-card {
  display: flex; align-items: baseline; gap: 8px; text-align: left;
  background: var(--theme-surface, #fff); border: 2px solid var(--theme-border, #000);
  border-radius: 10px; padding: 8px 12px;
  font-family: 'Nunito', Arial, sans-serif; font-weight: 700; font-size: 0.65em; line-height: 1.4;
}
.msg-card-num { font-family: 'Archivo Black', 'Arial Black', Arial, sans-serif; font-size: 0.85em; opacity: 0.5; flex-shrink: 0; }

/* --- Holding screens (2026-08-08): waits show the room, not a void --- */
.holding-progress {
  font-family: 'Archivo Black', 'Arial Black', Arial, sans-serif;
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  color: var(--theme-heading, #222);
  margin: 14px 0 4px;
}
.holding-next {
  font-family: 'Nunito', Arial, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--theme-text, #666);
  opacity: 0.75;
}
.holding-avatars {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 12px 0;
}
.holding-avatar-chip {
  font-family: 'Nunito', Arial, sans-serif;
  font-weight: 800;
  font-size: 0.9rem;
  background: var(--theme-surface, #fff);
  border: 2px solid var(--theme-border, #000);
  border-radius: 999px;
  padding: 5px 14px;
  animation: holding-chip-pop 0.25s ease;
}
.holding-dots {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 18px 0 10px;
}
.holding-dots span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--theme-heading, #222);
  opacity: 0.25;
  animation: holding-pulse 1.3s ease-in-out infinite;
}
.holding-dots span:nth-child(2) { animation-delay: 0.22s; }
.holding-dots span:nth-child(3) { animation-delay: 0.44s; }
@keyframes holding-pulse {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.3); }
}
@keyframes holding-chip-pop {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .holding-dots span { animation: none; opacity: 0.5; }
  .holding-avatar-chip { animation: none; }
}

/* ════════════════════════════════════════════════════════════════
   PASTE-UP SKIN (docs/paper-layout-test/) — structural re-theme.
   Colors flow through the --theme-* variables (default preset
   'paste-up' in shared/themes.js; per-game themes still override).
   Cut paper on a grained gesso ground: no borders, 2px radii, hard
   paste shadows, 90ms two-step snaps. Appended last so it wins.
   ════════════════════════════════════════════════════════════════ */

body {
  font-family: 'Nunito', Arial, sans-serif;
  font-weight: 600;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    radial-gradient(rgba(120,105,80,0.35) 0.5px, transparent 0.6px),
    radial-gradient(rgba(80,70,55,0.22) 0.5px, transparent 0.6px);
  background-size: 4px 4px, 7px 7px;
  background-position: 0 0, 2px 3px;
}

h1,
.holding-progress,
.timer-bar-text {
  font-family: 'Archivo Black', 'Arial Black', Arial, sans-serif;
  font-weight: 400;
}

/* The question is the spoken line, serif with a whisper of misprint */
.prompt {
  font-family: 'EB Garamond', Georgia, serif;
  font-weight: 400;
  font-size: 1.4rem;
  text-shadow: 1px 0 0 rgba(217,72,28,0.24), -1px 0 0 rgba(0,165,196,0.18);
}

/* Hard cuts between phases */
section {
  transition: none;
  transform: none;
}

/* Buttons are paper cuts with the two-step snap */
button {
  border: none;
  border-radius: 2px;
  box-shadow: 3px 3px 0 rgba(34,30,28,0.18);
  font-family: 'Archivo Black', 'Arial Black', Arial, sans-serif;
  font-weight: 400;
  transition: transform 90ms steps(2, end), box-shadow 90ms steps(2, end);
}

button:hover {
  opacity: 1;
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(34,30,28,0.18);
}

button:active {
  opacity: 1;
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 rgba(34,30,28,0.18);
}

button:disabled {
  background: #D8D2C4;
  color: #857A66;
  box-shadow: none;
  transform: none;
}

/* Join is the student's "go" moment, same loud color as Submit */
#join-btn {
  background: var(--theme-success, #D9481C);
  color: #FFF6EA;
}

/* The pass button stays quiet: readable Nunito on scrap */
.pass-btn {
  font-family: 'Nunito', Arial, sans-serif;
  font-weight: 800;
  box-shadow: 2px 2px 0 rgba(34,30,28,0.14), 0 0 0 1px rgba(34,30,28,0.10);
}

/* Inputs sit square with an inset shadow */
input, textarea, .field-input, #merge-draft-input {
  border: none;
  background: #FFFDF6;
  border-radius: 2px;
  box-shadow: inset 2px 2px 0 rgba(34,30,28,0.10), 0 0 0 1px rgba(34,30,28,0.16);
  font-family: 'Nunito', Arial, sans-serif;
  font-weight: 600;
}

input:focus, textarea:focus, .field-input:focus, #merge-draft-input:focus {
  border: none;
  box-shadow: inset 2px 2px 0 rgba(34,30,28,0.10), 0 0 0 2px var(--theme-text, #221E1C);
}

#room-code-input {
  font-family: 'Archivo Black', 'Arial Black', Arial, sans-serif;
  font-weight: 400;
}

input::placeholder, textarea::placeholder {
  color: #9A8F7C;
  font-family: 'Nunito', Arial, sans-serif;
}

.join-label { color: #6E6353; }
.join-hint { color: #857A66; }
.char-counter { color: #857A66; }

/* Paper panels and rows */
.prompt,
.ai-result,
#standings-list,
#leaderboard-standings,
.winner-entry,
.screen-template,
.merge-seed,
.inherited-block,
#relay-shared-display,
.reveal-one-item,
.team-card,
.rank-item,
.sort-item,
.checklist-item,
.match-left,
.match-right,
.match-answer-list p,
.rate-scale,
.rate-avg-bars,
.rate-pie-card,
.msg-card {
  border: none;
  border-radius: 2px;
  box-shadow: 2px 2px 0 rgba(34,30,28,0.12), 0 0 0 1px rgba(34,30,28,0.08);
}

.prompt {
  box-shadow: 4px 4px 0 rgba(34,30,28,0.10);
  transform: rotate(-0.3deg);
}

.winner-entry {
  box-shadow: 4px 4px 0 rgba(34,30,28,0.10), 0 0 0 2px var(--theme-success, #D9481C);
  transform: rotate(0.4deg);
}

/* Choice and vote buttons: ink cuts, left-aligned reading */
.choice-btn,
.vote-btn,
.wager-option-btn {
  border-radius: 2px;
  box-shadow: 3px 3px 0 rgba(34,30,28,0.18);
  font-family: 'Nunito', Arial, sans-serif;
  font-weight: 800;
  color: var(--theme-button-text, #FBF7EC);
}

/* Selection states flip to the loud color via the theme vars already */

/* Buzzer and one-voice taps: big paper cuts, not circles */
.buzz-tap {
  border: none;
  border-radius: 2px;
  background: var(--theme-success, #D9481C);
  transform: rotate(-1deg);
  box-shadow: 6px 6px 0 rgba(34,30,28,0.22);
  transition: transform 90ms steps(2, end), box-shadow 90ms steps(2, end);
}

.buzz-tap:active {
  transform: rotate(-1deg) translate(5px, 5px);
  box-shadow: 0 0 0 rgba(34,30,28,0.22);
}

.buzz-tap:disabled {
  background: #D8D2C4;
  color: #857A66;
  box-shadow: none;
  transform: none;
}

.one-voice-tap {
  border: none;
  border-radius: 2px;
  transform: rotate(1deg);
  box-shadow: 6px 6px 0 rgba(34,30,28,0.22);
}

.one-voice-tap:active:not(:disabled) {
  transform: rotate(1deg) translate(5px, 5px);
  box-shadow: 0 0 0 rgba(34,30,28,0.22);
}

/* Notices */
.response-notice {
  border: none;
  border-radius: 2px;
  background: #FFFDF6;
  color: var(--theme-danger, #AE3A16);
  box-shadow: 2px 2px 0 rgba(34,30,28,0.14), 0 0 0 2px var(--theme-danger, #AE3A16);
  font-family: 'Nunito', Arial, sans-serif;
  font-weight: 800;
}

#eliminated-banner {
  border-radius: 2px;
  box-shadow: 2px 2px 0 rgba(34,30,28,0.16);
}

/* Timer bar: quiet square track */
.timer-bar {
  border-radius: 2px;
  background: rgba(34,30,28,0.12);
}

.timer-bar-fill { border-radius: 2px; }

/* Drawing pad: white paper on the gesso */
.draw-pad,
.assigned-drawing,
.reveal-drawing,
.phase-image {
  border: none;
  border-radius: 2px;
  box-shadow: 3px 3px 0 rgba(34,30,28,0.14), 0 0 0 1px rgba(34,30,28,0.10);
}

.draw-swatch { border-radius: 2px; }
.draw-swatch-active { outline: 3px solid var(--theme-text, #221E1C); outline-offset: 1px; }

.draw-tool-btn {
  font-family: 'Nunito', Arial, sans-serif;
  font-weight: 800;
  box-shadow: 2px 2px 0 rgba(34,30,28,0.14), 0 0 0 1px rgba(34,30,28,0.10);
}

/* Rank / match drag affordances keep their motion cues */
.rank-item.rank-drag-over {
  border: none;
  box-shadow: 2px 2px 0 rgba(34,30,28,0.12), 0 0 0 2px var(--theme-success, #D9481C);
}

.match-row.rank-drag-over .match-right {
  border: none;
  box-shadow: 2px 2px 0 rgba(34,30,28,0.12), 0 0 0 2px var(--theme-success, #D9481C);
}

.rank-arrow { border-radius: 2px; }

.sort-bucket-btn {
  border-radius: 2px;
  font-family: 'Nunito', Arial, sans-serif;
  font-weight: 800;
  background: #FFFDF6;
  color: var(--theme-text, #221E1C);
  box-shadow: 2px 2px 0 rgba(34,30,28,0.14), 0 0 0 1px rgba(34,30,28,0.10);
}

.sort-bucket-btn.sort-bucket-chosen {
  background: var(--theme-button, #221E1C);
  color: var(--theme-button-text, #FBF7EC);
}

.checklist-box {
  border: none;
  border-radius: 2px;
  box-shadow: 0 0 0 2px rgba(34,30,28,0.55);
}

.checklist-item-done .checklist-box {
  background: var(--theme-success, #D9481C);
  color: #FFF6EA;
  box-shadow: 0 0 0 2px var(--theme-success, #D9481C);
}

.team-pick-mine {
  outline: 3px solid var(--theme-success, #D9481C);
  outline-offset: 1px;
}

/* Holding screen chips: little scraps */
.holding-avatar-chip {
  border: none;
  border-radius: 2px;
  box-shadow: 2px 2px 0 rgba(34,30,28,0.12);
}

.holding-avatar-chip:nth-child(odd) { transform: rotate(-0.8deg); }
.holding-avatar-chip:nth-child(even) { transform: rotate(0.7deg); }

.leaderboard-highlight { border-radius: 2px; }

/* Turn phase cards */
.turn-item {
  border: none;
  border-radius: 2px;
  background: var(--theme-surface, #FBF7EC);
  box-shadow: 4px 4px 0 rgba(34,30,28,0.12);
  transform: rotate(-0.4deg);
}

.turn-got-btn,
.turn-skip-btn {
  border: none;
  border-radius: 2px;
  box-shadow: 3px 3px 0 rgba(34,30,28,0.18);
}

.turn-role-label.role-describer { color: var(--theme-success, #D9481C); }
.turn-role-label.role-teammate { color: var(--theme-text, #221E1C); }
