:root {
  --ink: #1a1410;
  --muted: #8b7355;
  --line: rgba(139, 115, 85, 0.15);
  --panel: rgba(255, 252, 240, 0.92);
  --panel-strong: rgba(255, 252, 240, 0.98);
  --violet: #d4af37;
  --pink: #e6a857;
  --blue: #f0c674;
  --yellow: #ffd700;
  --danger: #ff4f6d;
  --shadow: 0 24px 70px rgba(212, 175, 55, 0.18);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Poppins", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 252, 240, 0.98) 0 18%, transparent 38%),
    radial-gradient(circle at 82% 14%, rgba(240, 198, 116, 0.4) 0 20%, transparent 42%),
    linear-gradient(145deg, #fffbf0 0%, #fff8e7 48%, #fffaf2 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.2) 0 1px, transparent 1px 90px);
}

button {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
  position: relative;
}

.header {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.eyebrow,
.panel-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header h1 {
  margin-top: 4px;
  font-size: clamp(2rem, 5vw, 4.3rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.global-timer {
  min-width: 156px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  color: #5a51ca;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.global-timer.danger {
  color: var(--danger);
  animation: pulse 0.8s infinite;
}

.main-content {
  display: grid;
  grid-template-columns: minmax(340px, 1.1fr) minmax(300px, 0.9fr);
  gap: 20px;
  align-items: stretch;
}

.wheel-card,
.turn-panel,
.remaining-section {
  border: 2px solid #d4af37;
  background: var(--panel);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.wheel-card {
  min-height: 620px;
  border-radius: 34px;
  padding: 24px;
  overflow: hidden;
}

.wheel-topline,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.wheel-topline span:last-child,
.section-heading span {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(143, 124, 255, 0.12);
  color: #6558d7;
  white-space: nowrap;
}

.wheel-section {
  min-height: 540px;
  display: grid;
  place-items: center;
  position: relative;
}

.pointer {
  width: 0;
  height: 0;
  position: absolute;
  top: 24px;
  left: 50%;
  z-index: 4;
  transform: translateX(-50%);
  border-left: 30px solid transparent;
  border-right: 30px solid transparent;
  border-top: 58px solid #d4af37;
  filter: drop-shadow(0 12px 14px rgba(212, 175, 55, 0.35));
}

#wheel {
  width: min(100%, 520px);
  aspect-ratio: 1;
  height: auto;
  border-radius: 50%;
  cursor: pointer;
  filter: drop-shadow(0 34px 44px rgba(73, 68, 128, 0.28));
  transition: transform 0.25s ease, filter 0.25s ease;
}

#wheel:hover {
  transform: translateY(-2px) scale(1.01);
  filter: drop-shadow(0 40px 52px rgba(73, 68, 128, 0.32));
}

#wheel.spinning {
  cursor: wait;
}

.turn-panel {
  min-height: 350px;
  border-radius: 28px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.speaker-name {
  min-height: 76px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  color: #2f3142;
  font-size: clamp(2rem, 4vw, 3.7rem);
  font-weight: 800;
  line-height: 1.05;
}

.speaker-name.new {
  animation: slideUp 0.4s ease;
}

.speaker-timer {
  margin-top: 12px;
  color: #7062e8;
  font-size: clamp(2.2rem, 6vw, 5.5rem);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.speaker-timer.danger {
  color: var(--danger);
  animation: pulse 0.5s infinite;
}

.progress-bar {
  width: 100%;
  height: 12px;
  margin: 28px 0;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(18, 20, 32, 0.08);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #91c6ff, #9b86ff, #ef9cff);
  transition: width 0.18s linear;
}

.progress-fill.danger {
  background: linear-gradient(90deg, #ffb25f, #ff4f6d);
}

.button-group {
  display: flex;
  gap: 12px;
}

.btn {
  min-height: 56px;
  flex: 1;
  border: 0;
  border-radius: 18px;
  padding: 14px 22px;
  cursor: pointer;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(96, 80, 190, 0.24);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #d4af37, #f0c674);
}

.btn-pass {
  background: linear-gradient(135deg, #e6a857, #d4af37);
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(96, 80, 190, 0.32);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.remaining-section {
  grid-column: 1 / -1;
  border-radius: 26px;
  padding: 22px;
}

.section-heading h2 {
  color: var(--ink);
  font-size: 1.2rem;
}

.participants-chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.chip {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid #d4af37;
  border-radius: 16px;
  background: rgba(255, 252, 240, 0.95);
  color: #1a1410;
  font-size: 0.9rem;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(212, 175, 55, 0.08);
  transition: transform 0.2s ease, opacity 0.2s ease;
  position: relative;
}

.chip::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border-radius: 50%;
  background: var(--chip-color, var(--violet));
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--chip-color, var(--violet)) 18%, transparent);
}

.chip:hover {
  transform: translateY(-2px);
}

.chip.spoken {
  opacity: 0.4;
  text-decoration: line-through;
}

.chip-remove {
  background: none;
  border: none;
  color: #ff4f6d;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, color 0.2s ease;
}

.chip-remove:hover {
  transform: scale(1.2);
  color: #ff1e3d;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(39, 43, 70, 0.4);
  backdrop-filter: blur(10px);
}

.modal-content {
  width: min(420px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: 28px;
  padding: 38px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  text-align: center;
  animation: popIn 0.35s ease;
}

.modal-content h2 {
  font-size: 2rem;
}

.modal-content p {
  margin: 10px 0 24px;
  color: var(--muted);
}

#confetti-container {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  pointer-events: none;
  animation: fall 3s ease-out forwards;
}

@keyframes fall {
  to {
    opacity: 0;
    transform: translateY(100vh) rotate(360deg);
  }
}

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

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 900px) {
  .main-content {
    grid-template-columns: 1fr;
  }

  .wheel-card {
    min-height: auto;
  }

  .wheel-section {
    min-height: min(82vw, 540px);
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 14px 0;
  }

  .header {
    align-items: stretch;
    flex-direction: column;
    margin-bottom: 12px;
  }

  .global-timer {
    width: 100%;
  }

  .wheel-card,
  .turn-panel,
  .remaining-section {
    border-radius: 22px;
  }

  .wheel-card,
  .turn-panel {
    padding: 18px;
  }

  .pointer {
    top: 18px;
    border-left-width: 22px;
    border-right-width: 22px;
    border-top-width: 42px;
  }

  .speaker-name {
    min-height: 58px;
  }

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

  .participants-chips {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
