/* CineAHO Janggi Stylesheet */

/* Theme & Variables */
:root {
  /* HSL Colors */
  --hue-purple: 270;
  --hue-blue: 210;
  --hue-green: 145;
  --hue-gold: 45;
  --hue-red: 350;
  --hue-cyan: 190;

  /* Theme Core (Dark Mode default) */
  --bg-color: #060913;
  --bg-grid: rgba(255, 255, 255, 0.015);
  
  --panel-bg: rgba(14, 20, 38, 0.55);
  --panel-border: rgba(255, 255, 255, 0.05);
  --panel-hover-border: rgba(0, 242, 254, 0.25);
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dark: #475569;
  
  /* Gradation Accents */
  --grad-purple: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  --grad-blue: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --grad-cyan: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  --grad-green: linear-gradient(135deg, #10b981 0%, #047857 100%);
  --grad-gold: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  --grad-red: linear-gradient(135deg, #f43f5e 0%, #be123c 100%);
  
  --neon-glow: 0 0 30px rgba(126, 34, 206, 0.2);
  --neon-border-glow: 0 0 15px rgba(0, 242, 254, 0.3);

  --font-main: 'Noto Sans KR', 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-card: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
  
  --highlight-color: #fbbf24;
}

[data-theme="light"] {
  --bg-color: #f8fafc;
  --bg-grid: rgba(15, 23, 42, 0.02);
  
  --panel-bg: rgba(255, 255, 255, 0.7);
  --panel-border: rgba(15, 23, 42, 0.06);
  --panel-hover-border: rgba(59, 130, 246, 0.3);
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dark: #cbd5e1;
  
  --neon-glow: 0 0 30px rgba(59, 130, 246, 0.1);
  --shadow-card: 0 12px 40px 0 rgba(15, 23, 42, 0.08);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.6;
  transition: background-color 0.5s ease, color 0.3s ease;
}

/* Grid Background */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: -2;
  pointer-events: none;
}

/* Background Glow Effects */
.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(160px);
  z-index: -3;
  pointer-events: none;
  opacity: 0.25;
  transition: opacity 0.5s ease;
}

.bg-glow-purple {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #7e22ce 0%, transparent 70%);
  top: -100px;
  left: 5%;
}

.bg-glow-blue {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #2563eb 0%, transparent 70%);
  top: 30%;
  right: 5%;
}

/* Glassmorphism Panel */
.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  transition: var(--transition-smooth);
}

.glass-panel:hover {
  border-color: var(--panel-hover-border);
}

/* Header */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  margin: 1rem 1.5rem 0 1.5rem;
  border-radius: 50px;
  transition: var(--transition-smooth);
}

