/* ═══════════════════════════════════════════════════
   Sa Bàn Chiến Thuật — Standalone Build
   Site: https://kythuatbongda.net
   Built: 2026-04-28 20:10
   ═══════════════════════════════════════════════════ */

/* ── SHARED VARIABLES & BASE ─────────────────────── */
:root {
  --bg-base:      #0d1117;
  --bg-card:      #161b22;
  --bg-hover:     #1c2128;
  --bg-input:     #0d1117;
  --border:       #30363d;
  --border-focus: #58a6ff;
  --text-primary: #e6edf3;
  --text-muted:   #8b949e;
  --text-dim:     #484f58;
  --accent:       #238636;
  --accent-hover: #2ea043;
  --brand:        #1f6feb;
  --brand-hover:  #388bfd;
  --danger:       #da3633;
  --warning:      #e3aa20;
  --green:        #3fb950;
  --orange:       #f0883e;
  --radius:       10px;
  --radius-sm:    6px;
  --shadow:       0 4px 24px rgba(0,0,0,.5);
  --transition:   0.18s ease;
}


* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

.hidden { display: none !important; }


.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 1000;
  background: #1f2937; color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 18px; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideUp .25s ease;
}
.toast.success { border-color: var(--green); background: #0d2818; }
.toast.error { border-color: var(--danger); background: #2c1a1a; }


@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}


::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }


.input {
  width: 100%; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 14px; color: var(--text-primary);
  font: 14px 'Inter', sans-serif; transition: border-color var(--transition);
}
.input:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(88,166,255,.1); }


.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent); color: white; margin-top: 12px; width: 100%;
  justify-content: center;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(63,185,80,.3);
}
.btn-secondary {
  background: var(--bg-hover); color: var(--text-primary);
  border: 1px solid var(--border); margin-top: 0;
  width: auto; justify-content: center;
}
.btn-secondary:hover:not(:disabled) { border-color: var(--brand); }
.btn-sm { padding: 5px 12px; font-size: 12px; margin-top: 0; width: auto; }
.btn-ghost {
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); margin-top: 0; width: auto;
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }


/* ═══════════════════════════════════════════════════
   WP HEADER — Branded for kythuatbongda.net
   ═══════════════════════════════════════════════════ */

.wp-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(13,17,23,.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.wp-header-inner {
  max-width: 1600px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
}
.wp-logo {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: inherit;
  transition: opacity 0.18s ease;
}
.wp-logo:hover { opacity: 0.85; }
.wp-logo-icon {
  font-size: 28px;
  filter: drop-shadow(0 0 8px rgba(63,185,80,.35));
}
.wp-logo-name {
  font-size: 16px; font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.wp-logo-sub {
  font-size: 11px; color: var(--text-muted);
  margin-top: 1px;
}
.wp-home-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--radius-sm);
  color: var(--text-muted); text-decoration: none;
  font-weight: 500; font-size: 13px;
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.wp-home-link:hover {
  background: var(--bg-hover); color: var(--text-primary);
  border-color: var(--brand);
}

@media (max-width: 480px) {
  .wp-header { padding: 0 12px; }
  .wp-header-inner { height: 48px; }
  .wp-logo-name { font-size: 14px; }
  .wp-logo-sub { display: none; }
  .wp-home-link { font-size: 12px; padding: 4px 10px; }
}

/* ── TACTICS BOARD ───────────────────────────────── */
/* ===================================================
   Sa Bàn Chiến Thuật — Tactics Board Styles
   Design System: Barlow + Lucide + Dark OLED + Glass
   =================================================== */

/* ── DESIGN TOKENS ───────────────────────────── */
:root {
  --tb-font-heading: 'Barlow Condensed', 'Inter', sans-serif;
  --tb-font-body: 'Barlow', 'Inter', sans-serif;
  --tb-transition: 200ms ease-out;
  --tb-radius-sm: 6px;
  --tb-radius-md: 10px;
  --tb-radius-lg: 14px;
  --tb-glass-bg: rgba(255, 255, 255, 0.04);
  --tb-glass-border: rgba(255, 255, 255, 0.08);
  --tb-accent: #0ea5e9;
  --tb-accent-hover: #0284c7;
  --tb-success: #22c55e;
  --tb-danger: #ef4444;
}

/* ── LUCIDE ICON SIZING ──────────────────────── */
.tb-icon { width: 16px; height: 16px; display: inline-block; vertical-align: -2px; }
.tb-icon-xs { width: 12px; height: 12px; display: inline-block; vertical-align: -1px; }
.tb-icon-lg { width: 28px; height: 28px; display: inline-block; color: var(--tb-accent); }

/* ── PRESET DOT SWATCH ───────────────────────── */
.preset-dot {
  display: inline-block;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  vertical-align: middle;
}
.field-preset-swatch { padding: 4px 6px !important; min-width: auto; }
.field-preset-swatch.active .preset-dot { border-color: var(--tb-accent); box-shadow: 0 0 6px rgba(14,165,233,0.4); }

/* ── ACCESSIBILITY ───────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── LAYOUT ──────────────────────────────────── */
.tactics-layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 20px;
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-family: var(--tb-font-body);
}

