/* ============================================
   BOARD STYLES — Tic Tac Toe
   ============================================ */

/* Game layout */
.game-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 32px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

/* Board wrapper */
.board-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Board */
.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  width: clamp(280px, 50vmin, 420px);
  aspect-ratio: 1 / 1;
  background: var(--cell-border);
  border-radius: var(--radius-lg);
  padding: 6px;
  box-shadow: var(--shadow-lg);
  position: relative;
}

/* Cell */
.cell {
  background: var(--cell-bg);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

.cell:hover:not(.cell--occupied):not(.cell--disabled) {
  background: var(--cell-bg-hover);
  transform: scale(1.03);
  z-index: 1;
}

.cell:active:not(.cell--occupied):not(.cell--disabled) {
  transform: scale(0.97);
}

.cell--touch-active {
  background: var(--cell-bg-hover) !important;
  transform: scale(0.96) !important;
}

.cell--occupied {
  cursor: default;
}

.cell--disabled {
  cursor: default;
  pointer-events: none;
}

.cell--preview {
  opacity: 0.3;
}

/* X Mark */
.mark {
  width: 60%;
  height: 60%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mark--x {
  animation: markPopIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mark--o {
  animation: markPopIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Classic mark style */
.mark-style-classic .mark--x {
  width: 55%;
  height: 55%;
}
.mark-style-classic .mark--o {
  width: 55%;
  height: 55%;
}

.mark-style-classic .x-mark {
  width: 100%;
  height: 100%;
}

.mark-style-classic .o-mark {
  width: 100%;
  height: 100%;
  border: 4px solid var(--o-color);
  border-radius: 50%;
}

/* Modern mark style */
.mark-style-modern .x-mark {
  width: 100%;
  height: 100%;
}

.mark-style-modern .o-mark {
  width: 100%;
  height: 100%;
  border: 5px solid var(--o-color);
  border-radius: 50%;
  box-shadow: var(--shadow-glow-o);
}

/* Neon mark style */
.mark-style-neon .x-mark {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 8px var(--x-color));
}

.mark-style-neon .o-mark {
  width: 100%;
  height: 100%;
  border: 5px solid var(--o-color);
  border-radius: 50%;
  filter: drop-shadow(0 0 8px var(--o-color));
  box-shadow: inset 0 0 8px var(--o-glow);
}

/* SVG marks */
.x-mark line {
  stroke: var(--x-color);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: drawLine 0.35s ease forwards;
}

.o-mark {
  border: 4px solid var(--o-color);
  border-radius: 50%;
  animation: drawCircle 0.35s ease forwards;
}

/* Mark animations */
@keyframes markPopIn {
  0% { opacity: 0; transform: scale(0.3) rotate(-10deg); }
  60% { opacity: 1; transform: scale(1.1) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}

@keyframes drawCircle {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Winning cells */
.cell--winning {
  animation: winPulse 0.8s ease infinite;
  background: rgba(255, 215, 0, 0.1);
  box-shadow: 0 0 20px var(--win-glow);
  z-index: 2;
}

.cell--winning .x-mark line {
  stroke: var(--cell-border-win);
}

.cell--winning .o-mark {
  border-color: var(--cell-border-win);
}

@keyframes winPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 15px var(--win-glow); }
  50% { transform: scale(1.06); box-shadow: 0 0 30px var(--win-glow); }
}

/* Draw state */
.cell--draw {
  opacity: 0.5;
}

/* Preview mark */
.preview-mark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50%;
  height: 50%;
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
}

.preview-mark-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.mark-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.cell:hover:not(.cell--occupied):not(.cell--disabled) .preview-mark {
  opacity: 0.25;
}

/* Side panel */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: clamp(200px, 25vw, 280px);
  min-width: 200px;
}

.panel-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--cell-border);
  box-shadow: var(--shadow-sm);
}

.panel-card__title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.panel-card__value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.panel-card__value--x {
  color: var(--x-color);
}

.panel-card__value--o {
  color: var(--o-color);
}

/* Status bar */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--cell-border);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
  min-height: 44px;
}

.status-bar--thinking {
  animation: glow 1.5s ease infinite;
}

.status-bar--win {
  color: var(--cell-border-win);
  border-color: var(--cell-border-win);
}

.status-bar--draw {
  color: var(--draw-color);
  border-color: var(--draw-color);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: pulse 1s ease infinite;
}

.status-dot--x {
  background: var(--x-color);
  box-shadow: 0 0 8px var(--x-glow);
}

.status-dot--o {
  background: var(--o-color);
  box-shadow: 0 0 8px var(--o-glow);
}

/* Game actions */
.game-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Round info */
.round-info {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

/* Score row */
.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--cell-border);
}

.score-row:last-child {
  border-bottom: none;
}

.score-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.score-value {
  font-weight: 700;
  font-size: 1.1rem;
}

/* Difficulty badge */
.difficulty-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.difficulty-badge--easy {
  background: rgba(46, 213, 115, 0.15);
  color: #2ed573;
}

.difficulty-badge--medium {
  background: rgba(255, 165, 2, 0.15);
  color: #ffa502;
}

.difficulty-badge--hard {
  background: rgba(233, 69, 96, 0.15);
  color: var(--accent);
}
