/* ============================================
   Chinese Chess 3D - Premium Styling
   ============================================ */

:root {
  /* Color Palette */
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.95);
  --bg-glass: rgba(255, 255, 255, 0.05);

  --gold-primary: #d4a853;
  --gold-light: #f0d78c;
  --gold-dark: #8b6914;
  --gold-glow: rgba(212, 168, 83, 0.4);

  --red-primary: #c0392b;
  --red-light: #e74c3c;
  --red-dark: #8b1a1a;
  --red-glow: rgba(231, 76, 60, 0.5);
  --red-piece-bg: #f5e6d3;
  --red-piece-border: #c0392b;

  --black-primary: #1a1a2e;
  --black-light: #2d2d44;
  --black-dark: #0d0d1a;
  --black-glow: rgba(45, 45, 68, 0.5);
  --black-piece-bg: #e8e0d0;
  --black-piece-border: #1a1a2e;

  --board-bg: #d4a853;
  --board-line: #4a3520;
  --board-river: rgba(74, 53, 32, 0.15);

  --text-primary: #f0f0f0;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-purple: #8b5cf6;

  --highlight-move: rgba(59, 130, 246, 0.4);
  --highlight-selected: rgba(212, 168, 83, 0.6);
  --highlight-hint: rgba(16, 185, 129, 0.5);
  --highlight-danger: rgba(231, 76, 60, 0.5);
  --highlight-last-move: rgba(139, 92, 246, 0.35);

  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-hard: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow-gold: 0 0 30px rgba(212, 168, 83, 0.3);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

  --font-display: "Cinzel", "Noto Serif TC", serif;
  --font-chinese: "Noto Serif TC", serif;
  --font-body: "Inter", sans-serif;

  --cell-size: 64px;
  --piece-size: 54px;
  --board-padding: 36px;
}

/* ============================================
   Reset & Base
   ============================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
}

/* ============================================
   Loading Screen
   ============================================ */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0e17 70%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-content {
  text-align: center;
}

.loading-piece {
  margin-bottom: 30px;
  display: flex;
  justify-content: center;
}

.loading-anim {
  animation: loadingFloat 2s ease-in-out infinite;
}

@keyframes loadingFloat {
  0%,
  100% {
    transform: translateY(0) rotateX(15deg);
  }
  50% {
    transform: translateY(-20px) rotateX(15deg);
  }
}

.loading-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(
    135deg,
    var(--gold-light),
    var(--gold-primary),
    var(--gold-dark)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 30px;
  letter-spacing: 3px;
}

.loading-bar-container {
  width: 240px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin: 0 auto 16px;
  overflow: hidden;
}

.loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-primary), var(--gold-light));
  border-radius: 2px;
  transition: width 0.3s ease;
}

.loading-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ============================================
   3D Chess Piece Styles
   ============================================ */
.piece-3d {
  width: var(--piece-size);
  height: var(--piece-size);
  position: relative;
  transform-style: preserve-3d;
  transform: perspective(500px) rotateX(15deg);
  cursor: pointer;
  transition:
    transform var(--transition-fast),
    filter var(--transition-fast);
}

.piece-3d:hover {
  transform: perspective(500px) rotateX(15deg) scale(1.1) translateY(-4px);
  filter: brightness(1.15);
}

.piece-3d.selected {
  transform: perspective(500px) rotateX(15deg) scale(1.15) translateY(-8px);
  filter: brightness(1.2);
}

.piece-3d.selected .piece-top {
  box-shadow:
    0 0 20px var(--highlight-selected),
    0 0 40px var(--highlight-selected);
}

.piece-top {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  border: 3px solid;
  transition: box-shadow var(--transition-fast);
}

.piece-side {
  position: absolute;
  bottom: -6px;
  left: 2px;
  right: 2px;
  height: 10px;
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
  z-index: 1;
}

.piece-char {
  font-family: var(--font-chinese);
  font-weight: 900;
  font-size: 1.5rem;
  line-height: 1;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
  user-select: none;
}

/* Red Pieces */
.piece-red .piece-top {
  background: radial-gradient(
    circle at 35% 35%,
    #fff8f0,
    #f5e6d3 40%,
    #e8d5b8 80%
  );
  border-color: var(--red-primary);
  box-shadow:
    0 4px 12px rgba(192, 57, 43, 0.3),
    inset 0 -2px 4px rgba(0, 0, 0, 0.1);
}

