/* ==========================================================================
   RuneDeck — lobby styles
   Dark fantasy esports UI: glass panels, gold / cyan / crimson metal, rune glow.
   ========================================================================== */

:root {
  --bg-0: #05070f;
  --bg-1: #0b1022;

  --gold-1: #fff1b8;
  --gold-2: #e3b755;
  --gold-3: #8a6220;
  --cyan-1: #b8f6ff;
  --cyan-2: #2fd3f5;
  --cyan-3: #0b6fa8;
  --crimson-1: #ffa696;
  --crimson-2: #f0413a;
  --crimson-3: #8a1420;
  --elixir-1: #ffc6ff;
  --elixir-2: #c94bf0;
  --elixir-3: #6a1aa8;

  --text: #e9eefb;
  --text-dim: #97a3c2;

  --font-display: 'Cinzel', 'Trajan Pro', 'Palatino Linotype', Georgia, serif;
  --font-ui: 'Rajdhani', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;

  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.35;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] {
  display: none !important;
}

button,
input {
  font: inherit;
  color: inherit;
}

h1,
h2,
p,
ul {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
}

#backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------------------------------------------------------------- Glass */

.glass {
  position: relative;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(24, 33, 62, 0.72), rgba(8, 12, 26, 0.78));
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5);
}

/* Metallic hairline running Radiant cyan -> gold -> Dire crimson. */
.glass::before {
  content: '';
  position: absolute;
  inset: 0;
  padding: 1.5px;
  border-radius: inherit;
  background: linear-gradient(
    100deg,
    var(--cyan-2) 0%,
    rgba(47, 211, 245, 0.25) 22%,
    var(--gold-2) 50%,
    rgba(240, 65, 58, 0.25) 78%,
    var(--crimson-2) 100%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.elixir-drop {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 7px;
  border-radius: 1px 50% 50% 50%;
  transform: rotate(45deg);
  background: radial-gradient(circle at 35% 35%, var(--elixir-1), var(--elixir-2) 50%, var(--elixir-3));
  box-shadow: 0 0 8px rgba(201, 75, 240, 0.8);
}

/* ---------------------------------------------------------------- Layout */

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  min-height: 100dvh;
  padding: 16px clamp(12px, 2vw, 28px) 10px;
}

/* ---------------------------------------------------------------- Top bar */

.topbar {
  display: flex;
  align-items: stretch;
  padding: 12px 18px;
  animation: drop-in 0.6s var(--ease-out) both;
}

.topbar > * + * {
  margin-left: 16px;
  padding-left: 16px;
  border-left: 1px solid rgba(255, 255, 255, 0.09);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: none;
  filter: drop-shadow(0 0 10px rgba(227, 183, 85, 0.45));
}

.brand-text {
  display: grid;
  gap: 1px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2) 55%, var(--gold-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.slot {
  display: flex;
  align-items: center;
}

/* Nickname */

.slot-nickname {
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 7px;
  width: 200px;
  flex: none;
}

.nick-field {
  position: relative;
  display: flex;
  align-items: center;
}

.nick-field svg {
  position: absolute;
  left: 11px;
  width: 18px;
  height: 18px;
  color: var(--cyan-2);
  pointer-events: none;
  filter: drop-shadow(0 0 5px rgba(47, 211, 245, 0.7));
}

.nick-field input {
  width: 100%;
  height: 42px;
  padding: 0 12px 0 38px;
  border: 1px solid rgba(184, 246, 255, 0.28);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(3, 6, 14, 0.85), rgba(12, 18, 36, 0.85));
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.05em;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.nick-field input::placeholder {
  color: rgba(151, 163, 194, 0.6);
  font-weight: 500;
}

.nick-field input:hover {
  border-color: rgba(184, 246, 255, 0.5);
}

.nick-field input:focus-visible {
  border-color: var(--cyan-2);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7), 0 0 0 3px rgba(47, 211, 245, 0.18), 0 0 18px rgba(47, 211, 245, 0.35);
}

/* Hero */

.slot-hero {
  flex: none;
}

.hero-chip {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 4px 8px 4px 4px;
  border-radius: 12px;
  outline: none;
  cursor: help;
  transition: background 0.2s ease;
}

.hero-chip:hover,
.hero-chip:focus-visible {
  background: rgba(255, 255, 255, 0.05);
}

.hero-chip:focus-visible {
  box-shadow: 0 0 0 2px var(--cyan-2);
}

.hero-portrait {
  position: relative;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  flex: none;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 35%, #223a70, #0a1024 75%);
  border: 1.5px solid var(--gold-2);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 -14px 16px -10px rgba(0, 0, 0, 0.8),
    0 0 16px rgba(227, 183, 85, 0.3);
}

.hero-portrait svg {
  width: 58px;
  height: 58px;
}

.hero-text {
  display: grid;
  gap: 3px;
}

.hero-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.1;
  white-space: nowrap;
  color: #f4f7ff;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--cyan-1);
}

