@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Inter:wght@400;600&display=swap');

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

:root {
  --gold: #ffd700;
  --red: #ff4d4d;
  --bg: #0a0505;
  --bg2: #1a0c0c;
  --card-bg: rgba(255,215,0,0.06);
  --border: rgba(255,215,0,0.25);
  --text: #fff5e6;
  --muted: #8b6914;
}

html, body {
  min-height: 100vh;
  min-height: 100dvh;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  font-family: 'Orbitron', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: max(56px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  gap: 14px;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,215,0,0.07) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(255,77,77,0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── Top bar ── */
div.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 500px;
  z-index: 1;
  gap: 10px;
}

div.top > p {
  font-family: 'Orbitron', monospace;
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 1px;
  margin: 0;
}

/* ── Header ── */
h2 {
  font-family: 'Orbitron', monospace;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 16px rgba(255,215,0,0.5);
  text-align: center;
  letter-spacing: 2px;
  margin: 0;
  z-index: 1;
  min-height: 2rem;
  transition: all 0.3s;
}

/* ── Score display ── */
h3 {
  font-family: 'Orbitron', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  z-index: 1;
  padding: 8px 20px;
  border-radius: 8px;
  width: 100%;
  max-width: 500px;
  text-align: center;
}

#computer-score {
  background: rgba(255,77,77,0.08);
  border: 1px solid rgba(255,77,77,0.3);
  color: var(--red);
}

#my-score {
  background: rgba(255,215,0,0.08);
  border: 1px solid rgba(255,215,0,0.3);
  color: var(--gold);
}

/* ── Cards ── */
div#cards {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
  z-index: 1;
  padding: 20px 0;
}

div.card-slot {
  border: 1px solid var(--border);
  border-radius: 10px;
  height: 150px;
  width: calc(150px * 5 / 7);
  background: var(--card-bg);
  overflow: hidden;
  box-shadow: 0 0 20px rgba(255,215,0,0.1), 0 8px 24px rgba(0,0,0,0.5);
  transition: all 0.3s;
}

div.card-slot:hover { box-shadow: 0 0 30px rgba(255,215,0,0.2); transform: translateY(-3px); }

img.card {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  animation: cardFlip 0.3s ease-out;
}

.fallback-card {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  background: #fffaf0;
  color: #111;
  border-radius: 8px;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 800;
}

.fallback-card strong {
  font-size: 2rem;
}

.fallback-card.red {
  color: #c1121f;
}

@keyframes cardFlip {
  from { opacity: 0; transform: rotateY(90deg) scale(0.8); }
  to   { opacity: 1; transform: rotateY(0) scale(1); }
}

/* ── Buttons ── */
button {
  font-family: 'Orbitron', monospace;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  transition: all 0.2s;
  letter-spacing: 1px;
  min-height: 44px;
  touch-action: manipulation;
}

button#new-deck {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 10px 14px;
  background: rgba(255,215,0,0.1);
  border: 1px solid var(--border);
  color: var(--gold);
}

button#new-deck:hover {
  background: rgba(255,215,0,0.2);
  box-shadow: 0 0 12px rgba(255,215,0,0.3);
}

button.draw {
  font-size: 0.85rem;
  font-weight: 900;
  padding: 14px 40px;
  background: linear-gradient(135deg, var(--gold), #ff9500);
  color: #1a0a00;
  width: 100%;
  max-width: 500px;
  z-index: 1;
  box-shadow: 0 4px 20px rgba(255,215,0,0.4);
}

button.draw:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(255,215,0,0.5);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none !important;
}

/* ── Mobile ── */
@media (max-width: 400px) {
  div.card-slot { height: 120px; width: calc(120px * 5 / 7); }
  h2 { font-size: 0.9rem; }
  div.top {
    align-items: stretch;
    flex-direction: column;
    text-align: center;
  }
}
