:root {
  --bg: #0f1116;
  --panel: #191c24;
  --text: #e9e6dc;
  --muted: #9a978d;
  --gold: #f0c35a;
  --line: #2b2f3a;
}

* { box-sizing: border-box; }

/* Stop double-tap zoom and text selection when tapping quickly on phones. */
html, body, button { touch-action: manipulation; }
.card { user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #1d2230 0%, var(--bg) 60%);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

main { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }

header { text-align: center; margin-bottom: 24px; }
h1 { margin: 0; color: var(--gold); font-family: Georgia, serif; letter-spacing: .02em; }
h2 { text-align: center; font-family: Georgia, serif; color: var(--gold); margin-bottom: 4px; }
.sub { color: var(--muted); margin: 6px 0 0; text-align: center; }

.progress { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.bar { flex: 1; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
#bar-fill { height: 100%; width: 0; background: var(--gold); transition: width .2s; }
#progress-text { color: var(--muted); font-size: 14px; white-space: nowrap; }

.arena { display: flex; align-items: stretch; gap: 12px; }
.vs { align-self: center; color: var(--muted); font-style: italic; }

.card {
  flex: 1;
  min-height: 180px;
  padding: 20px 12px;
  background: var(--panel);
  color: var(--text);
  border: 2px solid var(--line);
  border-top: 6px solid var(--c, var(--gold));
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  transition: transform .1s, border-color .1s, box-shadow .1s;
}
.card:hover, .card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--c);
  box-shadow: 0 0 24px -6px var(--c);
  outline: none;
}
.card .icon {
  width: 72px; height: 72px; border-radius: 8px;
  border: 2px solid var(--c); box-shadow: 0 0 16px -4px var(--c);
}
.card .name { font-size: 28px; font-family: Georgia, serif; color: var(--c); }

.hint { text-align: center; color: var(--muted); font-size: 13px; }
kbd { border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; background: var(--panel); }

.actions { display: flex; justify-content: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.actions button {
  font: inherit; padding: 8px 16px; border-radius: 6px; cursor: pointer;
  background: var(--gold); color: #1a1406; border: 1px solid var(--gold);
}
.actions button.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.actions button:disabled { opacity: .4; cursor: default; }

.share-status { text-align: center; color: var(--muted); font-size: 14px; min-height: 1.5em; }

#ranking { list-style: none; padding: 0; margin: 20px 0 0; counter-reset: r; }
#ranking li {
  counter-increment: r;
  display: grid; grid-template-columns: 24px 40px 1fr auto; align-items: center; gap: 12px;
  padding: 10px 14px; margin-bottom: 8px;
  background: var(--panel); border-left: 4px solid var(--c); border-radius: 6px;
}
#ranking li::before { content: counter(r); color: var(--muted); font-weight: 600; }
#ranking li:first-child { box-shadow: 0 0 20px -8px var(--c); }
#ranking .icon { width: 40px; height: 40px; border-radius: 6px; border: 1px solid var(--c); }
#ranking .name { color: var(--c); font-weight: 600; }
#ranking .stats { color: var(--muted); font-size: 13px; text-align: right; }

@media (max-width: 520px) {
  .arena { gap: 8px; }
  .vs { font-size: 13px; }
  .card { min-height: 150px; padding: 16px 8px; }
  .card .icon { width: 64px; height: 64px; }
  .card .name { font-size: 22px; }
}

@media (hover: none) { .hint { display: none; } }

.exclude { display: flex; justify-content: center; align-items: center; gap: 10px; margin-bottom: 18px; color: var(--muted); font-size: 14px; }
.exclude[hidden] { display: none; }
.exclude select {
  font: inherit; font-size: 16px; /* 16px stops iOS zooming into the dropdown */
  padding: 6px 10px; border-radius: 6px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
}

.community { margin-top: 36px; padding-top: 8px; border-top: 1px solid var(--line); }
.community[hidden] { display: none; }
.community h3 { text-align: center; color: var(--muted); font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; margin: 20px 0 0; }
.community-you { text-align: center; font-size: 17px; margin: 8px 0 0; }
#community-ranking { list-style: none; padding: 0; margin: 12px 0 0; counter-reset: r; }
#community-ranking li {
  counter-increment: r;
  display: grid; grid-template-columns: 24px 32px 1fr auto; align-items: center; gap: 10px;
  padding: 6px 12px; margin-bottom: 6px;
  background: var(--panel); border-left: 3px solid var(--c); border-radius: 6px; font-size: 14px;
}
#community-ranking li::before { content: counter(r); color: var(--muted); font-weight: 600; }
#community-ranking .icon { width: 32px; height: 32px; border-radius: 5px; }
#community-ranking .name { color: var(--c); font-weight: 600; }
#community-ranking .stats { color: var(--muted); font-size: 12px; text-align: right; }
