/* Eco Tap — dark + cyan glow (Arte v0.1) */

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

:root {
  --bg: #0b0f14;
  --bg-panel: rgba(11, 15, 20, 0.94);
  --text: #e8eef4;
  --muted: #8b9bb0;
  --accent: #4fc3f7;
  --accent-bright: #7df9ff;
  --accent-dim: #3a8fb7;
  --ring-base: #1e3a5f;
  --danger: #ff5a5a;
  --glow: 0 0 24px rgba(79, 195, 247, 0.45);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% 45%, #121a24 0%, var(--bg) 70%);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
  touch-action: none;
}

#fail-flash {
  position: absolute;
  inset: 0;
  background: rgba(255, 90, 90, 0.4);
  opacity: 0;
  pointer-events: none;
  z-index: 4;
  transition: none;
}

#fail-flash.show {
  animation: failFlash 140ms ease-out forwards;
}

@keyframes failFlash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
  background: rgba(8, 12, 18, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 10;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
}

.panel {
  width: min(360px, 100%);
  padding: 2rem 1.5rem;
  text-align: center;
  background: var(--bg-panel);
  border: 1px solid rgba(79, 195, 247, 0.22);
  border-radius: 20px;
  box-shadow: var(--glow), 0 16px 48px rgba(0, 0, 0, 0.5);
}

.badge {
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  color: var(--accent);
  border: 1px solid rgba(79, 195, 247, 0.35);
  border-radius: 999px;
}

h1 {
  font-size: clamp(2rem, 8vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent-bright);
  text-shadow: var(--glow);
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}

.tagline {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
  margin-bottom: 1.75rem;
}

.hint {
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.result-score {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.result-score strong {
  font-size: 2.25rem;
  color: var(--accent-bright);
  text-shadow: var(--glow);
}

.result-best {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.result-best strong {
  color: var(--text);
  font-size: 1.15rem;
}

.new-record {
  margin: 0.75rem 0 1rem;
  color: var(--accent-bright);
  font-weight: 700;
  text-shadow: var(--glow);
}

.new-record.hidden {
  display: none;
}

.btn {
  display: block;
  width: 100%;
  margin-top: 0.65rem;
  padding: 0.9rem 1.25rem;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-play {
  width: 72px;
  height: 72px;
  margin: 0 auto;
  padding: 0;
  border-radius: 50%;
  font-size: 0.95rem;
  font-weight: 800;
  color: #0b0f14;
  background: var(--accent);
  box-shadow: var(--glow);
}

.btn-play:hover {
  box-shadow: 0 0 32px rgba(79, 195, 247, 0.65);
}

.btn-primary {
  color: #0b0f14;
  background: linear-gradient(180deg, #7df9ff 0%, var(--accent) 100%);
  box-shadow: var(--glow);
}

.btn-primary:hover {
  box-shadow: 0 0 32px rgba(79, 195, 247, 0.65);
}

.btn-ghost {
  margin-top: 0.85rem;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: none;
  opacity: 0.7;
}

.btn-ghost:hover {
  color: var(--text);
  opacity: 1;
}

/* HUD — score top-center (Arte) */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(16px + var(--safe-top)) 16px 8px;
  pointer-events: none;
  z-index: 5;
  font-variant-numeric: tabular-nums;
}

.hud.hidden {
  display: none;
}

.hud #score {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  transition: transform 0.12s ease, color 0.12s ease;
}

.hud #score.bump {
  animation: scoreBump 0.28s ease-out;
  color: var(--accent-bright);
}

@keyframes scoreBump {
  0% { transform: scale(1); }
  35% { transform: scale(1.22); }
  100% { transform: scale(1); }
}

.hud #combo {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  text-shadow: 0 0 12px rgba(79, 195, 247, 0.5);
}

.hud #combo.hidden {
  visibility: hidden;
  height: 0;
  margin: 0;
  overflow: hidden;
}

.hud-best {
  position: absolute;
  top: calc(16px + var(--safe-top));
  right: 16px;
  font-size: 0.75rem;
  color: var(--muted);
}

.hud-best span {
  color: var(--text);
  font-weight: 600;
}

.feedback {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-bright);
  text-shadow: var(--glow);
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  transition: none;
}

.feedback.show {
  animation: popFade 0.55s ease-out forwards;
}

.feedback.miss {
  color: var(--danger);
  text-shadow: 0 0 16px rgba(255, 90, 90, 0.5);
}

@keyframes popFade {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.65); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.18); }
  100% { opacity: 0; transform: translate(-50%, -78%) scale(1); }
}

@media (min-width: 768px) {
  .panel {
    padding: 2.5rem 2rem;
  }
}


