/* Teamroom. No inline styles (CSP). Every color comes from these tokens. */
:root{
  --bg:#0a0e15; --bg2:#0f141d; --card:#141a26; --line:#243042;
  --text:#eef1f6; --muted:#9aa4b5; --accent:#4da3ff; --accent2:#ffb02e; --ok:#3ddc97;
  /* Darker accent for button backgrounds, with --on-accent as text: at least 4.5:1 (WCAG AA). */
  --accent-strong:#1f6fd1; --on-accent:#fff;
  --danger:#ff6b6b; --danger-strong:#c7373a;
  --radius:4px; --max:1140px;
}
*{box-sizing:border-box;margin:0;padding:0}
@media (prefers-reduced-motion:reduce){*{transition:none!important}}
body{background:var(--bg);color:var(--text);font:16px/1.6 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;-webkit-font-smoothing:antialiased;min-height:100vh;display:flex;flex-direction:column}
main{flex:1}
main:focus{outline:none}
a{color:var(--accent)}
:focus-visible{outline:3px solid var(--accent2);outline-offset:3px;border-radius:4px}
.wrap{max-width:var(--max);margin:0 auto;padding:0 16px;width:100%}
.wrap.narrow{max-width:720px}
h1,h2,h3{line-height:1.2;letter-spacing:-.01em}
h1{font-size:clamp(1.35rem,3vw,1.75rem);margin-bottom:10px}
h2{font-size:1.05rem;margin-bottom:8px}
h3{font-size:.95rem;margin:14px 0 6px}
p.lead{color:var(--muted);font-size:1.1rem;max-width:62ch;margin-bottom:18px}
.note,.hint{color:var(--muted);font-size:.9rem}
.eyebrow{display:inline-block;font-size:.78rem;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--accent)}
.visually-hidden{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.skip{position:absolute;left:12px;top:-60px;z-index:200;background:var(--text);color:var(--bg);padding:10px 16px;border-radius:var(--radius);font-weight:700}
.skip:focus{top:12px}

header{position:sticky;top:0;z-index:50;background:var(--bg2);border-bottom:1px solid var(--line)}
.nav{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:60px}
.brand{display:flex;align-items:center;flex:none}
.brand img{display:block;width:auto;height:26px}
nav{display:flex;align-items:center;gap:14px}
header nav a,header nav button.link{white-space:nowrap;font-size:.92rem}
nav a{color:var(--muted);text-decoration:none;font-weight:500}
nav a:hover,nav a[aria-current="page"]{color:var(--text)}

.btn{display:inline-flex;align-items:center;border:0;cursor:pointer;font:inherit;font-weight:700;padding:10px 18px;border-radius:var(--radius);text-decoration:none}
.btn.small{padding:6px 12px;font-size:.92rem}
.btn.primary{background:var(--accent-strong);color:var(--on-accent)}
.btn.ghost{background:transparent;color:var(--text);border:1px solid var(--line)}
.btn.danger{background:var(--danger-strong);color:#fff}
.btn:hover{filter:brightness(1.12)}
button.link{background:none;border:0;font:inherit;color:var(--muted);text-decoration:underline;cursor:pointer}
button.link:hover{color:var(--text)}

.hero{padding:56px 0 36px}
.hero h1{font-size:clamp(1.6rem,4vw,2.2rem)}
.page{padding:40px 0 64px}
.flush{padding:0 0 64px}
.stack > * + *{margin-top:20px}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:16px;margin-top:16px}
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:20px}
.link-card{color:inherit;text-decoration:none;display:block}
.link-card:hover{border-color:var(--accent)}
.box{max-width:520px;margin:0 auto}
.row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.row.between{justify-content:space-between}
.row.end{align-items:flex-end}
.plain{list-style:none}
.plain li{padding:8px 0;border-top:1px solid var(--line)}
.plain li:first-child{border-top:0}
.back{color:var(--muted)}

.form{display:flex;flex-direction:column;gap:14px;margin-top:12px;max-width:640px}
.form.row{flex-direction:row}
.field{display:flex;flex-direction:column;gap:4px}
.field.check{flex-direction:row;align-items:flex-start;gap:10px}
label{font-weight:600}
.field.check label{font-weight:400}
input[type=text],input[type=number],select{font:inherit;color:var(--text);background:var(--bg2);border:1px solid var(--line);border-radius:var(--radius);padding:9px 12px;max-width:100%}
input[type=text]{width:100%}
.row input[type=text]{flex:1;width:auto;min-width:0}
input[aria-invalid="true"]{border-color:var(--danger)}

