/* ── Carrom Board 3D Stylesheet ── */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;800&family=Syne:wght@700;800&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background: #05050c;
  color: #f1f2f6;
  font-family: 'Outfit', sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

/* Shell Layout */
.game-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  position: relative;
  background: radial-gradient(circle at center, #111124 0%, #05050c 100%);
}

/* Header Game Bar */
.game-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.2rem;
  height: 52px;
  background: rgba(8, 8, 18, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 100;
  flex-shrink: 0;
}

.back-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: color 0.2s;
}

.back-link:hover {
  color: #ff2d78;
}

.game-bar-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #ff2d78, #ffd24a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.player-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #ffd24a;
}

.icon-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.icon-btn svg {
  display: block;
}

.icon-btn .ic-sound-off {
  display: none;
}

.icon-btn.muted .ic-sound-on {
  display: none;
}

.icon-btn.muted .ic-sound-off {
  display: block;
  color: #ff2d78;
}

/* Game Wrapper */
.game-wrap {
  flex-grow: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

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

/* HUD Overlay */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
}

.hud-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  pointer-events: auto;
  flex-wrap: wrap;
}

.hud-chip {
  background: rgba(8, 8, 20, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.hud-chip span.label {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 1px;
}

.hud-chip b {
  color: #fff;
  font-weight: 800;
}

.flex-chip {
  display: flex;
  align-items: center;
}

.coin-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.3);
}

.white-dot { background: #f0f0f8; box-shadow: 0 0 6px #fff; }
.black-dot { background: #1a1a24; border-color: rgba(255,255,255,0.2); }
.red-dot { background: #ff2d78; box-shadow: 0 0 6px #ff2d78; }

.turn-indicator {
  border-color: #ffd24a;
  box-shadow: 0 0 10px rgba(255, 210, 74, 0.2);
}

.hud-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  pointer-events: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.hud-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Baseline Positioner Slider */
.baseline-positioner {
  position: absolute;
  bottom: 85px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(8, 8, 20, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 10px 18px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 80%;
  max-width: 320px;
  pointer-events: auto;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  transition: opacity 0.3s, transform 0.3s;
  z-index: 15;
}

.baseline-positioner.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 15px);
}

.positioner-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.5px;
}

/* Slider Custom Styling */
input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  background: transparent;
}

input[type=range]:focus {
  outline: none;
}

input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

input[type=range]::-webkit-slider-thumb {
  height: 22px;
  width: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff2d78, #ff6b3d);
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -8px;
  box-shadow: 0 0 8px rgba(255, 45, 120, 0.6);
  border: 2px solid #fff;
  transition: transform 0.1s;
}

input[type=range]::-webkit-slider-thumb:active {
  transform: scale(1.15);
}

/* Practice Controls */
.practice-controls {
  position: absolute;
  bottom: 85px;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
  z-index: 15;
}

.practice-controls.hidden {
  display: none;
}

/* Power Meter */
.power-meter {
  position: absolute;
  left: 1.5rem;
  bottom: 85px;
  width: 16px;
  height: 150px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 15;
  opacity: 0;
  transition: opacity 0.2s;
}

.power-meter.visible {
  opacity: 1;
}

.power-fill {
  width: 100%;
  height: 0%;
  background: linear-gradient(0deg, #ff2d78, #ffd24a);
  transition: height 0.05s ease-out;
  box-shadow: 0 0 10px rgba(255, 45, 120, 0.8);
}

.power-text {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.55rem;
  font-weight: 800;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.5px;
}

/* HUD Hint */
.hud-hint {
  width: 100%;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  padding: 8px;
  background: linear-gradient(180deg, transparent, rgba(5,5,12,0.8));
  border-radius: 0 0 12px 12px;
}

/* Screen Shell Overlays */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, backdrop-filter 0.35s ease;
}

