/* Krona Chess Design System — Dark & Light Themes, Responsive Desktop/Tablet/Mobile, Zero Paywall UI */

:root {
  --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.14);
  --shadow-lg: 0 18px 46px rgba(0, 0, 0, 0.36);
  --transition: 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

html[data-theme="dark"] {
  --bg-app: #161512;
  --bg-surface: #201e1a;
  --bg-elevated: #292621;
  --bg-hover: #332f29;
  --border: rgba(243, 239, 230, 0.09);
  --border-strong: rgba(243, 239, 230, 0.22);
  --text-main: #f3efe6;
  --text-muted: #a69e90;
  --accent: #69923e;
  --accent-hover: #587d32;
  --accent-soft: rgba(105, 146, 62, 0.17);
  --gold: #d9a441;
  --gold-soft: rgba(217, 164, 65, 0.16);
  --danger: #d9534f;
  --info: #4b9cd3;
}

html[data-theme="light"] {
  --bg-app: #f3efe7;
  --bg-surface: #fcfaf5;
  --bg-elevated: #efe9dc;
  --bg-hover: #e5decb;
  --border: rgba(35, 31, 26, 0.11);
  --border-strong: rgba(35, 31, 26, 0.24);
  --text-main: #231f1a;
  --text-muted: #655d51;
  --accent: #537b2c;
  --accent-hover: #436422;
  --accent-soft: rgba(83, 123, 44, 0.13);
  --gold: #b47d1e;
  --gold-soft: rgba(180, 125, 30, 0.14);
  --danger: #c0392b;
  --info: #2874a6;
  --shadow-sm: 0 2px 10px rgba(35, 31, 26, 0.07);
  --shadow-lg: 0 18px 40px rgba(35, 31, 26, 0.15);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.hidden {
  display: none !important;
}

/* App Shell */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 14px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(145deg, #e0ad48, #9c6a1f);
  color: #19150f;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 12px rgba(217, 164, 65, 0.28);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.brand-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 10px 12px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background var(--transition), color var(--transition);
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-badge-live {
  margin-left: auto;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 99px;
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

.sidebar-footer {
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.free-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
}

/* Main Column & Topbar */
.main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 58px;
  padding: 0 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 25;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.online-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.online-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.online-chip.connected .dot {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-main);
  transition: background var(--transition);
}

.icon-btn:hover {
  background: var(--bg-hover);
}

.view-root {
  flex: 1;
  padding: 20px;
  max-width: 1420px;
  width: 100%;
  margin: 0 auto;
}

/* Buttons & Badges */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-main);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: transform 80ms ease, background var(--transition), border-color var(--transition);
}

.btn:hover:not(:disabled) {
  background: var(--bg-hover);
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

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

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.28);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-gold {
  background: var(--gold);
  border-color: var(--gold);
  color: #18140e;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.22);
}

.hero-club-card {
  background: linear-gradient(135deg, rgba(105, 146, 62, 0.16), rgba(217, 164, 65, 0.08));
  border: 1px solid rgba(217, 164, 65, 0.28);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.home-feature-card {
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.home-feature-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.home-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.pill-accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.pill-gold {
  background: var(--gold-soft);
  color: var(--gold);
  border-color: transparent;
}

.pill-live {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.35);
}

/* Cards & Grids */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

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

.section-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

.muted {
  color: var(--text-muted);
  font-size: 13.5px;
}

.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-main);
  font-size: 13.5px;
}

.input:focus, .select:focus, .textarea:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