.tactics-body {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex: 1;
}

/* ── TOOLBAR ─────────────────────────────────── */
.tactics-toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--tb-radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tb-section {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tb-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  flex-shrink: 0;
  opacity: 0.5;
}

.tb-label {
  font-family: var(--tb-font-heading);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tb-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.tb-team {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tb-team-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
}

/* Field type toggle buttons */
.field-type-group {
  display: flex;
  gap: 2px;
  background: var(--bg-hover);
  border-radius: var(--tb-radius-sm);
  padding: 2px;
}

.field-type-btn {
  padding: 6px 14px;
  border-radius: 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font: 600 12px/1 var(--tb-font-body);
  cursor: pointer;
  transition: all var(--tb-transition);
  white-space: nowrap;
}

.field-type-btn:hover {
  color: var(--text-primary);
}

.field-type-btn.active {
  background: var(--brand);
  color: white;
  box-shadow: 0 2px 8px rgba(31,111,235,0.3);
}

/* Custom color pickers (inline with presets) */
.tb-color-pickers {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

.tb-color-pick {
  display: flex;
  align-items: center;
  gap: 5px;
}

.tb-color-pick label {
  font: 500 11px 'Inter', sans-serif;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.tb-color-pick input[type="color"] {
  -webkit-appearance: none;
  border: 2px solid var(--border);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.tb-color-pick input[type="color"]:hover {
  border-color: var(--brand);
}

.tb-color-pick input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.tb-color-pick input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

/* ── FIELD VIEW PICKER (trigger + popup) ────── */
.fv-picker {
  position: relative;
}

.fv-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
}

.fv-trigger:hover {
  border-color: var(--brand);
  background: rgba(31,111,235,0.06);
}

.fv-trigger.open {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(31,111,235,0.15);
}

.fv-trigger-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 28px;
  color: var(--brand);
}

.fv-trigger-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 52px;
}

.fv-trigger-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
}

.fv-trigger-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.fv-trigger-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.fv-trigger.open .fv-trigger-arrow {
  transform: rotate(180deg);
}

/* Popup dropdown */
.fv-popup {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 280px;
  padding: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.2);
  z-index: 1000;
  animation: fvPopupIn 0.15s ease;
}

.fv-popup.visible {
  display: block;
}

@keyframes fvPopupIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fv-popup-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 4px 8px 8px;
}

/* Individual option row */
.fv-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  color: var(--text-muted);
}

.fv-option:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.fv-option.active {
  background: rgba(31,111,235,0.10);
  color: var(--brand);
}

.fv-option .fv-thumb {
  flex-shrink: 0;
}

.fv-option-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.fv-option-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}

.fv-option.active .fv-option-name {
  color: var(--brand);
}

.fv-option-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.3;
}