.screen-active {
  opacity: 1;
  pointer-events: auto;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Panel Design */
.panel {
  background: rgba(10, 10, 26, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 2.2rem;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 
              inset 0 1px 0 rgba(255, 255, 255, 0.15);
  text-align: center;
  transform: scale(0.92);
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  max-height: 85vh;
  overflow-y: auto;
}

.screen-active .panel {
  transform: scale(1);
}

.panel-sm {
  max-width: 380px;
}

.panel.readable {
  max-width: 600px;
  text-align: left;
}

/* Load Bar styling */
.logo-carrom {
  font-size: 3.5rem;
  animation: spin 3s linear infinite;
  display: inline-block;
  align-self: center;
}

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

.eyebrow {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: #ffd24a;
  text-transform: uppercase;
}

h1 {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 2.2rem;
  line-height: 1.1;
  color: #fff;
  letter-spacing: -0.5px;
}

h1 span {
  display: block;
  background: linear-gradient(90deg, #ff2d78, #ffd24a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

h2 {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.6rem;
  color: #fff;
}

h2 span {
  color: #ff2d78;
}

.subtitle {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.5;
}

.stat-strip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
}

.stat-strip b {
  color: #ffd24a;
}

.load-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

#load-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff2d78, #ffd24a);
  border-radius: 3px;
  transition: width 0.1s ease-out;
}

/* Button & Action styling */
.menu-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-actions.compact {
  flex-direction: row;
  justify-content: stretch;
}

.menu-actions.compact button {
  flex: 1;
}

button {
  font-family: 'Outfit', sans-serif;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: white;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

button:active {
  transform: translateY(0);
}

button.primary {
  background: linear-gradient(135deg, #ff2d78 0%, #ff6b3d 100%);
  border: none;
  font-weight: 800;
  box-shadow: 0 4px 15px rgba(255, 45, 120, 0.35);
}

button.primary:hover {
  box-shadow: 0 6px 20px rgba(255, 45, 120, 0.5);
  background: linear-gradient(135deg, #ff3c85 0%, #ff7b50 100%);
}

/* Setup Grid */
.setup-grid {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.setup-section h3 {
  font-size: 0.85rem;
  font-weight: 800;
  color: rgba(255,255,255,0.4);
  letter-spacing: 1px;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.btn-group {
  display: flex;
  gap: 8px;
}

.btn-group button, .difficulty-select button {
  flex: 1;
  padding: 10px;
  font-size: 0.85rem;
  border-radius: 10px;
}

.btn-group button.active, .difficulty-select button.active {
  background: rgba(255, 210, 74, 0.15);
  border-color: #ffd24a;
  color: #ffd24a;
  box-shadow: 0 0 10px rgba(255, 210, 74, 0.15);
}

.difficulty-select {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.difficulty-select button {
  width: calc(33.33% - 4px);
  flex-grow: 1;
  padding: 8px 4px;
  font-size: 0.8rem;
}

.setup-desc {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.45);
  margin-top: 6px;
  min-height: 16px;
}

.equipped-status {
  background: rgba(255,255,255,0.03);
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.eq-item b {
  color: #ffd24a;
}

.store-link {
  color: #ff2d78;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8rem;
  margin-top: 4px;
}

.store-link:hover {
  text-decoration: underline;
}

/* How to Play Scrollable info */
.how-scroll {
  max-height: 380px;
  overflow-y: auto;
  padding-right: 8px;
}

.how-scroll::-webkit-scrollbar {
  width: 6px;
}

.how-scroll::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
}

.how-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
}

.how-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.how-grid div {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 12px 16px;
  border-radius: 12px;
}

.how-grid b {
  display: block;
  font-size: 0.9rem;
  color: #ffd24a;
  margin-bottom: 4px;
}

.how-grid span {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.4;
}

/* Game Over Summary card */
.summary-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px;
  text-align: left;
}

.summary-card h3 {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  row-gap: 8px;
  column-gap: 12px;
  font-size: 0.85rem;
}

.summary-grid div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
  padding-bottom: 4px;
}

.summary-grid b {
  color: rgba(255,255,255,0.6);
  font-weight: 400;
}

.summary-grid span {
  color: #fff;
  font-weight: 600;
}

.final-score {
  font-size: 3.5rem;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  color: #ffd24a;
  text-shadow: 0 0 15px rgba(255, 210, 74, 0.35);
  margin: 10px 0;
}

/* Score Nudge */
.nn-score-nudge {
  background: linear-gradient(135deg, rgba(255, 45, 120, 0.1) 0%, rgba(255, 210, 74, 0.05) 100%);
  border: 1px solid rgba(255, 45, 120, 0.25);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #fff;
  margin-top: 10px;
}

.nn-score-nudge p {
  margin-bottom: 8px;
  font-weight: 600;
}

.nn-nudge-btns {
  display: flex;
  gap: 8px;
}

.nn-nudge-signup {
  background: #ff2d78;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 8px;
  flex: 2;
  text-align: center;
  transition: background 0.2s;
}

.nn-nudge-signup:hover {
  background: #ff478c;
}

.nn-nudge-later {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  flex: 1;
}

/* Toasts */
.toast {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(8, 8, 20, 0.95);
  border: 1px solid #ffd24a;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  padding: 8px 18px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}

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

/* Responsive Hacks */
@media (max-width: 480px) {
  h1 { font-size: 1.8rem; }
  .panel { padding: 1.5rem; }
  .baseline-positioner { width: 90%; }
}

@media (max-height: 600px) {
  h1 { font-size: 1.5rem; }
  .panel { padding: 1rem; gap: 0.6rem; }
  .setup-grid { gap: 0.6rem; }
  .menu-actions { gap: 6px; }
  .setup-section h3 { margin-bottom: 2px; }
  .equipped-status { padding: 4px 8px; }
  .how-scroll { max-height: 180px; }
}