.piece-red .piece-side {
  background: linear-gradient(180deg, #d4a067, #b8875a);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.piece-red .piece-char {
  color: var(--red-primary);
}

/* Black Pieces */
.piece-black .piece-top {
  background: radial-gradient(
    circle at 35% 35%,
    #f5f0e8,
    #e8e0d0 40%,
    #d4cbb8 80%
  );
  border-color: var(--black-primary);
  box-shadow:
    0 4px 12px rgba(26, 26, 46, 0.3),
    inset 0 -2px 4px rgba(0, 0, 0, 0.1);
}

.piece-black .piece-side {
  background: linear-gradient(180deg, #b8a88a, #9a8a6c);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.piece-black .piece-char {
  color: var(--black-primary);
}

/* ============================================
   Main Menu
   ============================================ */
.main-menu {
  background: radial-gradient(ellipse at 50% 30%, #1a1a2e 0%, #0a0e17 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.menu-bg-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.menu-bg-particles .particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--gold-primary);
  border-radius: 50%;
  opacity: 0;
  animation: particleFloat 6s ease-in-out infinite;
}

@keyframes particleFloat {
  0% {
    opacity: 0;
    transform: translateY(100vh) scale(0);
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.6;
  }
  100% {
    opacity: 0;
    transform: translateY(-20vh) scale(1);
  }
}

.menu-content {
  text-align: center;
  z-index: 2;
  position: relative;
}

.menu-logo {
  margin-bottom: 50px;
}

.logo-pieces {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 24px;
}

.logo-piece {
  animation: logoFloat 3s ease-in-out infinite;
}

.logo-piece-2 {
  animation-delay: -1.5s;
}

@keyframes logoFloat {
  0%,
  100% {
    transform: perspective(500px) rotateX(15deg) translateY(0);
  }
  50% {
    transform: perspective(500px) rotateX(15deg) translateY(-12px);
  }
}

.menu-title {
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 900;
  background: linear-gradient(
    135deg,
    var(--gold-light) 0%,
    var(--gold-primary) 50%,
    var(--gold-dark) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 5px;
  text-transform: uppercase;
  margin-bottom: 8px;
  text-shadow: none;
}

.menu-subtitle {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-secondary);
  letter-spacing: 6px;
  text-transform: uppercase;
  font-weight: 300;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

/* Buttons */
.menu-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 40px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  min-width: 260px;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.menu-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transition: left 0.5s ease;
}

.menu-btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
  color: #fff;
  box-shadow: 0 4px 20px rgba(212, 168, 83, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(212, 168, 83, 0.5);
}

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  border-color: var(--gold-primary);
}

.btn-icon {
  font-size: 1.3rem;
}

/* Language Toggle */
.lang-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 4px;
  background: var(--bg-glass);
  border-radius: var(--radius-sm);
  padding: 4px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 100;
}

.lang-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  background: transparent;
  transition: all var(--transition-fast);
}

.lang-btn.active {
  background: var(--gold-primary);
  color: #fff;
}

/* ============================================
   Modal Screens
   ============================================ */
.modal-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

.modal-screen.hidden {
  display: none !important;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  z-index: 2;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 36px;
  min-width: 380px;
  max-width: 500px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-hard);
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  margin-bottom: 24px;
}

.modal-close-btn {
  display: block;
  margin: 24px auto 0;
  padding: 10px 32px;
  background: var(--bg-glass);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* Difficulty Selection */
.difficulty-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.diff-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-glass);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  text-align: left;
  color: var(--text-primary);
}

.diff-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--gold-primary);
  transform: translateX(4px);
}

.diff-icon {
  font-size: 1.8rem;
}

.diff-label {
  font-size: 1.1rem;
  font-weight: 600;
  display: block;
}

.diff-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

/* Settings */
.settings-card {
  min-width: 400px;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-glass);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-label {
  font-size: 0.95rem;
  font-weight: 500;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  display: inline-block;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 26px;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: all var(--transition-normal);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--gold-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* Language Select in Settings */
.lang-select {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  padding: 3px;
}

.lang-option {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-secondary);
  background: transparent;
  transition: all var(--transition-fast);
}

.lang-option.active {
  background: var(--gold-primary);
  color: #fff;
}

/* Tutorial */
.tutorial-card {
  min-width: 500px;
  max-width: 600px;
  max-height: 80vh;
}

.tutorial-content {
  min-height: 300px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 20px;
  background: var(--bg-glass);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.tutorial-content::-webkit-scrollbar {
  width: 6px;
}

.tutorial-content::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: 3px;
}

.tutorial-page {
  display: none;
}

.tutorial-page.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.tutorial-page h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--gold-primary);
  margin-bottom: 12px;
}