.glass-header {
  background: rgba(14, 20, 38, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.logo-circle {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-text {
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 0.95rem;
}

.logo-text span {
  color: var(--text-muted);
  font-weight: 400;
}

.header-nav {
  flex-grow: 1;
  margin: 0 2rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.header-nav::-webkit-scrollbar {
  display: none;
}

.nav-list {
  display: flex;
  list-style: none;
  gap: 1.25rem;
  white-space: nowrap;
}

.nav-list a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition-smooth);
  padding: 0.5rem 0.25rem;
  position: relative;
}

.nav-list a:hover,
.nav-list a.active {
  color: var(--text-main);
}

.nav-list a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: #2563eb;
  border-radius: 2px;
}

.btn-back-dashboard {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 30px;
  padding: 0.5rem 1.2rem;
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-back-dashboard:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: #2563eb;
  transform: translateX(-2px);
}

/* Container */
.janggi-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Header Section */
.janggi-header-section {
  text-align: center;
}

.main-title {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  letter-spacing: -0.5px;
}

.main-title i {
  color: #a855f7;
  margin-right: 0.5rem;
}

.main-title span {
  background: linear-gradient(135deg, #fbbf24 0%, #f97316 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 800px;
  margin: 0 auto 1.5rem auto;
  line-height: 1.6;
}

.tag-badges {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.25rem 0.75rem;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Top Control Bar */
.control-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
}

.control-logo-box {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #fff;
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

.control-buttons {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 600;
  border-radius: 12px;
  transition: var(--transition-smooth);
  border: none;
}

.btn-start-game {
  background: #10b981;
  color: #fff;
  padding: 0.65rem 1.5rem;
  font-size: 0.95rem;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-start-game:hover {
  background: #059669;
  transform: translateY(-2px);
}

.btn-action-icon {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  font-size: 1.1rem;
}

.btn-action-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* 5 Cards Info Grid */
.info-cards-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.25rem;
}

.info-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 200px;
}

.info-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.info-card h4 i {
  color: #06b6d4;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.setting-item:last-child {
  margin-bottom: 0;
}

.setting-item label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.select-wrapper select {
  width: 100%;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  appearance: none;
}

.select-wrapper i {
  position: absolute;
  right: 0.75rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  pointer-events: none;
}

/* Range Input Slider */
input[type="range"] {
  width: 100%;
  accent-color: #06b6d4;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  outline: none;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-dark);
  margin-top: 0.25rem;
}

.flex-row-item {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}

/* Switch Toggle Button */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-toggle {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .3s;
  border-radius: 20px;
}

.slider-toggle:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider-toggle {
  background-color: #10b981;
}

input:checked + .slider-toggle:before {
  transform: translateX(18px);
}

/* Game Statistics Stats Table */
.stats-table {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.stat-col {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.stat-col .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.stat-col strong {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
}

.text-orange {
  color: #f97316;
}

/* Captured Pieces Box */
.captured-box {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.captured-group {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 0.5rem;
}

.captured-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.camp-label {
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.captured-items {
  font-size: 0.8rem;
  color: var(--text-dark);
  margin-top: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-blue {
  color: #3b82f6;
}

.text-red {
  color: #ef4444;
}

/* Real-time Scores */
.scores-box {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.score-bar-wrapper {
  width: 100%;
  height: 8px;
  background: rgba(239, 68, 68, 0.3); /* Red base */
  border-radius: 10px;
  overflow: hidden;
}

.score-progress {
  height: 100%;
  background: #3b82f6; /* Blue progress */
  border-radius: 10px 0 0 10px;
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.score-row {
  display: flex;
  justify-content: space-between;
}

.score-col {
  display: flex;
  flex-direction: column;
}

.score-col span {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.score-col strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.score-tip {
  font-size: 0.65rem;
  color: var(--text-dark);
  text-align: center;
}

/* Board Panel */
.janggi-board-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  gap: 1.5rem;
}

.turn-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.5rem 1.25rem;
  border-radius: 50px;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-blue {
  background-color: #3b82f6;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.8);
}

.dot-red {
  background-color: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
}

.badge-text {
  font-size: 0.85rem;
  font-weight: 600;
}

.board-viewport {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 16px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 4px 20px rgba(0,0,0,0.4);
}

#janggi-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  cursor: pointer;
}

/* Board Toolbar */
.board-toolbar {
  display: flex;
  gap: 0.75rem;
}

.btn-tool {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  padding: 0.55rem 1.2rem;
  font-size: 0.85rem;
  border-radius: 8px;
}

.btn-tool:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

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

/* Guide Panel */
.guide-panel {
  padding: 2rem;
}

.guide-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 1rem;
}

.guide-header i {
  font-size: 1.75rem;
  color: #fbbf24;
}

.guide-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.guide-header span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.guide-content-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.guide-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.guide-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.guide-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Winner Modal Overlay */
.winner-modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(6, 9, 19, 0.8);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.winner-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.winner-box {
  padding: 3rem 2.5rem;
  text-align: center;
  max-width: 440px;
  width: 90%;
  transform: translateY(20px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.winner-modal-overlay.active .winner-box {
  transform: translateY(0);
}

.trophy-icon {
  font-size: 3rem;
  color: #fbbf24;
  margin-bottom: 1rem;
  animation: float 4s ease-in-out infinite;
}

.winner-box h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.winner-box p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.btn-win-close {
  background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  color: #fff;
  padding: 0.75rem 2rem;
  font-size: 0.95rem;
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

.btn-win-close:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.4);
}

/* Responsiveness */
@media (max-width: 1200px) {
  .info-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .info-card {
    min-height: 180px;
  }
}

@media (max-width: 900px) {
  .info-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .guide-content-row {
    grid-template-columns: 1fr;
  }
  .main-header {
    flex-direction: column;
    gap: 1rem;
    border-radius: 20px;
    padding: 1rem;
  }
  .header-nav {
    width: 100%;
    margin: 0;
  }
}

@media (max-width: 600px) {
  .info-cards-grid {
    grid-template-columns: 1fr;
  }
  .control-action-bar {
    flex-direction: column;
    gap: 1rem;
  }
}