.keycaps {
  display: inline-flex;
  gap: 3px;
}

.keycaps kbd {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 1px solid rgba(227, 183, 85, 0.6);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #0b1022;
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
  color: var(--gold-1);
}

/* Deck */

.slot-deck {
  flex: 1;
  justify-content: flex-end;
  gap: 16px;
  min-width: 0;
}

/* The summary text gives way before the cards do. */
.deck-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.deck-count {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.1;
  color: #f4f7ff;
}

.deck-avg {
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--elixir-1);
}

.deck-avg > span {
  margin-right: 5px;
  font-weight: 700;
}

.deck {
  display: flex;
  flex: none;
  gap: 8px;
  padding: 8px 0 0 8px;
}

.deck-card {
  --frame: var(--gold-2);
  --frame-glow: rgba(227, 183, 85, 0.6);
  --tint: rgba(227, 183, 85, 0.2);

  position: relative;
  width: 64px;
  height: 84px;
  flex: none;
  border: 1.5px solid var(--frame);
  border-radius: 9px;
  background:
    radial-gradient(120% 70% at 50% 30%, var(--tint), transparent 70%),
    linear-gradient(180deg, #1d2950 0%, #0a0f22 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    inset 0 -20px 18px -12px rgba(0, 0, 0, 0.75),
    0 6px 14px rgba(0, 0, 0, 0.5);
  outline: none;
  cursor: help;
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s ease;
  animation: card-in 0.5s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 60ms + 150ms);
}

.deck-card.type-spell {
  --frame: var(--crimson-2);
  --frame-glow: rgba(240, 65, 58, 0.6);
  --tint: rgba(240, 65, 58, 0.2);
}

.deck-card.type-building {
  --frame: var(--cyan-2);
  --frame-glow: rgba(47, 211, 245, 0.6);
  --tint: rgba(47, 211, 245, 0.2);
}

.deck-card:hover,
.deck-card:focus-visible {
  z-index: 2;
  transform: translateY(-5px) scale(1.08);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 -20px 18px -12px rgba(0, 0, 0, 0.75),
    0 12px 22px rgba(0, 0, 0, 0.6),
    0 0 22px var(--frame-glow);
}

.card-art {
  position: absolute;
  top: 9px;
  left: 0;
  right: 0;
  display: grid;
  place-items: center;
  height: 46px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.65));
}

.card-art svg {
  width: 46px;
  height: 46px;
}

.card-name {
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 4px;
  display: grid;
  place-items: center;
  height: 22px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.05;
  text-align: center;
  text-transform: uppercase;
  color: #eef2ff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.card-cost {
  position: absolute;
  top: -9px;
  left: -9px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1.5px solid #f9dcff;
  border-radius: 2px 50% 50% 50%;
  transform: rotate(45deg);
  background: radial-gradient(circle at 35% 35%, var(--elixir-1), var(--elixir-2) 48%, var(--elixir-3));
  box-shadow: 0 0 10px rgba(201, 75, 240, 0.75), 0 2px 4px rgba(0, 0, 0, 0.6);
}

.card-cost span {
  transform: rotate(-45deg);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  text-shadow: 0 1px 2px rgba(60, 0, 90, 0.95);
}

/* ---------------------------------------------------------------- Stage */

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 0 10px;
  text-align: center;
}

.emblem-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 3vw, 48px);
  width: 100%;
}

.emblem-slot {
  width: clamp(170px, 36vh, 360px);
  aspect-ratio: 1;
  flex: none;
}