/* How-to block on start screen */
.howto {
  margin: 1rem 0 1.25rem;
  padding: 0.85rem 1rem;
  text-align: left;
  background: rgba(79, 195, 247, 0.08);
  border: 1px solid rgba(79, 195, 247, 0.28);
  border-radius: 12px;
}
.howto-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-bright);
  margin-bottom: 0.5rem;
  text-align: center;
}
.howto-steps {
  margin: 0;
  padding-left: 1.15rem;
  color: #a8b8cc;
  font-size: 0.86rem;
  line-height: 1.5;
}
.howto-steps li + li { margin-top: 0.35rem; }
.howto-steps strong { color: var(--accent-bright); font-weight: 600; }
.over-tip {
  margin: 0.5rem 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Language picker */
.lang-picker {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}
.lang-btn {
  min-width: 44px;
  padding: 0.35rem 0.55rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: rgba(79, 195, 247, 0.06);
  border: 1px solid rgba(79, 195, 247, 0.25);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.lang-btn[aria-pressed="true"],
.lang-btn.active {
  color: #0b0f14;
  background: var(--accent);
  border-color: var(--accent-bright);
  box-shadow: 0 0 12px rgba(79, 195, 247, 0.4);
}
.lang-btn:hover {
  color: var(--text);
  border-color: rgba(79, 195, 247, 0.5);
}

.btn-secondary {
  color: var(--accent-bright);
  background: rgba(79, 195, 247, 0.12);
  border: 1px solid rgba(79, 195, 247, 0.4);
  box-shadow: none;
}
.btn-secondary:hover {
  background: rgba(79, 195, 247, 0.22);
  box-shadow: 0 0 16px rgba(79, 195, 247, 0.3);
}
.btn-secondary:disabled {
  opacity: 0.45;
  cursor: default;
}

/* Score submit on game over */
.submit-block {
  margin: 0.75rem 0 0.5rem;
  padding: 0.85rem 0.75rem;
  background: rgba(79, 195, 247, 0.06);
  border: 1px solid rgba(79, 195, 247, 0.2);
  border-radius: 12px;
}
.nick-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
#nick-input {
  display: block;
  width: 100%;
  margin-bottom: 0.5rem;
  padding: 0.65rem 0.75rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--text);
  background: rgba(11, 15, 20, 0.85);
  border: 1px solid rgba(79, 195, 247, 0.35);
  border-radius: 10px;
  outline: none;
}
#nick-input:focus {
  border-color: var(--accent-bright);
  box-shadow: 0 0 12px rgba(79, 195, 247, 0.35);
}
.submit-msg {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--accent);
}
.submit-msg.err {
  color: var(--danger);
}
.submit-msg.hidden {
  display: none;
}
.submit-block.hidden {
  display: none;
}

/* Ranking screen */
.panel-rank {
  max-height: min(90dvh, 640px);
  overflow-y: auto;
}
.rank-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin: -0.5rem 0 1rem;
}
.rank-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  text-align: left;
}
.rank-list li {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(79, 195, 247, 0.12);
}
.rank-list li:nth-child(-n+3) {
  background: rgba(79, 195, 247, 0.08);
  border-radius: 8px;
  border-bottom-color: transparent;
  margin-bottom: 0.25rem;
}
.rank-pos {
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.rank-name {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-score {
  font-weight: 700;
  color: var(--accent-bright);
  font-variant-numeric: tabular-nums;
}
.rank-empty {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.rank-empty.hidden {
  display: none;
}


.rank-list li.rank-you {
  border: 1px solid #7df9ff;
  border-radius: 10px;
  padding: 0.35rem 0.5rem;
  background: rgba(125, 249, 255, 0.06);
}

.your-best {
  margin-top: 0.85rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid #7df9ff;
  border-radius: 10px;
  color: var(--accent-bright);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
}


/* Mute toggle (start screen) */
.btn-mute {
  margin-top: 0.5rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  opacity: 0.85;
}
.btn-mute.is-muted {
  color: var(--danger);
  opacity: 1;
}

/* Optional tip-jar — external itch.io link only (no in-game payments) */
.btn-tip {
  display: block;
  width: 100%;
  margin-top: 0.55rem;
  padding: 0.55rem 1rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  color: var(--muted);
  background: transparent;
  border: 1px dashed rgba(79, 195, 247, 0.28);
  border-radius: 12px;
  box-sizing: border-box;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.btn-tip:hover {
  color: var(--accent-bright);
  border-color: rgba(79, 195, 247, 0.55);
  background: rgba(79, 195, 247, 0.06);
}
a.btn-tip:active {
  transform: scale(0.97);
}


/* v0.3.5 — pause + combo pulse + run stats */
#screen-pulse {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  background: radial-gradient(ellipse at center, rgba(125, 249, 255, 0.28) 0%, transparent 65%);
}
#screen-pulse.pulse {
  animation: screenPulse 420ms ease-out forwards;
}
@keyframes screenPulse {
  0% { opacity: 1; }
  100% { opacity: 0; }
}
#pause-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 30;
  background: rgba(5, 8, 12, 0.72);
  backdrop-filter: blur(4px);
}
#pause-overlay.active {
  display: flex;
}
#pause-overlay .pause-panel {
  text-align: center;
  padding: 1.4rem 1.6rem;
  border-radius: 16px;
  background: var(--bg-panel);
  border: 1px solid rgba(79, 195, 247, 0.35);
  box-shadow: var(--glow);
  max-width: 280px;
}
#pause-overlay h2 {
  font-size: 1.35rem;
  margin-bottom: 0.4rem;
  color: var(--accent-bright);
}
#pause-overlay p {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.9rem;
}
.run-stats {
  margin: 0.35rem 0 0.2rem;
  font-size: 0.82rem;
  color: var(--accent-dim);
  letter-spacing: 0.02em;
}

/* v0.3.8 — pause run stats */
.pause-stats {
  margin: 0.35rem 0 0.65rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent-bright);
  letter-spacing: 0.02em;
}
#screen-pulse.pulse-gold {
  background: radial-gradient(ellipse at center, rgba(255, 213, 79, 0.32) 0%, transparent 65%);
}
