/* ==========================================================================
   Xiangqi Piece & Board Detector - Modern UI Design System
   ========================================================================== */

:root {
  --bg-color: #0b0f19;
  --card-bg: rgba(22, 30, 49, 0.80);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-hover-border: rgba(255, 255, 255, 0.15);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-red: #ef4444;
  --accent-red-glow: rgba(239, 68, 68, 0.25);
  --accent-blue: #38bdf8;
  --accent-blue-glow: rgba(56, 189, 248, 0.25);
  --accent-gold: #fbbf24;
  --accent-emerald: #10b981;

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-chinese: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.15);

  --board-wood-bg: #e6c896;
  --board-line-color: #5c3a21;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 1rem;
  overflow-x: hidden;
  position: relative;
}

/* Background Ambient Lighting */
.background-decorations {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
}

.glow-orb-1 {
  width: 500px;
  height: 500px;
  top: -150px;
  left: -150px;
  background: radial-gradient(circle, #ef4444 0%, transparent 70%);
}

.glow-orb-2 {
  width: 550px;
  height: 550px;
  bottom: -150px;
  right: -150px;
  background: radial-gradient(circle, #0284c7 0%, transparent 70%);
}

.chess-watermark {
  position: absolute;
  font-family: var(--font-chinese);
  font-size: 28rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.015);
  user-select: none;
}

.chess-watermark.left {
  top: 15%;
  left: 2%;
}

.chess-watermark.right {
  bottom: 10%;
  right: 2%;
}

/* Layout Container */
.app-container {
  width: 100%;
  max-width: 1280px;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Header */
.header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-full);
  color: var(--accent-blue);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background-color: var(--accent-blue);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-blue);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.main-title {
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 40%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

.highlight-red {
  color: var(--accent-red);
  font-weight: 700;
}

.highlight-blue {
  color: var(--accent-blue);
  font-weight: 700;
}

/* ==========================================================================
   Navigation Tabs
   ========================================================================== */
.nav-tabs {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.4rem;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.tab-btn:hover {
  background: rgba(51, 65, 85, 0.8);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.tab-btn.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25) 0%, rgba(14, 165, 233, 0.15) 100%);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
}

.tab-icon {
  font-size: 1.15rem;
}

.tab-badge {
  padding: 0.15rem 0.45rem;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Main Grid Layout
   ========================================================================== */
.main-content {
  display: grid;
  grid-template-columns: 1.05fr 1.35fr;
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr;
  }
}

/* Card Styles */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.card-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-primary);
}

.card-header .icon {
  width: 20px;
  height: 20px;
  color: var(--accent-blue);
}

.info-pill {
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

/* ==========================================================================
   Drag & Drop Zone
   ========================================================================== */
.drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 1.75rem 1.25rem;
  text-align: center;
  background: rgba(15, 23, 42, 0.4);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.05);
  box-shadow: var(--shadow-glow);
}

.drop-zone-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.upload-icon-wrapper {
  width: 48px;
  height: 48px;
  background: rgba(56, 189, 248, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-blue);
}

.upload-icon {
  width: 24px;
  height: 24px;
}

.drop-text-main {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.drop-text-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Drop Zone Preview */
.drop-zone-preview {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.preview-img-container {
  position: relative;
  max-width: 100%;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  overflow: hidden;
  padding: 0.25rem;
}

.preview-img-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.btn-remove-image {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

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

.btn-remove-image svg {
  width: 16px;
  height: 16px;
}

.file-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
}

.file-name {
  color: var(--text-secondary);
  font-weight: 600;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  color: var(--text-muted);
}

/* ==========================================================================
   Mode Selector
   ========================================================================== */
.mode-selector-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.mode-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.mode-badge {
  color: var(--accent-blue);
  font-size: 0.8rem;
  font-weight: 700;
}

.mode-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.mode-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.mode-option:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.mode-option.active {
  background: rgba(56, 189, 248, 0.1);
  border-color: var(--accent-blue);
}

.mode-icon {
  font-size: 1.1rem;
}

.mode-info {
  display: flex;
  flex-direction: column;
}

.mode-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.mode-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.35);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.45);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.12);
  width: auto;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-icon {
  width: 18px;
  height: 18px;
}

.btn-spinner {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Quick Samples
   ========================================================================== */
.samples-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.samples-header {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.sample-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  padding: 0.35rem 0.65rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.chip:hover {
  background: rgba(56, 189, 248, 0.15);
  color: var(--text-primary);
  border-color: var(--accent-blue);
  transform: translateY(-1px);
}

/* Board Samples Grid */
.board-samples-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.board-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 0.6rem 0.75rem;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
}

.board-chip:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--accent-blue);
  transform: translateY(-1px);
}

.board-chip .chip-title {
  font-size: 0.8rem;
  font-weight: 700;
}

.board-chip .chip-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ==========================================================================
   Results Layout
   ========================================================================== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--accent-emerald);
  font-weight: 600;
}