.faction {
  display: grid;
  gap: 4px;
  flex: 1;
  max-width: 320px;
  animation: fade-in 1.2s ease 0.3s both;
}

.faction.radiant {
  text-align: right;
}

.faction.dire {
  text-align: left;
}

.faction-name {
  font-family: var(--font-display);
  font-size: clamp(18px, 2vw, 28px);
  font-weight: 700;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

.faction-desc {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.faction.radiant .faction-name {
  color: var(--cyan-1);
  text-shadow: 0 0 22px rgba(47, 211, 245, 0.75);
}

.faction.dire .faction-name {
  color: var(--crimson-1);
  text-shadow: 0 0 22px rgba(240, 65, 58, 0.8);
}

.title {
  /* Trailing letter-spacing would push the word off-centre. */
  padding-left: 0.16em;
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 84px);
  font-weight: 900;
  letter-spacing: 0.16em;
  line-height: 1.05;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff8dc 0%, #f3d275 40%, #a8731b 58%, #f7dc8a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.7)) drop-shadow(0 0 28px rgba(240, 190, 90, 0.3));
  animation: rise-in 0.8s var(--ease-out) 0.1s both;
}

.tagline {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
  font-size: clamp(12px, 1.2vw, 15px);
  font-weight: 700;
  letter-spacing: 0.46em;
  text-transform: uppercase;
  color: #cdd6ee;
  animation: rise-in 0.8s var(--ease-out) 0.2s both;
}

.tagline span {
  padding-left: 0.46em;
}

.tagline::before,
.tagline::after {
  content: '';
  width: clamp(28px, 7vw, 96px);
  height: 1px;
}

.tagline::before {
  background: linear-gradient(90deg, transparent, var(--cyan-2));
}

.tagline::after {
  background: linear-gradient(90deg, var(--crimson-2), transparent);
}

.mode-line {
  max-width: 640px;
  margin-top: 16px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
  animation: fade-in 1s ease 0.5s both;
}

/* ---------------------------------------------------------------- Buttons */

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: transform 0.15s ease, filter 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--cyan-1);
  outline-offset: 4px;
}

.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.985);
}

.btn:disabled {
  cursor: not-allowed;
}

.cta {
  margin-top: 22px;
  filter: drop-shadow(0 0 22px rgba(240, 190, 80, 0.4)) drop-shadow(0 10px 16px rgba(0, 0, 0, 0.65));
  transition: filter 0.25s ease;
  animation: rise-in 0.8s var(--ease-out) 0.3s both;
}

.cta:hover {
  filter: drop-shadow(0 0 38px rgba(255, 214, 120, 0.7)) drop-shadow(0 10px 16px rgba(0, 0, 0, 0.65));
}

.btn-find {
  --notch: 22px;
  display: block;
  padding: 3px;
  background: linear-gradient(180deg, #fff8dc, #b98a2c 50%, #5f400d);
  clip-path: polygon(var(--notch) 0, calc(100% - var(--notch)) 0, 100% 50%, calc(100% - var(--notch)) 100%, var(--notch) 100%, 0 50%);
}

.btn-find .btn-face {
  position: relative;
  display: block;
  overflow: hidden;
  padding: 17px clamp(44px, 6vw, 76px) 16px;
  padding-left: calc(clamp(44px, 6vw, 76px) + 0.24em);
  background: linear-gradient(180deg, #ffeeb0 0%, #f2c655 38%, #c58d27 62%, #94640f 100%);
  clip-path: polygon(var(--notch) 0, calc(100% - var(--notch)) 0, 100% 50%, calc(100% - var(--notch)) 100%, var(--notch) 100%, 0 50%);
  font-family: var(--font-display);
  font-size: clamp(20px, 2.2vw, 28px);
  font-weight: 900;
  letter-spacing: 0.24em;
  line-height: 1.2;
  white-space: nowrap;
  color: #2b1a02;
  text-shadow: 0 1px 0 rgba(255, 246, 205, 0.75);
}

.btn-find .btn-face::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 38%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  transform: skewX(-20deg);
  animation: sheen 3.8s ease-in-out infinite;
}

.btn-find:hover:not(:disabled) .btn-face {
  background: linear-gradient(180deg, #fff6cf 0%, #ffd668 38%, #d79c2f 62%, #a06c10 100%);
}

.btn-find:disabled {
  filter: grayscale(0.85) brightness(0.6);
}

.btn-find:disabled .btn-face::after {
  animation: none;
}

.btn-ghost {
  padding: 12px 22px;
  border: 1px solid rgba(184, 246, 255, 0.4);
  border-radius: 8px;
  background: rgba(10, 16, 34, 0.7);
  font-size: 15px;
  color: var(--cyan-1);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--cyan-2);
  background: rgba(47, 211, 245, 0.12);
  box-shadow: 0 0 18px rgba(47, 211, 245, 0.3);
}

.btn-dev {
  padding: 12px 18px;
  border: 1px dashed rgba(227, 183, 85, 0.7);
  border-radius: 8px;
  background: rgba(227, 183, 85, 0.08);
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--gold-1);
}

