:root {
  --bg: #14100e; --surface: #1e1915; --border: #33291f;
  --text: #e8e0d8; --muted: #8a7f76; --accent: #e2583e; --accent2: #e88d6f;
  --win: #4caf50;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg); color: var(--text);
  max-width: 900px; margin: 0 auto; padding: 1rem;
  line-height: 1.5; min-height: 100vh;
}
a { color: var(--accent2); }
.hidden { display: none !important; }
.hint { color: var(--muted); font-size: .82rem; margin-top: 1rem; }
.center { text-align: center; }

header {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid var(--border); padding-bottom: .8rem; margin-bottom: 1.5rem;
}
header h1 { color: var(--accent); font-size: 1.35rem; font-weight: 650; letter-spacing: .01em; }
header h1 span { color: var(--accent2); font-weight: 400; }
header h1.h-sm { display: none; }
header nav { font-size: .85rem; color: var(--muted); }
header nav a { color: var(--muted); text-decoration: none; }
header nav a:hover { color: var(--accent2); }

.screen { padding: .5rem 0; }
.blurb { font-size: 1.12rem; margin: 2.2rem auto 2.4rem; max-width: 32em; text-align: center; color: var(--text); }

.mode-cards { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.mode-card {
  position: relative; overflow: hidden;
  flex: 1; min-width: 220px; max-width: 300px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 2.6rem 1.4rem 2.2rem; color: var(--text); cursor: pointer;
  font-family: inherit; text-align: center;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.mode-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  opacity: .55; transition: opacity .18s ease;
}
.mode-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(226, 88, 62, .16);
}
.mode-card:hover::before { opacity: 1; }
.mode-card b { display: block; font-size: 1.55rem; letter-spacing: .04em; color: var(--accent); }
.mode-card span { display: block; font-size: .82rem; color: var(--muted); margin-top: .65rem; }
.mode-card em { display: block; font-style: normal; font-size: .78rem; color: var(--accent2); margin-top: .35rem; letter-spacing: .05em; }
.mode-card.wide { display: block; width: 100%; text-align: center; margin-top: 1rem; }

#resume-wrap { margin-top: 1.2rem; display: flex; gap: 1rem; align-items: center; }
#resume-btn {
  background: var(--surface); border: 1px solid var(--accent); color: var(--accent);
  padding: .6rem 1rem; border-radius: 6px; cursor: pointer; font-family: inherit;
}
.linklike { background: none; border: none; color: var(--muted); cursor: pointer; font-family: inherit; font-size: .8rem; }
.linklike:hover { color: var(--accent2); }

/* Match */
#match-top { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
#match-top #progress { flex: 1; margin-bottom: 0; }
#match-exit {
  display: none; background: none; border: 1px solid var(--border);
  color: var(--muted); border-radius: 6px; width: 2rem; height: 2rem;
  cursor: pointer; font-family: inherit; font-size: 1rem; line-height: 1;
}
#match-exit:hover { color: var(--accent2); border-color: var(--accent2); }
#progress {
  height: 9px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 99px; margin-bottom: .5rem; overflow: hidden;
}
#progress-bar {
  height: 100%; width: 0; border-radius: 99px; position: relative; overflow: hidden;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  box-shadow: 0 0 10px rgba(226, 88, 62, .6);
  transition: width .45s cubic-bezier(.22, 1, .36, 1);
}
#progress-bar::after {
  content: ''; position: absolute; inset: 0; border-radius: 99px;
  background: linear-gradient(90deg, transparent 15%, rgba(255,255,255,.45) 50%, transparent 85%);
  transform: translateX(-100%);
  animation: sheen 1.8s linear infinite;
}
@keyframes sheen {
  0%   { transform: translateX(-100%); opacity: 0; }
  12%  { opacity: 1; }
  82%  { opacity: 1; }
  100% { transform: translateX(110%); opacity: 0; }
}
#match-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; margin-bottom: 1rem; }
#phase-label { text-transform: uppercase; letter-spacing: .08em; }

#duel { display: grid; grid-template-columns: 1fr auto 1fr; gap: .75rem; align-items: start; }
.vs {
  align-self: center;
  display: grid; place-items: center;
  width: 3.1rem; height: 3.1rem; border-radius: 50%;
  font-weight: 800; font-style: italic; font-size: 1.2rem; letter-spacing: -.03em;
  color: var(--bg); text-shadow: 0 1px 0 rgba(0,0,0,.3);
  background: radial-gradient(circle at 35% 30%, var(--accent2), var(--accent));
  box-shadow: 0 0 14px rgba(226, 88, 62, .5), inset 0 -2px 6px rgba(0,0,0,.35);
  animation: vs-pulse 2.2s ease-in-out infinite;
}
@keyframes vs-pulse {
  0%, 100% { transform: scale(1);    box-shadow: 0 0 12px rgba(226,88,62,.45), inset 0 -2px 6px rgba(0,0,0,.35); }
  50%      { transform: scale(1.07); box-shadow: 0 0 26px rgba(226,88,62,.85), inset 0 -2px 6px rgba(0,0,0,.35); }
}
.side { cursor: pointer; }
.side .cards { display: flex; gap: .45rem; }
.side .cards .img-wrap { flex: 1; min-width: 0; }
.side .img-wrap {
  background: var(--surface); border: 2px solid var(--border);
  border-radius: 10px; overflow: hidden; aspect-ratio: 63/88;
}
.side img { width: 100%; height: 100%; object-fit: contain; display: block; }
.side:hover .img-wrap { border-color: var(--accent2); }
.side.picked .img-wrap { border-color: var(--win); }
.side.lost { opacity: .45; }
.artist-name { text-align: center; padding: .6rem .3rem .3rem; font-size: 1rem; color: var(--accent2); }
.card-reveal { text-align: center; font-size: .75rem; color: var(--muted); padding-bottom: .4rem; }

