/* =========================
   Professional UX Polish
   ========================= */

/* ---- SVG Theme Toggle Icons ----
   Sun shown in dark mode; moon shown in light mode.
   CSS-controlled via data-theme on :root (no JS innerHTML needed). */
.icon-theme-sun,
.icon-theme-moon {
  display: block;
  pointer-events: none;
}:root:not([data-theme="light"]) .icon-theme-moon { display: none; }

/* Ensure icon-only buttons don't render extra line-height from font-size: 28px */
#themeToggle,
#footerMainOptionsToggle {
  line-height: 0;
}

/* ---- Entry Switcher (Score / Games) icon + label layout ---- */
.entry-switcher-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: calc(13px + var(--font-size-step));
}

.entry-tab-label {
  font-size: calc(12px + var(--font-size-step));
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
}

.entry-switcher-btn svg {
  flex-shrink: 0;
}
/* Dark theme: active tab. Strong solid gradient + white text so the
   selected Score/Games tab is unmistakable — the prior translucent
   fill was too low-contrast against the dark footer. */
:root:not([data-theme="light"]) .entry-switcher-btn.active {
  color: #ffffff;
  background: linear-gradient(180deg, #2384dc, #176dc6);
  border-color: #4a9eff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 8px 18px -10px rgba(35, 132, 220, 0.55);
}
:root:not([data-theme="light"]) .entry-switcher-btn.active:hover {
  background: linear-gradient(180deg, #2f93eb, #1e7ad2);
}


/* =========================
   SVG Icon + Layout Modernization
   ========================= */

/* ---- Game Toggle: icon + label chip layout ---- */
/* Replace emoji-optimized 19px with tight icon+text layout */
.game-toggle {
  gap: 7px;
  font-size: calc(13px + var(--font-size-step));
  padding: 10px 14px;       /* was 10px 2px */
  letter-spacing: 0.01em;
}

/* ---- Gamesbar: ensure last tab is fully visible when scrolled to end ---- */


/* ---- Responsive: compact game toggles on narrow phones (<= 480px) ---- */
@media (max-width: 480px) {
  
  .game-toggle {
    padding: 8px 10px;
    gap: 5px;
  }
  .game-toggle-label {
    font-size: calc(11px + var(--font-size-step));
  }
}
.game-toggle-label {
  font-size: calc(12px + var(--font-size-step));
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

/* Prevent SVGs inside game toggles from shrinking when the button is narrow */
.game-toggle svg {
  flex-shrink: 0;
}

/* ---- Icon-only option buttons: fix line-height with SVG content ---- */
/* font-size: 28px was there for emoji; now SVGs are explicit-sized so reset */
.game-options-icon-btn,
.banker-options-icon-btn {
  line-height: 0;
  font-size: 0;
}#headerOptionsPanel #utilitiesToggle {
  width: 100%;
  justify-content: flex-start;
  gap: 8px;
  min-height: 56px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid var(--line-cool);
  background: linear-gradient(180deg, var(--hi-bright), rgba(242, 248, 255, 0.9));
  color: #1e3348;
  box-shadow: inset 0 1px 0 var(--hi-strong), 0 12px 20px -18px rgba(36, 71, 102, 0.3);
}#headerOptionsPanel #utilitiesToggle:hover {
  border-color: rgba(116, 149, 176, 0.4);
  background: linear-gradient(180deg, rgba(248, 252, 255, 0.98), rgba(236, 244, 252, 0.92));
}#headerOptionsPanel #utilitiesToggle.is-open {
  border-color: rgba(20, 93, 171, 0.62);
  background: linear-gradient(180deg, rgba(35, 132, 220, 0.2), rgba(23, 109, 198, 0.16));
  color: #133f62;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58), 0 0 0 2px rgba(35, 132, 220, 0.16);
}:root:not([data-theme="light"]) #headerOptionsPanel #utilitiesToggle {
  border-color: var(--line-medium);
  background: linear-gradient(180deg, var(--surface-d1), var(--surface-d2));
  color: #e5f1fb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 12px 20px -18px var(--shadow-deep);
}:root:not([data-theme="light"]) #headerOptionsPanel #utilitiesToggle.is-open {
  border-color: rgba(82, 169, 255, 0.65);
  background: linear-gradient(180deg, rgba(30, 101, 176, 0.36), rgba(24, 72, 130, 0.3));
  color: #f2f8ff;
}

