/* ==========================================================================
   RULETA BYTE DE TECNOLOGÍA - SYSTEM CSS
   Format: Desktop 4:5 Aspect Ratio (Optimized for Side-by-Side OBS Streaming)
   Palette: Light Lime, Hot Pink, Dark Navy
   ========================================================================== */

:root {
  --bg-lime: #bfe98f;
  --bg-lime-light: #cbf29d;
  --navy-dark: #141928;
  --navy-card: #192036;
  --navy-panel: #1e2640;
  --pink-accent: #f02a8b;
  --pink-hover: #d91c78;
  --pink-light: #ff68b4;
  --lime-accent: #9beb32;
  --lime-hover: #89d823;
  --text-white: #ffffff;
  --text-muted: #8b99b5;
  --border-navy: #141928;
  --font-main: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-display: 'Fredoka', cursive, sans-serif;
  --shadow-card: 0 16px 32px rgba(20, 25, 40, 0.15);
  --shadow-btn: 0 6px 14px rgba(0, 0, 0, 0.12);
}

/* Reset & Global Rules */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-lime);
  color: var(--navy-dark);
  font-family: var(--font-main);
  overflow: hidden;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Halftone Corner Pattern Background */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(var(--bg-lime-light) 20%, transparent 20%),
    radial-gradient(rgba(148, 228, 53, 0.35) 20%, transparent 20%);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
  opacity: 0.8;
  z-index: -1;
  pointer-events: none;
}

/* 4:5 Aspect Ratio OBS Viewport Container (Vertical / Side-by-Side Friendly) */
.app-viewport {
  width: 100vw;
  height: 100vh;
  max-width: 1080px;
  max-height: 1350px;
  aspect-ratio: 4 / 5;
  margin: 0 auto;
  padding: 1rem 1.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.8rem;
  overflow-y: auto;
}

/* Custom Scrollbar for 4:5 Container */
.app-viewport::-webkit-scrollbar {
  width: 6px;
}
.app-viewport::-webkit-scrollbar-thumb {
  background: rgba(20, 25, 40, 0.2);
  border-radius: 4px;
}

/* ==========================================================================
   HEADER SECTION (Compact 4:5 Header)
   ========================================================================== */
.main-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 4px;
}

.header-top-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 22px;
  width: 100%;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
}

.brand-logo {
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
  transition: transform 0.3s ease;
}

.brand-logo:hover {
  transform: rotate(-10deg) scale(1.05);
}

.donut-logo-img {
  width: 100%;
  height: 100%;
}

.brand-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-family: var(--font-display);
  line-height: 0.92;
  letter-spacing: -0.5px;
  color: var(--navy-dark);
}

.title-bold {
  font-weight: 700;
  font-size: 2.05rem;
}

.title-light {
  font-weight: 500;
  font-size: 1.02rem;
  margin-left: 1px;
  margin-top: 6px;
}

.header-actions-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.header-event-title {
  min-width: 0;
  flex: 1 1 auto;
  padding-left: 20px;
  border-left: 2px solid rgba(20, 25, 40, 0.18);
}

.header-event-title span {
  display: block;
  color: var(--pink-accent);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.header-event-title h2 {
  overflow: hidden;
  color: var(--navy-dark);
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2.4vw, 1.55rem);
  line-height: 1.05;
  text-overflow: ellipsis;
}

.config-trigger-btn {
  background-color: #ffffff;
  color: var(--navy-dark);
  border: 2.5px solid var(--navy-dark);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
  padding: 6px 12px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
  transition: all 0.2s ease;
}

.config-trigger-btn:hover {
  background-color: var(--navy-dark);
  color: #ffffff;
  transform: translateY(-2px);
}

.camera-view-btn {
  background: var(--navy-dark);
  color: #fff;
  border: 2.5px solid var(--navy-dark);
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.4px;
  padding: 6px 11px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.camera-view-btn:hover {
  background: var(--pink-accent);
  border-color: var(--pink-accent);
}

/* Stats Bar - Compact 4:5 Horizontal Grid */
.header-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
}

