/* Custom Touch & Mobile Optimization */
html, body {
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
}

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

select, select option, select optgroup {
  white-space: nowrap !important;
  word-break: keep-all !important;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 2px;
}

/* Ambient Court Background */
body {
  background-image: radial-gradient(circle at 50% 0%, rgba(16, 185, 129, 0.05) 0%, transparent 60%);
  background-attachment: fixed;
}

/* Dark Theme */
html.dark body {
  background-color: #080c14;
  color: #f1f5f9;
  background-image: radial-gradient(circle at 50% -10%, rgba(16, 185, 129, 0.08) 0%, transparent 70%),
    radial-gradient(circle at 100% 60%, rgba(245, 158, 11, 0.04) 0%, transparent 50%);
}

html.dark .glass-nav {
  background: rgba(8, 12, 20, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-color: rgba(255, 255, 255, 0.07);
}

html.dark .glass-card {
  background: rgba(18, 25, 38, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: #f1f5f9;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

html.dark .glass-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

html.dark .input-bg {
  background-color: rgba(11, 17, 28, 0.85);
  border-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

html.dark .sub-text {
  color: #94a3b8;
}

html.dark .card-inner {
  background-color: rgba(11, 17, 28, 0.65);
  border-color: rgba(255, 255, 255, 0.06);
}

html.dark select option {
  background-color: #0b111c;
  color: #ffffff;
}

/* Light Theme (白底 / 暖白簡約) */
html.light body {
  background-color: #faf8f5;
  color: #292524;
  background-image: radial-gradient(circle at 50% -5%, rgba(16, 185, 129, 0.06) 0%, transparent 60%),
    radial-gradient(circle at 100% 40%, rgba(245, 158, 11, 0.04) 0%, transparent 50%);
}

html.light .glass-nav {
  background: rgba(250, 248, 245, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-color: #e8e2d8;
}

html.light .glass-card {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid #ebd9c8;
  color: #292524;
  box-shadow: 0 4px 18px -2px rgba(180, 150, 120, 0.08);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

html.light .glass-card:hover {
  box-shadow: 0 8px 24px -4px rgba(180, 150, 120, 0.14);
  border-color: #dfcdb8;
}

html.light .input-bg {
  background-color: #ffffff;
  border-color: #d6c7b2;
  color: #1c1917;
}

html.light .sub-text {
  color: #78716c;
}

html.light .card-inner {
  background-color: #f6f2eb;
  border-color: #e5dbc9;
}

html.light select option {
  background-color: #ffffff;
  color: #292524;
}

html.light .text-white {
  color: #1c1917 !important;
}

html.light .text-slate-200,
html.light .text-slate-300 {
  color: #44403c !important;
}

html.light .text-slate-400 {
  color: #78716c !important;
}

html.light .bg-slate-900,
html.light .bg-slate-950,
html.light .bg-slate-800 {
  background-color: #f3ece0 !important;
  border-color: #e7ded0 !important;
}

/* Hover Lift & Glow Interactions */
.hover-lift {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
}

.hover-lift:hover {
  transform: translateY(-2.5px);
}

html.dark .hover-lift:hover {
  box-shadow: 0 12px 30px -6px rgba(0, 0, 0, 0.55), 0 0 16px -2px rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.35);
}

html.light .hover-lift:hover {
  box-shadow: 0 12px 26px -6px rgba(180, 150, 120, 0.2), 0 0 14px -2px rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.4);
}

/* Scoreboard Digits & Winner Glow */
.scoreboard-num {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.winner-card-blue {
  border-color: rgba(59, 130, 246, 0.5) !important;
  box-shadow: 0 0 18px -2px rgba(59, 130, 246, 0.25);
}

.winner-card-red {
  border-color: rgba(244, 63, 94, 0.5) !important;
  box-shadow: 0 0 18px -2px rgba(244, 63, 94, 0.25);
}

/* Animated Progress Shimmer */
@keyframes shimmerMove {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.progress-shimmer {
  background: linear-gradient(90deg, #10b981 0%, #34d399 45%, #6ee7b7 55%, #10b981 100%);
  background-size: 200% 100%;
  animation: shimmerMove 3.5s infinite linear;
}

/* Schedule Mode Buttons */
.mode-btn-active {
  border-color: #10b981 !important;
  background: rgba(16, 185, 129, 0.12) !important;
  color: #059669 !important;
  box-shadow: 0 0 12px -2px rgba(16, 185, 129, 0.25);
}

html.dark .mode-btn-active {
  border-color: #34d399 !important;
  background: rgba(52, 211, 153, 0.16) !important;
  color: #34d399 !important;
  box-shadow: 0 0 14px -2px rgba(52, 211, 153, 0.3);
}

.mode-btn-inactive {
  border-color: #cbd5e1;
  background: transparent;
}

html.dark .mode-btn-inactive {
  border-color: #334155;
  background: transparent;
  color: #94a3b8;
}

html.light .mode-btn-inactive {
  border-color: #d6c7b2;
  color: #78716c;
}

/* Light mode: nav 按鈕與 icon 加強對比，防止與米黃色背景融合 */
html.light header .card-inner {
  background-color: #ffffff;
  border-color: #d6c7b2;
}

html.light header .sub-text {
  color: #44403c;
}

html.light header #btn-settings-toggle {
  color: #292524;
}

/* Prevent double-tap zoom delay on mobile devices */
button,
input,
select,
textarea {
  touch-action: manipulation;
}