/* ---- SVG buttons in regular .btn rows: vertical alignment ---- */
.btn svg {
  flex-shrink: 0;
  vertical-align: middle;
}

/* ---- Game section h2: remove extra space from removed emoji ---- */
.game-section-header h2 {
  font-size: calc(17px + var(--font-size-step));
  font-weight: 700;
  letter-spacing: 0.01em;
}
/* =========================
   Games Native Polish (final overrides)
   ========================= */

/* Cleaner game surface hierarchy: less border noise, more depth by layer. */
.game-section {
  border-top-color: rgba(128, 153, 178, 0.22);
  border-bottom-color: var(--line-base);
}

.game-section-header {
  padding-top: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-base);
}
.game-options-icon-btn,
.banker-options-icon-btn {
  border-width: 1px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 8px 16px -14px rgba(36, 71, 102, 0.34);
}

.game-options-panel {
  border-color: var(--line-base);
  box-shadow: 0 14px 28px -24px rgba(36, 71, 102, 0.28);
}
.results-card-wrap {
  border-color: rgba(128, 153, 178, 0.24);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 16px 28px -24px rgba(36, 71, 102, 0.22);
}

.results-card-wrap .live-results-card,
.results-card-wrap .banker-header-totals {
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.99), rgba(239, 246, 253, 0.99));
}

.results-collapse-bar {
  min-height: 42px;
  letter-spacing: 0.02em;
  font-weight: 700;
}

.results-collapse-label {
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.gamesbar-scroll-indicator {
  height: 4px;
  border-radius: 999px;
  opacity: 0.85;
}

.gamesbar-scroll-indicator__thumb {
  border-radius: 999px;
}

.vegas-table th,
.vegas-table td,
.banker-table th,
.banker-table td,
.skins-table th,
.skins-table td,
.junk-table th,
.junk-table td {
  border-color: var(--line-base);
}

.vegas-table thead th,
.banker-table thead th,
.skins-table thead th,
.junk-table thead th {
  font-size: clamp(1.05rem, 2.35vw, 1.28rem);
  letter-spacing: 0.01em;
}

:root:not([data-theme="light"]) .game-section {
  border-top-color: rgba(112, 148, 178, 0.28);
  border-bottom-color: rgba(112, 148, 178, 0.24);
}

:root:not([data-theme="light"]) .game-section-header {
  border-bottom-color: rgba(112, 148, 178, 0.26);
}

:root:not([data-theme="light"]) .game-options-icon-btn,
:root:not([data-theme="light"]) .banker-options-icon-btn {
  border-color: rgba(112, 148, 178, 0.36);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 10px 18px -14px rgba(0, 0, 0, 0.56);
}

:root:not([data-theme="light"]) .game-options-panel {
  border-color: rgba(112, 148, 178, 0.26);
  box-shadow: 0 18px 30px -24px rgba(0, 0, 0, 0.62);
}
:root:not([data-theme="light"]) .results-card-wrap {
  border-color: rgba(112, 148, 178, 0.28);
  box-shadow: 0 16px 28px -20px rgba(0, 0, 0, 0.68);
}

:root:not([data-theme="light"]) .results-card-wrap .live-results-card,
:root:not([data-theme="light"]) .results-card-wrap .banker-header-totals {
  background: linear-gradient(180deg, rgba(16, 34, 52, 0.99), rgba(12, 27, 42, 0.99));
}
:root:not([data-theme="light"]) .vegas-table th,
:root:not([data-theme="light"]) .vegas-table td,
:root:not([data-theme="light"]) .banker-table th,
:root:not([data-theme="light"]) .banker-table td,
:root:not([data-theme="light"]) .skins-table th,
:root:not([data-theme="light"]) .skins-table td,
:root:not([data-theme="light"]) .junk-table th,
:root:not([data-theme="light"]) .junk-table td {
  border-color: rgba(112, 148, 178, 0.24);
}

@media (max-width: 480px) {
  .game-section-header {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .game-section-header h2 {
    font-size: calc(16px + var(--font-size-step));
  }

  .results-card-wrap {
    border-radius: 20px;
  }

  .results-collapse-bar {
    min-height: 40px;
    padding-left: 12px;
    padding-right: 12px;
  }}

/* =========================
   Error & Success Toast Notifications
   Appended from main.css
   ========================= */

/* =========================
   Error & Success Toast Notifications
   ========================= */

.error-toast,
.success-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  width: calc(100% - 2 * var(--space-xl));
  max-width: 400px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 32px var(--shadow);
  padding: var(--space-lg);
  opacity: 0;
  transform: translate(-50%, calc(-50% - 20px));
  transition: all 0.3s ease;
  z-index: 10000;
  pointer-events: all;
}

.error-toast {
  border-left: 4px solid var(--danger);
}

/* [release-readiness #9] Persistent banners (duration 0 — e.g. "Cloud sync
   paused") get their OWN slot near the top of the viewport instead of the
   centered slot transient error toasts use. Previously both shared the
   single centered .error-toast slot, and error-handler.js's show() evicted
   ANY existing .error-toast before showing a new one — so a transient,
   auto-dismissing error toast (e.g. "Could not start the round") would
   permanently replace the persistent banner, which never came back once
   removed. Distinct slots mean a transient toast can no longer touch the
   persistent banner's DOM node at all. */
.error-toast--persistent {
  top: calc(var(--safe-top-inset, env(safe-area-inset-top, 0px)) + 16px);
  transform: translateX(-50%) translateY(-16px);
}

.success-toast {
  top: 25%;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow:
    0 12px 48px var(--shadow),
    0 28px 80px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(31, 157, 85, 0.14);
}

/* Timer bar — fills left-to-right over the toast duration, then toast fades */
.success-timer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  animation: successTimerFill linear forwards;
}