/* Tab Pills */
.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 7px 13px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.tab-btn.active {
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

/* Chess Arena Layout */
.arena-layout {
  display: grid;
  grid-template-columns: minmax(280px, min(540px, calc(100vh - 208px))) minmax(280px, 1fr);
  gap: 18px;
  align-items: start;
}

.arena-board-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.arena-board-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

/* Vertical Eval Bar */
.eval-bar-wrap {
  width: 24px;
  border-radius: 8px;
  background: #1b222d;
  border: 1px solid var(--border-strong);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.eval-bar-white {
  background: #f8fafc;
  width: 100%;
  height: 50%;
  transition: height 260ms ease;
}

.eval-bar-score {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 9.5px;
  font-weight: 900;
  padding: 2px 1px;
  z-index: 2;
  color: #059669;
  text-shadow: none;
}

/* Interactive Krona Board */
.krona-board-host {
  flex: 1;
  min-width: 0;
}

.krona-board-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  border: 3px solid rgba(68, 57, 45, 0.8);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  user-select: none;
  touch-action: none;
  background: var(--sq-dark, #769656);
}

.krona-board-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
}

.krona-sq {
  position: relative;
  display: grid;
  place-items: center;
}

.sq-light {
  background: var(--sq-light, #eaefd9);
  color: var(--sq-dark, #5b8c5a);
}

.sq-dark {
  background: var(--sq-dark, #5b8c5a);
  color: var(--sq-light, #eaefd9);
}

.sq-last::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--sq-accent, #f6f669);
  opacity: 0.38;
  pointer-events: none;
}

.sq-selected::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #22c55e;
  opacity: 0.42;
  pointer-events: none;
}

.sq-premove::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #f43f5e;
  opacity: 0.46;
  pointer-events: none;
}

.sq-user-hl::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #f59e0b;
  opacity: 0.45;
  pointer-events: none;
}

.sq-check {
  background: radial-gradient(circle, #ff2e4c 0%, rgba(239, 68, 68, 0.7) 58%, transparent 80%) !important;
}

.sq-dragging-origin .krona-piece-slot {
  opacity: 0.28;
}

.krona-coord-rank, .krona-coord-file {
  position: absolute;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
  z-index: 3;
  opacity: 0.86;
}

.krona-coord-rank {
  top: 3px;
  left: 4px;
}

.krona-coord-file {
  bottom: 3px;
  right: 4px;
}

.krona-piece-slot {
  position: relative;
  width: 88%;
  height: 88%;
  z-index: 2;
  pointer-events: none;
  display: grid;
  place-items: center;
}

.krona-piece-slot.is-premove-ghost {
  opacity: 0.78;
}

.chess-piece-svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.28));
}

.krona-move-marker {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  display: grid;
  place-items: center;
}

.marker-dot::before {
  content: "";
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.28);
}

.marker-capture::before {
  content: "";
  width: 82%;
  height: 82%;
  border-radius: 50%;
  border: 4px solid rgba(15, 23, 42, 0.28);
}

.marker-premove::before {
  content: "";
  width: 34%;
  height: 34%;
  border-radius: 50%;
  background: rgba(244, 63, 94, 0.56);
}

.krona-board-arrows {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 6;
}

.krona-badge-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
}

.krona-eval-badge {
  position: absolute;
  transform: translate(-88%, 12%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  border: 2px solid #ffffff;
}

@keyframes badgePop {
  0% { transform: translate(-88%, 12%) scale(0.3); opacity: 0; }
  65% { transform: translate(-88%, 12%) scale(1.18); opacity: 1; }
  100% { transform: translate(-88%, 12%) scale(1); opacity: 1; }
}

.badge-pop {
  animation: badgePop 260ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.krona-drag-ghost {
  position: fixed;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 9999;
}

.krona-promo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.krona-promo-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.krona-promo-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.krona-promo-choices {
  display: flex;
  gap: 8px;
}

.krona-promo-btn {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  cursor: pointer;
  padding: 6px;
}

/* Player Bars & Clocks */
.player-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.player-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}

.clock-box {
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  min-width: 82px;
  text-align: center;
}

.clock-box.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.clock-box.low {
  background: #dc2626;
  color: #fff;
}

/* Tables & Move Lists */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th, .data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.data-table th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.data-table tr:hover td {
  background: var(--bg-elevated);
}

.move-grid {
  max-height: 290px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.move-row {
  display: grid;
  grid-template-columns: 42px 1fr 1fr;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.move-num {
  padding: 6px 8px;
  color: var(--text-muted);
  font-weight: 600;
}

.move-cell {
  padding: 6px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.move-cell:hover {
  background: var(--bg-hover);
}

.move-cell.current {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

/* Crowns & Bots */
.crowns-row {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.crown-pip {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  opacity: 0.28;
}

.crown-pip.earned {
  color: #f59e0b;
  opacity: 1;
}

/* Modals & Toasts */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 20, 0.72);
  backdrop-filter: blur(4px);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 20px;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.toast-root {
  position: fixed;
  right: 16px;
  bottom: 78px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  max-width: 340px;
}

.toast.error {
  border-left-color: var(--danger);
}

.mobile-only {
  display: none;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: -264px;
    transition: left 200ms ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    left: 0;
  }
  .mobile-only {
    display: inline-flex;
  }
  .arena-layout {
    grid-template-columns: 1fr;
  }
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .view-root {
    padding: 14px 12px 84px;
  }
  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 62px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    z-index: 35;
  }
  .mobile-nav-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 10.5px;
    font-weight: 600;
    cursor: pointer;
  }
  .mobile-nav-btn.active {
    color: var(--accent);
  }
}

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  .topbar {
    padding: 0 10px;
  }
  .topbar-left, .topbar-right {
    gap: 6px;
  }
  .topbar-title {
    font-size: 14.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
  }
  #ws-label {
    display: none;
  }
  .online-chip {
    padding: 5px 8px;
  }
  #topbar-register-btn {
    white-space: nowrap;
    padding: 6px 10px;
    font-size: 12px;
  }
  .eval-bar-wrap {
    width: 18px;
  }
}

