/* Design Tokens */
:root {
  /* Colors */
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --surface-2: #F3F4F6;
  
  --text: #111827;
  --text-muted: #6B7280;
  --text-inverse: #FFFFFF;
  
  --primary: #3B82F6;
  --primary-hover: #2563EB;
  --secondary: #FACC15;
  --secondary-hover: #EAB308;
  --accent: #EF4444;
  
  --border: #E5E7EB;
  --border-strong: #D1D5DB;
  
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --focus-ring: #93C5FD;
  
  /* Spacing */
  --spacing-base: 8px;
  --section-padding-desktop: 72px;
  --section-padding-mobile: 40px;
  
  /* Border Radius */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  
  /* Container */
  --container-max-width: 1120px;
}

/* Reset & Base */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 {
  font-family: 'Kanit', sans-serif;
  font-weight: 800;
  margin: 0;
}

h1 {
  font-size: 40px;
  line-height: 1.2;
}

h2 {
  font-size: 28px;
  line-height: 1.286;
}

h3 {
  font-size: 20px;
  line-height: 1.4;
  font-weight: 700;
}

/* Container */
.container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* Header */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 24px;
}

.logo-link {
  display: flex;
  align-items: center;
}

.logo {
  height: 40px;
  width: auto;
}

.nav {
  display: flex;
  gap: 32px;
  align-items: center;
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 16px;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-link:hover {
  color: var(--primary);
}

.nav-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-button:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease-out;
  outline: none;
}

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

.button:focus-visible {
  box-shadow: 0 0 0 2px var(--focus-ring);
}

/* Button Sizes */
.button-lg {
  height: 48px;
  padding: 0 20px;
  font-size: 16px;
}

.button-md {
  height: 40px;
  padding: 0 16px;
  font-size: 14px;
}

.button-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

/* Button Variants */
.button-primary {
  background: var(--primary);
  color: var(--text-inverse);
}

.button-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: var(--shadow-sm);
}

.button-secondary {
  background: #FFF7DB;
  border: 1px solid #FDE68A;
  color: #7C5E00;
}

.button-secondary:hover:not(:disabled) {
  background: #FEF3C7;
  box-shadow: var(--shadow-sm);
}

.button-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}

.button-outline:hover:not(:disabled) {
  background: var(--primary);
  color: var(--text-inverse);
}

.button-ghost {
  background: transparent;
  color: var(--text);
}

.button-ghost:hover:not(:disabled) {
  background: var(--surface-2);
}

/* Sections */
.section {
  padding: var(--section-padding-desktop) 0;
}

.section-light {
  background: var(--surface);
}

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

.section-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
}

.link-more {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: color 0.15s ease;
}

.link-more:hover {
  color: var(--primary-hover);
}

/* Hero Section */
.hero {
  padding: 80px 0;
  background: var(--surface);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, rgba(250, 204, 21, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.hero-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.hero-text {
  max-width: 520px;
}

.hero-title {
  font-size: 48px;
  line-height: 1.2;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--text);
}

.hero-subtitle {
  font-size: 18px;
  line-height: 1.556;
  color: var(--text-muted);
  margin-bottom: 32px;
  font-weight: 500;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-illustration {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-illustration img {
  width: 100%;
  height: auto;
  max-width: 500px;
}

/* Game Grid */
.game-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

/* Game Card */
.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: all 0.15s ease-out;
  position: relative;
  overflow: hidden;
}

.game-card:hover:not(.game-card-disabled) {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.game-card-disabled {
  opacity: 0.6;
}

/* Beta Badge */
.beta-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(238, 90, 111, 0.4);
  animation: pulse-beta 2s ease-in-out infinite;
}

@keyframes pulse-beta {
  0%, 100% {
    box-shadow: 0 2px 8px rgba(238, 90, 111, 0.4);
  }
  50% {
    box-shadow: 0 2px 12px rgba(238, 90, 111, 0.6);
  }
}

.game-thumbnail {
  width: 100%;
  aspect-ratio: 5 / 4;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--surface-2);
}

.game-thumbnail svg,
.game-thumbnail img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* Hover image effect for game thumbnails */
.game-thumbnail-hover {
  position: relative;
}

.game-thumbnail-hover .thumbnail-hover {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.game-card:hover .game-thumbnail-hover .thumbnail-hover {
  opacity: 1;
}

.game-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.game-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.game-meta {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
  margin: 0;
}

.game-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Badge */
.badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  line-height: 1;
  z-index: 1;
}

.badge-new {
  background: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FECACA;
}

.badge-original {
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}

/* Tools Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-top: 32px;
}

.tool-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease-out;
  outline: none;
  text-decoration: none;
}

.tool-button:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.tool-button:focus-visible {
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.tool-icon {
  font-size: 32px;
  line-height: 1;
}

.tool-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* Watch & Play Section */
.watch-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
  margin-bottom: 48px;
  padding: 40px;
  background: var(--surface-2);
  border-radius: var(--radius-lg);
}

.watch-illustration {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
}

.watch-illustration iframe {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
}

.watch-illustration svg {
  width: 100%;
  height: auto;
  max-width: 400px;
}

.watch-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.watch-description {
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0;
}

.video-section {
  margin-top: 48px;
}

.video-section-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}

.video-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.search {
  width: min(520px, 100%);
  padding: 10px 14px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font: inherit;
  outline: none;
  font-size: 14px;
  transition: all 0.15s ease;
}

.search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.search::placeholder {
  color: var(--text-muted);
}

.muted {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
}

.embed {
  margin-top: 16px;
}

.responsive-iframe {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  background: #0f172a;
}

