:root {
  --bg: #14161a; --panel: #1e2128; --panel2: #262a33; --line: #333844;
  --text: #eceef2; --muted: #9aa3b2; --accent: #4f8cff; --danger: #e5484d; --ok: #3fb950;
  --team: #4f8cff; --team-ink: #fff;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Space Grotesk', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.45;
  max-width: 560px; margin: 0 auto; min-height: 100vh;
}
h1, h2, h3 { margin: 0 0 .4em; font-weight: 650; }
a { color: var(--accent); }
button {
  font: inherit; cursor: pointer; border: 0; border-radius: 10px;
  background: var(--accent); color: #fff; padding: .7em 1.1em; font-weight: 600;
}
button.secondary { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button:disabled { opacity: .45; cursor: not-allowed; }
input, textarea, select {
  font: inherit; width: 100%; padding: .7em .8em; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
}
label { display: block; font-size: .82rem; color: var(--muted); margin: .8em 0 .3em; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1em; margin: .8em; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.row { display: flex; gap: .6em; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: .4em; padding: .2em .6em; border-radius: 999px;
  background: var(--panel2); border: 1px solid var(--line); font-size: .8rem; }
.dot { width: .8em; height: .8em; border-radius: 50%; display: inline-block; }
.center { text-align: center; }
.hidden { display: none !important; }

/* Player header */
.header { padding: 1em .9em .6em; position: sticky; top: 0; background: var(--bg); z-index: 5;
  border-bottom: 1px solid var(--line); }
.teambar { height: 6px; border-radius: 3px; background: var(--team); margin-bottom: .7em; }
.teamname { font-size: 1.4rem; font-weight: 750; }
.tentative { font-size: .72rem; color: var(--muted); font-weight: 500; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.05rem; }

/* Tabs */
.tabs { display: flex; overflow-x: auto; gap: .3em; padding: .5em .6em; position: sticky;
  top: 0; background: var(--bg); border-bottom: 1px solid var(--line); z-index: 4; }
.tab { white-space: nowrap; background: transparent; color: var(--muted); padding: .5em .8em;
  border-radius: 999px; font-size: .9rem; font-weight: 600; }
.tab.active { background: var(--team); color: #fff; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: .55em .2em; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: .6em; }
.list li:last-child { border-bottom: 0; }
.check { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line); flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; }
.check.on { background: var(--ok); border-color: var(--ok); }

/* Chat */
.chat { display: flex; flex-direction: column; height: 62vh; }
.chatlog { flex: 1; overflow-y: auto; padding: .3em; }
.msg { margin: .35em 0; }
.msg .who { font-weight: 650; font-size: .82rem; color: var(--muted); }
.chatform { display: flex; gap: .5em; padding-top: .5em; }

/* Objective / reveal */
.objective { background: linear-gradient(135deg, #3a1d5c, #1e2a5c); border: 1px solid #4f8cff55;
  border-radius: 14px; padding: 1em; margin: .8em; }
.badge { display: inline-flex; align-items: center; gap: .4em; padding: .4em .7em; border-radius: 10px;
  background: #2a2f3a; border: 1px solid var(--line); font-weight: 600; font-size: .85rem; margin: .25em .25em 0 0; }
.badge.locked { opacity: .5; }
.stat { display: flex; justify-content: space-between; padding: .5em 0; border-bottom: 1px solid var(--line); }
.stat b { font-size: 1.3rem; }
.toast { position: fixed; left: 50%; bottom: 1.2em; transform: translateX(-50%); background: #000c;
  border: 1px solid var(--line); padding: .7em 1em; border-radius: 10px; max-width: 90%; z-index: 20; }

/* Admin */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5em; }
.teamcount { display: flex; align-items: center; gap: .6em; padding: .5em; border-radius: 10px; background: var(--panel2); }
.teamcount .n { margin-left: auto; font-weight: 750; font-size: 1.2rem; }
.feed { max-height: 240px; overflow-y: auto; font-size: .85rem; }
.qcard { border: 1px solid var(--line); border-radius: 10px; padding: .6em; margin: .5em 0; }

/* Admin player-management rows */
.pguild { display: flex; align-items: center; gap: .5em; margin: .8em 0 .2em; font-weight: 700; }
.prow { display: flex; align-items: center; gap: .5em; padding: .35em 0; border-bottom: 1px solid var(--line); }
.prow .pn { flex: 1; }
.prow select { width: auto; padding: .35em .5em; }
.prow button { padding: .35em .7em; }

/* Stage */
.stage { max-width: 900px; text-align: center; padding: 6vh 4vw; }
.stage .big { font-size: clamp(1.6rem, 5vw, 3rem); font-weight: 800; margin-top: 4vh; min-height: 3em; }

/* ============================================================
   PLAYER APP redesign — bigger, game-like, accordion + wizards
   ============================================================ */
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/space-grotesk-400.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/space-grotesk-500.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/space-grotesk-700.woff2') format('woff2'); }

body.player { font-size: 18px; font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif; }
.player h1, .player .jointitle { font-size: 2.1rem; font-weight: 700; }
.player label { font-size: 1rem; }
.player input, .player textarea, .player select, .player button { font-size: 1.05rem; padding: .85em .9em; }

/* Big primary action button */
.bigbtn {
  width: 100%; font-size: 1.35rem !important; font-weight: 800; padding: .95em 1em !important;
  border-radius: 14px; letter-spacing: .01em; box-shadow: 0 3px 0 rgba(0,0,0,.35);
}
.bigbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.35); }

/* Header */
.player .header { padding: 1.1em .9em .7em; }
.player .teambar { height: 10px; border-radius: 5px; }
.player .hrow { display: flex; align-items: center; gap: .6em; }
.player .teamname { font-size: 1.9rem; font-weight: 700; line-height: 1.05; flex: 1; text-transform: uppercase; letter-spacing: .01em; }
.emblem { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex: 0 0 auto;
  border: 2px solid var(--team); background: var(--panel2); box-shadow: 0 0 0 1px rgba(255,255,255,.22); }
.player .cd { text-align: right; }
.player .countdown { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.player .cdlabel { font-size: .72rem; color: var(--muted); }
.player .tentative { font-size: .8rem; color: var(--muted); margin-top: .35em; }

/* Switch bar */
#switchbar { margin: .8em; }
#switchbar .cooldown { text-align: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: .8em; }
#switchbar .cooldown .countdown { font-size: 1.8rem; font-weight: 800; }

/* Accordion */
.acc { margin: .8em; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--panel); }
.acc-head { display: flex; align-items: center; gap: .6em; width: 100%; background: var(--panel2);
  color: var(--text); padding: .95em 1em; font-size: 1.15rem; font-weight: 750; border-radius: 0; }
.acc-head .chev { margin-left: auto; transition: transform .15s; color: var(--muted); }
.acc.open .acc-head .chev { transform: rotate(90deg); }
.acc-body { padding: .9em 1em 1.1em; display: none; }
.acc.open .acc-body { display: block; }
.acc-head .badge-count { background: var(--team); color: var(--team-ink, #fff); border-radius: 999px;
  font-size: .8rem; padding: .05em .55em; margin-left: auto; }
.acc-head .excl { margin-left: .4em; font-size: 1rem; line-height: 1; }

/* Roster with inline met checkmarks + "I've met" column header */
.rosterhead { display: flex; padding: 0 .1em .2em; }
.rosterhead .metcol { margin-left: auto; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.roster { list-style: none; margin: 0; padding: 0; }
.roster li { display: flex; align-items: center; gap: .7em; padding: .7em .1em; border-bottom: 1px solid var(--line); font-size: 1.15rem; }
.roster li:last-child { border-bottom: 0; }
.roster .rn { flex: 1; }
.roster .cdot { width: 1em; height: 1em; border-radius: 50%; border: 1px solid rgba(128,128,128,.5); flex: 0 0 auto; }
.roster .met { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line);
  background: transparent; color: transparent; font-size: 1.1rem; display: inline-flex; align-items: center; justify-content: center; }
.roster .met.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.roster .youtag { margin-left: auto; color: var(--muted); font-size: .9rem; }

/* Objective reminder (compact; full reveal is a popup) */
.obj { background: linear-gradient(135deg, #3a1d5c, #1e2a5c); border: 1px solid #4f8cff55;
  border-radius: 12px; padding: .8em 1em; margin-bottom: .8em; font-size: 1.05rem; }

/* Achievements grid with custom icons (grayscale until earned) */
.achgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6em; }
.achtile { text-align: center; padding: .6em .2em; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); }
.achtile .ico { font-size: 2.1rem; line-height: 1.1; height: 60px; display: flex; align-items: center;
  justify-content: center; filter: grayscale(1) opacity(.45); transition: filter .2s; }
.achtile .ico img { width: 58px; height: 58px; object-fit: contain; }
.achtile.earned { border-color: var(--ok); background: #12321c; }
.achtile.earned .ico { filter: none; }
.achtile.locked .ico { filter: none; opacity: .6; }
.achtile.locked .lbl { letter-spacing: .1em; }
.achtile .lbl { font-size: .72rem; color: var(--muted); margin-top: .25em; }
.achtile.earned .lbl { color: var(--text); }
.statbig { display: flex; justify-content: space-between; align-items: center; padding: .6em 0; border-bottom: 1px solid var(--line); font-size: 1.1rem; }
.statbig b { font-size: 1.7rem; }

/* Guild emblem voting (pictures upvoted like the name) */
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 1em 0 .6em; }
.picgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5em; margin-top: .5em; }
.pictile { position: relative; border-radius: 12px; overflow: hidden; border: 2px solid var(--line); aspect-ratio: 1; cursor: pointer; }
.pictile.mine { border-color: var(--ok); }
.pictile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pictile .pv { position: absolute; bottom: 0; left: 0; right: 0; background: #000a; color: #fff;
  font-size: .8rem; text-align: center; padding: .15em 0; }