@media (max-width: 460px) {
  #topbar-login-btn {
    display: none;
  }
}

/* ============================================================================
   Special Modes: Win Streak Fire, Blindfold, Voice Input & 4-Player 14x14 Board
   ============================================================================ */

@keyframes flameFlicker {
  0%, 100% { transform: translateY(0) scale(1) rotate(-1deg); }
  50% { transform: translateY(-1.5px) scale(1.07) rotate(2deg); }
}

@keyframes flameAuraPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(249, 115, 22, 0.35); }
  50% { box-shadow: 0 0 18px rgba(245, 158, 11, 0.72), 0 0 30px rgba(239, 68, 68, 0.42); }
}

@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-weight: 800;
  font-size: 12.5px;
  border: 1px solid rgba(249, 115, 22, 0.38);
  background: rgba(249, 115, 22, 0.14);
  color: #fb923c;
  flex-shrink: 0;
}

.streak-badge.compact {
  padding: 2px 7px;
  font-size: 11.5px;
  gap: 3px;
}

.streak-badge .streak-flame-svg .flame-outer {
  fill: #f97316;
}

.streak-badge .streak-flame-svg .flame-inner {
  fill: #fde047;
}

.streak-badge.streak-lvl-0 {
  opacity: 0.65;
  border-color: var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.streak-badge.streak-lvl-0 .streak-flame-svg .flame-outer {
  fill: var(--text-muted);
}

.streak-badge.streak-lvl-1 {
  border-color: rgba(251, 146, 60, 0.45);
  background: rgba(251, 146, 60, 0.15);
  color: #fb923c;
}

.streak-badge.streak-lvl-2 {
  border-color: rgba(249, 115, 22, 0.65);
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.24), rgba(245, 158, 11, 0.18));
  color: #fdba74;
}

.streak-badge.streak-lvl-2 .streak-flame-svg {
  animation: flameFlicker 1.4s ease-in-out infinite;
}

.streak-badge.streak-lvl-3 {
  border-color: rgba(239, 68, 68, 0.72);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.28), rgba(245, 158, 11, 0.28));
  color: #fef08a;
  animation: flameAuraPulse 1.8s ease-in-out infinite;
}

.streak-badge.streak-lvl-3 .streak-flame-svg {
  animation: flameFlicker 0.95s ease-in-out infinite;
}

.streak-badge.streak-lvl-4 {
  border-color: rgba(250, 204, 21, 0.9);
  background: linear-gradient(135deg, #b91c1c, #ea580c, #d97706);
  color: #ffffff;
  animation: flameAuraPulse 1.15s ease-in-out infinite;
}

.streak-badge.streak-lvl-4 .streak-flame-svg .flame-outer {
  fill: #fde047;
}

.streak-badge.streak-lvl-4 .streak-flame-svg .flame-inner {
  fill: #ffffff;
}

.streak-badge.streak-lvl-4 .streak-flame-svg {
  animation: flameFlicker 0.72s ease-in-out infinite;
}

/* Blindfold Mode Visual Markers */
.krona-bf-dot {
  width: 42%;
  height: 42%;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.krona-bf-dot.krona-bf-w {
  background: #f8fafc;
  border: 2px solid #475569;
}

.krona-bf-dot.krona-bf-b {
  background: #1e293b;
  border: 2px solid #cbd5e1;
}

.krona-bf-chip {
  width: 68%;
  height: 68%;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: clamp(11px, 2.2vw, 17px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.38);
}

.krona-bf-chip.krona-bf-w {
  background: #f8fafc;
  color: #0f172a;
  border: 2px solid #64748b;
}

.krona-bf-chip.krona-bf-b {
  background: #1c1917;
  color: #f8fafc;
  border: 2px solid #a8a29e;
}

.krona-bf-ghost {
  width: 72%;
  height: 72%;
  margin: 14%;
  border-radius: 50%;
  border: 3px dashed var(--accent);
  background: rgba(105, 146, 62, 0.25);
}

.voice-mic-active {
  background: #dc2626 !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
  animation: voicePulse 1.3s infinite;
}

/* 4-Player 14x14 Cross Chessboard */
.fp-arena-layout {
  display: grid;
  grid-template-columns: minmax(300px, min(680px, calc(100vh - 150px))) minmax(270px, 1fr);
  gap: 18px;
  align-items: start;
}

.fp-board-outer {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-surface);
  border: 2px solid var(--border-strong);
  border-radius: 14px;
  padding: 6px;
  box-shadow: var(--shadow-lg);
}

.fp-board-grid {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  grid-template-rows: repeat(14, 1fr);
  width: 100%;
  height: 100%;
  gap: 0;
  user-select: none;
  touch-action: manipulation;
}

.fp-void {
  background: transparent;
  pointer-events: none;
}

.fp-sq {
  position: relative;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
}

.fp-sq-light {
  background: #eee7d4;
}

.fp-sq-dark {
  background: #739459;
}

.fp-sq-selected {
  box-shadow: inset 0 0 0 3px #facc15;
  background: rgba(250, 204, 21, 0.55) !important;
}

.fp-sq-last {
  box-shadow: inset 0 0 0 2px rgba(245, 158, 11, 0.8);
  background: rgba(245, 158, 11, 0.34) !important;
}

.fp-sq-check {
  background: radial-gradient(circle, #ef4444 0%, rgba(239, 68, 68, 0.72) 72%) !important;
}

.fp-sq-legal::after {
  content: "";
  width: 32%;
  height: 32%;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.42);
  position: absolute;
  pointer-events: none;
  z-index: 4;
}

.fp-sq-capture::after {
  content: "";
  width: 82%;
  height: 82%;
  border-radius: 50%;
  border: 3px solid rgba(220, 38, 38, 0.72);
  position: absolute;
  pointer-events: none;
  z-index: 4;
}

.fp-piece-svg {
  width: 88%;
  height: 88%;
  display: block;
  z-index: 2;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.36));
}

