/* Penalty Kick 3D — stadium aesthetic. */

.app {
  align-items: center;
  gap: 12px;
  padding-bottom: 24px;
}

.pk-hud {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 480px;
  justify-content: space-between;
  align-items: center;
}

.hud-cell {
  flex: 1;
  background: linear-gradient(180deg, #1c4a2f 0%, #0e2e1c 100%);
  border: 2px solid #d4a534;     /* gold trim — football badge feel */
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 60px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -2px 6px rgba(0, 0, 0, 0.4),
    0 3px 8px rgba(0, 0, 0, 0.25);
  position: relative;
}
body.dark .hud-cell {
  background: linear-gradient(180deg, #2a5a3e 0%, #143824 100%);
}

.hud-label {
  font-size: 11px;
  color: #d4a534;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.hud-value {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  margin-top: 2px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  text-shadow:
    0 2px 4px rgba(0, 0, 0, 0.55),
    0 0 8px rgba(212, 165, 52, 0.20);
  letter-spacing: 0.04em;
  transition: color 0.15s;
}
.hud-value.flash {
  animation: hudFlash 0.7s cubic-bezier(0.2, 1, 0.3, 1);
}
@keyframes hudFlash {
  0%   { transform: scale(1);    color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,.55); }
  25%  { transform: scale(1.45); color: #fff8a8; text-shadow: 0 0 16px rgba(255, 220, 80, 1), 0 0 26px rgba(255, 200, 0, 0.8); }
  60%  { transform: scale(1.10); color: #ffe066; }
  100% { transform: scale(1);    color: #fff;    text-shadow: 0 2px 4px rgba(0,0,0,.55); }
}

.board-wrapper {
  position: relative;
  width: 100%;
  max-width: 480px;
  border-radius: 14px;
  overflow: hidden;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.22));
  isolation: isolate;
  aspect-ratio: 4 / 3;
  background: #87ceeb;
}

#three-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 16px;
  z-index: 10;
}
.loading[hidden] { display: none; }
.loading-text { margin-bottom: 4px; }
.loading-sub { font-size: 12px; opacity: 0.7; }

.power-meter {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 16px;
  width: 240px;
  height: 18px;
  background: rgba(0, 0, 0, 0.55);
  border: 2px solid #d4a534;
  border-radius: 999px;
  overflow: hidden;
  z-index: 5;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.6),
    0 2px 8px rgba(0, 0, 0, 0.5);
}
.power-meter[hidden] { display: none; }
/* Saturation zone marker — vertical hairline at the 50% point so the player
   can see where "safe" power ends and drift starts. */
