/* ELEMENTA — Cyber-Fantasy Stylesheet */

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

:root {
  --bg-deep:    #050508;
  --bg-dark:    #0d0d1a;
  --bg-panel:   rgba(10, 10, 22, 0.88);
  --bg-card:    rgba(18, 18, 40, 0.82);
  --accent-a:   #e05050;
  --accent-b:   #4488dd;
  --gold:       #c8a840;
  --text:       #e8e8f0;
  --text-muted: #7880a0;
  --border:     rgba(255,255,255,0.07);
  --border-hi:  rgba(255,255,255,0.14);
  --radius:     10px;
  --glass-blur: blur(16px);
}

html, body {
  height: 100%;
  background: var(--bg-deep);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  overflow: hidden;
}

#app { height: 100vh; display: flex; flex-direction: column; }

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

.screen { display: none; flex-direction: column; height: 100%; }
.screen.active { display: flex; }

/* ─── Menu Screen ─────────────────────────────────────────────────────────── */

#menu-screen {
  background: radial-gradient(ellipse at 50% 30%, #1a0a2e 0%, var(--bg-deep) 70%);
  align-items: center;
  justify-content: center;
}

.menu-content { width: 100%; max-width: 640px; padding: 2rem; text-align: center; }

.game-title {
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  background: linear-gradient(135deg, var(--accent-a), var(--gold), var(--accent-b));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.25rem;
}

.game-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 2rem;
}

.menu-buttons { display: flex; gap: 1rem; justify-content: center; margin-bottom: 2rem; }

#mode-select { margin-top: 1.5rem; }
#mode-select h3 { color: var(--gold); margin-bottom: 1rem; letter-spacing: 0.1em; }

.mode-options {
  display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1.5rem;
}

.mode-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  cursor: pointer;
  transition: all 0.2s ease-out;
  color: var(--text);
  text-align: center;
  min-width: 140px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
.mode-btn:hover {
  border-color: var(--gold);
  background: rgba(30, 28, 58, 0.90);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(200,168,64,0.20);
}
.mode-btn .mode-icon { font-size: 2rem; display: block; margin-bottom: 0.5rem; }
.mode-btn .mode-name { font-weight: 600; display: block; }
.mode-btn .mode-desc { font-size: 0.75rem; color: var(--text-muted); display: block; }

#map-select { animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:none; } }

#map-select h3, .deck-select h3 {
  color: var(--gold);
  margin: 1.5rem 0 0.75rem;
  letter-spacing: 0.1em;
  font-size: 0.9rem;
  text-transform: uppercase;
}

.map-options, .deck-options {
  display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; margin-bottom: 0.5rem;
}

.map-card, .deck-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease-out;
  text-align: center;
  min-width: 130px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
.map-card:hover, .deck-card:hover  { border-color: var(--border-hi); }
.map-card.active, .deck-card.active { border-color: var(--gold); background: rgba(30,28,48,0.92); }
.map-card .map-icon  { font-size: 1.5rem; display: block; }
.map-card .map-name  { font-weight: 600; font-size: 0.9rem; display: block; margin: 0.25rem 0 0.1rem; }
.map-card .map-desc  { font-size: 0.72rem; color: var(--text-muted); }
.deck-card .deck-name { font-weight: 600; font-size: 0.9rem; display: block; }
.deck-card .deck-composition { font-size: 0.8rem; color: var(--text-muted); }

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

.btn {
  padding: 0.65rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease-out;
  letter-spacing: 0.05em;
}
.btn-primary  { background: linear-gradient(135deg, #7733bb, #3355cc); color: white; }
.btn-primary:hover  { filter: brightness(1.25); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(100,60,200,0.4); }
.btn-secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border-hi); backdrop-filter: var(--glass-blur); }
.btn-secondary:hover { border-color: rgba(255,255,255,0.28); background: rgba(28,28,55,0.92); }
.btn-small { background: transparent; color: var(--text-muted); border: 1px solid var(--border); padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-small:hover { color: var(--text); border-color: var(--border-hi); }
.btn-danger { background: #882222; color: white; }

/* ─── Matchmaking ─────────────────────────────────────────────────────────── */

#matchmaking-screen { align-items: center; justify-content: center; background: var(--bg-deep); }
.matchmaking-content { text-align: center; }
.matchmaking-content h2 { font-size: 1.5rem; margin-bottom: 1rem; }
#matchmaking-count {
  font-size: 4rem; font-weight: 900; color: var(--accent-b);
  display: block; margin: 1rem 0; animation: pulse 1s infinite;
}
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.5; } }
.matchmaking-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 2rem; }

/* ─── Game Screen ─────────────────────────────────────────────────────────── */

#game-screen {
  background:
    radial-gradient(ellipse at 50% 100%, rgba(18,8,45,0.70) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 50%,  rgba(8,5,20,0.40)  0%, transparent 80%),
    var(--bg-deep);
  overflow: hidden;
}

/* ── Top bar ──────────────────────────────────────────────────────────────── */

#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.75rem;
  background: rgba(6, 6, 14, 0.92);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  gap: 0.75rem;
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}

/* ── Player panels ─────────────────────────────────────────────────────────── */

.player-panel {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 180px;
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}
.player-panel.player-b { flex-direction: row-reverse; }