.fv-check {
  font-size: 14px;
  font-weight: 700;
  color: var(--brand);
  opacity: 0;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

.fv-option.active .fv-check {
  opacity: 1;
}

/* Field view thumbnails (CSS-drawn miniature fields) */
.fv-thumb {
  display: block;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  position: relative;
  background: rgba(45,122,30,0.15);
}

.fv-landscape { width: 36px; height: 22px; }
.fv-portrait  { width: 22px; height: 36px; }
.fv-half-field { width: 36px; height: 22px; }

/* Midlines */
.fv-midline-v {
  position: absolute;
  left: 50%;
  top: 2px;
  bottom: 2px;
  width: 0;
  border-left: 1px solid currentColor;
}

.fv-midline-h {
  position: absolute;
  top: 50%;
  left: 2px;
  right: 2px;
  height: 0;
  border-top: 1px solid currentColor;
}

/* Center circle */
.fv-circle {
  position: absolute;
  width: 8px;
  height: 8px;
  border: 1px solid currentColor;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Half-field thumbnail */
.fv-half-field {
  border-right-style: dashed;
  border-right-color: rgba(255,255,255,0.3);
}

.fv-half-arc {
  position: absolute;
  right: -1px;
  top: 50%;
  width: 12px;
  height: 12px;
  border: 1px solid currentColor;
  border-radius: 50%;
  transform: translateY(-50%);
}

.fv-half-box {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 14px;
  border: 1px solid currentColor;
  border-left: none;
  border-radius: 0 1px 1px 0;
}

/* Half-portrait thumbnail (vertical half-field) */
.fv-half-portrait {
  width: 22px;
  height: 36px;
  border-bottom-style: dashed;
  border-bottom-color: rgba(255,255,255,0.3);
}

.fv-hp-arc {
  position: absolute;
  bottom: -1px;
  left: 50%;
  width: 12px;
  height: 12px;
  border: 1px solid currentColor;
  border-radius: 50%;
  transform: translateX(-50%);
}

.fv-hp-box {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 8px;
  border: 1px solid currentColor;
  border-top: none;
  border-radius: 0 0 1px 1px;
}

/* Attacking third thumbnail */
.fv-third {
  width: 30px;
  height: 26px;
  border-left-style: dashed;
  border-left-color: rgba(255,255,255,0.3);
}

.fv-third-box {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 16px;
  border: 1px solid currentColor;
  border-right: none;
  border-radius: 1px 0 0 1px;
}

.fv-third-arc {
  position: absolute;
  right: 9px;
  top: 50%;
  width: 8px;
  height: 8px;
  border: 1px solid currentColor;
  border-radius: 50%;
  transform: translateY(-50%);
}

/* Formation dropdown */
.tb-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font: 500 12px 'Inter', sans-serif;
  padding: 5px 24px 5px 10px;
  cursor: pointer;
  transition: border-color var(--transition);
  min-width: 140px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.tb-select:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* Color picker */
.tb-color {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  background: none;
  overflow: hidden;
  transition: border-color var(--transition);
}

.tb-color:hover {
  border-color: var(--text-muted);
}

.tb-color::-webkit-color-swatch-wrapper { padding: 0; }
.tb-color::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

/* Action buttons */
.tb-actions {
  margin-left: auto;
}

.tb-btn {
  margin-top: 0 !important;
  width: auto !important;
  padding: 7px 14px !important;
  font-size: 12px !important;
}

/* ── CANVAS WRAPPER ──────────────────────────── */
.tactics-canvas-wrap {
  flex: 1;
  min-width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#tactics-canvas {
  width: 100%;
  max-width: 900px;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  background: #1a3a10;
}

/* Portrait mode: constrain canvas width for better layout */
.tactics-canvas-wrap.view-portrait #tactics-canvas {
  max-width: 500px;
}

.tactics-canvas-wrap.view-half #tactics-canvas {
  max-width: 700px;
}

/* ── SIDEBAR ─────────────────────────────────── */
.tactics-sidebar {
  width: 250px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 80px;
}

.sidebar-section {
  background: var(--tb-glass-bg);
  border: 1px solid var(--tb-glass-border);
  border-radius: var(--tb-radius-md);
  padding: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.sb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--tb-glass-border);
}

