/* ═══════════════════════════════════════════
   PATOS Reflex Arcade – Stylesheet
   ═══════════════════════════════════════════ */

:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --border:    #30363d;
  --text:      #e6edf3;
  --muted:     #8b949e;
  --accent:    #f0883e;
  --accent-2:  #d29922;
  --success:   #3fb950;
  --danger:    #f85149;
  --highlight: rgba(240, 136, 62, 0.15);
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

/* ── Screens ────────────────────────────── */

#game-container {
  width: 100%; height: 100%;
  position: relative;
}

.screen {
  position: absolute; inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
}
.screen.active { display: flex; }

.screen-inner {
  text-align: center;
  padding: 2rem;
  max-width: 480px;
  width: 90%;
}

/* ── Start Screen ───────────────────────── */

.title {
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.25rem;
}
.subtitle {
  font-size: 1.1rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}
.owl-logo {
  font-size: 5rem;
  margin: 1rem 0;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.instructions {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}
.key-hint {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.5em;
  font-size: 0.85em;
  color: var(--accent);
}

.wallet-row {
  margin-bottom: 1.5rem;
}
.btn-wallet {
  background: linear-gradient(135deg, #9945ff, #14f195);
  color: #0d1117;
  border: none;
  border-radius: 8px;
  padding: 0.7em 1.4em;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-wallet:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(153, 69, 255, 0.4); }
.btn-wallet:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.wallet-connected {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.wallet-address {
  font-family: ui-monospace, monospace;
  font-size: 0.9rem;
  color: var(--accent);
  word-break: break-all;
}
.btn-wallet-small {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 0.35em 0.75em;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-wallet-small:hover { border-color: var(--accent); color: var(--text); }
.wallet-error {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--danger);
}

/* ── Buttons ────────────────────────────── */

.btn-primary, .btn-secondary {
  display: inline-block;
  padding: 0.85em 2.5em;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, box-shadow 0.15s;
  margin: 0.4rem;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 4px 20px rgba(240, 136, 62, 0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 28px rgba(240, 136, 62, 0.5); }
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); }

/* ── Gameplay ───────────────────────────── */

#screen-game { background: var(--bg); }

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#hud-score {
  position: absolute;
  top: 1rem; left: 50%;
  transform: translateX(-50%);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  pointer-events: none;
  z-index: 10;
}

/* Direction pad: click / touch to strike */
.direction-pad {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
.direction-pad .dir-btn {
  position: absolute;
  pointer-events: auto;
  border: none;
  background: rgba(22, 27, 34, 0.5);
  color: rgba(230, 237, 243, 0.7);
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.direction-pad .dir-btn:hover,
.direction-pad .dir-btn:active {
  background: rgba(240, 136, 62, 0.25);
  color: var(--accent);
}
.dir-btn-up   { top: 0;    left: 30%; width: 40%; height: 35%; }
.dir-btn-down { bottom: 0; left: 30%; width: 40%; height: 35%; }
.dir-btn-left { left: 0;   top: 35%;  width: 30%; height: 30%; }
.dir-btn-right{ right: 0;  top: 35%;  width: 30%; height: 30%; }

/* ── Game Over ──────────────────────────── */

.go-title {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--danger);
  margin-bottom: 1rem;
}
.go-score {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.go-rank {
  font-size: 1.2rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}
.go-loading {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 1rem;
  animation: blink 1.2s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0.4; } }

/* ── Leaderboard ────────────────────────── */

.lb-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  color: var(--accent);
}

#lb-table-wrap {
  max-height: 55vh;
  overflow-y: auto;
  margin-bottom: 1.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
}

#lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
#lb-table th {
  background: var(--surface);
  padding: 0.7em 0.8em;
  text-align: left;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.8em;
  letter-spacing: 0.08em;
  position: sticky; top: 0;
}
#lb-table td {
  padding: 0.6em 0.8em;
  border-top: 1px solid var(--border);
}
#lb-table tr.highlight {
  background: var(--highlight);
}
#lb-table tr.highlight td {
  color: var(--accent);
  font-weight: 700;
}
.lb-wallet-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.lb-wallet {
  font-family: ui-monospace, monospace;
  font-size: 0.9em;
}
.lb-copy-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 0.25em 0.5em;
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.lb-copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.lb-copy-btn.lb-copy-done {
  border-color: var(--success);
  color: var(--success);
}

/* ── Responsive ─────────────────────────── */
@media (max-width: 480px) {
  .title { font-size: 2.8rem; }
  .owl-logo { font-size: 3.5rem; }
  .instructions { font-size: 0.85rem; }
}