.player-label {
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.player-a .player-label { color: #ff5555; text-shadow: 0 0 10px rgba(255,60,60,0.55); }
.player-b .player-label,
.player-name-b { color: #55aaff; text-shadow: 0 0 10px rgba(60,130,255,0.55); font-size: 0.78rem; letter-spacing: 0.12em; font-weight: 800; text-transform: uppercase; display: flex; align-items: center; gap: 0.35rem; }

/* Large timer */
.timer-main {
  font-size: 1.35rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: #f0f0ff;
  min-width: 42px;
  text-align: center;
}

/* Small bank */
.bank-sm {
  font-size: 0.70rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* BOT badge */
#bot-badge {
  display: inline-block;
  background: rgba(255,50,50,0.18);
  border: 1px solid rgba(255,80,80,0.55);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ff6666;
  vertical-align: middle;
}

/* Legacy .timer/.bank selectors kept for any remaining references */
.timer { font-size: 1.35rem; font-weight: 900; font-variant-numeric: tabular-nums; min-width: 42px; text-align: center; }
.bank  { font-size: 0.70rem; color: var(--text-muted); min-width: 60px; }

/* ── HUD center ───────────────────────────────────────────────────────────── */

#hud-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
}

/* ── Dominance Bar ────────────────────────────────────────────────────────── */

#dominance-bar-container { width: 100%; text-align: center; }

#dominance-bar {
  display: flex;
  height: 14px;
  border-radius: 7px;
  overflow: visible;
  background: rgba(0,0,0,0.5);
  margin-bottom: 4px;
  position: relative;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06) inset;
}

#dominance-a {
  background: linear-gradient(90deg, rgba(200,50,50,0.6), var(--accent-a));
  transition: width 0.5s ease-out;
  height: 100%;
  border-radius: 7px 0 0 7px;
  position: relative;
}
#dominance-a::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.18) 0%, transparent 60%);
  border-radius: inherit;
}

#dominance-b {
  background: linear-gradient(90deg, var(--accent-b), rgba(40,80,200,0.6));
  transition: width 0.5s ease-out;
  height: 100%;
  border-radius: 0 7px 7px 0;
  position: relative;
}
#dominance-b::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.14) 0%, transparent 60%);
  border-radius: inherit;
}

/* Clash point — glowing separator */
#dominance-clash {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 22px;
  background: linear-gradient(180deg, rgba(255,240,160,0.0) 0%, #fff9c0 30%, white 50%, #fff9c0 70%, rgba(255,240,160,0.0) 100%);
  border-radius: 2px;
  box-shadow: 0 0 8px 2px rgba(255,240,120,0.90), 0 0 20px 4px rgba(255,200,60,0.50);
  animation: clashPulse 1.4s ease-in-out infinite alternate;
  z-index: 2;
  pointer-events: none;
}
@keyframes clashPulse {
  from { opacity: 0.70; box-shadow: 0 0 6px 2px rgba(255,240,120,0.80), 0 0 16px 3px rgba(255,200,60,0.40); }
  to   { opacity: 1.00; box-shadow: 0 0 10px 3px rgba(255,255,180,1.00), 0 0 26px 6px rgba(255,220,80,0.65); }
}

#dominance-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}
.dom-inf {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}
.dom-inf-a { color: var(--accent-a); }
.dom-inf-b { color: var(--accent-b); }
.dom-pct {
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ── Dominance bar heat effects ──────────────────────────────────────────── */

#dominance-a.heat-1 {
  box-shadow: 0 0 8px 2px rgba(255,100,20,0.45);
}
#dominance-a.heat-2 {
  box-shadow: 0 0 12px 3px rgba(255,70,0,0.65);
  animation: fireGlowA 0.9s ease-in-out infinite alternate;
}
#dominance-a.heat-3 {
  box-shadow: 0 0 18px 5px rgba(255,40,0,0.85);
  animation: fireRageA 0.45s ease-in-out infinite alternate;
}
@keyframes fireGlowA {
  from { box-shadow: 0 0 10px 3px rgba(255,80,0,0.55), 0 0 22px 5px rgba(255,140,0,0.25); }
  to   { box-shadow: 0 0 16px 5px rgba(255,50,0,0.80), 0 0 32px 8px rgba(255,120,0,0.45); }
}
@keyframes fireRageA {
  from { box-shadow: 0 0 14px 4px rgba(255,30,0,0.75), 0 0 28px 8px rgba(255,100,0,0.50); filter: brightness(1.1); }
  to   { box-shadow: 0 0 22px 7px rgba(255,10,0,1.00), 0 0 44px 12px rgba(255,80,0,0.70); filter: brightness(1.3); }
}

#dominance-b.heat-1 {
  box-shadow: 0 0 8px 2px rgba(30,140,255,0.45);
}
#dominance-b.heat-2 {
  box-shadow: 0 0 12px 3px rgba(0,180,255,0.65);
  animation: waveGlowB 1.1s ease-in-out infinite alternate;
}
#dominance-b.heat-3 {
  box-shadow: 0 0 18px 5px rgba(0,200,255,0.85);
  animation: waveRageB 0.55s ease-in-out infinite alternate;
}
@keyframes waveGlowB {
  from { box-shadow: 0 0 10px 3px rgba(0,160,255,0.55), 0 0 22px 5px rgba(80,200,255,0.25); }
  to   { box-shadow: 0 0 16px 5px rgba(0,200,255,0.80), 0 0 32px 8px rgba(60,220,255,0.45); }
}
@keyframes waveRageB {
  from { box-shadow: 0 0 14px 4px rgba(0,180,255,0.75), 0 0 28px 8px rgba(80,220,255,0.50); filter: brightness(1.1); }
  to   { box-shadow: 0 0 22px 7px rgba(0,220,255,1.00), 0 0 44px 12px rgba(60,240,255,0.70); filter: brightness(1.3); }
}

/* ── Turn indicator — now inside #hud-center ─────────────────────────────── */

#turn-indicator {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0;
  letter-spacing: 0.04em;
}
#turn-player { color: #d0d8ff; font-weight: 700; }

#contested-info {
  font-size: 0.65rem;
  color: #ffd700;
  text-align: center;
  letter-spacing: 0.04em;
  opacity: 0.85;
  min-height: 1em;
}