.tutorial-page p {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.tutorial-piece-demo {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  margin: 12px 0;
}

.tutorial-piece-demo .piece-3d {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.tutorial-piece-demo .piece-3d .piece-char {
  font-size: 1.15rem;
}

.tutorial-piece-info {
  flex: 1;
}

.tutorial-piece-info .piece-name {
  font-weight: 600;
  color: var(--gold-light);
  margin-bottom: 2px;
  font-size: 0.95rem;
}

.tutorial-piece-info .piece-desc {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.tutorial-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.tut-nav-btn {
  padding: 8px 24px;
  background: var(--bg-glass);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tut-nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--gold-primary);
}

.tut-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.tut-page-indicator {
  color: var(--text-muted);
  font-size: 0.85rem;
  min-width: 50px;
  text-align: center;
}

/* ============================================
   Game Screen
   ============================================ */
.game-screen {
  background: radial-gradient(ellipse at 50% 50%, #1a1a2e 0%, #0a0e17 80%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 20px;
  gap: 6px;
  overflow: hidden;
}

/* Top Bar */
.game-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 700px;
  padding: 6px 0;
}

.game-title-bar {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--gold-primary);
  letter-spacing: 2px;
}

.top-bar-controls {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--gold-primary);
  border-color: var(--gold-dark);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* Player Info */
.player-info {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 600px;
  padding: 8px 16px;
  background: var(--bg-glass);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all var(--transition-normal);
}

.player-info.active-turn {
  border-color: var(--gold-primary);
  box-shadow: 0 0 20px rgba(212, 168, 83, 0.15);
}

.player-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-chinese);
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.player-avatar-red {
  background: linear-gradient(135deg, var(--red-light), var(--red-dark));
  color: #fff;
  box-shadow: 0 2px 10px rgba(192, 57, 43, 0.3);
}

.player-avatar-black {
  background: linear-gradient(135deg, var(--black-light), var(--black-dark));
  color: #ccc;
  box-shadow: 0 2px 10px rgba(26, 26, 46, 0.3);
}

.player-details {
  flex: 1;
  min-width: 0;
}

.player-name {
  font-weight: 600;
  font-size: 0.95rem;
  display: block;
  margin-bottom: 2px;
}

.captured-pieces {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  min-height: 18px;
}

.captured-piece-icon {
  font-family: var(--font-chinese);
  font-size: 0.7rem;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
}

.captured-piece-icon.red {
  color: var(--red-primary);
  background: rgba(192, 57, 43, 0.15);
}

.captured-piece-icon.black {
  color: var(--black-light);
  background: rgba(26, 26, 46, 0.3);
}

.player-timer {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Board */
.board-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.board-frame {
  position: relative;
  background: linear-gradient(145deg, #c4983f, #e0b85f, #c4983f);
  border-radius: 8px;
  padding: 4px;
  box-shadow:
    0 0 0 2px var(--gold-dark),
    0 0 0 4px rgba(139, 105, 20, 0.5),
    0 8px 40px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(212, 168, 83, 0.15);
}

#boardCanvas {
  display: block;
  border-radius: 4px;
}

.board-overlay {
  position: absolute;
  top: 4px;
  left: 4px;
  pointer-events: none;
}

/* Piece on Board */
.board-piece {
  position: absolute;
  pointer-events: auto;
  transition:
    left var(--transition-normal),
    top var(--transition-normal);
  z-index: 10;
}

.board-piece.moving {
  transition:
    left 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    top 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 20;
}

.board-piece.captured-anim {
  animation: pieceCaptured 0.4s ease forwards;
}

@keyframes pieceCaptured {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.5;
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}

/* Board Highlights */
.board-highlight {
  position: absolute;
  border-radius: 50%;
  pointer-events: auto;
  cursor: pointer;
  z-index: 5;
}

.highlight-move {
  background: var(--highlight-move);
  width: 24px;
  height: 24px;
  border: 2px solid rgba(59, 130, 246, 0.6);
  animation: highlightPulse 1.5s ease-in-out infinite;
}

@keyframes highlightPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.15);
    opacity: 1;
  }
}

.highlight-capture {
  width: calc(var(--piece-size) + 4px);
  height: calc(var(--piece-size) + 4px);
  background: var(--highlight-danger);
  border: 2px solid rgba(231, 76, 60, 0.6);
  animation: highlightPulse 1.2s ease-in-out infinite;
}

.highlight-selected {
  width: calc(var(--piece-size) + 8px);
  height: calc(var(--piece-size) + 8px);
  background: var(--highlight-selected);
  border: 2px solid var(--gold-primary);
  z-index: 4;
  pointer-events: none;
}

.highlight-lastmove {
  width: calc(var(--piece-size) + 4px);
  height: calc(var(--piece-size) + 4px);
  background: var(--highlight-last-move);
  border: 2px solid rgba(139, 92, 246, 0.4);
  z-index: 3;
  pointer-events: none;
}