.btn-dev:hover:not(:disabled) {
  border-style: solid;
  background: rgba(227, 183, 85, 0.18);
  box-shadow: 0 0 18px rgba(227, 183, 85, 0.3);
}

.btn-ghost:disabled,
.btn-dev:disabled {
  opacity: 0.4;
}

/* ---------------------------------------------------------------- Status bar */

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 4px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.statusbar > * {
  flex: 1;
}

.stats {
  text-align: center;
}

.build {
  text-align: right;
}

.conn {
  display: flex;
  align-items: center;
  gap: 9px;
}

.conn-dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--gold-2);
  box-shadow: 0 0 10px var(--gold-2);
  animation: pulse-dot 1.4s ease-in-out infinite;
}

.conn[data-state='online'] .conn-dot {
  background: #4dffa0;
  box-shadow: 0 0 10px #4dffa0;
}

.conn[data-state='offline'] .conn-dot {
  background: var(--crimson-2);
  box-shadow: 0 0 10px var(--crimson-2);
}

/* ---------------------------------------------------------------- Overlays */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  background: radial-gradient(ellipse at center, rgba(5, 7, 15, 0.5), rgba(5, 7, 15, 0.88));
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  animation: fade-in 0.25s ease both;
}

.modal {
  width: min(500px, 100%);
  padding: 30px 28px 26px;
  text-align: center;
  animation: modal-in 0.35s var(--ease-out) both;
}

.modal-title {
  font-family: var(--font-display);
  font-size: clamp(16px, 4.4vw, 20px);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-1);
  text-shadow: 0 0 18px rgba(227, 183, 85, 0.45);
}

.queue-ring {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 22px auto 16px;
}

.queue-ring svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotate(-90deg);
}

.queue-ring circle {
  fill: none;
  transform-origin: 100px 100px;
}

.ring-track {
  stroke: rgba(255, 255, 255, 0.09);
  stroke-width: 6;
}

/* The stroke colour is driven from client.js: cyan -> gold -> crimson as time runs out. */
.ring-progress {
  color: var(--cyan-2);
  stroke: currentColor;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 552.92;
  stroke-dashoffset: 552.92;
  filter: drop-shadow(0 0 7px currentColor);
}

.ring-runes {
  stroke: rgba(246, 226, 160, 0.55);
  stroke-width: 3;
  stroke-dasharray: 2 13.24;
  animation: spin 16s linear infinite;
}

.ring-inner {
  stroke: rgba(47, 211, 245, 0.4);
  stroke-width: 1.5;
  stroke-dasharray: 26 14;
  animation: spin 9s linear infinite reverse;
}

.queue-readout {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
}

.queue-timer {
  font-size: 58px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  line-height: 1;
  color: #eaffff;
  text-shadow: 0 0 18px rgba(80, 220, 255, 0.8);
}

.queue-limit {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: var(--text-dim);
}

.queue-status {
  min-height: 1.4em;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--cyan-1);
}

.queue-hint {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-dim);
}

.queue-hint strong {
  color: var(--gold-1);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
}

.queue-panel.resolved .queue-timer {
  color: var(--gold-1);
  text-shadow: 0 0 22px rgba(227, 183, 85, 0.9);
}

.queue-panel.resolved .queue-status {
  color: var(--gold-1);
}

.queue-panel.resolved .ring-progress {
  color: var(--gold-1);
}