/* Overlays (reveal popup + switch wizard) */
.overlay { position: fixed; inset: 0; background: rgba(6,8,12,.82); display: flex; align-items: center;
  justify-content: center; padding: 5vw; z-index: 50; }
.sheet { width: 100%; max-width: 460px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 1.4em 1.2em; }
.sheet h2 { font-size: 1.7rem; }
.sheet p { font-size: 1.1rem; }
.wizstep .choice { width: 100%; display: flex; align-items: center; gap: .7em; text-align: left;
  background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 12px;
  padding: .9em 1em; font-size: 1.2rem; font-weight: 650; margin-top: .55em; }
.wizstep .choice .cdot { width: 1.3em; height: 1.3em; border-radius: 50%; border: 1px solid rgba(128,128,128,.5); }
.warn { background: #3a1414; border: 1px solid var(--danger); border-radius: 12px; padding: .8em 1em;
  margin: .9em 0; font-size: 1.05rem; }
.chatlog { height: 52vh; }
.player .msg { font-size: 1.08rem; margin: .45em 0; }

/* Guild-color theming — the whole player app picks up the guild's color */
.player .header { background: color-mix(in srgb, var(--team) 16%, var(--bg)); border-bottom-color: color-mix(in srgb, var(--team) 45%, var(--line)); }
.player .bigbtn { background: var(--team); color: var(--team-ink); box-shadow: 0 3px 0 rgba(0,0,0,.4), inset 0 0 0 1px rgba(255,255,255,.14); }
.player .acc.open { border-color: color-mix(in srgb, var(--team) 50%, var(--line)); }
.player .acc.open > .acc-head { background: color-mix(in srgb, var(--team) 24%, var(--panel2)); }
.player .acc.open > .acc-head .chev { color: var(--text); }
.player .acc-body button:not(.met):not(.secondary):not(.ghost) { background: var(--team); color: var(--team-ink); box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.player .cooldown { border-color: color-mix(in srgb, var(--team) 45%, var(--line)); }

/* First-timer hints (auto-hide once the action is done) */
.hint { background: color-mix(in srgb, var(--team) 20%, var(--panel2));
  border: 1px solid color-mix(in srgb, var(--team) 45%, var(--line));
  border-radius: 10px; padding: .6em .8em; font-size: .98rem; margin-bottom: .75em; }

/* All-guilds list (identities only) */
.guildlist { display: flex; flex-direction: column; gap: .55em; }
.guildrow { display: flex; align-items: center; gap: .85em; padding: .6em .8em; border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.gimg { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.gimg.gph { background: rgba(255,255,255,.28); box-shadow: inset 0 0 0 1px rgba(0,0,0,.3); }
.gname { font-size: 1.25rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }

/* Winner banner */
.obj.win { background: linear-gradient(135deg, #6b4e00, #3a2e07); border-color: #f6c45388; text-align: center; font-size: 1.15rem; }