.highlight-hint {
  width: calc(var(--piece-size) + 4px);
  height: calc(var(--piece-size) + 4px);
  background: var(--highlight-hint);
  border: 2px dashed rgba(16, 185, 129, 0.7);
  animation: hintPulse 1s ease-in-out infinite;
  pointer-events: none;
  z-index: 15;
}

@keyframes hintPulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 10px var(--highlight-hint);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 25px var(--highlight-hint);
  }
}

.highlight-check {
  width: calc(var(--piece-size) + 8px);
  height: calc(var(--piece-size) + 8px);
  background: rgba(231, 76, 60, 0.35);
  border: 3px solid rgba(231, 76, 60, 0.8);
  animation: checkPulse 0.8s ease-in-out infinite;
  z-index: 4;
  pointer-events: none;
}

@keyframes checkPulse {
  0%,
  100% {
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.5);
  }
  50% {
    box-shadow: 0 0 35px rgba(231, 76, 60, 0.8);
  }
}

/* Turn Indicator */
.turn-indicator {
  padding: 6px 24px;
  background: var(--bg-glass);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold-primary);
  text-align: center;
  letter-spacing: 1px;
  transition: all var(--transition-normal);
}

.turn-indicator.red-turn {
  border-color: rgba(192, 57, 43, 0.3);
  box-shadow: 0 0 15px rgba(192, 57, 43, 0.15);
}

.turn-indicator.black-turn {
  border-color: rgba(45, 45, 68, 0.5);
  box-shadow: 0 0 15px rgba(45, 45, 68, 0.2);
}

/* Game Over */
.game-over-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.game-over-card {
  text-align: center;
  animation: modalIn 0.4s ease;
}

.game-over-crown {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: crownBounce 1s ease;
}

@keyframes crownBounce {
  0% {
    transform: scale(0) rotate(-20deg);
  }
  50% {
    transform: scale(1.3) rotate(10deg);
  }
  70% {
    transform: scale(0.9) rotate(-5deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

.game-over-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.game-over-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 30px;
}

.game-over-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.game-over-buttons .menu-btn {
  min-width: 160px;
}

/* Game Menu */
.game-menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
  :root {
    --cell-size: 44px;
    --piece-size: 38px;
    --board-padding: 24px;
  }

  .menu-title {
    font-size: 2rem;
    letter-spacing: 3px;
  }

  .menu-subtitle {
    font-size: 0.8rem;
    letter-spacing: 4px;
  }

  .menu-btn {
    min-width: 220px;
    padding: 12px 30px;
    font-size: 0.9rem;
  }

  .modal-card {
    min-width: 320px;
    padding: 24px;
    margin: 0 16px;
  }

  .settings-card {
    min-width: 320px;
  }

  .tutorial-card {
    min-width: 320px;
    max-width: 95vw;
  }

  .piece-char {
    font-size: 1.1rem;
  }

  .logo-piece .piece-3d {
    width: 44px;
    height: 44px;
  }

  .logo-piece .piece-char {
    font-size: 1.2rem;
  }

  .player-info {
    padding: 6px 12px;
  }

  .game-screen {
    padding: 8px 12px;
  }

  .game-over-title {
    font-size: 1.8rem;
  }

  .game-over-buttons {
    flex-direction: column;
    align-items: center;
  }
}

@media (max-height: 700px) {
  :root {
    --cell-size: 42px;
    --piece-size: 36px;
    --board-padding: 20px;
  }

  .game-screen {
    gap: 4px;
    padding: 4px 12px;
  }

  .player-info {
    padding: 4px 10px;
  }

  .player-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }

  .player-name {
    font-size: 0.85rem;
  }

  .turn-indicator {
    padding: 4px 18px;
    font-size: 0.8rem;
  }

  .game-top-bar {
    padding: 2px 0;
  }
}

@media (max-height: 600px) {
  :root {
    --cell-size: 38px;
    --piece-size: 32px;
    --board-padding: 16px;
  }

  .piece-char {
    font-size: 0.95rem;
  }
}

/* ============================================
   Footer
   ============================================ */
.app-footer {
  position: fixed;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: 100%;
  text-align: center;
  pointer-events: none;
}

.app-footer p {
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 1px;
  opacity: 0.8;
  font-family: var(--font-body);
}

@media (max-width: 600px) {
  .app-footer {
    bottom: 10px;
  }
  .app-footer p {
    font-size: 0.65rem;
  }
}

.player-timer.low-time {
  color: #ff4d4d;
  text-shadow: 0 0 10px rgba(255, 77, 77, 0.5);
  animation: timerPulse 1s ease-in-out infinite;
}

@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}