.power-meter::after {
  content: "";
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.45);
  pointer-events: none;
}
/* Shake animation kicks in via JS-toggled .danger class at high charge */
.power-meter.danger {
  animation: powerShake 90ms ease-in-out infinite alternate;
  border-color: #ff4d4d;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.6),
    0 0 12px rgba(255, 77, 77, 0.7);
}
@keyframes powerShake {
  from { transform: translateX(calc(-50% - 2px)); }
  to   { transform: translateX(calc(-50% + 2px)); }
}
.power-fill {
  height: 100%;
  width: 0%;
  background:
    repeating-linear-gradient(135deg,
      rgba(255, 255, 255, 0.18) 0px, rgba(255, 255, 255, 0.18) 8px,
      transparent 8px, transparent 16px),
    linear-gradient(90deg, #2ecc71, #f1c40f 50%, #e74c3c);
  transition: width 16ms linear;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}

.instruction {
  position: absolute;
  left: 50%;
  bottom: 36px;
  transform: translateX(-50%);
  color: #fff;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 10px;
  border-radius: 999px;
  pointer-events: none;
  z-index: 4;
  white-space: nowrap;
}
.instruction[hidden] { display: none; }

.goal-flash {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 8;
  animation: goalFlash 1.4s cubic-bezier(0.2, 1, 0.3, 1);
}
.goal-flash[hidden] { display: none; }
.goal-flash-text {
  font-size: 76px;
  font-weight: 900;
  color: #fff;
  text-shadow:
    0 0 12px rgba(255, 220, 60, 0.95),
    0 0 28px rgba(255, 150, 30, 0.85),
    0 4px 0 #1a1a1a,
    0 6px 14px rgba(0, 0, 0, 0.7);
  letter-spacing: 0.05em;
  transform: scale(0.5);
  animation: goalText 1.4s cubic-bezier(0.2, 1, 0.3, 1);
}
@keyframes goalText {
  0%   { transform: scale(0.3); opacity: 0; }
  20%  { transform: scale(1.3); opacity: 1; }
  35%  { transform: scale(1.0); }
  85%  { transform: scale(1.0); opacity: 1; }
  100% { transform: scale(1.1); opacity: 0; }
}
@keyframes goalFlash {
  0%, 100% { background: rgba(255, 255, 255, 0); }
  10%      { background: rgba(255, 255, 255, 0.4); }
  25%      { background: rgba(255, 255, 255, 0.1); }
}

.streak-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: linear-gradient(135deg, #ff7a00, #e53935);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(255, 100, 30, 0.5);
  z-index: 6;
  animation: streakPulse 0.6s ease-out;
}
.streak-badge[hidden] { display: none; }
@keyframes streakPulse {
  0%   { transform: scale(0.5); opacity: 0; }
  50%  { transform: scale(1.18); }
  100% { transform: scale(1.0); opacity: 1; }
}

.toolbar {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  justify-content: center;
}
.toolbar .btn {
  flex: 1;
  max-width: 180px;
  background: linear-gradient(180deg, #2d7d4e 0%, #1c5234 100%);
  color: #fff;
  border: 2px solid #d4a534;
  border-radius: 8px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -3px 6px rgba(0, 0, 0, 0.3),
    0 3px 6px rgba(0, 0, 0, 0.25);
  transition: transform 80ms ease, box-shadow 80ms ease, filter 80ms;
  padding: 10px 12px;
}
.toolbar .btn:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.30),
    inset 0 -3px 6px rgba(0, 0, 0, 0.3),
    0 5px 10px rgba(0, 0, 0, 0.30);
}
.toolbar .btn:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.4),
    0 1px 2px rgba(0, 0, 0, 0.2);
}
.toolbar .btn-secondary {
  background: linear-gradient(180deg, #4a4a4a 0%, #2a2a2a 100%);
}
#daily-btn.active {
  background: linear-gradient(180deg, #d4a534 0%, #a07d1e 100%);
  color: #1a1a1a;
}

.pk-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  z-index: 100;
  backdrop-filter: blur(6px);
}
.pk-overlay[hidden] { display: none; }

.overlay-card {
  background: linear-gradient(180deg, #1f4d2e 0%, #0d2c1a 100%);
  border: 3px solid #d4a534;
  border-radius: 18px;
  padding: 32px 40px;
  text-align: center;
  min-width: 280px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.15),
    0 12px 40px rgba(0, 0, 0, 0.55),
    0 0 20px rgba(212, 165, 52, 0.25);
  position: relative;
}
.overlay-card::before {
  content: '🏆';
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 36px;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.55);
}

.overlay-title {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 10px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), 0 0 12px rgba(212, 165, 52, 0.3);
  letter-spacing: 0.04em;
}

.overlay-sub {
  font-size: 16px;
  color: #e8e0c8;
  margin-bottom: 22px;
  line-height: 1.6;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.overlay-card .btn {
  background: linear-gradient(180deg, #2d7d4e 0%, #1c5234 100%);
  color: #fff;
  border: 2px solid #d4a534;
  border-radius: 8px;
  font-weight: 700;
  padding: 12px 28px;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 3px 8px rgba(0, 0, 0, 0.35);
  transition: filter 80ms;
}
.overlay-card .btn:hover { filter: brightness(1.12); }

/* Error overlay — display:flex would override [hidden] without explicit rule */
#error[hidden] { display: none; }
#error {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 18px;
  padding: 20px;
  text-align: center;
  z-index: 9999;
}
#error .err-detail {
  margin-top: 8px;
  font-size: 14px;
  opacity: 0.7;
}