.responsive-iframe iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Video Browser (keep existing styles) */
.video-browser {
  margin-top: 6px;
}

.playlist {
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
}

.playlist + .playlist {
  margin-top: 16px;
}

.playlist-title {
  margin: 0 0 16px 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.video-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.video-item {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  transition: all 0.15s ease-out;
}

.video-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: var(--primary);
}

.thumb {
  width: 120px;
  height: 68px;
  flex: 0 0 auto;
  border-radius: 8px;
  overflow: hidden;
  background: #0f172a;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-meta {
  min-width: 0;
}

.video-title {
  margin: 0;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.video-sub {
  margin: 4px 0 0 0;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Footer */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 48px 0;
  margin-top: 80px;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

.footer-logo {
  display: flex;
  align-items: center;
}

.footer-logo img {
  height: 36px;
  width: auto;
}

.footer-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s ease;
}

.footer-links a:hover {
  color: var(--text);
}

.footer-copy {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0;
}

/* Mobile Menu */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 200;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-menu.active {
  display: block;
  opacity: 1;
}

.mobile-menu-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.mobile-menu-content {
  position: absolute;
  top: 0;
  right: 0;
  width: 320px;
  max-width: 85vw;
  height: 100%;
  background: var(--surface);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.mobile-menu.active .mobile-menu-content {
  transform: translateX(0);
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.mobile-menu-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

.mobile-menu-close {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.mobile-menu-close:hover {
  background: var(--surface-2);
  color: var(--text);
}

.mobile-menu-nav {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.mobile-menu-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 16px;
  transition: all 0.2s ease;
}

.mobile-menu-link:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-inverse);
  transform: translateX(-4px);
  box-shadow: var(--shadow-sm);
}

.mobile-menu-link svg {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

.mobile-menu-link:hover svg {
  stroke: var(--text-inverse);
}

.mobile-menu-link:hover svg[fill="currentColor"] {
  fill: var(--text-inverse);
}

/* Responsive Breakpoints */

/* Tablet (768px and below) */
@media (max-width: 768px) {
  .section {
    padding: var(--section-padding-mobile) 0;
  }
  
  .hero {
    padding: 60px 0;
  }
  
  .hero-content {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  
  .hero-title {
    font-size: 36px;
  }
  
  .hero-subtitle {
    font-size: 16px;
  }
  
  .hero-text {
    max-width: 100%;
  }
  
  .hero-actions {
    flex-direction: column;
  }
  
  .hero-actions .button {
    width: 100%;
  }
  
  .nav {
    display: none;
  }
  
  .game-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  
  .watch-hero {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .video-list {
    grid-template-columns: 1fr;
  }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }
  
  .header-content {
    height: 56px;
  }
  
  .logo {
    height: 32px;
  }
  
  h1 {
    font-size: 32px;
  }
  
  h2 {
    font-size: 24px;
  }
  
  .hero-title {
    font-size: 28px;
  }
  
  .game-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .tools-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .tool-button {
    flex-direction: row;
    justify-content: flex-start;
    padding: 16px;
  }
  
  .tool-icon {
    font-size: 24px;
  }
  
  .video-item {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

/* Desktop large (1024px and up) */
@media (min-width: 1024px) {
  .video-list {
    grid-template-columns: 1fr 1fr;
  }
}

/* ===== Dice Roller Styles ===== */

/* Dice Header */
.dice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

/* Dice Display Section */
.dice-display-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-sm);
}

.dice-display-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.dice-count-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.dice-result-container {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  align-items: center;
  min-height: 160px;
  margin-bottom: 24px;
}

.dice-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}

.dice-placeholder-icon {
  font-size: 64px;
  opacity: 0.5;
}

.dice-placeholder-text {
  margin: 0;
  font-size: 16px;
}

/* Dice Items */
.dice-item {
  width: 80px;
  height: 80px;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
}

.dice-item.queued {
  background: var(--surface);
  border: 2px dashed var(--border-strong);
  cursor: default;
}

.dice-item.queued:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.dice-remove-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--danger);
  color: var(--text-inverse);
  border: 2px solid var(--surface);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}

.dice-remove-btn:hover {
  background: #dc2626;
  transform: scale(1.1);
}

.dice-item.rolling {
  animation: diceRoll 0.6s ease-in-out;
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-inverse);
}

.dice-item.revealed {
  animation: diceReveal 0.3s ease-out;
  background: var(--surface);
  border-color: var(--primary);
}

.dice-face {
  font-size: 32px;
  font-weight: 700;
  font-family: 'Kanit', sans-serif;
  color: var(--text);
}

.dice-item.rolling .dice-face {
  color: var(--text-inverse);
}

.dice-type-badge {
  position: absolute;
  bottom: 4px;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
}

.dice-item.rolling .dice-type-badge {
  color: var(--text-inverse);
  background: rgba(255, 255, 255, 0.2);
}

/* Dice Animations */
@keyframes diceRoll {
  0%, 100% {
    transform: rotate(0deg) scale(1);
  }
  25% {
    transform: rotate(90deg) scale(1.1);
  }
  50% {
    transform: rotate(180deg) scale(1);
  }
  75% {
    transform: rotate(270deg) scale(1.1);
  }
}

@keyframes diceReveal {
  0% {
    transform: scale(1.2);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Dice Total */
.dice-total {
  text-align: center;
  padding: 16px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  display: none;
}

.dice-total:not(:empty) {
  display: block;
}

.dice-total-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-right: 8px;
}

.dice-total-value {
  font-size: 32px;
  font-weight: 800;
  font-family: 'Kanit', sans-serif;
  color: var(--primary);
}

/* Dice Controls */
.dice-controls {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
}

.dice-control-section {
  margin-bottom: 24px;
}

.dice-section-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 16px 0;
  color: var(--text);
}