/* ---------------------------------------------------------------- Match found */

.overlay-match {
  background: radial-gradient(ellipse at center, rgba(5, 7, 15, 0.35), rgba(5, 7, 15, 0.9));
}

.versus {
  width: min(980px, 100%);
  text-align: center;
}

.versus-title {
  padding-left: 0.2em;
  font-family: var(--font-display);
  font-size: clamp(28px, 4.6vw, 56px);
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff8dc, #f3d275 45%, #a8731b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 26px rgba(240, 190, 90, 0.45));
  animation: rise-in 0.5s var(--ease-out) both;
}

.versus-sub {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.versus-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(10px, 3vw, 36px);
  margin: 28px 0 24px;
}

.side-card {
  --side: var(--cyan-2);
  --side-soft: rgba(47, 211, 245, 0.28);

  display: grid;
  justify-items: center;
  gap: 9px;
  min-width: 0;
  padding: 24px 18px 22px;
  border: 1px solid var(--side);
  border-radius: 16px;
  background: linear-gradient(165deg, var(--side-soft), rgba(7, 11, 24, 0.82) 62%);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 0 44px var(--side-soft), inset 0 0 34px rgba(255, 255, 255, 0.04);
}

.side-card.radiant {
  animation: slide-from-left 0.55s var(--ease-out) both;
}

.side-card.dire {
  --side: var(--crimson-2);
  --side-soft: rgba(240, 65, 58, 0.28);
  background: linear-gradient(195deg, var(--side-soft), rgba(7, 11, 24, 0.82) 62%);
  animation: slide-from-right 0.55s var(--ease-out) both;
}

.side-label {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--side);
}

.side-sigil {
  width: 86px;
  height: 86px;
  filter: drop-shadow(0 0 16px var(--side));
}

.side-sigil svg {
  width: 100%;
  height: 100%;
}

.side-name {
  max-width: 100%;
  font-family: var(--font-display);
  font-size: clamp(18px, 2.5vw, 30px);
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
  color: #fff;
}

.side-tag {
  padding: 3px 12px 2px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.side-card.is-you .side-tag {
  border-color: var(--gold-2);
  background: rgba(227, 183, 85, 0.16);
  color: var(--gold-1);
}

.side-hero {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.versus-vs {
  font-family: var(--font-display);
  font-size: clamp(34px, 6vw, 76px);
  font-weight: 900;
  color: var(--gold-1);
  text-shadow: 0 0 30px rgba(240, 190, 90, 0.85), 0 3px 0 rgba(0, 0, 0, 0.7);
  animation: vs-pop 0.6s var(--ease-out) 0.25s both;
}

.match-status {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.match-status b {
  display: inline-block;
  min-width: 1ch;
  margin-left: 4px;
  font-size: 1.6em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  vertical-align: -0.08em;
  color: var(--gold-1);
  text-shadow: 0 0 18px rgba(240, 190, 90, 0.8);
}

.match-status.live {
  color: #7dffb8;
  text-shadow: 0 0 20px rgba(77, 255, 160, 0.6);
}

.match-note {
  min-height: 1.4em;
  margin: 8px 0 20px;
  font-size: 15px;
  color: var(--text-dim);
}

/* ---------------------------------------------------------------- Toasts */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 54px;
  z-index: 80;
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(520px, calc(100% - 24px));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: 11px 18px;
  border: 1px solid rgba(184, 246, 255, 0.35);
  border-left: 3px solid var(--cyan-2);
  border-radius: 8px;
  background: rgba(8, 12, 26, 0.92);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.03em;
  animation: toast-in 0.3s var(--ease-out) both;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.toast-warn {
  border-color: rgba(227, 183, 85, 0.4);
  border-left-color: var(--gold-2);
}

.toast.toast-error {
  border-color: rgba(240, 65, 58, 0.4);
  border-left-color: var(--crimson-2);
}

.toast.leaving {
  opacity: 0;
  transform: translateY(8px);
}

/* ---------------------------------------------------------------- Tooltip */

.tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 90;
  width: 272px;
  padding: 14px 16px 13px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(20, 28, 54, 0.96), rgba(7, 10, 22, 0.97));
  text-align: left;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transform: translateY(-5px);
  transition: opacity 0.14s ease, transform 0.14s ease, visibility 0s linear 0.14s;
}

.tooltip.visible {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition-delay: 0s;
}

.tooltip.above {
  transform: translateY(5px);
}

.tooltip.above.visible {
  transform: none;
}

.tooltip::after {
  content: '';
  position: absolute;
  top: -6px;
  left: var(--arrow-x, 50%);
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-top: 1.5px solid var(--gold-2);
  border-left: 1.5px solid var(--gold-2);
  background: #141c36;
  transform: rotate(45deg);
}

.tooltip.above::after {
  top: auto;
  bottom: -6px;
  background: #070a16;
  transform: rotate(225deg);
}

.tip-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.tip-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fff;
}

