/* ============================================
   Tablo — Breakout Styles
   ============================================ */

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 100vh;
}

.game-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px 20px;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  /* Fixed: spacing from header */
  margin-top: 24px;
}

/* Removed ::before spacer entirely */

.game-stats {
  display: flex;
  gap: 16px;
  padding: 12px 20px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 500px;
  margin: 0 auto;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 70px;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 16px;
  font-weight: 700;
  color: #2dd4bf;
}

.canvas-wrapper {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  position: relative;
  height: calc(min(60vh, 500px));
  max-height: 500px;
}

.canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0f172a;
  border: 4px solid #334155;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.start-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.start-content {
  text-align: center;
  padding: 24px;
}

.start-title {
  font-size: 28px;
  font-weight: 700;
  color: #2dd4bf;
  margin-bottom: 12px;
}

.start-text {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 20px;
  max-width: 350px;
  line-height: 1.5;
}

.winner-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.winner-modal.visible { display: flex; }

.winner-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.winner-content {
  position: relative;
  background: #1e293b;
  border: 2px solid #2dd4bf;
  border-radius: 12px;
  padding: 28px 20px;
  text-align: center;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.6);
}

.winner-icon { font-size: 42px; margin-bottom: 12px; }
.winner-title { font-size: 22px; font-weight: 700; margin-bottom: 10px; color: #e2e8f0; }
.winner-message { font-size: 14px; color: #94a3b8; margin-bottom: 20px; }
.winner-buttons { display: flex; gap: 10px; justify-content: center; }

.tablo-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.tablo-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.game-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 6px;
}

.game-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: var(--font-primary, sans-serif);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}

.game-btn:hover:not(:disabled) {
  background: #243044;
  border-color: #2dd4bf;
  color: #2dd4bf;
}

.game-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.game-btn.primary {
  background: #2dd4bf;
  border-color: #2dd4bf;
  color: #0f1923;
}

.game-btn.primary:hover:not(:disabled) {
  background: #5eead4;
}

.game-hint {
  font-size: 11px;
  color: #64748b;
  text-align: center;
  margin: 6px auto;
  max-width: 600px;
  line-height: 1.4;
}

/* REMOVED: All #tablo-header SVG overrides — they were causing the gear distortion */

@media (max-width: 600px) {
  .canvas-wrapper {
    height: calc(min(55vh, 400px));
    max-height: 400px;
  }

  .canvas-container {
    border-radius: 8px;
    border-width: 2px;
  }

  .start-title { font-size: 22px; }
  .start-text { font-size: 12px; max-width: 300px; }

  .game-stats {
    gap: 10px;
    padding: 10px 14px;
    max-width: 100%;
  }

  .stat-label { font-size: 9px; }
  .stat-value { font-size: 14px; }

  .game-hint {
    font-size: 10px;
    padding: 0 12px;
    margin: 4px auto;
  }

  .game-btn {
    padding: 7px 14px;
    font-size: 12px;
  }

  .game-controls { margin-top: 4px; }
}

@media (max-height: 600px), (max-width: 400px) {
  .canvas-wrapper {
    height: calc(min(50vh, 320px));
    max-height: 320px;
  }

  .game-stats {
    padding: 8px 12px;
    gap: 8px;
  }

  .stat-label { font-size: 8px; }
  .stat-value { font-size: 13px; }
  .start-title { font-size: 20px; }
  .start-text { font-size: 11px; }
}