/* Dice Type Tabs */
.dice-type-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.dice-type-tab {
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s ease;
  margin-bottom: -2px;
}

.dice-type-tab:hover {
  color: var(--text);
}

.dice-type-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Dice Type Panels */
.dice-type-panel {
  display: none;
}

.dice-type-panel.active {
  display: block;
}

/* Dice Type Grid */
.dice-type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.dice-type-button {
  padding: 16px 12px;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.dice-type-button:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.dice-type-button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-inverse);
}

.dice-type-label {
  font-size: 18px;
  font-weight: 700;
  font-family: 'Kanit', sans-serif;
}

.dice-type-desc {
  font-size: 12px;
  opacity: 0.8;
}

.dice-type-button.active .dice-type-label,
.dice-type-button.active .dice-type-desc {
  color: var(--text-inverse);
}

/* Custom Dice Input */
.dice-custom-input {
  max-width: 400px;
}

.dice-custom-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.dice-custom-sublabel {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

/* Dice Count Control */
.dice-control-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.dice-count-control {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 240px;
}

.dice-count-btn {
  width: 40px;
  height: 40px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dice-count-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-inverse);
}

.dice-number-input {
  flex: 1;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  text-align: center;
  transition: all 0.2s ease;
}

.dice-number-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Roll Button */
.dice-roll-button {
  width: 100%;
  margin-top: 8px;
}

.dice-roll-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Dice Queue */
.dice-queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.dice-queue {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 60px;
  padding: 16px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  border: 2px dashed var(--border);
}

.dice-queue-empty {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dice-queue-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}

.dice-queue-label {
  color: var(--text);
}

.dice-queue-remove {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: var(--text-inverse);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: all 0.2s ease;
}

.dice-queue-remove:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-sm);
}

/* Dice History Section */
.dice-history-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}

.dice-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.dice-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 500px;
  overflow-y: auto;
}

.dice-history-empty {
  text-align: center;
  padding: 40px;
}

.dice-history-item {
  padding: 16px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.dice-history-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.dice-history-time {
  font-size: 12px;
  color: var(--text-muted);
}

.dice-history-type {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.dice-history-total {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.dice-history-results {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dice-history-result {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-md);
  z-index: 1;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 12px 0;
  color: var(--text);
}

.modal-text {
  font-size: 16px;
  color: var(--text-muted);
  margin: 0 0 24px 0;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Responsive Dice Styles */
@media (max-width: 768px) {
  .dice-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .dice-display-section {
    padding: 24px;
  }

  .dice-controls {
    padding: 24px;
  }

  .dice-history-section {
    padding: 24px;
  }

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

  .dice-item {
    width: 64px;
    height: 64px;
  }

  .dice-face {
    font-size: 24px;
  }

  .dice-total-value {
    font-size: 24px;
  }

  .modal-content {
    padding: 24px;
  }
  
  .modal-actions {
    flex-direction: column;
  }
  
  .modal-actions .button {
    width: 100%;
  }
}

/* ===== Timer Styles ===== */

/* Timer Header */
.timer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.timer-header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Timer Mode Tabs */
.timer-mode-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
  justify-content: center;
}

.timer-mode-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 40px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 160px;
}

.timer-mode-tab span:first-child {
  font-size: 32px;
}

.timer-mode-tab:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.timer-mode-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-inverse);
}

/* Timer Display */
.timer-display-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 60px 40px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-md);
  text-align: center;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.timer-display {
  font-family: 'Kanit', sans-serif;
  font-size: 120px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  letter-spacing: 0.05em;
}

.timer-milliseconds {
  font-family: 'Kanit', sans-serif;
  font-size: 48px;
  font-weight: 700;
  color: var(--text-muted);
  align-self: flex-end;
  padding-bottom: 12px;
}

/* Timer Warning Animation */
.timer-display-container.timer-warning {
  animation: timerPulse 1s ease-in-out infinite;
}

@keyframes timerPulse {
  0%, 100% {
    background: var(--surface);
  }
  50% {
    background: #FEF3C7;
  }
}

/* Timer Finished Animation */
.timer-display-container.timer-finished {
  animation: timerFlash 0.5s ease-in-out 3;
  background: var(--success);
}

.timer-display-container.timer-finished .timer-display {
  color: var(--text-inverse);
}

@keyframes timerFlash {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Timer Mode Panels */
.timer-mode-panel {
  display: none;
}

.timer-mode-panel.active {
  display: block;
}

/* Timer Presets */
.timer-presets {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.timer-preset-btn {
  padding: 12px 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.timer-preset-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-inverse);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* Timer Input Group */
.timer-input-group {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
  justify-content: center;
  flex-wrap: wrap;
}

.timer-input-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 120px;
}

.timer-input-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.timer-input-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timer-input-btn {
  width: 40px;
  height: 48px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-input-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-inverse);
}

.timer-input {
  width: 70px;
  height: 48px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 24px;
  font-weight: 700;
  font-family: 'Kanit', sans-serif;
  text-align: center;
  transition: all 0.2s ease;
}

.timer-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Timer Controls */
.timer-controls {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.timer-controls .button {
  min-width: 140px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.timer-btn-icon {
  font-size: 20px;
}

/* Timer Lap Section */
.timer-lap-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}

.timer-section-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 16px 0;
  color: var(--text);
}

.timer-lap-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.timer-lap-empty {
  text-align: center;
  padding: 40px;
}