.tip-cost {
  display: flex;
  align-items: center;
  flex: none;
  font-size: 16px;
  font-weight: 700;
  color: var(--elixir-1);
}

.tip-type {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-2);
}

.tip-type.type-spell {
  color: var(--crimson-1);
}

.tip-type.type-building {
  color: var(--cyan-2);
}

.tip-type.type-hero {
  color: var(--cyan-1);
}

.tip-desc {
  margin-top: 9px;
  font-size: 15px;
  line-height: 1.35;
  color: #d5dcf0;
}

.tip-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.tip-traits li {
  padding: 2px 9px 1px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #c3cde8;
}

.noscript {
  position: fixed;
  inset: auto 0 0;
  z-index: 100;
  padding: 14px;
  background: var(--crimson-3);
  text-align: center;
}

/* ---------------------------------------------------------------- Keyframes */

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes drop-in {
  from { opacity: 0; translate: 0 -14px; }
}

@keyframes rise-in {
  from { opacity: 0; translate: 0 14px; }
}

/* Uses `translate` so the hover `transform` still applies after the fill. */
@keyframes card-in {
  from { opacity: 0; translate: 0 10px; }
}

@keyframes modal-in {
  from { opacity: 0; scale: 0.94; translate: 0 10px; }
}

@keyframes slide-from-left {
  from { opacity: 0; translate: -70px 0; }
}

@keyframes slide-from-right {
  from { opacity: 0; translate: 70px 0; }
}

@keyframes vs-pop {
  from { opacity: 0; scale: 2.4; }
}

@keyframes toast-in {
  from { opacity: 0; translate: 0 10px; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes sheen {
  0%, 55% { left: -60%; }
  100% { left: 130%; }
}

@keyframes pulse-dot {
  50% { opacity: 0.45; }
}

/* ---------------------------------------------------------------- Responsive */

@media (max-width: 1480px) {
  .brand-text {
    display: none;
  }

  .topbar > * + * {
    margin-left: 14px;
    padding-left: 14px;
  }
}

@media (max-width: 1269px) {
  .topbar {
    flex-wrap: wrap;
    row-gap: 12px;
  }

  .slot-deck {
    flex-basis: 100%;
    justify-content: center;
    margin-left: 0;
    padding: 12px 0 0;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.09);
  }

  .slot-nickname {
    flex: 1;
    width: auto;
    min-width: 180px;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 12px 14px;
  }

  .brand {
    display: none;
  }

  .topbar > .slot-nickname {
    flex-basis: 100%;
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }

  .topbar > .slot-hero {
    flex-basis: 100%;
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }

  .slot-deck {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .deck-meta {
    display: flex;
    align-items: baseline;
    gap: 12px;
  }

  .deck-count {
    font-size: 15px;
  }

  .deck {
    flex-wrap: wrap;
    row-gap: 14px;
  }

  .faction {
    display: none;
  }

  .statusbar {
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
  }

  .stats,
  .build {
    text-align: center;
  }

  .versus-row {
    grid-template-columns: 1fr;
    gap: 6px;
    margin: 18px 0;
  }

  .side-card {
    padding: 14px;
  }

  .side-sigil {
    width: 56px;
    height: 56px;
  }
}

@media (max-height: 720px) {
  .emblem-slot {
    width: clamp(150px, 30vh, 360px);
  }

  .title {
    font-size: clamp(36px, 5vw, 64px);
  }

  .cta {
    margin-top: 14px;
  }

  .mode-line {
    margin-top: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