.status-indicator {
  width: 7px;
  height: 7px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-emerald);
}

.result-placeholder {
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 2rem;
}

.empty-icon svg {
  width: 48px;
  height: 48px;
  color: rgba(255, 255, 255, 0.15);
}

.result-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  animation: fadeIn 0.3s ease-out;
}

/* Single Piece Hero */
.piece-result-hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
}

.piece-avatar-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #f4e8c1;
  border: 3px solid #b45309;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

.piece-avatar-circle.is-red .chinese-char {
  color: #dc2626;
}

.piece-avatar-circle.is-black .chinese-char {
  color: #1e293b;
}

.chinese-char {
  font-family: var(--font-chinese);
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1;
}

.piece-info {
  flex: 1;
}

.predicted-name {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.predicted-class-en {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.confidence-badge-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}

.pill-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pill-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent-emerald);
}

/* Score Breakdown */
.score-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: rgba(15, 23, 42, 0.4);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
}

.breakdown-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.score-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.score-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
}

.score-meta .char-symbol {
  font-family: var(--font-chinese);
  font-size: 1.05rem;
  font-weight: 700;
  margin-right: 0.3rem;
}

.score-pct {
  font-family: var(--font-mono);
  font-weight: 700;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar-fill.fill-rook {
  background: linear-gradient(90deg, #10b981, #059669);
}

.progress-bar-fill.fill-horse {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.threshold-notice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.info-svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--accent-gold);
}

/* ==========================================================================
   Board Detection Specific Views
   ========================================================================== */
.view-toggle-group {
  display: flex;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.25rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--card-border);
}

.view-toggle-btn {
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.view-toggle-btn.active {
  background: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.4);
}

/* Board Summary Stats Banner */
.board-stats-banner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

@media (max-width: 768px) {
  .board-stats-banner {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0.5rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  text-align: center;
}

.stat-card.stat-total {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.3);
}

.stat-num {
  font-size: 1.4rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.stat-card.stat-total .stat-num {
  color: var(--accent-blue);
}

.stat-lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 0.2rem;
}

/* View Pane */
.board-view-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.board-view-pane.hidden {
  display: none;
}

.annotated-image-wrapper {
  width: 100%;
  max-height: 480px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.annotated-image-wrapper img {
  max-width: 100%;
  max-height: 480px;
  object-fit: contain;
  border-radius: var(--radius-md);
}

.view-caption {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* ==========================================================================
   Virtual 10x9 Xiangqi Board
   ========================================================================== */
.virtual-board-container {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 0.5rem;
}

.virtual-board {
  position: relative;
  width: 440px;
  height: 500px;
  background: var(--board-wood-bg);
  border: 4px double var(--board-line-color);
  border-radius: 6px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(92, 58, 33, 0.2);
  margin: 0 auto;
}

/* River text */
.virtual-river-text {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  display: flex;
  justify-content: space-around;
  font-family: var(--font-chinese);
  font-size: 1.1rem;
  font-weight: 700;
  color: rgba(92, 58, 33, 0.75);
  pointer-events: none;
  user-select: none;
}

/* Piece Token on Virtual Board */
.virtual-piece {
  position: absolute;
  width: 38px;
  height: 38px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #fbf5e5;
  border: 2px solid #5c3a21;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-chinese);
  font-size: 1.25rem;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), inset 0 0 4px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  z-index: 10;
}

.virtual-piece:hover {
  transform: translate(-50%, -50%) scale(1.25);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5), 0 0 12px var(--accent-gold);
  z-index: 20;
}

.virtual-piece.piece-red {
  color: #dc2626;
  border-color: #b91c1c;
}

.virtual-piece.piece-black {
  color: #0f172a;
  border-color: #334155;
}

/* ==========================================================================
   Positions Table
   ========================================================================== */
.positions-table-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.table-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.table-responsive {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.4);
}

.positions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.positions-table th {
  background: rgba(30, 41, 59, 0.8);
  padding: 0.6rem 0.75rem;
  color: var(--text-secondary);
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 5;
}

.positions-table td {
  padding: 0.55rem 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.positions-table tr:hover {
  background: rgba(56, 189, 248, 0.08);
}

.piece-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
}

.piece-tag .tag-char {
  font-family: var(--font-chinese);
  font-size: 1.05rem;
}

.piece-tag.tag-red {
  color: #f87171;
}

.piece-tag.tag-black {
  color: #94a3b8;
}

.badge-coord {
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.badge-conf {
  font-family: var(--font-mono);
  color: var(--accent-emerald);
  font-weight: 700;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 999;
}

.toast {
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  color: #fff;
  font-size: 0.9rem;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.error {
  border-color: var(--accent-red);
  background: rgba(153, 27, 27, 0.95);
}

.toast.success {
  border-color: var(--accent-emerald);
  background: rgba(6, 95, 70, 0.95);
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.hidden {
  display: none !important;
}