.stat-badge {
  background-color: var(--navy-card);
  color: var(--text-white);
  border: 2px solid var(--navy-dark);
  border-radius: 12px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}

.stat-icon {
  color: var(--lime-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.pink-icon {
  color: var(--pink-accent);
}

.stat-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.stat-label {
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-white);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Live Badge & Youtube Button */
.live-pill-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-badge {
  background-color: var(--pink-accent);
  color: var(--text-white);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 6px 10px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 10px rgba(240, 42, 139, 0.3);
}

.live-dot {
  width: 7px;
  height: 7px;
  background-color: #ffffff;
  border-radius: 50%;
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

.yt-link-btn {
  background-color: #e62117;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(230, 33, 23, 0.3);
  transition: transform 0.2s ease;
}

.yt-link-btn:hover {
  transform: scale(1.1);
}

/* ==========================================================================
   MAIN CONTENT (4:5 STACKED LAYOUT)
   ========================================================================== */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  flex: 1;
  align-items: center;
  width: 100%;
}

/* ==========================================================================
   ROULETTE STAGE (UPPER MID)
   ========================================================================== */
.roulette-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
}

.event-heading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin: 2px 0 23px;
  text-align: center;
}

.spin-progress-pill {
  margin-top: 3px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--navy-dark);
  color: #fff;
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.07em;
}

/* Wheel Stage Container - Scaled for 4:5 Ratio */
.wheel-stage {
  position: relative;
  width: 390px;
  height: 390px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32px;
}

/* Top Pointer Pin (Teardrop) */
.wheel-pointer {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.25));
}

.pointer-pin {
  width: 28px;
  height: 38px;
  background-color: var(--pink-accent);
  border: 3px solid var(--navy-dark);
  clip-path: polygon(50% 100%, 0% 25%, 20% 0%, 80% 0%, 100% 25%);
  border-radius: 6px 6px 0 0;
  position: relative;
}

.pointer-pin::after {
  content: '';
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  background-color: #ffffff;
  border-radius: 50%;
}

/* Outer Ring & Bulbs */
.wheel-outer-ring {
  width: 375px;
  height: 375px;
  border-radius: 50%;
  background-color: var(--navy-dark);
  border: 5px solid var(--navy-dark);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 36px rgba(20, 25, 40, 0.3);
}

.bulbs-container {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  pointer-events: none;
  z-index: 5;
}

.bulb {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: #fff;
  border: 1.5px solid var(--navy-dark);
  top: 50%;
  left: 50%;
  margin-top: -4.5px;
  margin-left: -4.5px;
  transition: background-color 0.15s ease;
}

.bulb.active-lime { background-color: var(--lime-accent); box-shadow: 0 0 8px var(--lime-accent); }
.bulb.active-pink { background-color: var(--pink-accent); box-shadow: 0 0 8px var(--pink-accent); }
.bulb.active-white { background-color: #ffffff; box-shadow: 0 0 6px #ffffff; }

/* Canvas Wheel */
#rouletteCanvas {
  width: 345px;
  height: 345px;
  border-radius: 50%;
  z-index: 2;
  cursor: pointer;
  transition: transform 0.05s linear;
}

/* Center Donut Cap */
.wheel-center-cap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90px;
  height: 90px;
  background-color: #ffffff;
  border: 5px solid var(--navy-dark);
  border-radius: 50%;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.wheel-center-cap:hover {
  transform: translate(-50%, -50%) scale(1.08);
}

