:root {
  --bg: #0f1417;
  --bg2: #161d22;
  --panel: #1e272e;
  --panel2: #26323a;
  --line: #33424c;
  --ink: #eef4f2;
  --muted: #8fa3ad;
  --accent: #4fd1a5;
  --accent2: #6ea8fe;
  --good: #4fd1a5;
  --bad: #f2657a;
  --extinct: #c79bff;
  --sil: #cfe8dd;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --r: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: radial-gradient(1200px 700px at 50% -10%, #1a252b 0%, var(--bg) 60%);
  color: var(--ink); min-height: 100vh; -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 920px; margin: 0 auto; padding: 22px 18px 60px; }

/* header */
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand-mark { width: 30px; height: 30px; color: var(--accent); display: inline-flex; }
.brand-mark svg { width: 100%; height: 100%; }
.brand h1 { font-size: 22px; margin: 0; letter-spacing: .2px; font-weight: 800; }
.brand .dot { color: var(--accent); }
.scoreboard { display: flex; gap: 10px; align-items: center; }
.pill { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--muted); display: flex; gap: 7px; align-items: center; }
.pill b { color: var(--ink); font-variant-numeric: tabular-nums; font-size: 15px; }
.pill.hot b { color: #f4a259; }
.iconbtn {
  width: 30px; height: 30px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); color: var(--muted); font-family: Georgia, serif; font-style: italic;
  font-weight: 700; font-size: 16px; cursor: pointer; line-height: 1; padding: 0;
  transition: color .12s, border-color .12s;
}
.iconbtn:hover { color: var(--ink); border-color: var(--accent); }

/* hero / start */
.hero { text-align: center; max-width: 620px; margin: 4vh auto 0; padding: 10px; }
.hero-mark { width: 76px; height: 76px; color: var(--accent); margin: 0 auto 18px; display: flex; }
.hero-mark svg { width: 100%; height: 100%; filter: drop-shadow(0 6px 20px rgba(79,209,165,.25)); }
.hero h2 { font-size: 34px; margin: 0 0 14px; letter-spacing: -.3px; }
.hero .tagline { color: var(--ink); font-size: 17px; line-height: 1.55; margin: 0 auto 12px; max-width: 520px; }
.hero .tagline b { color: var(--accent); }
.hero .sub2 { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 0 auto 26px; max-width: 500px; }
.streakline { color: var(--muted); font-size: 13px; margin-top: 16px; min-height: 18px; }

/* game head */
.gamehead { text-align: center; margin: 6px 0 18px; }
.gamehead .q { font-size: 22px; font-weight: 700; margin: 6px 0; line-height: 1.3; }
.gamehead .sub { color: var(--muted); font-size: 14px; }
.target-name { color: var(--accent); }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; text-align: center; position: relative; }
.silbox { height: 120px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.sil { width: 100%; height: 100%; object-fit: contain; filter: brightness(0) invert(88%) sepia(6%) saturate(400%) hue-rotate(105deg) brightness(97%); }
.name { font-size: 17px; font-weight: 650; }
.latin { font-size: 12.5px; color: var(--muted); font-style: italic; margin-top: 2px; }
.when { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.badge-extinct { display: inline-block; font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase; color: var(--extinct); border: 1px solid color-mix(in srgb, var(--extinct) 45%, transparent); border-radius: 999px; padding: 2px 8px; margin-top: 6px; }

.target-card { max-width: 300px; margin: 0 auto 18px; background: var(--panel2); border-color: var(--accent); }
.target-card .sil { filter: brightness(0) invert(66%) sepia(52%) saturate(560%) hue-rotate(104deg) brightness(96%); }

/* rank grid */
.rank-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 700px){ .rank-grid { grid-template-columns: 1fr 1fr; } }
.rank-item { cursor: pointer; transition: transform .1s, border-color .1s, box-shadow .1s, background .1s; }
.rank-item:hover:not(.chosen) { transform: translateY(-2px); border-color: var(--accent2); box-shadow: var(--shadow); }
.rank-item.chosen { border-color: var(--accent2); background: color-mix(in srgb, var(--accent2) 12%, var(--panel)); }
.rank-badge {
  position: absolute; top: 10px; left: 10px; z-index: 2; min-width: 26px; height: 26px; padding: 0 7px;
  border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--accent2); color: #08203a; border: 2px solid var(--bg2);
}
.rank-badge[hidden] { display: none !important; }

/* reveal panel + timeline */
.panel { margin: 4px auto 0; max-width: 760px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.timeline-box { overflow-x: auto; }
.timeline { display: block; min-width: 520px; }
.tl-icon { filter: brightness(0) invert(88%) sepia(6%) saturate(400%) hue-rotate(105deg) brightness(97%); }
.tl-target { filter: brightness(0) invert(66%) sepia(52%) saturate(560%) hue-rotate(104deg) brightness(96%); }

.banner { text-align: center; font-size: 16px; font-weight: 650; margin-top: 16px; min-height: 22px; }
.banner.good { color: var(--good); }
.banner.bad { color: var(--bad); }
.factline { text-align: center; color: var(--muted); font-size: 13.5px; margin-top: 10px; line-height: 1.5; max-width: 640px; margin-left: auto; margin-right: auto; }
.factline .hl { color: var(--accent); font-weight: 600; }

/* buttons */
.actions { display: flex; justify-content: center; gap: 12px; margin-top: 22px; min-height: 46px; }
.btn { border: 1px solid var(--line); background: var(--accent); color: #06231a; border-radius: 12px; padding: 12px 24px; font-size: 15px; font-weight: 700; cursor: pointer; transition: transform .1s, filter .1s; }
.btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn.big { padding: 15px 40px; font-size: 17px; border-radius: 14px; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { border-color: var(--accent); }

/* modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(6,10,12,.7); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 22px; z-index: 50; }
.modal { position: relative; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); max-width: 640px; width: 100%; max-height: 86vh; overflow-y: auto; padding: 26px 26px 30px; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 14px; font-size: 22px; }
.modal-close { position: absolute; top: 14px; right: 16px; background: none; border: none; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 4px; }
.modal-close:hover { color: var(--ink); }
.modal-body { color: var(--muted); font-size: 14px; line-height: 1.6; }
.modal-body a { color: var(--accent); }
.modal-body p { margin: 0 0 12px; }
.modal-body h3 { color: var(--ink); font-size: 13px; text-transform: uppercase; letter-spacing: .8px; margin: 22px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.credit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
@media (max-width: 520px){ .credit-grid { grid-template-columns: 1fr; } }
.credit-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; min-width: 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 45%, transparent); }
.credit-row img { width: 26px; height: 26px; object-fit: contain; flex: none; filter: brightness(0) invert(70%); }
.credit-row .ctext { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.credit-row .cn { color: var(--ink); font-weight: 600; font-size: 13px; }
.credit-row .ca { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hidden { display: none !important; }
@media (max-width: 520px){
  .brand h1 { font-size: 19px; }
  .hero h2 { font-size: 27px; }
  .gamehead .q { font-size: 19px; }
  .pill { padding: 5px 11px; font-size: 12px; }
}