.sb-title {
  font-family: var(--tb-font-heading);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sb-field {
  margin-bottom: 10px;
}

.sb-field:last-child {
  margin-bottom: 0;
}

.sb-label {
  font-family: var(--tb-font-heading);
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.sb-input {
  font-family: var(--tb-font-body);
  font-size: 13px !important;
  padding: 7px 10px !important;
}

.sb-player-team {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--tb-glass-border);
}

/* Guide section */
.sb-guide {
  text-align: center;
}

.sb-guide-icon {
  margin-bottom: 6px;
  display: flex;
  justify-content: center;
}

.sb-guide-title {
  font-family: var(--tb-font-heading);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sb-guide-list {
  list-style: none;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sb-guide-list li {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  padding-left: 12px;
  position: relative;
}

.sb-guide-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--tb-accent);
}

/* Branding */
.sb-branding {
  text-align: center;
  padding: 12px;
  border: 1px dashed var(--tb-glass-border) !important;
  background: transparent !important;
}

.sb-brand-text {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.6;
}

.sb-brand-link {
  color: var(--tb-accent);
  text-decoration: none;
  font-weight: 600;
}

.sb-brand-link:hover {
  text-decoration: underline;
}

/* ── EQUIPMENT TOOLBAR (Drag-from-toolbar) ──── */
.eq-toolbar {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 100;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 8px;
}

/* Toggle button */
.eq-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  background: rgba(20, 28, 40, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--brand);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.eq-toggle:hover {
  background: rgba(31,111,235,0.2);
  border-color: var(--brand);
  transform: scale(1.1);
}

.eq-toggle.open {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
  transform: rotate(45deg);
}

.eq-toggle-icon {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

/* Panel */
.eq-panel {
  display: none;
  background: rgba(20, 28, 40, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 14px;
  min-width: 200px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
  animation: eqPanelIn 0.2s ease;
}

.eq-panel.visible {
  display: block;
}

@keyframes eqPanelIn {
  from { opacity: 0; transform: translateY(8px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.eq-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.eq-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.eq-panel-hint {
  font-size: 10px;
  color: var(--text-dim);
  background: rgba(255,255,255,0.06);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Groups */
.eq-group {
  margin-bottom: 10px;
}

.eq-group:last-of-type {
  margin-bottom: 0;
}

.eq-group-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}

.eq-items {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Individual draggable item */
.eq-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid transparent;
  cursor: grab;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}

.eq-item:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.eq-item:active {
  cursor: grabbing;
  transform: scale(0.95);
}

.eq-item-label {
  font-size: 9px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Player disc */
.eq-disc {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: box-shadow 0.15s ease;
}

.eq-item:hover .eq-disc {
  box-shadow: 0 3px 10px rgba(0,0,0,0.4);
}

.eq-disc-num {
  font-size: 16px;
  font-weight: 700;
  color: white;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Cone */
.eq-cone {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  display: block;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.eq-item:hover .eq-cone {
  box-shadow: 0 3px 10px rgba(0,0,0,0.4);
}

/* Ball */
.eq-ball {
  font-size: 22px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* Trash zone */
.eq-trash {
  margin-top: 10px;
  padding: 10px;
  border: 2px dashed rgba(255,255,255,0.1);
  border-radius: 8px;
  text-align: center;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.eq-trash.drag-over {
  border-color: #e74c3c;
  background: rgba(231, 76, 60, 0.15);
}

.eq-trash-icon {
  font-size: 16px;
  opacity: 0.5;
}

.eq-trash-text {
  font-size: 10px;
  color: var(--text-dim);
}

/* Delete button in sidebar */
.sb-delete-btn {
  margin-top: 12px;
  width: 100%;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px !important;
  padding: 8px !important;
  background: rgba(231, 76, 60, 0.1) !important;
  color: #e74c3c !important;
  border: 1px solid rgba(231, 76, 60, 0.2) !important;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sb-delete-btn:hover {
  background: rgba(231, 76, 60, 0.2) !important;
  border-color: rgba(231, 76, 60, 0.4) !important;
}

/* Ghost image for drag */
.eq-drag-ghost {
  position: fixed;
  pointer-events: none;
  opacity: 0;
  z-index: -1;
}

/* ── TRAINING EQUIPMENT icons in panel ──────── */
.eq-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.eq-icon svg {
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
  transition: all 0.18s ease;
}

.eq-item:hover .eq-icon svg {
  transform: scale(1.15);
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.5));
}

/* ── ROTATION CONTROLS (sidebar) ────────────── */
.sb-rotate-group {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.sb-rotate-btn {
  font-size: 11px !important;
  padding: 4px 10px !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px;
  background: rgba(255,255,255,0.04) !important;
  color: var(--text-muted) !important;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.sb-rotate-btn:hover {
  background: rgba(31,111,235,0.12) !important;
  border-color: var(--brand) !important;
  color: var(--brand) !important;
}

.sb-rotate-value {
  font: 600 13px 'Inter', sans-serif;
  color: var(--text-primary);
  min-width: 36px;
  text-align: center;
  background: rgba(255,255,255,0.04);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.sb-rotate-hint {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 6px;
  padding: 4px 8px;
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
  line-height: 1.4;
}

/* ── CANVAS DROP ZONE indicator ─────────────── */
.tactics-canvas-wrap.drag-over-canvas {
  box-shadow: inset 0 0 0 3px rgba(31, 111, 235, 0.4);
}

/* Canvas position context for eq-toolbar */
.tactics-canvas-wrap {
  position: relative;
}

/* ── DRAWING TOOLS TOOLBAR (Bottom-right) ───── */
.dt-toolbar {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(20, 28, 40, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.dt-group {
  display: flex;
  align-items: center;
  gap: 3px;
}

.dt-shapes {
  gap: 2px;
}

.dt-sep {
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,0.12);
  margin: 0 3px;
}

.dt-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-right: 4px;
  white-space: nowrap;
}

/* Tool buttons */
.dt-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.dt-btn:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

.dt-btn.active {
  background: var(--brand);
  color: white;
  box-shadow: 0 2px 8px rgba(31,111,235,0.3);
}

.dt-btn.active[data-tool="eraser"] {
  background: #e74c3c;
  box-shadow: 0 2px 8px rgba(231,76,60,0.3);
}

/* Line style buttons */
.dt-style-group {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
  padding: 2px;
}

.dt-style-btn {
  padding: 4px 6px;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all 0.12s ease;
}

.dt-style-btn:hover {
  color: white;
}

.dt-style-btn.active {
  background: rgba(255,255,255,0.15);
  color: white;
}

/* Cap selectors */
.dt-caps-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dt-cap-selector {
  display: flex;
  gap: 1px;
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
  padding: 2px;
}

.dt-cap-btn {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}

.dt-cap-btn:hover {
  color: white;
}

.dt-cap-btn.active {
  background: rgba(255,255,255,0.15);
  color: white;
}

.dt-cap-divider {
  font-size: 8px;
  color: rgba(255,255,255,0.2);
  letter-spacing: -1px;
}

/* Color picker */
.dt-color {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  background: none;
  overflow: hidden;
  transition: border-color 0.15s ease;
  flex-shrink: 0;
}

.dt-color:hover {
  border-color: rgba(255,255,255,0.5);
}

.dt-color::-webkit-color-swatch-wrapper { padding: 0; }
.dt-color::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

/* Action buttons */
.dt-action-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.dt-action-btn:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

.dt-action-btn:active {
  transform: scale(0.9);
}

/* Cursor overrides for drawing modes */
.drawing-mode-crosshair #tactics-canvas {
  cursor: crosshair !important;
}

.drawing-mode-eraser #tactics-canvas {
  cursor: not-allowed !important;
}

.drawing-mode-text #tactics-canvas {
  cursor: text !important;
}

/* Drawing shape hover highlight for eraser */
.dt-eraser-highlight {
  cursor: pointer !important;
}

/* Old responsive rules moved to bottom of file (comprehensive version) */

/* ═══════════════════════════════════════════
   AI ANALYSIS PANEL
   ═══════════════════════════════════════════ */

.sb-textarea {
  resize: vertical;
  min-height: 48px;
  max-height: 120px;
  font-size: 12px;
  line-height: 1.4;
}

.sb-ai-actions {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}

.sb-ai-actions .btn {
  flex: 1;
  font-size: 12px;
  padding: 6px 10px;
}

.ai-result-box {
  margin-top: 10px;
  padding: 12px;
  background: var(--surface-elevated);
  border-radius: 8px;
  border: 1px solid var(--border);
  max-height: 400px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
}

.ai-result-box::-webkit-scrollbar {
  width: 4px;
}
.ai-result-box::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.ai-content h2, .ai-content h3, .ai-content h4 {
  color: var(--accent);
  margin: 12px 0 6px;
  font-size: 14px;
}
.ai-content h2 { font-size: 16px; }
.ai-content h3 { font-size: 15px; }

.ai-content strong {
  color: var(--text-primary);
}

.ai-content ul {
  margin: 4px 0;
  padding-left: 18px;
}
.ai-content li {
  margin: 2px 0;
}

.ai-content p {
  margin: 6px 0;
}

.ai-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  color: var(--text-secondary);
  font-style: italic;
}

.ai-loading .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

.ai-error {
  color: #e74c3c;
  padding: 10px;
  font-size: 13px;
}

/* ── ZOOM CONTROLS ──────────────────────────── */
.tb-zoom-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tb-zoom-value {
  font: 600 11px 'Inter', sans-serif;
  color: var(--text-muted);
  min-width: 36px;
  text-align: center;
}

/* ── WIDTH / DEPTH SLIDERS ──────────────────── */
.tb-slider-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

.tb-slider-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tb-slider-label {
  font: 500 10px 'Inter', sans-serif;
  color: var(--text-dim);
  min-width: 42px;
  white-space: nowrap;
}

.tb-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-hover);
  outline: none;
  cursor: pointer;
}

.tb-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid rgba(255,255,255,0.2);
  cursor: pointer;
  transition: box-shadow 0.15s ease;
}

.tb-slider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 4px rgba(31,111,235,0.2);
}

.tb-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid rgba(255,255,255,0.2);
  cursor: pointer;
}

.tb-slider-value {
  font: 600 10px 'Inter', sans-serif;
  color: var(--text-dim);
  min-width: 30px;
  text-align: right;
}

.tb-slider-reset {
  position: absolute;
  right: -24px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px !important;
  padding: 2px 4px !important;
  opacity: 0.5;
  transition: opacity 0.15s ease;
}

.tb-slider-reset:hover {
  opacity: 1;
}

/* ── SAVE FORMATION BUTTON (sidebar) ────────── */
.sb-save-formation {
  width: 100%;
  margin-top: 10px;
  font-size: 12px !important;
  padding: 8px 12px !important;
  border: 1px dashed var(--border) !important;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.sb-save-formation:hover {
  border-color: var(--brand) !important;
  color: var(--brand);
  background: rgba(31,111,235,0.06);
}

/* ── BTN SIZES ──────────────────────────────── */
.btn-xs {
  padding: 4px 8px !important;
  font-size: 12px !important;
  min-width: 28px;
  line-height: 1;
}

.btn-sm {
  padding: 6px 12px !important;
  font-size: 12px !important;
}

/* ── ROLE SELECT ────────────────────────────── */
.sb-role-select {
  font-size: 12px !important;
  padding: 6px 10px !important;
  cursor: pointer;
}

/* ── FACING ANGLE ───────────────────────────── */
.sb-facing-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sb-facing-value {
  font: 700 16px 'Inter', sans-serif;
  color: var(--brand);
  min-width: 40px;
}

.sb-facing-hint {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.4;
}

/* Multi-select sidebar */
.sb-multi-select {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.sb-multi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.sb-multi-count {
  font-size: 10px;
  font-weight: 600;
  color: #00e5ff;
  background: rgba(0, 229, 255, 0.12);
  padding: 2px 8px;
  border-radius: 10px;
}

.sb-multi-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.btn-xs {
  padding: 3px 8px !important;
  font-size: 11px !important;
  border-radius: 6px !important;
}

/* ══════════════════════════════════════════════════ */
/* KEYFRAME TIMELINE                                  */
/* ══════════════════════════════════════════════════ */

.kf-timeline-section {
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 8px 12px;
  margin-top: 4px;
  border-radius: 0 0 12px 12px;
}

.kf-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.kf-add-btn {
  font-weight: 600 !important;
}

.kf-speed-select {
  background: var(--bg-main);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}

.kf-frame-count {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: auto;
}

/* Playback settings row */
.kf-settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}

.kf-setting {
  display: flex;
  align-items: center;
  gap: 4px;
}

.kf-setting-label {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.kf-ghost-btn {
  margin-left: auto;
  font-size: 11px !important;
}

/* Thumbnail strip container */
.kf-strip-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--brand) transparent;
  padding-bottom: 4px;
}

.kf-strip-wrap::-webkit-scrollbar {
  height: 5px;
}

.kf-strip-wrap::-webkit-scrollbar-thumb {
  background: var(--brand);
  border-radius: 3px;
}

.kf-strip {
  display: flex;
  gap: 8px;
  min-height: 72px;
  align-items: stretch;
}

/* Individual thumbnail card */
.kf-thumb {
  flex: 0 0 auto;
  width: 110px;
  border: 2px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  background: var(--bg-main);
}

.kf-thumb:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 200, 120, 0.15);
}

.kf-thumb.kf-active {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(0, 200, 120, 0.3);
}

.kf-thumb.kf-active .kf-thumb-label {
  color: var(--brand);
  font-weight: 700;
}

.kf-thumb-img {
  width: 100%;
  height: 56px;
  object-fit: cover;
  display: block;
  background: #1a1a2e;
}

.kf-thumb-label {
  text-align: center;
  font-size: 10px;
  padding: 2px 0;
  color: var(--text-dim);
  font-weight: 500;
  white-space: nowrap;
}

/* Action buttons overlay */
.kf-thumb-actions {
  position: absolute;
  top: 2px;
  right: 2px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.2s;
}

.kf-thumb:hover .kf-thumb-actions {
  opacity: 1;
}

.kf-action-btn {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background 0.15s;
}

.kf-action-btn:hover {
  background: rgba(0, 200, 120, 0.6);
}

.kf-del-btn:hover {
  background: rgba(231, 76, 60, 0.7) !important;
}

/* Empty state hint */
.kf-strip:empty::after {
  content: '💡 Click "➕ Thêm frame" để bắt đầu tạo animation';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-size: 12px;
  color: var(--text-dim);
  min-height: 56px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 8px;
}

/* Help button */
.kf-help-btn {
  padding: 4px 8px !important;
  font-size: 14px !important;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.kf-help-btn:hover { opacity: 1; }

/* ══════════════════════════════════════════════════ */
/* KEYFRAME HELP MODAL                                */
/* ══════════════════════════════════════════════════ */

.kf-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

.kf-modal-overlay.kf-modal-open {
  display: flex;
}

.kf-modal {
  background: var(--card-bg, #1a1a2e);
  border: 1px solid var(--border, #2a2a4a);
  border-radius: 16px;
  max-width: 560px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: kfModalIn 0.25s ease-out;
}

@keyframes kfModalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.kf-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.kf-modal-close:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

.kf-modal-title {
  font: 700 20px 'Inter', sans-serif;
  color: var(--brand, #00c878);
  margin: 0 0 4px;
}

.kf-modal-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 20px;
  line-height: 1.5;
}

/* Sections */
.kf-help-section {
  margin-bottom: 20px;
}

.kf-help-section h3 {
  font: 600 14px 'Inter', sans-serif;
  color: white;
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border, #2a2a4a);
}

.kf-help-section > p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0;
}

/* Steps */
.kf-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kf-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.kf-step-num {
  flex: 0 0 28px;
  height: 28px;
  background: var(--brand, #00c878);
  color: #0a0a1a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 13px 'Inter', sans-serif;
  margin-top: 2px;
}

.kf-step div strong {
  font-size: 13px;
  color: white;
  display: block;
  margin-bottom: 2px;
}

.kf-step div p {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.5;
}

/* Table */
.kf-help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.kf-help-table tr {
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.kf-help-table td {
  padding: 6px 8px;
  vertical-align: middle;
}

.kf-help-icon {
  font-weight: 600;
  color: white;
  white-space: nowrap;
  width: 130px;
}

.kf-help-table td:last-child {
  color: var(--text-dim);
}

/* Tips */
.kf-tips {
  list-style: none;
  padding: 0;
  margin: 0;
}

.kf-tips li {
  font-size: 12px;
  color: var(--text-dim);
  padding: 5px 0 5px 20px;
  position: relative;
  line-height: 1.5;
}

.kf-tips li::before {
  content: '✦';
  position: absolute;
  left: 0;
  color: var(--brand, #00c878);
  font-size: 10px;
}

.kf-tips li strong {
  color: white;
}

/* Footer */
.kf-help-footer {
  text-align: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border, #2a2a4a);
}

/* Scrollbar inside modal */
.kf-modal::-webkit-scrollbar {
  width: 5px;
}
.kf-modal::-webkit-scrollbar-thumb {
  background: var(--tb-accent);
  border-radius: 3px;
}

/* ── INTERACTIVE POLISH (Global for tactics page) ── */

/* Action bar primary button glow */
.tb-action-primary {
  background: var(--tb-accent) !important;
  color: #fff !important;
  border: none !important;
  font-weight: 600;
}
.tb-action-primary:hover {
  background: var(--tb-accent-hover) !important;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
  transform: translateY(-1px);
}

/* Cursor pointer on ALL interactive elements */
.field-type-btn, .tb-btn, .fv-trigger, .fv-option,
.sb-rotate-btn, .sb-save-formation, .sb-delete-btn,
.kf-frame-thumb, .kf-add-btn, .kf-help-btn, .kf-ghost-btn,
.dt-btn, .dt-style-btn, .dt-action-btn, .dt-cap-btn,
.eq-toggle, .eq-item, .eq-trash,
.btn, [onclick], select, .kf-speed-select {
  cursor: pointer;
}

/* Consistent hover transitions */
.field-type-btn, .tb-btn, .btn, .dt-btn, .dt-style-btn,
.dt-action-btn, .dt-cap-btn, .fv-option, .eq-item,
.kf-frame-thumb, .sb-save-formation {
  transition: all var(--tb-transition);
}

/* Focus visible for keyboard nav */
.field-type-btn:focus-visible, .tb-btn:focus-visible,
.btn:focus-visible, .dt-btn:focus-visible,
.fv-trigger:focus-visible, select:focus-visible,
input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--tb-accent);
  outline-offset: 2px;
}

/* Hint text styling (info icon + text) */
.sb-facing-hint, .sb-rotate-hint {
  font-family: var(--tb-font-body);
}

/* Keyframe settings labels */
.kf-setting-label {
  font-family: var(--tb-font-heading) !important;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-size: 10px !important;
}

/* Modal headings */
.kf-modal-title, .kf-help-section h3 {
  font-family: var(--tb-font-heading);
}

/* ── DISABLED STATE ── */
.dt-disabled {
  opacity: 0.3;
  pointer-events: none;
}

.tb-btn-disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* ── RESPONSIVE: TABLET (768-1023px) ── */
@media (max-width: 1023px) {
  .tactics-body {
    flex-direction: column;
  }

  /* Hide button text labels on tablet */
  .tb-btn-text {
    display: none;
  }

  /* Sidebar → bottom sheet */
  .tactics-sidebar {
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 55vh;
    overflow-y: auto;
    transform: translateY(calc(100% - 44px));
    transition: transform 0.3s ease;
    z-index: 100;
    border-radius: 16px 16px 0 0;
    border-top: 1px solid var(--tb-glass-border, rgba(255,255,255,0.08));
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
  }

  .tactics-sidebar.sb-expanded {
    transform: translateY(0);
  }

  /* Drag handle for sidebar */
  .sb-drag-handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 6px;
    cursor: grab;
    position: sticky;
    top: 0;
    z-index: 2;
    background: inherit;
  }

  .sb-drag-handle::after {
    content: '';
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
  }

  .sidebar-section {
    flex: 1;
    min-width: 200px;
  }

  /* Canvas full width */
  .tactics-canvas-wrap {
    width: 100%;
    padding-bottom: 50px; /* space for sidebar handle */
  }

  /* Toolbar compact */
  .tactics-toolbar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
  }

  .tb-divider {
    height: 16px;
  }

  /* Drawing toolbar scroll */
  .drawing-toolbar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .drawing-toolbar::-webkit-scrollbar {
    display: none;
  }

  /* Animation strip */
  .kf-strip-scroll {
    max-width: calc(100vw - 280px);
  }
}

/* ── RESPONSIVE: MOBILE (<768px) ── */
@media (max-width: 767px) {
  .tactics-layout {
    padding: 4px;
    gap: 4px;
  }

  /* Toolbar: 2-row compact layout */
  .tactics-toolbar {
    padding: 6px 8px;
    gap: 3px;
    flex-wrap: wrap;
    justify-content: center;
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--tb-surface, #1a1a2e);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  /* Hide text labels and dividers */
  .tb-btn-text { display: none !important; }
  .tb-label { display: none !important; }
  .tb-divider { display: none !important; }

  /* Hide slider section on mobile — too complex for small screens */
  .tb-slider-group { display: none; }
  .tb-color-pickers { display: none; }

  .tb-section {
    width: auto;
    justify-content: center;
    gap: 2px;
  }

  .tb-actions {
    margin-left: 0;
    width: auto;
    justify-content: center;
    gap: 3px;
  }

  .tb-row {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 3px;
  }

  /* Touch-friendly targets */
  .field-type-btn {
    padding: 6px 10px;
    font-size: 11px;
    min-height: 36px;
  }

  .tb-btn {
    min-width: 36px;
    min-height: 36px;
    padding: 6px 8px;
    font-size: 11px;
  }

  .btn {
    min-height: 36px;
    padding: 6px 10px;
  }

  /* Canvas area */
  .tactics-canvas-wrap {
    padding: 2px;
    padding-bottom: 56px; /* Space for drawing toolbar + sidebar handle */
  }

  /* Sidebar z-index above drawing toolbar */
  .tactics-sidebar {
    flex-direction: column;
    max-height: 65vh;
    z-index: 120;
  }

  .sidebar-section {
    min-width: unset;
  }

  .tb-select {
    min-width: 100px;
    font-size: 11px;
  }

  .fv-popup {
    min-width: 260px;
    left: -20px;
  }

  /* Drawing toolbar: scrollable row */
  .drawing-toolbar {
    overflow-x: auto;
    padding: 5px;
    gap: 2px;
    flex-wrap: nowrap;
    z-index: 60;
  }

  .dt-btn, .dt-style-btn, .dt-action-btn {
    min-width: 34px;
    min-height: 34px;
    flex-shrink: 0;
  }

  /* Animation controls */
  .kf-controls {
    flex-wrap: wrap;
    gap: 4px;
  }

  .kf-strip-scroll {
    max-width: calc(100vw - 100px);
  }

  /* Zoom controls */
  .tb-zoom-group {
    gap: 2px;
  }

  /* Field view picker */
  .fv-options {
    flex-wrap: wrap;
  }

  /* Equipment panel */
  .eq-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Equipment toggle — ensure above sidebar */
  .eq-toolbar {
    z-index: 130;
  }

  /* Field preset swatches compact */
  .field-preset-swatch {
    padding: 4px 6px;
  }

  /* Player props compact */
  .sb-header {
    padding: 8px 12px;
  }
}

/* ── TOUCH: prevent scroll during canvas drag ── */
.tactics-canvas-wrap {
  touch-action: none;
}

/* ── Drag handle: hidden on desktop, shown on tablet/mobile ── */
.sb-drag-handle {
  display: none;
}