.center-cap-inner {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.center-donut-img {
  width: 100%;
  height: 100%;
}

/* Wheel Bottom Controls */
.wheel-bottom-bar {
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}

.live-info-card {
  background-color: var(--navy-card);
  color: #ffffff;
  border: 2px solid var(--navy-dark);
  border-radius: 12px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.green-indicator-dot {
  width: 10px;
  height: 10px;
  background-color: var(--lime-accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--lime-accent);
}

.live-info-card strong {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.live-info-card small {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
}

.sound-toggle-card {
  background-color: #ffffff;
  border: 2px solid var(--navy-dark);
  border-radius: 12px;
  padding: 5px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 0.75rem;
  color: var(--navy-dark);
}

.sound-label {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Switch Toggle Styling */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-round {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #c7d2e5;
  transition: .3s;
  border-radius: 22px;
  border: 2px solid var(--navy-dark);
}

.slider-round:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background-color: var(--navy-dark);
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider-round {
  background-color: var(--lime-accent);
}

input:checked + .slider-round:before {
  transform: translateX(18px);
}

/* ==========================================================================
   WINNER DISPLAY CARD & RECENT WINNERS (LOWER MID & BOTTOM)
   ========================================================================== */
.winner-section {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  width: 100%;
}

/* WINNER MAIN CARD */
.winner-card {
  background-color: var(--navy-card);
  color: var(--text-white);
  border: 3.5px solid var(--navy-dark);
  border-radius: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Pink Scallop Top Edge */
.scallop-top-border {
  height: 14px;
  width: 100%;
  background-color: var(--pink-accent);
  mask-image: radial-gradient(circle at 8px 14px, transparent 8px, black 9px);
  mask-size: 16px 16px;
  mask-repeat: repeat-x;
  border-bottom: 2px solid var(--navy-dark);
}

.winner-card-body {
  padding: 1rem 1.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  position: relative;
  z-index: 2;
}

.winner-number-summary,
.winner-identity-summary {
  display: contents;
}

/* Pink Ribbon Banner */
.ribbon-banner {
  background-color: var(--pink-accent);
  color: #ffffff;
  padding: 6px 28px;
  border-radius: 10px;
  position: relative;
  display: inline-block;
  box-shadow: 0 4px 14px rgba(240, 42, 139, 0.4);
  border: 2px solid var(--navy-dark);
  transform: translateY(-4px);
}

.ribbon-text {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 1.2px;
}

.ribbon-banner::before, .ribbon-banner::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 14px;
  height: 100%;
  background-color: #c7166e;
  z-index: -1;
}

.ribbon-banner::before { left: -8px; transform: translateY(-50%) skewY(15deg); }
.ribbon-banner::after { right: -8px; transform: translateY(-50%) skewY(-15deg); }

/* Number Display Row */
.selected-number-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.number-line {
  height: 2px;
  flex: 1;
  max-width: 70px;
  background-color: rgba(255, 255, 255, 0.2);
}

.selected-number-text {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--lime-accent);
  letter-spacing: 1px;
}

/* Nick Large Text Display */
.nick-display-container {
  margin: 0.1rem 0;
}

.winner-nick-text {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.1;
  text-shadow: 0 4px 10px rgba(0,0,0,0.3);
  word-break: break-word;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.winner-nick-text.pop-anim {
  animation: pop-text 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-message-text {
  max-width: 90%;
  color: var(--pink-light);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.15;
}

.winner-card.is-losing:not(.has-selection) .selected-number-row,
.winner-card.is-losing:not(.has-selection) .nick-display-container,
.winner-card.is-losing .privacy-badge {
  display: none;
}

.winner-card.is-losing .result-message-text {
  margin: 12px 0 16px;
  color: #fff;
  font-size: clamp(1.8rem, 5vw, 3rem);
}

.winner-card.is-winner .ribbon-banner {
  background: var(--lime-accent);
  color: var(--navy-dark);
  box-shadow: 0 4px 18px rgba(155, 235, 50, 0.45);
}

.winner-card.is-winner .ribbon-banner::before,
.winner-card.is-winner .ribbon-banner::after {
  background: #70b719;
}

@keyframes pop-text {
  0% { transform: scale(0.7); opacity: 0; }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

/* Privacy Badge */
.privacy-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: rgba(255, 255, 255, 0.05);
  padding: 3px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Action Buttons Row */
.winner-actions-row {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}

.btn {
  flex: 1;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2.5px solid var(--navy-dark);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-btn);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.btn:active {
  transform: translateY(1px);
}

.btn-spin-again {
  background-color: var(--lime-accent);
  color: var(--navy-dark);
}

.btn-spin-again:hover {
  background-color: var(--lime-hover);
}

.btn-confirm-winner {
  background-color: var(--pink-accent);
  color: #ffffff;
}

.btn-confirm-winner:hover {
  background-color: var(--pink-hover);
}

/* Hide Result Row */
.hide-result-row {
  width: 100%;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hide-result-info {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  color: var(--text-white);
}

.hide-result-info strong {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
}

.hide-result-info span {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Confetti Layer */
.confetti-layer {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

/* RECENT WINNERS CARD */
.recent-winners-card {
  background-color: #d6faab;
  border: 3px solid var(--navy-dark);
  border-radius: 18px;
  padding: 0.8rem 1rem;
  width: 100%;
}

.recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.recent-title {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--navy-dark);
}

.view-history-btn {
  background: none;
  border: none;
  font-family: var(--font-main);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--navy-dark);
  cursor: pointer;
  letter-spacing: 0.5px;
}

.view-history-btn:hover {
  text-decoration: underline;
}

.recent-winners-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
}

.winner-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(255, 255, 255, 0.65);
  border: 1.5px solid var(--navy-dark);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--navy-dark);
}

.winner-item-spin {
  font-size: 0.68rem;
  color: #5b657e;
  width: 16px;
}

.winner-item-num {
  font-weight: 800;
  color: var(--navy-dark);
}

.winner-item-nick {
  flex: 1;
  margin: 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.winner-item-time {
  font-size: 0.65rem;
  color: #636d85;
}

/* ==========================================================================
   MODALS STYLING
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background-color: rgba(20, 25, 40, 0.75);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background-color: var(--navy-card);
  color: var(--text-white);
  border: 4px solid var(--navy-dark);
  border-radius: 24px;
  width: 92%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,0.4);
  transform: translateY(20px);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-card.modal-large {
  max-width: 920px;
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  padding: 1rem 1.4rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-white);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 1.2rem 1.4rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.config-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.config-label {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--lime-accent);
}

.badge-count {
  background-color: var(--pink-accent);
  color: white;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 800;
}

.config-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.config-input, .config-textarea, .config-select {
  width: 100%;
  background-color: rgba(255, 255, 255, 0.07);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 9px 12px;
  color: #ffffff;
  font-family: var(--font-main);
  font-size: 0.88rem;
  outline: none;
}

.config-select {
  min-height: 42px;
  color-scheme: dark;
}

.config-select option {
  background-color: var(--navy-panel);
  color: #ffffff;
}

.config-input:focus, .config-textarea:focus, .config-select:focus {
  border-color: var(--lime-accent);
}

.config-textarea {
  resize: vertical;
  line-height: 1.5;
}

.preset-buttons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.preset-buttons-row .btn-secondary {
  flex: 1 1 145px;
}

.demo-hint {
  margin-top: 2px;
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.12);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.22);
}

/* Sheets Config Box */
.sheets-config-box {
  background-color: rgba(15, 157, 88, 0.1);
  border: 2px dashed rgba(15, 157, 88, 0.4);
  border-radius: 14px;
  padding: 1rem;
}

.sheets-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.sheets-header h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  color: #34a853;
}

.sheets-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.sheets-status-badge {
  font-size: 0.75rem;
  color: #34a853;
  font-weight: 700;
}

/* Danger Zone Box */
.danger-box {
  background-color: rgba(240, 42, 139, 0.08);
  border: 2px dashed rgba(240, 42, 139, 0.3);
  border-radius: 14px;
  padding: 0.9rem;
}

.danger-box h3 {
  font-size: 0.85rem;
  color: var(--pink-accent);
  margin-bottom: 6px;
}

.danger-buttons {
  display: flex;
  gap: 8px;
}

.btn-danger {
  background-color: rgba(240, 42, 139, 0.2);
  color: var(--pink-accent);
  border: 2px solid var(--pink-accent);
  padding: 6px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.75rem;
  cursor: pointer;
}

.btn-danger:hover {
  background-color: var(--pink-accent);
  color: white;
}

.modal-footer {
  padding: 0.8rem 1.4rem;
  border-top: 2px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* History Table Styling */
.table-container {
  max-height: 320px;
  overflow-y: auto;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

.history-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.8rem;
}

.history-table th, .history-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: top;
}

.history-table th {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--lime-accent);
  font-family: var(--font-display);
  position: sticky;
  top: 0;
}

.history-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-count-tag {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Flexible importer and adaptive wheel metadata */
.wheel-data-note {
  position: relative;
  z-index: 12;
  margin-top: 0;
  padding: 3px 11px;
  border-radius: 999px;
  background: rgba(191, 233, 143, 0.9);
  color: var(--navy-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.file-button {
  display: inline-flex;
  align-items: center;
}

.file-button input {
  display: none;
}

.sheets-actions {
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.sheets-status-badge {
  margin-left: auto;
}

.import-builder {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin-top: 10px;
  padding-top: 12px;
}

.sequence-config-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 1rem;
  border: 2px solid rgba(155, 235, 50, 0.28);
  border-radius: 14px;
  background: rgba(155, 235, 50, 0.07);
}

.sequence-config-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sequence-config-header h3 {
  color: var(--lime-accent);
  font-family: var(--font-display);
  font-size: 1rem;
}

.sequence-live-badge {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--pink-accent);
  font-size: 0.68rem;
  font-weight: 900;
}

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

/* Camera face: presentation only, no visible controls. */
body.view-display .header-actions-group,
body.view-display .event-heading,
body.view-display .wheel-data-note,
body.view-display .wheel-bottom-bar,
body.view-display .winner-actions-row,
body.view-display .hide-result-row,
body.view-display .recent-winners-card,
body.view-display .privacy-badge {
  display: none !important;
}

body.view-display .app-viewport {
  padding: 1.05rem 2rem 1.8rem;
  justify-content: flex-start;
  gap: 0.7rem;
  overflow: hidden;
}

body.view-display .main-content {
  min-height: 0;
  gap: 12px;
}

body.view-display .main-header {
  flex-shrink: 0;
}

body.view-display .roulette-section {
  flex: 1;
  min-height: 0;
  container-type: size;
}

body.view-display .wheel-stage {
  width: min(100cqw, calc(100cqh - 24px), 720px);
  height: min(100cqw, calc(100cqh - 24px), 720px);
  flex-shrink: 0;
  margin: 24px 0 0;
}

body.view-display .wheel-outer-ring {
  width: 100%;
  height: 100%;
}

body.view-display #rouletteCanvas {
  width: 94%;
  height: 94%;
}

body.view-display .wheel-center-cap {
  width: 20%;
  height: 20%;
}

body.view-display .bulb {
  width: 11px;
  height: 11px;
  margin-top: -5.5px;
  margin-left: -5.5px;
}

body.view-display .winner-section {
  max-width: 820px;
  flex-shrink: 0;
}

body.view-display .winner-card {
  height: clamp(126px, 16vh, 160px);
}

body.view-display .scallop-top-border {
  flex-shrink: 0;
}

body.view-display .winner-card-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 36px minmax(0, 1fr);
  grid-template-areas: "ribbon" "message";
  align-items: center;
  justify-items: center;
  gap: 6px 24px;
  padding: 8px 24px 12px;
}

body.view-display .ribbon-banner {
  grid-area: ribbon;
  padding: 4px 18px;
  transform: none;
}

body.view-display .ribbon-text {
  font-size: clamp(0.9rem, 2vw, 1.3rem);
}

body.view-display .result-message-text {
  grid-area: message;
  max-width: 100%;
  width: 100%;
  max-height: 100%;
  margin: 0;
  overflow: hidden;
}

body.view-display .winner-card.is-losing .result-message-text {
  margin: 0;
  font-size: clamp(1.45rem, 4vw, 2.2rem);
}

body.view-display .winner-card.has-selection .winner-card-body {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  grid-template-rows: 36px minmax(0, 1fr);
  grid-template-areas: "summary identity" "summary identity";
}

body.view-display .winner-card.has-selection .winner-number-summary {
  grid-area: summary;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

body.view-display .winner-card.has-selection .winner-identity-summary {
  grid-area: identity;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

body.view-display .winner-card.has-selection .result-message-text {
  flex-shrink: 0;
}

body.view-display .selected-number-row {
  grid-area: number;
  min-width: 0;
  gap: 8px;
}

body.view-display .selected-number-text {
  font-size: clamp(1.1rem, 3vw, 1.8rem);
  white-space: nowrap;
}

body.view-display .nick-display-container {
  grid-area: nick;
  width: 100%;
  height: auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  display: flex;
  align-items: center;
}

body.view-display .winner-nick-text {
  width: 100%;
  max-height: 100%;
  font-size: clamp(1.25rem, 3.4vw, 2.5rem);
  overflow: hidden;
  white-space: nowrap;
}

body.view-display .header-event-title h2 {
  font-size: clamp(1.35rem, 3vw, 2rem);
}

@media (max-width: 760px) {
  .header-top-row {
    gap: 12px;
  }

  .brand-logo {
    width: 48px;
    height: 48px;
  }

  .title-bold {
    font-size: 1.7rem;
  }

  .title-light {
    font-size: 0.86rem;
  }

  .header-event-title {
    padding-left: 12px;
  }

  .camera-view-btn {
    display: none;
  }
}

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.mapping-grid > .config-group {
  min-width: 0;
  height: 100%;
  justify-content: flex-end;
}

.mapping-grid > .config-group > .config-label {
  min-height: 2.55em;
  display: flex;
  align-items: flex-end;
  line-height: 1.25;
}

.import-builder .mapping-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.filter-header-row,
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-header-row {
  justify-content: space-between;
  margin: 14px 0 8px;
}

.filter-header-row strong {
  color: var(--lime-accent);
  font-size: 0.86rem;
}

.filters-container {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.filter-row .config-select,
.filter-row .config-input {
  min-width: 0;
  height: 42px;
}

.filter-row .filter-column {
  flex: 1.2;
}

.filter-row .filter-operator {
  flex: 0.9;
}

.filter-row .filter-value {
  flex: 1;
}

.filter-remove {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: rgba(240, 42, 139, 0.18);
  color: #ff68b4;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 800;
}

.import-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.import-summary > div {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 11px;
  padding: 9px 6px;
  text-align: center;
}

.import-summary strong,
.import-summary span {
  display: block;
}

.import-summary strong {
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.import-summary span {
  color: var(--text-muted);
  font-size: 0.65rem;
}

.import-summary .summary-valid {
  background: rgba(155, 235, 50, 0.12);
  border-color: rgba(155, 235, 50, 0.4);
}

.import-summary .summary-valid strong {
  color: var(--lime-accent);
}

.import-preview-wrap {
  margin-top: 12px;
}

.import-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  max-height: 112px;
  overflow-y: auto;
  margin-top: 6px;
}

.preview-person {
  overflow: hidden;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-person b {
  color: var(--lime-accent);
  margin-right: 4px;
}

.btn-apply-import {
  width: 100%;
  margin-top: 12px;
  padding: 10px 14px;
  border: 0;
  border-radius: 11px;
  background: var(--lime-accent);
  color: var(--navy-dark);
  font-family: var(--font-main);
  font-weight: 800;
  cursor: pointer;
}

.btn-apply-import:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

@media (max-width: 620px) {
  .mapping-grid {
    grid-template-columns: 1fr;
  }

  .filter-row {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .filter-row .filter-column,
  .filter-row .filter-operator,
  .filter-row .filter-value {
    flex: 1 1 42%;
  }

  .import-preview {
    grid-template-columns: repeat(2, 1fr);
  }
}

.camera-list-toggle, .camera-participants[hidden] { display: none; }
body.view-display .camera-list-toggle { display: grid; place-items: center; position: fixed; right: 16px; bottom: 16px; z-index: 30; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: #fff; color: #202035; cursor: pointer; box-shadow: 0 2px 8px #0002; }
.camera-list-toggle:focus-visible { outline: 3px solid #f02a8b; outline-offset: 3px; }
body.view-display.show-participants .roulette-section, body.view-display.show-participants .winner-section { display: none; }
.camera-participants { display: flex; flex-direction: column; min-height: 0; width: 100%; flex: 1; overflow: hidden; background: #1e1d35; color: #fff; border-radius: 20px; border-top: 5px solid #f02a8b; }
.participants-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 24px; }
.participants-list-heading h2 { font-size: 26px; margin: 0 0 4px; }
.participants-list-heading p { font-size: 13px; opacity: .7; margin: 0; }
.participants-list-heading input { width: min(260px, 42%); border: 1px solid #ffffff30; border-radius: 10px; background: #ffffff0b; color: #fff; padding: 10px 12px; font: inherit; font-size: 14px; }
.participants-list-heading input::placeholder { color: #ffffff90; }
.participants-table-scroll { min-height: 0; overflow: auto; flex: 1; }
.participants-table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; font-size: 18px; }
.participants-table th { position: sticky; top: 0; background: #292840; color: #9beb32; font-size: 13px; text-transform: uppercase; z-index: 1; }
.participants-table th, .participants-table td { padding: 13px 24px; border-bottom: 1px solid #ffffff12; overflow-wrap: anywhere; }
.participants-table th:first-child, .participants-table td:first-child { width: 80px; white-space: nowrap; }
.participants-table tbody tr:nth-child(even) { background: #ffffff03; }
.participants-table tbody tr.participant-is-winner { background: #9beb32; color: #1e1d35; font-weight: 700; }
@media (max-width: 650px) { .participants-list-heading { padding: 14px; flex-wrap: wrap; } .participants-list-heading input { width: 100%; } .participants-table th, .participants-table td { padding: 10px; } .participants-table { font-size: 15px; } }

.camera-list-toggle:disabled { opacity: .5; cursor: default; }

.prize-editor-row { display: grid; grid-template-columns: 1fr 100px; gap: 16px; margin-bottom: 12px; }
.prize-editor-row label { display: grid; gap: 6px; font-size: 13px; }
.participants-download { display: grid; place-items: center; margin-left: auto; flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; border: 1px solid #ffffff35; background: #ffffff0b; color: white; cursor: pointer; }
.participants-table tbody tr.participant-confirmed { background: #ffffff07; color: #92929f; }
body.view-display .winner-card.is-losing.has-selection .result-message-text { font-size: clamp(14px, 2.2vh, 22px); }
body.view-display .winner-card.is-losing.has-selection .ribbon-text { font-size: 14px; }
.btn-confirm-winner:disabled { opacity: .45; cursor: default; }

/* Explicit controls stay readable regardless of browser number-input styling. */
.number-stepper { position: relative; width: 100%; }
.number-stepper .config-input { padding-right: 46px; min-height: 46px; appearance: textfield; -moz-appearance: textfield; }
.number-stepper input::-webkit-inner-spin-button, .number-stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.number-stepper-arrows { position: absolute; right: 3px; top: 3px; bottom: 3px; display: grid; grid-template-rows: 1fr 1fr; width: 36px; gap: 1px; }
.number-stepper-arrows button { display: grid; place-items: center; border: 0; background: #9beb32; color: #161b2e; cursor: pointer; border-radius: 5px; padding: 0; }
.number-stepper-arrows button:hover { background: #c2ff77; }
.number-stepper-arrows button:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.number-stepper-arrows button:disabled { opacity: .35; cursor: default; }
body.view-display .ribbon-text { overflow-wrap: anywhere; }