#screen-phase { text-align: center; padding-top: 15vh; }
#screen-phase h2 { color: var(--accent); margin-bottom: .75rem; }
#screen-phase p { color: var(--muted); max-width: 30em; margin: 0 auto; }

#screen-results h2 { color: var(--accent); }
#champion-card { display: flex; gap: 1.2rem; align-items: center; margin: 1rem 0 1.5rem; }
#champion-card img { width: 140px; border-radius: 8px; }
#champion-card .champ-name { font-size: 1.6rem; color: var(--accent); }
#champion-card .champ-sub { color: var(--muted); font-size: .85rem; }
#top10 { margin: .5rem 0 1.5rem 1.4rem; line-height: 1.9; }
#top10 .rating { color: var(--muted); font-size: .8rem; }

#board-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-top: 1rem; }
#board-table th { text-align: left; color: var(--muted); padding: .4rem .5rem; border-bottom: 2px solid var(--border); }
#board-table td { padding: .35rem .5rem; border-bottom: 1px solid var(--border); }
#board-table tr:hover td { background: #1a1612; }
#board-wrap { position: relative; }
#board-lock {
  position: absolute; inset: 0; min-height: 22rem;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 12, 9, .45);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-radius: 10px; text-align: center; z-index: 2;
}
#board-lock .lock-card { padding: 2rem 1rem; }
#board-lock .lock-icon { color: var(--accent); margin-bottom: .4rem; }
#board-lock p { color: var(--muted); font-size: .9rem; margin-bottom: 1.1rem; }
#board-lock .mode-cards { display: flex; gap: .6rem; justify-content: center; }
.skel {
  height: .85rem; border-radius: 4px;
  background: linear-gradient(90deg, var(--surface) 25%, #2a221a 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: skel-shine 1.6s linear infinite;
}
@keyframes skel-shine { from { background-position: 200% 0; } to { background-position: -200% 0; } }
#board-table a { color: inherit; text-decoration: none; }
#board-table a:hover { color: var(--accent2); text-decoration: underline; }

/* Artist page */
.stat-grid { display: flex; flex-wrap: wrap; gap: .6rem; margin: .8rem 0 1.2rem; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: .55rem .9rem; min-width: 7.5rem;
}
.stat b { display: block; font-size: 1.15rem; color: var(--accent); }
.stat span { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.filter-row { display: flex; gap: .45rem; margin-bottom: .9rem; flex-wrap: wrap; }
.filter-row button {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: .25rem .8rem; font-size: .78rem; cursor: pointer;
}
.filter-row button.on { border-color: var(--accent2); color: var(--accent2); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .6rem; }
.card-cell { text-align: center; }
.card-cell img {
  width: 100%; aspect-ratio: 63/88; object-fit: contain;
  background: var(--surface); border: 1px solid var(--border); border-radius: 7px;
}
.card-cell .cap { font-size: .62rem; color: var(--muted); margin-top: .25rem; line-height: 1.3; }
.card-cell .cap .wins { color: var(--win); }

footer { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .75rem; }

@media (max-width: 560px) {
  body { padding: .5rem; }
  header { padding-bottom: .5rem; margin-bottom: .8rem; }
  header h1.h-lg { display: none; }
  header h1.h-sm { display: block; }
  body.in-match header { display: none; }
  #match-top { margin-bottom: .4rem; }
  #match-exit { display: block; }
  #match-meta { margin-bottom: .4rem; font-size: .72rem; }
  #duel { grid-template-columns: 1fr; gap: .35rem; }
  .vs { justify-self: center; width: 2.3rem; height: 2.3rem; font-size: .95rem; }
  .side .cards { justify-content: space-between; }
  .side .cards .img-wrap { flex: 0 0 auto; width: 48%; max-width: none; height: auto; aspect-ratio: 63/88; }
  .side .cards.solo .img-wrap { width: 62%; margin: 0 auto; }
  .artist-name, .card-reveal { display: none !important; }
  .hint { margin-top: .5rem; font-size: .72rem; }
  .mode-card { padding: 1.6rem 1.2rem 1.4rem; }
}