.timer-lap-item {
  display: grid;
  grid-template-columns: 80px 1fr 1fr;
  gap: 16px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  align-items: center;
}

.timer-lap-number {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.timer-lap-split {
  font-size: 16px;
  font-weight: 600;
  font-family: 'Kanit', sans-serif;
  color: var(--primary);
  text-align: center;
}

.timer-lap-time {
  font-size: 14px;
  font-weight: 500;
  font-family: 'Kanit', sans-serif;
  color: var(--text-muted);
  text-align: right;
}

/* Fullscreen Styles */
:fullscreen .timer-display-container,
:-webkit-full-screen .timer-display-container,
:-moz-full-screen .timer-display-container {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  border-radius: 0;
}

:fullscreen .timer-display,
:-webkit-full-screen .timer-display,
:-moz-full-screen .timer-display {
  font-size: 200px;
}

:fullscreen .timer-milliseconds,
:-webkit-full-screen .timer-milliseconds,
:-moz-full-screen .timer-milliseconds {
  font-size: 80px;
  padding-bottom: 24px;
}

/* Responsive Timer Styles */
@media (max-width: 1024px) {
  .timer-display {
    font-size: 100px;
  }
  
  .timer-milliseconds {
    font-size: 40px;
    padding-bottom: 10px;
  }
}

@media (max-width: 768px) {
  .timer-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .timer-mode-tabs {
    flex-direction: column;
    width: 100%;
  }

  .timer-mode-tab {
    width: 100%;
  }

  .timer-display-container {
    padding: 40px 20px;
  }

  .timer-display {
    font-size: 72px;
  }

  .timer-milliseconds {
    font-size: 32px;
    padding-bottom: 8px;
  }

  .timer-input-group {
    flex-direction: column;
    align-items: stretch;
  }

  .timer-input-field {
    min-width: auto;
  }

  .timer-controls {
    flex-direction: column;
  }

  .timer-controls .button {
    width: 100%;
  }

  .timer-lap-item {
    grid-template-columns: 60px 1fr 1fr;
    gap: 8px;
    font-size: 14px;
  }

  .timer-lap-section {
    padding: 24px;
  }

  :fullscreen .timer-display,
  :-webkit-full-screen .timer-display,
  :-moz-full-screen .timer-display {
    font-size: 120px;
  }

  :fullscreen .timer-milliseconds,
  :-webkit-full-screen .timer-milliseconds,
  :-moz-full-screen .timer-milliseconds {
    font-size: 48px;
  }
}

/* ============================================
   Team Randomizer Styles
   ============================================ */

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

.team-container {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 32px;
  align-items: start;
}

.team-input-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}

.team-input-section {
  margin-bottom: 24px;
}

.team-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.team-textarea {
  width: 100%;
  min-height: 200px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--surface);
  resize: vertical;
  transition: border-color 0.15s ease;
}

.team-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.team-textarea::placeholder {
  color: var(--text-muted);
}

.team-mode-section {
  margin-bottom: 24px;
}

.team-mode-options {
  display: flex;
  gap: 12px;
}

.team-mode-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
  font-size: 14px;
}

.team-mode-option:hover {
  border-color: var(--primary);
  background: var(--surface-2);
}

.team-mode-option input[type="radio"] {
  margin: 0;
  cursor: pointer;
}

.team-mode-option input[type="radio"]:checked + span {
  color: var(--primary);
}

.team-mode-option:has(input[type="radio"]:checked) {
  border-color: var(--primary);
  background: var(--surface-2);
}

.team-number-section {
  margin-bottom: 24px;
}

.team-number-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s ease;
}

.team-number-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.team-warning {
  display: none;
  padding: 12px;
  background: #FEF3C7;
  border: 1px solid #F59E0B;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #92400E;
  margin-bottom: 24px;
  line-height: 1.5;
}

.team-actions {
  display: flex;
  gap: 12px;
}

.team-actions .button {
  flex: 1;
}

.team-results-panel {
  min-height: 400px;
}

