:root {
    --bg: #0f1115; --panel: #181c24; --line: #2a3140;
    --ink: #e7ebf2; --muted: #8b94a7; --accent: #4f8cff;
    --ok: #2e7d32; --warn: #b26a00; --bad: #c2362f;
}
* { box-sizing: border-box; }
body {
    margin: 0; background: var(--bg); color: var(--ink);
    font: 15px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
.topbar {
    display: flex; align-items: center; gap: 1.5rem;
    padding: .6rem 1.2rem; background: var(--panel); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 1.15rem; margin: 0; }
.topbar nav { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.topbar nav a {
    color: var(--muted); text-decoration: none; padding: .35rem .7rem; border-radius: 6px;
}
.topbar nav a:hover { color: var(--ink); }
.topbar nav a.active { color: #fff; background: var(--accent); }
.navgroup { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; opacity: .7; }
.navsep { width: 1px; height: 1.2rem; background: var(--line); margin: 0 .5rem; }
main { padding: 1.2rem; max-width: 1200px; margin: 0 auto; }
h2 { margin-top: .2rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.msg { background: #16321c; border: 1px solid #2e7d32; padding: .5rem .8rem; border-radius: 6px; }

.card {
    background: var(--panel); border: 1px solid var(--line);
    padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem;
}
.row { display: flex; align-items: flex-end; gap: 1rem; }
.row.wrap { flex-wrap: wrap; }
label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
input, select {
    background: #0e1219; color: var(--ink); border: 1px solid var(--line);
    border-radius: 6px; padding: .4rem .5rem; font: inherit;
}
button {
    background: var(--accent); color: #fff; border: 0; border-radius: 6px;
    padding: .45rem .8rem; cursor: pointer; font: inherit;
}
button:hover { filter: brightness(1.1); }
button.danger { background: var(--bad); }
button.small { padding: .25rem .5rem; }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
button.ghost:hover { color: var(--ink); }
form.inline { display: inline-flex; align-items: center; gap: .25rem; margin: 0; }
form.inline.grow { flex: 1; }
.btnlink { display: inline-block; padding: .4rem .8rem; border-radius: 6px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; cursor: pointer; }
.btnlink:hover { background: var(--panel); }
.btnlink[hidden] { display: none; }
.btnlink.danger-outline { border-color: var(--bad); color: #ef8079; }
.btnlink.danger-outline:hover { background: rgba(194,54,47,.12); }

/* Photo field with cropper */
.photofield { display: flex; flex-direction: column; gap: .35rem; }
.photofield-row { display: flex; align-items: center; gap: .7rem; }
.photofield-btns { display: flex; flex-direction: column; gap: .4rem; }
.filebtn { margin: 0; }
.photofield #photoPreview { width: 56px; height: 56px; }

.cropmodal {
    position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.7); padding: 1rem;
}
.cropmodal[hidden] { display: none; }
.cropdialog {
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
    padding: 1rem; width: min(560px, 100%); display: flex; flex-direction: column; gap: .8rem;
}
.crophead { font-weight: 600; }
.cropstage { width: 100%; height: 60vh; max-height: 460px; background: #0e1219; border-radius: 8px; overflow: hidden; }
.cropstage img { display: block; max-width: 100%; }
.cropbar { display: flex; justify-content: flex-end; gap: .6rem; }
tr.editing { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Caught admin */
.catchgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.catchcard { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .7rem; display: flex; flex-direction: column; gap: .6rem; }
.catchhead { display: flex; align-items: center; gap: .6rem; }
.catchstatus { display: flex; align-items: center; gap: .6rem; }
.catchbtns { display: flex; gap: .5rem; }
.bigcatch { width: 100%; padding: .9rem; font-size: 1.05rem; font-weight: 700; background: var(--bad); }

/* Check-in cards */
.checkcard { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.checkcard[open] { outline: 2px solid var(--accent); outline-offset: -2px; }
.checkcard.done { border-color: #2e7d32; }
.checkcard.caughtout summary .who > div:first-child { opacity: .7; }
.checkcard summary {
    display: flex; align-items: center; gap: .7rem; padding: .7rem; cursor: pointer; list-style: none;
}
.checkcard summary::-webkit-details-marker { display: none; }
.checkcard summary:hover { background: rgba(255,255,255,.03); }
.checkcard .who { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.summaryline { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: .85rem; }
.ok-text { color: #7bd17f; }
.checkinpanel { display: flex; flex-direction: column; gap: .6rem; padding: 0 .7rem .5rem; border-top: 1px solid var(--line); }
.checkinpanel label { color: var(--muted); }
.checkinpanel input { width: 100%; }
.panelbtns { display: flex; gap: .5rem; }
.bigcheck { width: 100%; padding: .7rem; font-weight: 700; }
.undoform { padding: 0 .7rem .7rem; }
.sectionhead { margin: 1.4rem 0 .6rem; padding-bottom: .3rem; border-bottom: 2px solid var(--line); }
.sectionhead.done-head { color: #7bd17f; border-bottom-color: #2e7d32; }

/* Dashboard display font */
@font-face {
    font-family: 'Capture It';
    src: url('fonts/Capture it.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
body.dash { font-family: 'Capture It', system-ui, sans-serif; }

@font-face {
    font-family: 'Erika Ormig';
    src: url('fonts/Erika Ormig.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Big-screen dashboard */
.dashhead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.dashclock { font-family: 'Erika Ormig', monospace; font-variant-numeric: tabular-nums; font-weight: 800; line-height: 1; letter-spacing: .02em; font-size: clamp(2rem, 6vw, 5rem); }

/* Fill the viewport on the dashboard: iframe left, stat boxes right. */
body.dash { display: flex; flex-direction: column; min-height: 100vh; }
body.dash main { flex: 1 1 auto; display: flex; flex-direction: column; max-width: none; width: 100%; min-height: 0; }
body.dash .dashmain {
    flex: 1 1 auto; display: flex; gap: clamp(.8rem, 2vw, 1.6rem);
    min-height: 0; margin-top: clamp(.6rem, 2vh, 1.4rem);
}
.dashframe {
    flex: 1 1 auto; min-height: 0; align-self: stretch;
    border: 1px solid var(--line); border-radius: 16px; background: #0e1219;
}
iframe.dashframe { display: block; width: 100%; }
.dashframe-empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: clamp(1rem, 2vw, 1.4rem); text-align: center; }
.dashframe-empty code { background: rgba(255,255,255,.06); padding: .1rem .4rem; border-radius: 5px; }
.dashstats {
    flex: 0 0 clamp(220px, 24vw, 380px); display: flex; flex-direction: column;
    gap: clamp(.6rem, 1.5vw, 1.2rem); min-height: 0;
}
.dashstats .statcard { flex: 1 1 0; min-height: 0; }
.dashstats .statnum { font-family: 'Erika Ormig', monospace; font-size: clamp(2.5rem, 6vw, 6rem); }

/* Hide the fullscreen button once actually in fullscreen. */
:fullscreen .fsbtn, :-webkit-full-screen .fsbtn { display: none; }

.statcard {
    background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
    padding: clamp(.8rem, 2vh, 2rem) 1rem; text-align: center;
    border-top: 6px solid var(--line);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.statnum { font-size: clamp(3rem, 11vw, 9rem); font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.statlabel { margin-top: .5rem; font-size: clamp(.9rem, 2.2vw, 1.6rem); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat-ok     { border-top-color: var(--ok); }
.stat-ok     .statnum { color: #7bd17f; }
.stat-warn   { border-top-color: var(--warn); }
.stat-warn   .statnum { color: #e0a35a; }
.stat-bad    { border-top-color: var(--bad); }
.stat-bad    .statnum { color: #ef8079; }
.stat-accent { border-top-color: var(--accent); }
.stat-accent .statnum { color: #79a6ff; }
.stat-muted  .statnum { color: var(--muted); }
.stat-plain  .statnum { color: var(--ink); }

.dashbar {
    position: relative; height: clamp(2.4rem, 6vh, 4rem); background: var(--panel);
    border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.dashbar-fill { position: absolute; inset: 0 auto 0 0; background: rgba(79,140,255,.35); transition: width .6s ease; }
.dashbar-text {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: clamp(1rem, 2.6vw, 1.8rem); font-weight: 700;
}

table.grid { width: 100%; border-collapse: collapse; margin-bottom: 1rem; background: var(--panel); border-radius: 10px; overflow: hidden; }
.grid th, .grid td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; }
.grid th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.grid tr:last-child td { border-bottom: 0; }
.players td { vertical-align: middle; }
tr.caughtout { opacity: .65; }
.count { display: inline-block; min-width: 1.2rem; text-align: center; font-weight: 700; }

.avatar { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; display: block; background: #0e1219; border: 1px solid var(--line); }
.avatar.sm { width: 26px; height: 26px; border-radius: 6px; display: inline-block; vertical-align: middle; margin-right: .3rem; }
.avatar.placeholder { display: flex; align-items: center; justify-content: center; color: var(--muted); }
.photoform { margin-top: .25rem; }
.photoform input[type=file] { width: 90px; font-size: .7rem; color: var(--muted); }

.badge { padding: .15rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge.ok { background: rgba(46,125,50,.2); color: #7bd17f; }
.badge.warn { background: rgba(178,106,0,.22); color: #e0a35a; }
.badge.bad { background: rgba(194,54,47,.22); color: #ef8079; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 760px) { .cols { grid-template-columns: 1fr; } }
.teamhead { margin: 1rem 0 .4rem; border-left: 3px solid var(--accent); padding-left: .6rem; scroll-margin-top: 7rem; }

/* Team jump bar (sticky under the top nav) */
.teamjump {
    position: sticky; top: 0; z-index: 1000;
    display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
    padding: .5rem .2rem; margin: -.4rem 0 .8rem;
    background: var(--bg); border-bottom: 1px solid var(--line);
}
.teamjump a {
    color: var(--ink); text-decoration: none; background: var(--panel);
    border: 1px solid var(--line); border-radius: 999px; padding: .2rem .65rem; font-size: .85rem;
}
.teamjump a:hover { border-color: var(--accent); color: #fff; }
.chipcount { color: var(--muted); font-size: .78rem; margin-left: .15rem; }
.foot { color: var(--muted); padding: 1rem 1.2rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 1.5rem; font-size: .85rem; }
iframe {
    /* 1. Flips lightness values (white becomes black) */
    /* 2. Shifts the color wheel by 180 degrees to restore original hues */
    filter: invert(100%) hue-rotate(180deg);

    /* Optional: Improves performance and prevents rendering glitches */
    will-change: filter;
}