:root {
  --bg: #070a14;
  --panel: #111a2e;
  --line: #22304d;
  --text: #e8eefc;
  --dim: #7d8aa8;
  --accent: #ff4757;
  --accent2: #4a90d9;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(circle at 50% 0%, #16213e 0%, #070a14 70%);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game {
  display: block;
  width: min(100vw, 177.78vh);
  height: auto;
  max-height: 100vh;
  background: #0b1020;
  image-rendering: auto;
}

#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 24px;
  background: radial-gradient(circle at 50% 20%, rgba(22, 33, 62, 0.96) 0%, rgba(7, 10, 20, 0.99) 75%);
}

#overlay.hidden { display: none; }

.screen {
  width: 100%;
  max-width: 560px;
  text-align: center;
  animation: pop 0.22s ease-out;
}

.screen.wide { max-width: 980px; }

@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

h1 {
  margin: 0 0 6px;
  font-size: clamp(28px, 5vw, 52px);
  letter-spacing: 0.02em;
  line-height: 1.05;
  text-transform: uppercase;
}

h1 em {
  display: block;
  font-style: normal;
  color: var(--accent);
  text-shadow: 0 0 30px rgba(255, 71, 87, 0.45);
}

h2 {
  margin: 0 0 10px;
  font-size: clamp(20px, 3vw, 30px);
}

h2 .dim, .dim { color: var(--dim); font-weight: 500; }

.sub {
  margin: 0 0 22px;
  color: var(--dim);
  font-size: 15px;
}

.kicker {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hint {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--dim);
}

.hint b {
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 12px;
}

.row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 12px;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

button:active { transform: scale(0.97); }

.big {
  padding: 15px 42px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(180deg, #ff5c6b, #d92b3c);
  box-shadow: 0 8px 24px rgba(255, 71, 87, 0.3);
}

.big:hover { background: linear-gradient(180deg, #ff7180, #e63a4b); }

.big.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  box-shadow: none;
}

.big.ghost:hover { border-color: var(--accent2); background: rgba(74, 144, 217, 0.1); }

.tiny {
  margin-top: 26px;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--line);
}

.tiny:hover { color: var(--text); border-color: var(--dim); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
  margin: 18px 0 6px;
  max-height: 62vh;
  overflow-y: auto;
  padding: 4px;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
}

.card:hover:not(.locked) {
  border-color: var(--accent2);
  background: #16223a;
  transform: translateY(-2px);
}

.card.locked {
  opacity: 0.34;
  cursor: not-allowed;
  filter: grayscale(1);
}

.portrait {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--c, #444);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.28), 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.portrait .face {
  font-weight: 800;
  font-size: 20px;
  color: rgba(0, 0, 0, 0.55);
}

.cname {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  word-break: break-word;
}

.ctier {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

.bigportrait {
  width: 96px;
  height: 96px;
  margin: 0 auto 16px;
  border-radius: 18px;
  background: var(--c, #444);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  font-weight: 800;
  color: rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 -12px 0 rgba(0, 0, 0, 0.28), 0 0 0 3px rgba(255, 255, 255, 0.1), 0 14px 40px rgba(0, 0, 0, 0.5);
  animation: bob 2.4s ease-in-out infinite;
}

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

.grid::-webkit-scrollbar { width: 8px; }
.grid::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