@keyframes successTimerFill {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.error-content,
.success-content {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.error-icon,
.success-icon {
  font-size: var(--text-2xl);
  flex-shrink: 0;
  line-height: 1;
}

.error-icon {
  color: var(--danger);
}

.success-icon {
  color: var(--accent);
  font-weight: bold;
}

.error-body {
  flex: 1;
}

.error-message,
.success-message {
  font-size: var(--text-lg);
  color: var(--ink-strong);
  font-weight: 500;
  margin-bottom: var(--space-xs);
}

.error-details {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: var(--space-xs);
}

.error-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: calc(24px + var(--font-size-step));
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin-left: var(--space-sm);
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.error-close:hover {
  color: var(--ink-strong);
}

/* [perf] touch has no :hover — give the dismiss tap its own instant coarse-pointer
   feedback, mirroring the .btn/.theme-toggle/.game-toggle rules below —
   notes/PERFORMANCE_UPGRADE.md §Appendix E */
@media (pointer: coarse) {
  .error-close:active {
    color: var(--ink-strong);
    transform: scale(0.9);
    transition: transform 0ms, color 0ms;
  }
}

/* ==========================================================
   Touch press feedback — touch screens only (pointer: coarse)
   Immediate visual response on tap for a native-app feel.
   No impact on mouse/desktop interactions.
   ========================================================== */
@media (pointer: coarse) {
  .btn:active,
  .theme-toggle:active {
    transform: scale(0.95);
    filter: brightness(0.80);
    transition: transform 0ms, filter 0ms;
  }

  .game-toggle:active {
    transform: scale(0.92);
    filter: brightness(0.75);
    transition: transform 0ms, filter 0ms;
  }

  .entry-switcher-btn:active {
    transform: scale(0.96);
    filter: brightness(0.82);
    transition: transform 0ms, filter 0ms;
  }}

/* =========================
   Swipe-to-delete + Professional UX Polish
   Appended from main.css
   ========================= */

/* ---- Swipe-to-delete: touch devices only ---- */

/* Hide the regular delete button on touch; show on pointer:fine (mouse) */
@media (pointer: fine) {
  .swipe-delete-btn { display: none; }
}

@media (pointer: coarse) {
  .player-delete-btn { display: none; }

  .player-row > td:first-child {
    position: relative;
    overflow: hidden;
  }

  .player-row > td:first-child > .name-cell-container {
    transition: transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
  }

  .player-row.swipe-open > td:first-child > .name-cell-container {
    transform: translateX(-72px);
  }

  .swipe-delete-btn {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 72px;
    background: #ff3b30;
    color: #fff;
    border: none;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    /* +2px past the cell's right edge so the red button is fully clipped by
       the cell's overflow:hidden — at exactly 100% a sub-pixel sliver bled
       through at the name/total column seam on Android. */
    transform: translateX(calc(100% + 2px));
    transition: transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 2;
    touch-action: manipulation;
  }

  .player-row.swipe-open .swipe-delete-btn {
    transform: translateX(0);
  }

  .swipe-delete-btn:active {
    background: #c0392b;
  }
}

/* Light mode: keep the swipe Delete action red (matches the "−" delete button)
   instead of inheriting the grey sticky-column surface. */
:root[data-theme="light"] .swipe-delete-btn {
  background: var(--danger-strong);
  color: #fff;
}

:root[data-theme="light"] .swipe-delete-btn:active {
  background: #bb2d3b;
}
/* ---- Responsive: compact game toggles on narrow phones (≤ 480px) ---- */
@media (max-width: 480px) {  .game-toggle-label {
    font-size: 11px;
  }
}
/* =========================================================================
   Light theme overrides — moved from light-theme-overrides.css. Re-defines
   --bg/--panel-alt/--line (this file loads after main.css), so these win
   over the values set in main.css's light-theme block.
   ========================================================================= */

:root[data-theme="light"] .icon-theme-sun { display: none; }

/* Light theme: refined color palette */
:root[data-theme="light"] {
  --bg: #f0f4f8;         /* was #dbe3ea - cleaner, lighter */
  --panel-alt: #e2eaf3;  /* was #e8eef4 */
  --line: #c5d1de;       /* was #b7c2cd - slightly lighter */
}

/* Light theme: card elevation via subtle shadows */
:root[data-theme="light"] .scorecard-container {
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.05);
}

:root[data-theme="light"] .control {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

:root[data-theme="light"] .scorecard-card-footer {
  box-shadow: 0 -1px 0 rgba(15, 23, 42, 0.06);
}

/* Light theme: inactive tab (the .active variants live in game-shell.css
   alongside the rest of the .entry-switcher-btn light rules). */
:root[data-theme="light"] .entry-switcher-btn:not(.active) {
  color: #64748b;
}

/* Light theme: btn default improvement.
   Excludes selected .hcp-mode-btn-family toggles (data-active="true") the
   same way .active/.is-open already are — those components signal
   "selected" via the attribute instead of a literal class, and without this
   exclusion this rule's specificity (0,6,0) beats their selected-state
   rules (games-mode.css/game-options-ui.css, (0,5,0) or lower), flattening
   the selected look. */
:root[data-theme="light"] .btn:not(.accent):not(.active):not(.is-open):not(.hcp-mode-btn[data-active="true"]) {
  background: #ffffff;
  border-color: #c5d1de;
  color: #1e293b;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

:root[data-theme="light"] .btn:not(.accent):not(.active):not(.is-open):not(.hcp-mode-btn[data-active="true"]):hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

/* Light theme: header area polish */
:root[data-theme="light"] .top-pinned-shell {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
}

/* Light theme: footer shells polish */


/* Light theme: error/success toast surfaces */
:root[data-theme="light"] .error-toast,
:root[data-theme="light"] .success-toast {
  background: #ffffff;
  border-color: #d3d7dc;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

:root[data-theme="light"] .success-toast {
  box-shadow:
    0 12px 48px rgba(0, 0, 0, 0.18),
    0 28px 80px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(31, 157, 85, 0.12);
}

/* (.error-message / .success-message light override deleted — the dark rule
   above now uses --ink-strong, which swaps per theme.) */

:root[data-theme="light"] .error-details {
  color: #6c757d;
}

:root[data-theme="light"] .error-close {
  color: #6c757d;
}

/* Kept (not collapsible): the light .error-close rule above (0,3,0) outranks
   the dark .error-close:hover rule (0,2,0), so dropping this (0,4,0) guard
   would lose the hover effect in light. Re-pointed at the token (no-op). */
:root[data-theme="light"] .error-close:hover {
  color: var(--ink-strong);
}