.team-results-empty {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 80px 32px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state {
  text-align: center;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-text {
  font-size: 16px;
  color: var(--text-muted);
  margin: 0;
}

.team-results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.team-card {
  background: var(--surface);
  border: 3px solid;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.team-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.team-card-header {
  padding: 16px;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.team-card-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.team-card-count {
  font-size: 14px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.3);
  padding: 4px 12px;
  border-radius: 12px;
  color: white;
}

.team-card-body {
  padding: 20px;
}

.team-member-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.team-member-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.team-member-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.team-member-name {
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
}

.team-reshuffle-container {
  margin-top: 20px;
  text-align: center;
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Responsive Design */
@media (max-width: 768px) {
  .team-container {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .team-results-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .team-card-title {
    font-size: 16px;
  }

  .team-member-name {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .team-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .team-input-panel {
    padding: 24px;
  }

  .team-results-grid {
    grid-template-columns: 1fr;
  }

  .team-mode-options {
    flex-direction: column;
  }

  .team-actions {
    flex-direction: column;
  }

  .team-actions .button {
    width: 100%;
  }
}

/* ===========================
   Cardloop Game Styles
   =========================== */

.cardloop-game {
  max-width: 900px;
  margin: 0 auto;
}

/* Stats */
.cardloop-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: white;
  padding: 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.stat-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-family: 'Kanit', sans-serif;
  font-size: 36px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

/* Card Display */
.card-display {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.card-slot {
  aspect-ratio: 2.5 / 3.5;
  perspective: 1000px;
}

.card-back,
.card-front {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-family: 'Kanit', sans-serif;
  transition: all 0.3s ease;
}

.card-back {
  background: linear-gradient(135deg, #3B82F6 0%, #1d4ed8 100%);
  color: white;
  font-size: 48px;
  font-weight: 800;
}

.card-slot.revealed .card-front {
  animation: flipCard 0.6s ease;
}

@keyframes flipCard {
  0% {
    transform: rotateY(180deg) scale(0.8);
    opacity: 0;
  }
  50% {
    transform: rotateY(90deg) scale(0.9);
  }
  100% {
    transform: rotateY(0deg) scale(1);
    opacity: 1;
  }
}

.card-front {
  border: 3px solid #e5e7eb;
}

.card-front.red {
  color: #dc2626;
}

.card-front.black {
  color: #1f2937;
}

.card-value {
  font-size: 48px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 8px;
}

.card-suit {
  font-size: 36px;
  line-height: 1;
}

/* Question Area */
.question-area {
  background: white;
  padding: 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  text-align: center;
}

.question-text {
  font-family: 'Kanit', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 32px 0;
}

.answer-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.answer-btn {
  padding: 16px 32px;
  font-size: 18px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  min-width: 140px;
}

.answer-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.answer-btn:active {
  transform: translateY(0);
}

.start-btn {
  background: var(--primary);
  color: white;
  font-size: 20px;
  padding: 20px 48px;
}

.start-btn:hover {
  background: #2563eb;
}

.red-btn {
  background: #dc2626;
  color: white;
}

.red-btn:hover {
  background: #b91c1c;
}

.black-btn {
  background: #1f2937;
  color: white;
}

.black-btn:hover {
  background: #111827;
}

.higher-btn {
  background: var(--success);
  color: white;
}

.higher-btn:hover {
  background: #16a34a;
}

.lower-btn {
  background: var(--warning);
  color: white;
}

.lower-btn:hover {
  background: #ea580c;
}

.inside-btn {
  background: #8b5cf6;
  color: white;
}

.inside-btn:hover {
  background: #7c3aed;
}

.outside-btn {
  background: #ec4899;
  color: white;
}

.outside-btn:hover {
  background: #db2777;
}

.suit-btn {
  background: white;
  color: #1f2937;
  border: 3px solid #e5e7eb;
  font-size: 32px;
  min-width: 80px;
  padding: 12px 20px;
}

.suit-btn:hover {
  border-color: var(--primary);
  background: #eff6ff;
}

.suit-btn.suit-red {
  color: #dc2626;
}

.suit-btn.suit-red:hover {
  border-color: #dc2626;
  background: #fef2f2;
}

/* Win Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: white;
  padding: 48px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  text-align: center;
  max-width: 500px;
  width: 90%;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-title {
  font-family: 'Kanit', sans-serif;
  font-size: 36px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 16px 0;
}

.modal-text {
  font-size: 18px;
  color: var(--text-secondary);
  margin: 0 0 24px 0;
}

.modal-rounds {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 32px 0;
}

.modal-rounds span {
  font-family: 'Kanit', sans-serif;
  font-size: 32px;
  font-weight: 800;
}

.modal-btn {
  padding: 16px 48px;
  font-size: 18px;
  font-weight: 700;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.modal-btn:hover {
  background: #2563eb;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.wrong-modal .modal-title {
  color: var(--danger);
}

.wrong-btn {
  background: var(--danger);
}

.wrong-btn:hover {
  background: #dc2626;
}

/* Responsive */
@media (max-width: 768px) {
  .cardloop-section {
    padding: 60px 0 80px;
  }

  .cardloop-title {
    font-size: 36px;
  }

  .cardloop-stats {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .stat-card {
    padding: 20px;
  }

  .card-display {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .question-area {
    padding: 32px 24px;
  }

  .question-text {
    font-size: 22px;
  }

  .answer-btn {
    padding: 14px 24px;
    font-size: 16px;
    min-width: 120px;
  }

  .start-btn {
    font-size: 18px;
    padding: 16px 36px;
  }

  .suit-btn {
    font-size: 28px;
    min-width: 70px;
    padding: 10px 16px;
  }
}

/* ===========================
   Scoreboard Styles
   =========================== */

.scoreboard-setup {
  max-width: 700px;
  margin: 0 auto;
}

.setup-card {
  background: white;
  padding: 48px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.setup-icon {
  font-size: 64px;
  text-align: center;
  margin-bottom: 24px;
}

.setup-title {
  font-family: 'Kanit', sans-serif;
  font-size: 32px;
  font-weight: 800;
  text-align: center;
  color: var(--text-primary);
  margin: 0 0 12px 0;
}

.setup-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  text-align: center;
  margin: 0 0 32px 0;
}

.scoreboard-input {
  font-size: 16px;
  line-height: 1.6;
  min-height: 200px;
}

.input-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--surface-light);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-secondary);
}

.input-hint svg {
  flex-shrink: 0;
  color: var(--primary);
}

.setup-card .button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 24px;
}

.scoreboard-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 32px;
}

.scoreboard-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.score-card {
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.score-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.score-card-header {
  background: var(--primary);
  padding: 16px;
  text-align: center;
}

.score-card-name {
  font-family: 'Kanit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: white;
  margin: 0;
}

.score-card-body {
  padding: 24px;
  text-align: center;
}

.team-members-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.team-member-badge {
  padding: 6px 12px;
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.score-display {
  margin-bottom: 20px;
}

.score-value {
  font-family: 'Kanit', sans-serif;
  font-size: 56px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.score-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.score-btn {
  width: 60px;
  height: 60px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.score-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.score-btn:active {
  transform: scale(0.95);
}

.minus-btn {
  background: var(--danger);
  color: white;
}

.minus-btn:hover {
  background: #dc2626;
}

.plus-btn {
  background: var(--success);
  color: white;
}

.plus-btn:hover {
  background: #16a34a;
}

/* Summary Modal */
.summary-modal {
  max-width: 600px;
}

.ranking-list {
  margin: 32px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  background: var(--surface-light);
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  transition: all 0.2s ease;
}

.ranking-item:hover {
  transform: translateX(4px);
}

.ranking-item.rank-1 {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-color: #f59e0b;
}

.ranking-item.rank-2 {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  border-color: #9ca3af;
}

.ranking-item.rank-3 {
  background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
  border-color: #f97316;
}

.ranking-medal {
  font-size: 48px;
  line-height: 1;
  min-width: 60px;
  text-align: center;
  font-family: 'Kanit', sans-serif;
  font-weight: 800;
}

.ranking-info {
  flex: 1;
}

.ranking-name {
  font-family: 'Kanit', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.ranking-score {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  .scoreboard-list {
    grid-template-columns: 1fr;
  }

  .scoreboard-actions {
    flex-direction: column;
  }

  .scoreboard-actions .button {
    width: 100%;
  }

  .ranking-medal {
    font-size: 36px;
    min-width: 50px;
  }

  .ranking-name {
    font-size: 20px;
  }

  .ranking-score {
    font-size: 16px;
  }
}

@media (max-width: 768px) {
  .setup-card {
    padding: 32px 24px;
  }

  .setup-title {
    font-size: 28px;
  }

  .setup-icon {
    font-size: 56px;
  }
}

@media (max-width: 480px) {
  .score-value {
    font-size: 48px;
  }

  .score-btn {
    width: 50px;
    height: 50px;
  }

  .ranking-item {
    padding: 16px;
  }

  .setup-card {
    padding: 24px 20px;
  }

  .setup-title {
    font-size: 24px;
  }

  .setup-icon {
    font-size: 48px;
  }

  .input-hint {
    font-size: 13px;
    padding: 10px 12px;
  }
}

@media (max-width: 480px) {
  .cardloop-title {
    font-size: 28px;
  }

  .cardloop-description {
    font-size: 16px;
  }

  .stat-value {
    font-size: 28px;
  }

  .card-display {
    gap: 8px;
  }

  .card-value {
    font-size: 36px;
  }

  .card-suit {
    font-size: 28px;
  }

  .question-area {
    padding: 24px 16px;
  }

  .question-text {
    font-size: 18px;
    margin-bottom: 24px;
  }

  .answer-buttons {
    gap: 12px;
  }

  .answer-btn {
    padding: 12px 20px;
    font-size: 15px;
    min-width: 100px;
  }

  .modal-content {
    padding: 32px 24px;
  }

  .modal-title {
    font-size: 28px;
  }
}

/* ===========================
   About Page Styles
   =========================== */

.about-hero {
  padding: 80px 0 60px;
  background: var(--surface);
  position: relative;
  overflow: hidden;
}

.about-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, rgba(250, 204, 21, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.about-hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.about-hero-title {
  font-size: 48px;
  line-height: 1.2;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--text);
}

.about-hero-subtitle {
  font-size: 20px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0;
  font-weight: 500;
}

.about-content {
  padding: var(--section-padding-desktop) 0;
}

.about-sections {
  max-width: 800px;
  margin: 0 auto;
}

.about-section {
  margin-bottom: 48px;
}

.about-section:last-child {
  margin-bottom: 0;
}

.about-section-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 24px 0;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--primary);
}

.about-section-content {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text);
}

.about-section-content p {
  margin: 0 0 16px 0;
}

.about-section-content p:last-child {
  margin-bottom: 0;
}

.about-contact-subtitle {
  text-align: center;
  font-size: 16px;
  color: var(--text-muted);
  margin: -16px 0 32px 0;
}

/* Contact Cards */
.contact-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.contact-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.15s ease-out;
  text-decoration: none;
  cursor: pointer;
}

.contact-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.contact-card-icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--primary);
  transition: all 0.15s ease;
}

.contact-card:hover .contact-card-icon {
  background: var(--primary);
  color: var(--text-inverse);
  transform: scale(1.1);
}

.contact-card-icon svg {
  width: 48px;
  height: 48px;
}

.contact-card-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px 0;
}

.contact-card-description {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 16px 0;
  line-height: 1.5;
}

.contact-card-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  transition: color 0.15s ease;
}

.contact-card:hover .contact-card-link {
  color: var(--primary-hover);
}

/* Responsive About Page */
@media (max-width: 768px) {
  .about-hero {
    padding: 60px 0 40px;
  }

  .about-hero-title {
    font-size: 36px;
  }

  .about-hero-subtitle {
    font-size: 16px;
  }

  .about-content {
    padding: var(--section-padding-mobile) 0;
  }

  .about-section {
    margin-bottom: 40px;
  }

  .about-section-title {
    font-size: 28px;
  }

  .contact-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .contact-card {
    padding: 24px 16px;
  }

  .contact-card-icon {
    width: 64px;
    height: 64px;
  }

  .contact-card-icon svg {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  .about-hero-title {
    font-size: 28px;
  }

  .about-hero-subtitle {
    font-size: 15px;
  }

  .about-section-title {
    font-size: 24px;
  }

  .about-section-content {
    font-size: 15px;
  }

  .contact-cards {
    grid-template-columns: 1fr;
  }
}

/* ===========================
   Competition Timer Styles
   =========================== */

.input-field {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  outline: none;
}

.input-field:hover {
  border-color: var(--primary);
}

.input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background: var(--background);
}

.input-field::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.input-field[type="number"] {
  -moz-appearance: textfield;
}

.input-field[type="number"]::-webkit-outer-spin-button,
.input-field[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.countdown-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.countdown-overlay.active {
  display: flex;
}

.countdown-content {
  text-align: center;
  animation: countdown-pulse 0.5s ease-out;
}

.countdown-text {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-inverse);
  margin-bottom: 24px;
  opacity: 0.8;
}

.countdown-number {
  font-size: 120px;
  font-weight: 800;
  color: var(--primary);
  text-shadow: 0 0 40px rgba(59, 130, 246, 0.6);
  animation: countdown-scale 1s ease-in-out;
}

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

@keyframes countdown-scale {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.timer-setup {
  display: none;
  flex-direction: column;
  gap: 24px;
  max-width: 800px;
  margin: 0 auto;
}

.timer-setup.active {
  display: flex;
}

.timer-setup > .button {
  width: 100%;
  max-width: 400px;
  margin: 8px auto 0;
}

.setup-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
}

.setup-section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 16px 0;
}

.player-count-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.player-count-selector label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.player-names-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.player-name-input {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.player-name-input label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.time-presets {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.preset-btn {
  flex: 1;
  min-width: 100px;
}

.preset-btn.active {
  background: var(--primary);
  color: var(--text-inverse);
  border-color: var(--primary);
}

.custom-time-input {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.custom-time-input label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.timer-game {
  display: none;
  flex-direction: column;
  gap: 32px;
}

.timer-game.active {
  display: flex;
}

.timer-controls-top {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.timer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin: 0 auto;
  max-width: 1200px;
  width: 100%;
}

.timer-card {
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.2s ease;
  position: relative;
}

.timer-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.timer-player-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.timer-status {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.timer-display {
  font-size: 48px;
  font-weight: 800;
  text-align: center;
  color: var(--text);
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
}

.timer-card.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
  transform: scale(1.02);
}

.timer-card.active .timer-display {
  color: var(--primary);
}

.timer-card.warning {
  border-color: var(--warning);
  animation: pulse-warning 1s ease-in-out infinite;
}

.timer-card.warning .timer-display {
  color: var(--warning);
}

.timer-card.timeout {
  border-color: var(--danger);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
  opacity: 0.7;
}

.timer-card.timeout .timer-display {
  color: var(--danger);
}

.timer-card.timeout .timer-status {
  background: var(--danger);
  color: var(--text-inverse);
}

@keyframes pulse-warning {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(250, 204, 21, 0);
  }
}

.timer-controls-bottom {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}

.button-xl {
  padding: 20px 48px;
  font-size: 20px;
  font-weight: 700;
  min-width: 200px;
}

/* Responsive Timer Styles */
@media (max-width: 768px) {
  .countdown-text {
    font-size: 24px;
  }

  .countdown-number {
    font-size: 80px;
  }

  .timer-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
  }

  .timer-card {
    padding: 20px;
  }

  .timer-display {
    font-size: 36px;
  }

  .timer-player-name {
    font-size: 16px;
  }

  .player-names-grid {
    grid-template-columns: 1fr;
  }

  .time-presets {
    flex-direction: column;
  }

  .preset-btn {
    width: 100%;
  }

  .button-xl {
    width: 100%;
    padding: 16px 32px;
    font-size: 18px;
  }

  .timer-controls-top {
    flex-direction: column;
  }

  .timer-controls-top .button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .countdown-text {
    font-size: 20px;
  }

  .countdown-number {
    font-size: 64px;
  }

  .timer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .timer-card {
    padding: 16px;
  }

  .timer-display {
    font-size: 28px;
  }

  .timer-player-name {
    font-size: 14px;
  }

  .setup-card {
    padding: 16px;
  }
}

/* ===========================
   Lucky Draw Styles
   =========================== */

.lucky-draw-container {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 32px;
  margin-top: 32px;
}

.lucky-draw-setup {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.item-input-group {
  gap: 12px;
}

.item-input-group .input-field {
  flex: 1;
}

.settings-group {
  margin-top: 16px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.stats-bar {
  display: flex;
  gap: 24px;
  padding: 16px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  margin-top: 16px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

.item-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 100px;
}

.item-list-empty {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  padding: 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
}

.item-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--primary);
  color: var(--text-inverse);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.item-chip:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.item-chip-text {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-chip-remove {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  color: var(--text-inverse);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.item-chip-remove:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.lucky-draw-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.draw-area {
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.draw-result-empty {
  text-align: center;
  padding: 48px 24px;
}

.draw-result-content {
  text-align: center;
  width: 100%;
}

.draw-result-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.draw-result-item {
  font-size: 48px;
  font-weight: 800;
  color: var(--primary);
  word-wrap: break-word;
  line-height: 1.2;
}

.draw-animation {
  animation: drawReveal 0.5s ease-out;
}

@keyframes drawReveal {
  0% {
    opacity: 0;
    transform: scale(0.5) rotate(-10deg);
  }
  50% {
    transform: scale(1.1) rotate(5deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.draw-controls {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.history-section {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.history-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px 0;
}

.history-stats {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.history-empty {
  text-align: center;
  padding: 32px 16px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.history-item:hover {
  background: var(--background);
}

.history-order {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: var(--text-inverse);
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.history-item-name {
  flex: 1;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

/* Responsive Lucky Draw */
@media (max-width: 968px) {
  .lucky-draw-container {
    grid-template-columns: 1fr;
  }

  .draw-result-item {
    font-size: 36px;
  }

  .stats-bar {
    flex-direction: column;
    gap: 12px;
  }

  .stat-item {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .stat-value {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .item-input-group {
    flex-direction: column;
  }

  .item-input-group .button {
    width: 100%;
  }

  .draw-result-item {
    font-size: 28px;
  }

  .draw-controls {
    flex-direction: column;
  }

  .draw-controls .button {
    width: 100%;
  }

  .item-chip-text {
    max-width: 150px;
  }
}

/* ===========================
   Partners Section Styles
   =========================== */

.partners-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.partner-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.15s ease-out;
  box-shadow: var(--shadow-sm);
}

.partner-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.partner-logo {
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 16px;
}

.partner-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.partner-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 16px 0;
}

.partner-code {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px solid var(--secondary);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  width: 100%;
}

.partner-code-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.partner-code-value {
  font-family: 'Kanit', sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: var(--secondary-hover);
  letter-spacing: 1px;
}

.partner-card .button {
  width: 100%;
}

/* Responsive Partners Section */
@media (max-width: 768px) {
  .partners-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .partners-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .partner-card {
    padding: 24px;
  }

  .partner-logo {
    width: 100px;
    height: 100px;
  }

  .partner-code-value {
    font-size: 20px;
  }
}

/* ===========================
   Tournament Bracket Styles
   =========================== */

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

.bracket-setup {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
}

.bracket-setup-section {
  margin-bottom: 24px;
}

.bracket-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.bracket-mode-options {
  display: flex;
  gap: 12px;
}

.bracket-mode-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
  font-size: 14px;
}

.bracket-mode-option:hover {
  border-color: var(--primary);
  background: var(--surface-2);
}

.bracket-mode-option input[type="radio"] {
  margin: 0;
  cursor: pointer;
}

.bracket-mode-option:has(input[type="radio"]:checked) {
  border-color: var(--primary);
  background: var(--surface-2);
}

.bracket-textarea {
  width: 100%;
  min-height: 150px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--surface);
  resize: vertical;
  transition: border-color 0.15s ease;
}

.bracket-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.bracket-textarea::placeholder {
  color: var(--text-muted);
}

.bracket-checkbox-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  transition: all 0.15s ease;
}

.bracket-checkbox-option:hover {
  background: var(--surface);
  border-color: var(--primary);
}

.bracket-checkbox-option input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
  width: 18px;
  height: 18px;
}

.bracket-checkbox-option label {
  margin: 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

/* Bracket Display */
.bracket-display {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  display: none;
}

.bracket-display.active {
  display: block;
}

.bracket-container {
  overflow-x: auto;
  overflow-y: visible;
  padding: 20px 0;
}

.bracket-wrapper {
  display: flex;
  gap: 60px;
  min-width: min-content;
}

.bracket-section {
  margin-bottom: 40px;
}

.bracket-section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  text-align: center;
}

.bracket-section.winner .bracket-section-title {
  color: var(--success);
}

.bracket-section.loser .bracket-section-title {
  color: var(--danger);
}

.bracket-section.grand-final .bracket-section-title {
  color: var(--secondary);
}

.bracket-round {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  min-width: 200px;
}

.bracket-round-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bracket-matches {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.bracket-match {
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 180px;
}

.bracket-match:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.bracket-match.completed {
  border-color: var(--success);
}

.bracket-participant {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 4px;
  background: var(--surface);
  margin-bottom: 6px;
  transition: all 0.15s ease;
}

.bracket-participant:last-child {
  margin-bottom: 0;
}

.bracket-participant.winner {
  background: var(--success);
  color: white;
  font-weight: 600;
}

.bracket-participant.loser {
  opacity: 0.5;
}

.bracket-participant.bye {
  background: var(--surface-2);
  color: var(--text-muted);
  font-style: italic;
}

.bracket-participant-name {
  font-size: 14px;
  font-weight: 500;
}

.bracket-participant-score {
  font-size: 14px;
  font-weight: 700;
  margin-left: 8px;
}

/* Bracket Modal */
.bracket-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.bracket-modal.active {
  display: flex;
}

.bracket-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.bracket-modal-content {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-md);
  z-index: 1;
}

.bracket-modal-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 20px 0;
  color: var(--text);
}

.bracket-modal-match {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.bracket-modal-participant {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.bracket-modal-participant-name {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
}

.bracket-modal-score-input {
  width: 80px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

.bracket-modal-score-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.bracket-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.bracket-modal-winner-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.bracket-winner-button {
  padding: 16px;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bracket-winner-button:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* Champion Display */
.bracket-champion {
  text-align: center;
  padding: 40px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-radius: var(--radius-lg);
  border: 3px solid var(--secondary);
  margin-top: 32px;
  display: none;
}

.bracket-champion.active {
  display: block;
}

.bracket-champion-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.bracket-champion-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.bracket-champion-name {
  font-family: 'Kanit', sans-serif;
  font-size: 36px;
  font-weight: 800;
  color: var(--secondary-hover);
}

/* Responsive - Mobile Vertical Layout */
@media (max-width: 768px) {
  .bracket-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .bracket-setup {
    padding: 24px;
  }

  .bracket-mode-options {
    flex-direction: column;
  }

  .bracket-display {
    padding: 24px;
  }

  .bracket-wrapper {
    flex-direction: column;
    gap: 40px;
  }

  .bracket-round {
    min-width: 100%;
  }

  .bracket-match {
    min-width: 100%;
  }

  .bracket-modal-content {
    padding: 24px;
  }

  .bracket-modal-actions {
    flex-direction: column;
  }

  .bracket-modal-actions .button {
    width: 100%;
  }

  .bracket-champion-name {
    font-size: 28px;
  }
}