.flashes{padding-top:16px}
.alert{border:1px solid var(--line);border-left-width:4px;border-radius:var(--radius);padding:10px 14px;margin-bottom:10px;background:var(--card)}
.alert ul{margin:6px 0 0 18px}
.alert.success{border-left-color:var(--ok)}
.alert.error{border-left-color:var(--danger)}
.alert.info{border-left-color:var(--accent)}

.prose-card > * + *{margin-top:12px}
.prose-card ul{margin-left:20px}
.error-code{font-size:3rem;font-weight:800;color:var(--muted)}
.prose > * + *{margin-top:12px}
.debug{overflow:auto;background:var(--bg2);padding:12px;border-radius:var(--radius);font-size:.8rem}
.dev-login{margin-top:20px;padding-top:16px;border-top:1px dashed var(--line)}

footer{border-top:1px solid var(--line);margin-top:auto}
.footer{display:flex;flex-wrap:wrap;gap:12px 24px;align-items:center;justify-content:space-between;padding-top:18px;padding-bottom:18px;color:var(--muted);font-size:.9rem}
.version{opacity:.6;font-size:.8rem}

/* team navigation */
.tabs{display:flex;gap:4px;flex-wrap:wrap;border-bottom:1px solid var(--line)}
.tabs a{padding:8px 12px;color:var(--muted);text-decoration:none;font-weight:600;border-bottom:2px solid transparent;margin-bottom:-1px}
.tabs a:hover{color:var(--text)}
.tabs a[aria-current="page"]{color:var(--text);border-bottom-color:var(--accent)}

/* events */
.event{display:flex;gap:12px;justify-content:space-between;align-items:baseline;flex-wrap:wrap}
.event-type{font-size:.72rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--accent)}
textarea{font:inherit;color:var(--text);background:var(--bg2);border:1px solid var(--line);border-radius:var(--radius);padding:9px 12px;width:100%;min-height:90px}
input[type=date],input[type=time]{font:inherit;color:var(--text);background:var(--bg2);border:1px solid var(--line);border-radius:var(--radius);padding:9px 12px;color-scheme:dark}
.form-row{display:flex;gap:12px;flex-wrap:wrap}

/* availability */
.window{display:flex;gap:12px;justify-content:space-between;align-items:center;flex-wrap:wrap}
.window strong{font-variant-numeric:tabular-nums}
.day{padding:10px 0;border-top:1px solid var(--line)}
.day:first-of-type{border-top:0}
.day legend{float:left;font-weight:600;width:82px;padding-top:4px}
.day-fields{display:flex;gap:8px;flex-wrap:wrap;align-items:center;min-width:0}
fieldset{border:0;min-width:0}
.choice{display:inline-flex;align-items:center;gap:4px;font-weight:400;font-size:.92rem}
.day-fields select{padding:5px 6px}
.day-fields input[type=text]{flex:1 1 140px;width:auto;padding:5px 8px}
.day-error{clear:both;color:var(--danger);font-size:.9rem}
.table-scroll{overflow-x:auto}
.grid-table{border-collapse:collapse;font-size:.85rem;width:100%}
.grid-table th,.grid-table td{padding:6px 8px;border:1px solid var(--line);text-align:left;white-space:nowrap}
.grid-table th[scope=row]{position:sticky;left:0;background:var(--card)}
.av-yes{color:var(--ok)}
.av-maybe{color:var(--accent2)}
.av-no{color:var(--muted)}
.bottom-save{margin-top:12px}

@media (max-width:640px){
  .nav{gap:8px}
  header nav{gap:10px}
  header nav a,header nav button.link{font-size:.85rem}
  .day legend{float:none;width:auto;padding:0 0 4px}
  .day-fields input[type=text]{flex-basis:100%}
  .footer{flex-direction:column;align-items:flex-start}
}
@media (max-width:360px){
  header nav{gap:8px}
}

/* One height for all controls. Safari draws native selects with their own height,
   so they need appearance:none and their own arrow. */