#map-notification {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  pointer-events: none;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
}
#map-notification.notif-active {
  animation: notifPop 1.4s ease-out forwards;
}
#map-notification.notif-active.notif-fire {
  animation: notifPop 1.4s ease-out forwards, notifFire 0.12s ease-in-out infinite;
}
#map-notification.notif-active.notif-water {
  animation: notifPop 1.4s ease-out forwards, notifWater 0.55s ease-in-out infinite;
}
#map-notification.notif-active.notif-storm {
  animation: notifPop 1.4s ease-out forwards, notifStorm 0.09s steps(1) infinite;
}
#map-notification.notif-active.notif-steam {
  animation: notifPop 1.4s ease-out forwards, notifSteam 0.7s ease-in-out infinite;
}
#map-notification.notif-active.notif-earth {
  animation: notifPop 1.4s ease-out forwards, notifEarth 0.9s ease-in-out infinite;
}
@keyframes notifPop {
  0%   { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(0.85); }
  18%  { opacity: 1; transform: translateX(-50%) translateY(0)    scale(1.06); }
  32%  { opacity: 1; transform: translateX(-50%) translateY(0)    scale(1.00); }
  72%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-4px); }
}
@keyframes notifFire {
  0%   { text-shadow: 0 0 8px #ff6600, 0 0 22px #ff3300, 0 0 40px #ff1100; }
  25%  { text-shadow: 0 0 14px #ffaa00, 0 0 30px #ff6600, 0 0 55px #ff2200; }
  50%  { text-shadow: 0 0 6px  #ff4400, 0 0 18px #ff2200, 0 0 35px #ff0000; }
  75%  { text-shadow: 0 0 16px #ffcc00, 0 0 34px #ff7700, 0 0 60px #ff3300; }
  100% { text-shadow: 0 0 8px  #ff6600, 0 0 22px #ff3300, 0 0 40px #ff1100; }
}
@keyframes notifWater {
  0%   { text-shadow: 0 0 10px #00ccff, 0 0 25px #0088ff, 0 0 45px #0044cc; }
  50%  { text-shadow: 0 0 16px #44eeff, 0 0 35px #00aaff, 0 0 60px #0066dd; }
  100% { text-shadow: 0 0 10px #00ccff, 0 0 25px #0088ff, 0 0 45px #0044cc; }
}
@keyframes notifStorm {
  0%   { text-shadow: 0 0 10px #cc44ff, 0 0 28px #9900ff, 0 0 50px #6600cc; }
  33%  { text-shadow: 0 0 18px #ee88ff, 0 0 40px #cc00ff, 0 0 70px #9900ff; filter: brightness(1.4); }
  66%  { text-shadow: 0 0 4px  #aa22dd, 0 0 14px #7700cc, 0 0 30px #440099; filter: brightness(0.8); }
  100% { text-shadow: 0 0 10px #cc44ff, 0 0 28px #9900ff, 0 0 50px #6600cc; }
}
@keyframes notifSteam {
  0%   { text-shadow: 0 0 10px #aaddff, 0 0 24px #88bbee, 0 0 40px #6699cc; }
  50%  { text-shadow: 0 0 18px #ddeeff, 0 0 38px #aaccff, 0 0 60px #88aadd; }
  100% { text-shadow: 0 0 10px #aaddff, 0 0 24px #88bbee, 0 0 40px #6699cc; }
}
@keyframes notifEarth {
  0%   { text-shadow: 0 0 10px #44ff44, 0 0 24px #22cc22, 0 0 40px #119911; }
  50%  { text-shadow: 0 0 16px #88ff44, 0 0 34px #44dd22, 0 0 58px #22aa11; }
  100% { text-shadow: 0 0 10px #44ff44, 0 0 24px #22cc22, 0 0 40px #119911; }
}

/* ── Spy overlay ──────────────────────────────────────────────────────────── */

#spy-overlay {
  position: absolute;
  top: 80px;
  right: 10px;
  background: rgba(16, 12, 34, 0.92);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(255,180,0,0.45);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  z-index: 50;
  font-size: 0.85rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.6);
}
#spy-overlay h3 { margin-bottom: 0.5rem; color: var(--gold); }
.spy-card {
  display: inline-block;
  background: rgba(20,18,45,0.85);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  margin: 0.2rem;
  border: 1px solid var(--border);
}

/* ── Game area — floating arena ───────────────────────────────────────────── */

#game-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* ── Synergy panel ───────────────────────────────────────────────────────── */

#synergy-panel {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 172px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: none;
}

.syn-title {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.30);
  text-transform: uppercase;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 2px;
}

.syn-item {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 8px;
  row-gap: 0px;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.02);
  transition: background 0.3s, border-color 0.3s, opacity 0.3s;
  opacity: 0.38;
}

.syn-item.active {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.14);
  opacity: 1;
  box-shadow: 0 0 10px rgba(255,255,255,0.04);
}

.syn-item.warn { border-color: rgba(255,130,0,0.18); }
.syn-item.warn.active { border-color: rgba(255,130,0,0.35); }

.syn-icons {
  grid-row: 1 / 4;
  font-size: 1.15rem;
  line-height: 1;
  display: flex;
  align-items: center;
}
.syn-name {
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255,255,255,0.80);
  white-space: nowrap;
  align-self: end;
}
.syn-recipe {
  font-size: 0.78rem;
  line-height: 1.1;
  letter-spacing: 0.02em;
  align-self: center;
}
.syn-effect {
  font-size: 0.58rem;
  color: rgba(255,255,255,0.38);
  align-self: start;
}
.syn-item.active .syn-effect { color: rgba(255,255,255,0.58); }
.syn-item.warn .syn-effect { color: rgba(255,160,60,0.65); }

/* Mist beneath the floating grid */
#game-area::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  height: 60%;
  background: radial-gradient(ellipse at 50% 100%, rgba(30,10,70,0.35) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

#canvas-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  /* Floating shadow beneath the grid */
  filter: drop-shadow(0 28px 55px rgba(60,30,120,0.45))
          drop-shadow(0 6px 18px rgba(0,0,0,0.70));
}

#game-canvas, #overlay-canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
#overlay-canvas { z-index: 10; cursor: pointer; }

/* ── Bottom bar ────────────────────────────────────────────────────────────── */

#bottom-bar {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 0.5rem 1rem 0.7rem;
  background: rgba(5, 5, 12, 0.94);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}

#hand-container { flex: 1; overflow: visible; }
#player-hand {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  align-items: flex-end;
}

/* ── Cards — Cyber-Glass style ────────────────────────────────────────────── */

.card {
  background: rgba(14, 14, 32, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  padding: 0.55rem 0.65rem 0.6rem;
  cursor: pointer;
  transition: transform 0.20s ease-out, box-shadow 0.20s ease-out, border-color 0.18s ease-out, background 0.18s;
  text-align: center;
  min-width: 88px;
  max-width: 115px;
  position: relative;
  user-select: none;
}

/* Per-element border tint */
.card.element-fire    { border-color: rgba(255, 78,  0,  0.32); }
.card.element-water   { border-color: rgba(0,  242, 255, 0.32); }
.card.element-earth   { border-color: rgba(57, 255,  20, 0.32); }
.card.element-storm   { border-color: rgba(188, 19, 254, 0.32); }
.card.element-ice     { border-color: rgba(135,206, 235, 0.32); }
.card.element-volcano { border-color: rgba(255, 78,  0,  0.32); }
.card.element-tornado { border-color: rgba(160,224,255, 0.32); }

/* Hover: lift + scale + neon glow */
.card:hover { transform: translateY(-8px) scale(1.06); }
.card.element-fire:hover    { border-color: #ff4e00; box-shadow: 0 8px 28px rgba(255, 78,  0,  0.50), 0 0 0 1px rgba(255,78,0,0.35) inset; }
.card.element-water:hover   { border-color: #00f2ff; box-shadow: 0 8px 28px rgba(0,  242, 255, 0.50), 0 0 0 1px rgba(0,242,255,0.30) inset; }
.card.element-earth:hover   { border-color: #39ff14; box-shadow: 0 8px 28px rgba(57, 255,  20, 0.50), 0 0 0 1px rgba(57,255,20,0.30) inset; }
.card.element-storm:hover   { border-color: #bc13fe; box-shadow: 0 8px 28px rgba(188, 19, 254, 0.50), 0 0 0 1px rgba(188,19,254,0.30) inset; }
.card.element-ice:hover     { border-color: #87ceeb; box-shadow: 0 8px 28px rgba(135,206, 235, 0.50); }
.card.element-volcano:hover { border-color: #ff4e00; box-shadow: 0 8px 28px rgba(255, 78,  0,  0.50); }
.card.element-tornado:hover { border-color: #a0e0ff; box-shadow: 0 8px 28px rgba(160,224,255, 0.50); }

/* Selected — bigger lift + strong glow */
.card.selected {
  border-color: var(--gold);
  background: rgba(20, 20, 44, 0.96);
  transform: translateY(-18px) scale(1.12);
  box-shadow: 0 0 0 1.5px var(--gold), 0 14px 40px rgba(200,168,64,0.40), 0 0 30px rgba(200,168,64,0.20) inset;
  z-index: 5;
}
.card.selected.element-fire    { box-shadow: 0 0 0 1.5px #ff6020, 0 14px 40px rgba(255,78,0,0.65),  0 0 24px rgba(255,78,0,0.18) inset; }
.card.selected.element-water   { box-shadow: 0 0 0 1.5px #00f2ff, 0 14px 40px rgba(0,242,255,0.65), 0 0 24px rgba(0,242,255,0.15) inset; }
.card.selected.element-earth   { box-shadow: 0 0 0 1.5px #39ff14, 0 14px 40px rgba(57,255,20,0.65), 0 0 24px rgba(57,255,20,0.15) inset; }
.card.selected.element-storm   { box-shadow: 0 0 0 1.5px #bc13fe, 0 14px 40px rgba(188,19,254,0.65),0 0 24px rgba(188,19,254,0.15) inset; }

.card-cost { position: absolute; top: 4px; right: 6px; font-size: 0.7rem; color: var(--gold); font-weight: 700; }

.card-icon { display: block; margin: 0 auto 0.1rem; transition: filter 0.2s; }
.card.element-fire:hover    .card-icon { filter: drop-shadow(0 0 8px #ff4e00); }
.card.element-water:hover   .card-icon { filter: drop-shadow(0 0 8px #00f2ff); }
.card.element-earth:hover   .card-icon { filter: drop-shadow(0 0 8px #39ff14); }
.card.element-storm:hover   .card-icon { filter: drop-shadow(0 0 8px #bc13fe); }
.card.selected.element-fire  .card-icon { filter: drop-shadow(0 0 14px #ff4e00); }
.card.selected.element-water .card-icon { filter: drop-shadow(0 0 14px #00f2ff); }
.card.selected.element-earth .card-icon { filter: drop-shadow(0 0 14px #39ff14); }
.card.selected.element-storm .card-icon { filter: drop-shadow(0 0 14px #bc13fe); }

.card-emoji { font-size: 1.6rem; display: block; margin-bottom: 0.1rem; }
.card-name  { font-size: 0.72rem; font-weight: 600; margin-bottom: 0.1rem; }
.card-desc  { font-size: 0.62rem; color: var(--text-muted); line-height: 1.2; }

.bot-thinking { color: var(--text-muted); font-style: italic; padding: 1rem; }
#action-buttons { display: flex; flex-direction: column; gap: 0.4rem; }
/* ── Deck pile ───────────────────────────────────────────────────────────── */

#deck-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 64px;
}

#deck-pile {
  position: relative;
  width: 52px;
  height: 72px;
  cursor: default;
  user-select: none;
}

.deck-back {
  position: absolute;
  width: 48px;
  height: 68px;
  background: linear-gradient(135deg, #1a1040 0%, #0d0d2a 100%);
  border: 1.5px solid #3a3060;
  border-radius: 6px;
  top: 0; left: 0;
}
.deck-back:nth-child(1) { transform: translate(4px, 4px); border-color: #2a2050; }
.deck-back:nth-child(2) { transform: translate(2px, 2px); border-color: #302860; }
.deck-back:nth-child(3) { transform: translate(0px, 0px); border-color: #3a3070;
  background: linear-gradient(135deg, #201550 0%, #0f0d30 100%); }

#deck-count {
  position: absolute;
  bottom: 6px;
  left: 0; right: 0;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 800;
  color: #aaa;
  z-index: 2;
  pointer-events: none;
}

#deck-label {
  font-size: 0.65rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#deck-pile.deck-empty .deck-back {
  opacity: 0.2;
  border-style: dashed;
}
#deck-pile.deck-empty #deck-count {
  color: #555;
}

#deck-pile.drawable {
  cursor: pointer;
  animation: deckPulse 0.9s ease-in-out infinite;
}
#deck-pile.drawable .deck-back:nth-child(3) {
  border-color: #ffd700;
  box-shadow: 0 0 12px #ffd700aa, 0 0 28px #ff990055;
}
#deck-pile.drawable #deck-count {
  color: #ffd700;
}

@keyframes deckPulse {
  0%, 100% { transform: translateY(0);   }
  50%       { transform: translateY(-4px); }
}

/* ── Card deal animation ─────────────────────────────────────────────────── */

@keyframes cardDeal {
  0%   {
    opacity: 0.7;
    transform: translateY(90px) translateX(40px) scale(0.45) rotateY(-80deg) rotateZ(8deg);
    filter: brightness(0.15) saturate(0);
  }
  28% {
    opacity: 1;
    transform: translateY(30px) translateX(15px) scale(0.75) rotateY(-30deg) rotateZ(3deg);
    filter: brightness(0.6) saturate(0.4);
  }
  60% {
    transform: translateY(-12px) translateX(0) scale(1.10) rotateY(6deg) rotateZ(-1deg);
    filter: brightness(1.5) saturate(1.8);
    box-shadow: 0 0 0 2px var(--el-color, #fff4), 0 0 28px var(--el-color, #fff3), 0 8px 24px #0008;
  }
  80% {
    transform: translateY(4px) scale(0.97) rotateY(-2deg);
    filter: brightness(1.05) saturate(1.1);
    box-shadow: 0 0 10px var(--el-color, #fff2);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotateY(0deg) rotateZ(0deg);
    filter: brightness(1) saturate(1);
    box-shadow: none;
  }
}

.card.dealing {
  animation: cardDeal 0.52s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  transform-origin: center bottom;
}

/* draw-phase placeholder in hand */
#draw-phase-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #ffd70099;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 12px 20px;
  animation: hintPulse 1s ease-in-out infinite;
}
@keyframes hintPulse {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1.0; }
}

/* ── Stone tooltip ───────────────────────────────────────────────────────── */

#stone-tooltip {
  position: fixed;
  z-index: 100;
  min-width: 170px;
  max-width: 230px;
  background: rgba(10, 8, 28, 0.96);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 9px 13px 10px;
  pointer-events: none;
  box-shadow: 0 4px 24px #000a, 0 0 0 1px rgba(255,255,255,0.05);
  backdrop-filter: blur(6px);
  animation: tooltipFade 0.12s ease-out;
}
#stone-tooltip.hidden { display: none; }

@keyframes tooltipFade {
  from { opacity: 0; transform: translateY(4px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

.stt-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.stt-player { font-size: 0.75rem; }
.stt-emoji  { font-size: 1.3rem; line-height: 1; }
.stt-name   { font-size: 0.9rem; font-weight: 700; color: #eee; }

.stt-stats {
  display: flex;
  gap: 10px;
  margin-bottom: 5px;
}
.stt-stats span {
  font-size: 0.72rem;
  color: #aaa;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  padding: 2px 6px;
}

.stt-state {
  font-size: 0.72rem;
  font-weight: 600;
  color: #ffd700;
  margin-bottom: 5px;
  min-height: 0;
}
.stt-state:empty { margin-bottom: 0; }

.stt-desc {
  font-size: 0.67rem;
  color: #888;
  line-height: 1.35;
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 5px;
  margin-top: 3px;
}
.stt-desc:empty { display: none; }

.stt-inf {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.stt-inf:empty { display: none; }
.stt-inf-margin {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.02em;
}
.stt-inf-margin.color-a   { color: #ff5555; }
.stt-inf-margin.color-b   { color: #5599ff; }
.stt-inf-margin.color-neu { color: #888; }
.stt-inf-before {
  font-size: 0.65rem;
  color: #666;
  margin-bottom: 1px;
}
.stt-inf-arrow {
  font-size: 0.7rem;
  color: #555;
}
.stt-inf-after-margin {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
}
.stt-inf-after-margin.color-a   { color: #ff5555; }
.stt-inf-after-margin.color-b   { color: #5599ff; }
.stt-inf-after-margin.color-neu { color: #888; }

/* ─── End Screen ──────────────────────────────────────────────────────────── */

#end-screen {
  background: radial-gradient(ellipse at 50% 40%, #1a0a30 0%, var(--bg-deep) 70%);
  align-items: center;
  justify-content: center;
}
.end-content { text-align: center; }
#winner-text {
  font-size: 2.5rem; font-weight: 900; margin: 1rem 0;
  background: linear-gradient(135deg, var(--accent-a), var(--gold), var(--accent-b));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
#final-score {
  font-size: 2rem; margin: 0.5rem 0 2rem;
  display: flex; gap: 1.5rem; justify-content: center; align-items: center;
}
.score-a { color: var(--accent-a); font-weight: 700; }
.score-b { color: var(--accent-b); font-weight: 700; }
.end-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

#game-stats { margin: 1rem auto 1.5rem; max-width: 420px; width: 100%; }
.stats-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 1.2rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 0.9rem 1.2rem;
  text-align: left;
}
.stat-label {
  color: var(--text-muted);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
}
.stat-val {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}
.stats-synergies {
  margin-top: 0.75rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 0.75rem 1.2rem;
  text-align: left;
}
.stats-syn-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.25rem 0;
}
.stats-syn-row + .stats-syn-row {
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 0.25rem;
  padding-top: 0.5rem;
}
.stats-syn-label {
  color: var(--text-muted);
  font-size: 0.82rem;
  white-space: nowrap;
  min-width: 7rem;
}
.stats-syn-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.syn-badge {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
  font-size: 0.78rem;
  color: var(--text);
  white-space: nowrap;
}
#victory-animation { font-size: 4rem; margin-bottom: 1rem; animation: victoryBounce 0.6s ease infinite alternate; }
@keyframes victoryBounce { from { transform: scale(1); } to { transform: scale(1.15); } }

/* ─── End game overlay ─────────────────────────────────────────────────────── */
#end-game-overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 200;
}
#end-game-overlay.active {
  opacity: 1;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  pointer-events: all;
}
.end-game-card {
  text-align: center;
  transform: translateY(18px) scale(0.92);
  transition: transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 2.5rem 3.5rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
}
#end-game-overlay.active .end-game-card { transform: translateY(0) scale(1); }
#end-game-icon   { font-size: 3.5rem; margin-bottom: 0.5rem; }
#end-game-text   { font-size: 1.65rem; font-weight: 700; color: #fff; }
#end-game-sub    { font-size: 0.95rem; color: rgba(255,255,255,0.5); margin-top: 0.3rem; }
#end-game-scores { margin-top: 1.1rem; font-size: 1.1rem; }

/* ─── Synergy newly-active glow ─────────────────────────────────────────────── */
@keyframes syn-new-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 220, 60, 0); }
  18%  { box-shadow: 0 0 18px 5px rgba(255, 220, 60, 0.7); background: rgba(255,220,60,0.13); }
  100% { box-shadow: none; }
}
.syn-item.syn-newly-active { animation: syn-new-pulse 2s ease-out; }

/* ─── Replay Screen ───────────────────────────────────────────────────────── */

#replay-screen { background: var(--bg-deep); align-items: center; justify-content: center; }
.replay-content { text-align: center; width: 100%; max-width: 720px; padding: 1rem; }
.replay-content h2 { color: var(--gold); margin-bottom: 1rem; }
#replay-canvas-container { margin-bottom: 1rem; }
#replay-canvas { background: rgba(10,10,22,0.80); border-radius: var(--radius); }
#replay-controls { display: flex; align-items: center; gap: 1rem; justify-content: center; margin-bottom: 1rem; }
#replay-progress { color: var(--text-muted); font-size: 0.85rem; }

/* ─── Modals ──────────────────────────────────────────────────────────────── */

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

.modal-content {
  background: rgba(12, 12, 28, 0.95);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-hi);
  border-radius: 14px;
  padding: 2rem;
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.7);
}
.modal-content h3 { color: var(--gold); margin-bottom: 1rem; }

#vision-choices { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.vision-choice {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  cursor: pointer;
  transition: all 0.18s ease-out;
  text-align: center;
  color: var(--text);
  min-width: 90px;
}
.vision-choice.element-fire  { border-color: rgba(255, 78,  0,  0.30); }
.vision-choice.element-water { border-color: rgba(0,  242, 255, 0.30); }
.vision-choice.element-earth { border-color: rgba(57, 255,  20, 0.30); }
.vision-choice.element-storm { border-color: rgba(188, 19, 254, 0.30); }
.vision-choice:hover { transform: translateY(-5px) scale(1.05); }
.vision-choice.element-fire:hover  { border-color: #ff4e00; box-shadow: 0 6px 20px rgba(255, 78,  0,  0.55); }
.vision-choice.element-water:hover { border-color: #00f2ff; box-shadow: 0 6px 20px rgba(0,  242, 255, 0.55); }
.vision-choice.element-earth:hover { border-color: #39ff14; box-shadow: 0 6px 20px rgba(57, 255,  20, 0.55); }
.vision-choice.element-storm:hover { border-color: #bc13fe; box-shadow: 0 6px 20px rgba(188, 19, 254, 0.55); }
.vision-choice .card-icon  { display: block; margin: 0 auto 0.4rem; }
.vision-choice .card-emoji { font-size: 2rem; display: block; margin-bottom: 0.4rem; }
.vision-choice .card-name  { font-size: 0.85rem; font-weight: 600; }

.modal-content.rules { max-width: 560px; }
.rules-content { margin-bottom: 1rem; }
.rules-content h3 { color: var(--accent-a); margin: 1rem 0 0.5rem; font-size: 1rem; }
.rules-content p, .rules-content li { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; }
.rules-content ul { padding-left: 1.2rem; margin-bottom: 0.5rem; }
.rules-content .element-row { display: flex; align-items: baseline; gap: 0.5rem; margin: 0.3rem 0; }
.rules-content .element-row span { font-size: 0.82rem; color: var(--text-muted); }

/* ─── Utilities ───────────────────────────────────────────────────────────── */

.hidden { display: none !important; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }

/* ══════════════════════════════════════════════════════════════════
   DRAFT SCREEN
══════════════════════════════════════════════════════════════════ */

.draft-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1rem 1.5rem;
  gap: 0.75rem;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.draft-header { text-align: center; }

.draft-title {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  color: var(--gold);
  letter-spacing: 0.05em;
}

.draft-turn-info {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-bright);
}

.draft-progress {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.draft-main {
  display: grid;
  grid-template-columns: 160px 1fr 160px;
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

/* Player panels */
.draft-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(255,255,255,0.03);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 0.75rem 0.5rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.draft-panel-a.draft-active {
  border-color: rgba(255,80,80,0.7);
  box-shadow: 0 0 20px rgba(255,80,80,0.15);
}

.draft-panel-b.draft-active {
  border-color: rgba(50,150,255,0.7);
  box-shadow: 0 0 20px rgba(50,150,255,0.15);
}

.draft-panel-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-align: center;
  text-transform: uppercase;
}

.draft-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.draft-picked {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1.5px solid var(--el-color, rgba(255,255,255,0.2));
  background: color-mix(in srgb, var(--el-color, #444) 15%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: transform 0.2s;
}

.draft-slot-empty {
  border-style: dashed;
  border-color: rgba(255,255,255,0.1);
  background: transparent;
}

/* Offer area */
.draft-offer-area {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow: hidden;
}

.draft-offer-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-align: center;
  text-transform: uppercase;
}

.draft-offer {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  align-items: center;
  flex: 1;
  padding: 0.5rem 0;
}

.draft-offer-card {
  width: 130px;
  padding: 1.25rem 0.75rem 1rem;
  border-radius: 14px;
  border: 2px solid var(--el-color, rgba(255,255,255,0.2));
  background: color-mix(in srgb, var(--el-color, #444) 12%, rgba(10,10,20,0.85));
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.18s, box-shadow 0.18s;
  user-select: none;
}

.draft-offer-card:hover {
  transform: translateY(-8px) scale(1.05);
  box-shadow: 0 16px 40px rgba(0,0,0,0.6), 0 0 24px color-mix(in srgb, var(--el-color, #fff) 50%, transparent);
}

.draft-offer-emoji {
  font-size: 3rem;
  filter: drop-shadow(0 0 8px var(--el-color, #fff));
}

.draft-offer-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-bright, var(--text));
}

.draft-offer-desc {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-align: center;
  min-height: 2.8em;
  line-height: 1.4;
}

.draft-offer-category {
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--el-color);
  border: 1px solid var(--el-color);
  border-radius: 10px;
  padding: 1px 7px;
  opacity: 0.85;
}

.draft-offer-btn {
  margin-top: 0.5rem;
  padding: 0.35rem 1rem;
  border-radius: 20px;
  background: color-mix(in srgb, var(--el-color, #fff) 30%, transparent);
  border: 1px solid var(--el-color, rgba(255,255,255,0.3));
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-bright, var(--text));
  pointer-events: none;
}

.draft-card-disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.card-category {
  font-size: 0.50rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--el-color, var(--text-muted));
  border: 1px solid var(--el-color, rgba(255,255,255,0.2));
  border-radius: 8px;
  padding: 1px 6px;
  opacity: 0.80;
  margin: 1px 0;
}

/* Game type toggle */
.game-type-row {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.type-btn {
  padding: 0.30rem 1rem;
  border-radius: 20px;
  border: 1.5px solid var(--border-hi);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
}

.type-btn:hover { color: var(--text); border-color: rgba(255,255,255,0.3); }

.type-btn.active {
  background: rgba(200,168,64,0.15);
  border-color: var(--gold);
  color: var(--gold);
}

/* Deck select screen */
#deck-select-screen {
  background: radial-gradient(ellipse at 50% 30%, #1a0a2e 0%, var(--bg-deep) 70%);
  align-items: center;
  justify-content: center;
}

.deck-select-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 820px;
  padding: 1.5rem 1rem;
  height: 100%;
  overflow-y: auto;
}

.deck-select-header { text-align: center; }

.deck-select-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  flex: 1;
}

.deck-select-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  text-align: center;
}

.deck-select-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--gold);
  box-shadow: 0 12px 36px rgba(0,0,0,0.5), 0 0 20px rgba(200,168,64,0.20);
}

.deck-select-icon { font-size: 2.8rem; line-height: 1; }

.deck-select-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.04em;
}

.deck-select-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 260px;
}

.deck-select-stones {
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

.deck-select-btn {
  margin-top: 0.4rem;
  padding: 0.35rem 1.2rem;
  border-radius: 20px;
  background: rgba(200,168,64,0.15);
  border: 1px solid var(--gold);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold);
}

.draft-footer {
  display: flex;
  gap: 1rem;
  justify-content: center;
  padding-bottom: 0.5rem;
}


/* ─── Draft offer cards: 3D hover + slide-in ────────────────────────────── */

@keyframes draftCardIn {
  from { opacity: 0; transform: translateY(-14px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.draft-offer-card {
  animation: draftCardIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  transform-style: preserve-3d;
  transform-origin: center bottom;
  will-change: transform, opacity;
}

.draft-offer-card:hover {
  transform: perspective(500px) rotateY(-9deg) rotateX(5deg) scale(1.06) translateY(-6px);
  box-shadow:
    0 18px 44px rgba(0,0,0,0.65),
    0 0 28px color-mix(in srgb, var(--el-color, #fff) 55%, transparent),
    4px 0 20px rgba(0,0,0,0.3);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease;
}

/* When a card is fading out (sibling of the picked one) */
.draft-offer-card.draft-fading {
  opacity: 0;
  transform: scale(0.88) translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

/* Deck-select cards also get 3D hover */
.deck-select-card {
  transform-style: preserve-3d;
  will-change: transform;
}

.deck-select-card:hover {
  transform: perspective(500px) rotateY(-7deg) rotateX(4deg) scale(1.04) translateY(-4px);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet & Mobile
   Breakpoints: ≤900px tablet · ≤600px phone · ≤400px small phone
══════════════════════════════════════════════════════════════════ */

/* ─── Tablet (≤ 900px) ─── */
@media (max-width: 900px) {
  /* Top bar — tighter */
  .player-panel { min-width: 140px; padding: 0.25rem 0.5rem; gap: 0.4rem; }
  .timer-main { font-size: 1.15rem; }

  /* Game cards — slightly smaller */
  .card { min-width: 78px; max-width: 106px; }
  .card-icon { width: 48px !important; height: 48px !important; }

  /* Synergy panel — narrower */
  #synergy-panel { width: 144px; font-size: 0.9em; }

  /* Menu — stack map cards */
  .map-options, .deck-options { gap: 0.5rem; }
  .map-card, .deck-card { min-width: 110px; }

  /* Draft — narrower side panels */
  .draft-main { grid-template-columns: 130px 1fr 130px; }
}

/* ─── Phone (≤ 600px) ─── */
@media (max-width: 600px) {
  /* ── Top bar: compact single row ── */
  #top-bar { padding: 0.3rem 0.4rem; gap: 0.3rem; }
  .player-panel {
    min-width: 0;
    padding: 0.2rem 0.4rem;
    gap: 0.25rem;
    background: transparent;
    border-color: transparent;
  }
  .player-label { font-size: 0.70rem; letter-spacing: 0.08em; }
  .timer-main { font-size: 1.05rem; min-width: 34px; }
  .bank-sm { display: none; } /* hide bank on phones */
  #hud-center { gap: 0.1rem; }
  #dominance-bar { height: 11px; border-radius: 6px; }
  .dom-inf { font-size: 1.1rem; }
  #turn-indicator { font-size: 0.64rem; }
  .player-name-b { font-size: 0.70rem; letter-spacing: 0.08em; }

  /* ── Synergy panel: hide on phones (overlaps map) ── */
  #synergy-panel { display: none; }

  /* ── Bottom bar: compact ── */
  #bottom-bar { padding: 0.3rem 0.5rem 0.4rem; gap: 0.4rem; }
  #player-hand { gap: 0.4rem; }
  .card {
    min-width: 60px;
    max-width: 80px;
    padding: 0.3rem 0.35rem 0.35rem;
    border-radius: 9px;
  }
  .card-icon  { width: 40px !important; height: 40px !important; }
  .card-emoji { font-size: 1.25rem; }
  .card-name  { font-size: 0.63rem; margin-bottom: 0.05rem; }
  .card-desc  { display: none; }
  .card-cost  { font-size: 0.62rem; top: 3px; right: 4px; }
  .card:hover { transform: translateY(-6px) scale(1.05); }
  .card.selected { transform: translateY(-14px) scale(1.10); }

  /* Deck pile — smaller */
  #deck-info { min-width: 44px; gap: 2px; }
  #deck-pile  { width: 42px; height: 58px; }
  .deck-back  { width: 38px; height: 54px; }
  #deck-count { font-size: 0.8rem; bottom: 4px; }
  #deck-label { font-size: 0.58rem; }

  /* Action buttons — compact */
  #action-buttons { gap: 0.3rem; }
  #action-buttons .btn { font-size: 0.78rem; padding: 0.45rem 0.7rem; }

  /* ── Menu ── */
  .game-title { font-size: 2.4rem; letter-spacing: 0.10em; }
  .game-subtitle { font-size: 0.85rem; margin-bottom: 1.5rem; }
  .menu-content { padding: 1rem 0.75rem; }
  .menu-buttons { gap: 0.75rem; margin-bottom: 1.5rem; }
  .mode-options { gap: 0.5rem; }
  .mode-btn { min-width: 96px; padding: 0.7rem 0.8rem; }
  .mode-btn .mode-icon { font-size: 1.6rem; margin-bottom: 0.3rem; }
  .map-options, .deck-options { gap: 0.4rem; }
  .map-card, .deck-card { min-width: 88px; padding: 0.5rem 0.6rem; }
  .map-card .map-icon { font-size: 1.3rem; }
  .map-card .map-name { font-size: 0.82rem; }

  /* ── Map notification ── */
  #map-notification { font-size: 1.1rem; top: 10px; }

  /* ── Draft: switch to vertical layout ── */
  .draft-layout { padding: 0.75rem; gap: 0.5rem; }
  .draft-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }
  .draft-panel { flex-direction: row; flex-wrap: wrap; padding: 0.5rem; gap: 0.3rem; }
  .draft-picks { gap: 3px; }
  .draft-picked { width: 28px; height: 28px; font-size: 0.85rem; }
  .draft-offer-area { order: -1; } /* offers first on phone */
  .draft-title { font-size: 1.2rem; }

  /* ── Stone tooltip ── */
  #stone-tooltip { font-size: 0.78rem; max-width: 180px; }

  /* ── End screen ── */
  .end-title { font-size: 2rem !important; }
  .score-bar-wrap { font-size: 0.85rem !important; }
}

/* ─── Small phone (≤ 400px) ─── */
@media (max-width: 400px) {
  #top-bar { padding: 0.2rem 0.3rem; gap: 0.2rem; }
  .player-label { font-size: 0.62rem; letter-spacing: 0.04em; }
  .timer-main { font-size: 0.95rem; min-width: 28px; }

  .card { min-width: 52px; max-width: 68px; padding: 0.22rem 0.25rem; }
  .card-icon  { width: 34px !important; height: 34px !important; }
  .card-emoji { font-size: 1.1rem; }
  .card-name  { font-size: 0.58rem; }

  #action-buttons .btn { font-size: 0.72rem; padding: 0.38rem 0.55rem; }

  .game-title { font-size: 2rem; }
  .mode-btn { min-width: 84px; }

  /* Narrower draft side panels */
  .draft-picked { width: 24px; height: 24px; font-size: 0.75rem; }
}

/* ─── Landscape phones: maximise game area ─── */
@media (max-height: 500px) and (orientation: landscape) {
  #top-bar { padding: 0.15rem 0.5rem; }
  .timer-main { font-size: 0.95rem; }
  .player-panel { padding: 0.1rem 0.35rem; }
  #bottom-bar { padding: 0.2rem 0.5rem 0.25rem; }
  .card { min-width: 54px; max-width: 74px; padding: 0.2rem 0.25rem; }
  .card-icon  { width: 36px !important; height: 36px !important; }
  .card-desc  { display: none; }
  .bank-sm    { display: none; }
  #synergy-panel { display: none; }
  #deck-info  { display: none; } /* more space for cards */
}

/* ─── Ensure canvas fills its container on all sizes ─── */
#canvas-container { touch-action: none; }
#game-canvas, #overlay-canvas { touch-action: none; }

/* ─── Prevent horizontal overflow ─── */
body, #app, .screen { max-width: 100vw; overflow-x: hidden; }
#bottom-bar { flex-wrap: nowrap; overflow-x: auto; }
#player-hand { flex-wrap: nowrap; }