.fp-piece-svg.fp-piece-dead {
  opacity: 0.65;
  filter: grayscale(0.9);
}

.fp-seat-card {
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.fp-seat-card.fp-turn-glow {
  box-shadow: 0 0 14px rgba(217, 164, 65, 0.32);
  transform: translateY(-1px);
  background: var(--bg-surface);
}

.fp-seat-card.fp-seat-elim {
  opacity: 0.52;
}

@media (max-width: 1024px) {
  .fp-arena-layout {
    grid-template-columns: 1fr;
  }
}

/* --- Global Upgrade: Custom Skins, Board Textures, Brilliant Glow, Voice Chat, Confetti, Parallel & Tournaments --- */

.krona-custom-piece-img {
  width: 92%;
  height: 92%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.board-tex-wood .sq-light {
  background-image: repeating-linear-gradient(25deg, rgba(139, 90, 43, 0.05) 0 4px, transparent 4px 10px);
}
.board-tex-wood .sq-dark {
  background-image: repeating-linear-gradient(25deg, rgba(20, 10, 0, 0.12) 0 4px, transparent 4px 10px);
}

.board-tex-marble .krona-sq {
  background-image: radial-gradient(circle at 22% 28%, rgba(255, 255, 255, 0.14), transparent 55%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.06) 0%, transparent 45%, rgba(0, 0, 0, 0.08) 100%);
}

.board-tex-slate .krona-sq {
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 0);
  background-size: 6px 6px;
}

.board-tex-felt .krona-sq {
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.12);
}

.badge-brilliant {
  background: linear-gradient(135deg, #06b6d4, #0891b2) !important;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.78), 0 2px 8px rgba(0, 0, 0, 0.45) !important;
  animation: brilliantGlow 1.6s ease-in-out infinite alternate;
}

@keyframes brilliantGlow {
  from { box-shadow: 0 0 8px rgba(6, 182, 212, 0.55), 0 2px 8px rgba(0, 0, 0, 0.45); }
  to { box-shadow: 0 0 16px rgba(34, 211, 238, 0.95), 0 2px 10px rgba(0, 0, 0, 0.55); }
}

.voice-chat-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.parallel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

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

.pg-turn-alert {
  border-color: var(--accent) !important;
  box-shadow: 0 0 10px rgba(105, 146, 62, 0.4);
}

.trn-bracket-scroll {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.trn-bracket-col {
  min-width: 195px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trn-match-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
}

.trn-win-row {
  color: var(--accent);
  font-weight: 800;
}

.krona-confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 120;
  overflow: hidden;
}

.krona-confetti-bit {
  position: absolute;
  top: -16px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation-name: kronaConfettiFall;
  animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  animation-fill-mode: forwards;
}

@keyframes kronaConfettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateY(105vh) rotate(540deg); opacity: 0; }
}