:root{--control:38px}
input[type=text],input[type=number],input[type=date],input[type=time],select,.btn,.btn.small,
.day-fields select,.day-fields input[type=text]{height:var(--control);padding-top:0;padding-bottom:0;line-height:1.2}
select{-webkit-appearance:none;appearance:none;padding-left:10px;padding-right:26px;
  background-color:var(--bg2);background-repeat:no-repeat;background-position:right 8px center;background-size:10px 6px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239aa4b5' stroke-width='1.5'/%3E%3C/svg%3E")}
.day-fields select{padding-left:8px;padding-right:24px}
input[type=number]{width:80px}

/* map pool: every map keeps its color; the name is always written out */
.c0{--m:#b98cff}.c1{--m:#4fc3b0}.c2{--m:#4da3ff}.c3{--m:#ff6b6b}.c4{--m:#3ddc97}.c5{--m:#c9d1dc}.c6{--m:#ffb02e}.c7{--m:#ff8ac4}
.map-chip{display:inline-block;padding:2px 8px;border-left:3px solid var(--m);border-radius:var(--radius);background:color-mix(in srgb,var(--m) 16%,var(--card));font-weight:600;white-space:nowrap}
.pool,.ranking{list-style:none}
.pool li,.ranking li{padding:6px 0;border-top:1px solid var(--line)}
.pool li:first-child,.ranking li:first-child{border-top:0}
.pool-place{display:inline-block;min-width:36px;font-weight:700;font-size:.85rem;color:var(--muted)}
input.map-name{width:220px;flex:0 1 220px}
.js .rank-select{display:none}
@media (max-width:640px){
  .tabs{flex-wrap:nowrap;overflow-x:auto}
  .tabs a{white-space:nowrap;padding:8px 10px}
}

/* drag handle of the map ranking; only useful with JavaScript, the selects work without */
.rank-handle{display:none;width:32px;height:var(--control);flex:none;border:0;background:none;cursor:grab;touch-action:none;
  background-repeat:no-repeat;background-position:center;background-size:12px 18px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 18' fill='%239aa4b5'%3E%3Ccircle cx='3' cy='3' r='1.6'/%3E%3Ccircle cx='9' cy='3' r='1.6'/%3E%3Ccircle cx='3' cy='9' r='1.6'/%3E%3Ccircle cx='9' cy='9' r='1.6'/%3E%3Ccircle cx='3' cy='15' r='1.6'/%3E%3Ccircle cx='9' cy='15' r='1.6'/%3E%3C/svg%3E")}
.js .rank-handle{display:block}
.rank-handle:active{cursor:grabbing}
.ranking li.dragging{background:var(--bg2);outline:1px solid var(--accent);user-select:none;-webkit-user-select:none}

/* stratbook */
.pills{display:flex;gap:6px;flex-wrap:wrap}
.pills .map-chip{text-decoration:none;color:var(--text);padding:6px 12px}
.pills [aria-current="page"]{outline:2px solid var(--accent);outline-offset:-2px}
.strat h2 a{color:inherit;text-decoration:none}
.strat h2 a:hover{text-decoration:underline}
.strat > * + *{margin-top:8px}
.side,.status{font-size:.72rem;font-weight:700;padding:2px 7px;border:1px solid var(--line);border-radius:var(--radius)}
.side-t{color:var(--accent2)}
.side-ct{color:var(--accent)}
.status-ready{color:var(--ok);border-color:var(--ok)}
.status-archived{color:var(--muted)}
.my-task{border-left:3px solid var(--accent);background:var(--bg2);padding:8px 12px;border-radius:var(--radius)}
.my-task > * + *{margin-top:2px}
details summary{cursor:pointer;color:var(--muted);font-weight:600}
.tasks{margin-top:8px}
.tasks dt{font-size:.82rem;font-weight:700;color:var(--muted);margin-top:10px}
.tasks dd{margin:2px 0 0}
.setup-table{min-width:560px}
.setup-table th[scope=row]{width:44px}
.setup-row .field{flex:1 1 200px}
input[type=file]{font:inherit;color:var(--text)}

/* portraits: always square */
.portrait{display:inline-grid;place-items:center;aspect-ratio:1;object-fit:cover;flex:none;background:var(--bg2);border:1px solid var(--line);border-radius:var(--radius);color:var(--muted);font-weight:700}
.portrait.small{width:36px;height:36px;font-size:.9rem}
.portrait.large{width:100%;max-width:120px;font-size:2rem}
.portrait-note{flex:1 1 200px}
.roster{list-style:none;display:grid;grid-template-columns:repeat(auto-fill,minmax(104px,120px));gap:14px;margin-top:8px}
.roster li{display:flex;flex-direction:column;gap:6px;min-width:0}
.roster span:last-child{overflow-wrap:anywhere;font-weight:600;font-size:.92rem}

/* performance */
.grid-table td.below,.metric.below strong{color:var(--danger)}
.grid-table th a{color:inherit}
.metrics{display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:10px}
.metric{display:flex;flex-direction:column;gap:2px;padding:12px}
.metric strong{font-size:1.3rem;font-variant-numeric:tabular-nums}
.portrait.medium{width:72px;height:72px;font-size:1.5rem}
.metric-main{grid-column:span 2}
.metric-main strong{font-size:1.9rem}
@media (max-width:360px){
  .brand img{height:20px}
}

/* intensity: the number leads, the label says the level, the bar only supports them */
.intensity{display:flex;flex-direction:column;gap:4px;min-width:96px}
.intensity-head{display:flex;align-items:baseline;gap:6px}
.intensity-head strong{font-size:1.05rem;font-variant-numeric:tabular-nums}
.metric .intensity-head strong{font-size:1.3rem}
meter{-webkit-appearance:none;appearance:none;display:block;width:100%;height:6px;border:0;background:var(--line);border-radius:2px}
meter::-webkit-meter-bar{background:var(--line);border:0;border-radius:2px;height:6px}
meter::-webkit-meter-optimum-value{background:var(--ok);border-radius:2px}
meter::-webkit-meter-suboptimum-value{background:var(--accent2);border-radius:2px}
meter::-webkit-meter-even-less-good-value{background:var(--danger);border-radius:2px}
meter::-moz-meter-bar{background:var(--danger);border-radius:2px}
meter:-moz-meter-optimum::-moz-meter-bar{background:var(--ok)}
meter:-moz-meter-sub-optimum::-moz-meter-bar{background:var(--accent2)}

/* card headings: a dark band across the whole card */
.card > h2:first-child,
.card > .row.between:first-child{
  margin:-20px -20px 14px;padding:10px 20px;background:var(--bg2);border-bottom:1px solid var(--line);
  border-radius:calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}
.card > .row.between:first-child h2{margin:0}

/* wellbeing */
.mood-label{font-weight:600}
.mood-value{display:flex;align-items:center;gap:10px;flex:1 1 180px;max-width:320px}
.mood-value strong{font-variant-numeric:tabular-nums;min-width:30px}
.consent-list{margin:10px 0 0 20px}
.scale{padding:10px 0;border-top:1px solid var(--line)}
.scale:first-of-type{border-top:0}
.scale legend{float:left;width:100%;font-weight:600;margin-bottom:6px}
.scale-options{clear:both;display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.scale-option{position:relative;font-weight:600}
.scale-option input{position:absolute;opacity:0;width:100%;height:100%;margin:0;cursor:pointer}
.scale-option span{display:grid;place-items:center;width:var(--control);height:var(--control);border:1px solid var(--line);border-radius:var(--radius);background:var(--bg2)}
.scale-option input:checked + span{background:var(--accent-strong);border-color:var(--accent-strong);color:var(--on-accent)}
.scale-option input:focus-visible + span{outline:3px solid var(--accent2);outline-offset:2px}
@media (max-width:640px){
  .scale-option{flex:1 1 17%}
  .scale-option span{width:100%}
  .scale-options .note{order:2;flex:1 1 40%}
  .scale-options .note:last-child{text-align:right}
}

/* death diary: big targets, tapped next to a running game */
.tracker h2.reason-group{font-size:.8rem;color:var(--muted);letter-spacing:.06em;text-transform:uppercase;margin:12px 0 6px}
.reason-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:8px}
.reason{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:60px;padding:8px 12px;font:inherit;font-weight:600;color:var(--text);text-align:left;cursor:pointer;background:var(--card);border:1px solid var(--line);border-radius:var(--radius)}
.reason:hover{border-color:var(--accent)}
.reason:active{background:var(--accent-strong);color:var(--on-accent)}
.reason-count{font-variant-numeric:tabular-nums;color:var(--muted)}
.side-switch{display:flex;gap:8px}
.side-switch label{position:relative;flex:1;max-width:160px}
.side-switch input{position:absolute;opacity:0;inset:0;width:100%;height:100%;margin:0;cursor:pointer}
.side-switch span{display:grid;place-items:center;height:var(--control);border:1px solid var(--line);border-radius:var(--radius);background:var(--bg2);font-weight:700}
.side-switch input:checked + span{background:var(--accent-strong);border-color:var(--accent-strong);color:var(--on-accent)}
.side-switch input:focus-visible + span{outline:3px solid var(--accent2);outline-offset:2px}
.tracker-status{min-height:1.6em;color:var(--muted)}
.report li{display:flex;flex-direction:column;gap:4px}
meter.count-bar::-webkit-meter-optimum-value{background:var(--accent)}
meter.count-bar:-moz-meter-optimum::-moz-meter-bar{background:var(--accent)}
.pills + .note,.pills + .plain{margin-top:10px}
@media (max-width:640px){
  /* all twelve reasons on one screen, no scrolling during a game */
  .tracker{display:grid;grid-template-columns:1fr 1fr;gap:6px}
  .tracker .side-switch{grid-column:1 / -1}
  .side-switch label{max-width:none}
  .tracker h2.reason-group{display:none}
  .reason-grid{display:contents}
  .reason{min-height:58px;padding:6px 10px;font-size:.92rem}
}

/* events: answers and calendar */
.event-main{flex:1 1 260px;min-width:0}
.event-title{color:inherit}
.event-note{white-space:pre-line}
.response{display:flex;flex-direction:column;align-items:flex-start;gap:6px}
.response-buttons{display:flex;gap:6px;flex-wrap:wrap}
.response-buttons .btn{background:var(--bg2);color:var(--text);border:1px solid var(--line)}
.response-buttons .response-yes[aria-pressed="true"]{background:var(--ok);border-color:var(--ok);color:#04140c}
.response-buttons .response-maybe[aria-pressed="true"]{background:var(--accent2);border-color:var(--accent2);color:#1a1200}
.response-buttons .response-no[aria-pressed="true"]{background:var(--danger-strong);border-color:var(--danger-strong);color:#fff}
.attendance{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px}
.attendance h3{margin-top:0}
.calendar{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:1px;background:var(--line);border:1px solid var(--line)}
.calendar-head{background:var(--bg2);padding:6px;font-size:.8rem;font-weight:700;color:var(--muted);text-align:center}
.calendar-day{background:var(--card);min-height:96px;padding:4px;display:flex;flex-direction:column;gap:3px;min-width:0}
.calendar-day.outside{background:var(--bg);color:var(--muted)}
.calendar-day.today .calendar-date{background:var(--accent-strong);color:var(--on-accent)}
.calendar-date{align-self:flex-end;min-width:22px;text-align:center;font-size:.8rem;border-radius:var(--radius)}
.calendar-event{display:block;font-size:.76rem;line-height:1.3;padding:2px 4px;border-left:3px solid var(--accent);border-radius:2px;background:var(--bg2);color:var(--text);text-decoration:none;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.calendar-event.type-match{border-left-color:var(--accent2)}
.calendar-event.type-other{border-left-color:var(--muted)}
.calendar-event:hover{background:var(--line)}
@media (max-width:640px){
  .calendar-day{min-height:64px;padding:2px}
  .calendar-event{padding:1px 2px;font-size:.68rem;border-left-width:2px}
  .calendar-title{display:none}
}

/* who plays: name, then a mark that also differs in shape */
.event-players{list-style:none;min-width:190px}
.event-players li{display:flex;justify-content:space-between;gap:16px;padding:2px 0;font-size:.92rem}
.event-players .mark{width:1.2em;text-align:center;font-weight:800}
.player-yes .mark{color:var(--ok)}
.player-no .mark{color:var(--danger)}
.player-maybe .mark{color:var(--accent2)}
.player-open .mark,.player-open{color:var(--muted)}

/* proposed events: dashed, and always named */
.proposed-tag{font-size:.72rem;font-weight:700;padding:1px 6px;border:1px dashed var(--accent2);border-radius:var(--radius);color:var(--accent2);text-transform:none;letter-spacing:0}
.calendar-event.status-proposed{background:transparent;border:1px dashed var(--accent2);color:var(--muted)}

/* team header */
.team-head{display:flex;align-items:center;gap:14px;min-width:0}
.team-head h1{margin:0;text-transform:uppercase;letter-spacing:.04em;font-weight:800;overflow-wrap:anywhere}
.team-logo{flex:none;width:56px;height:56px;object-fit:contain;border-radius:var(--radius)}
.team-logo-empty{display:grid;place-items:center;background:var(--card);border:1px solid var(--line);color:var(--muted);font-size:1.5rem;font-weight:800}
@media (max-width:640px){
  .team-logo{width:44px;height:44px}
}

/* display font for the team heading, served from here so no visitor data goes elsewhere */
@font-face{font-family:"Cal Sans";src:url("fonts/Cal_Sans/CalSans-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:swap}
.team-head h1{font-family:"Cal Sans",system-ui,sans-serif;font-weight:400;letter-spacing:.03em}
