/* The Daily Grind: a LitRPG "System window" console. Single dark look on purpose; it's a game screen. */
:root {
  color-scheme: dark;
  --bg: #0a1022;
  --panel: #10193a;
  --panel-2: #16224a;
  --line: #26366a;
  --fg: #e3e9f7;
  --muted: #8f9cc0;
  --sys: #7cc9ff;
  --sys-dim: rgba(124, 201, 255, .10);
  --gold: #f3c45b;
  --gold-dim: rgba(243, 196, 91, .10);
  --hp: #ec6a77;
  --mp: #7f8fff;
  --ok: #6bd8a2;
  --foe: #f2935f;
  --xp: #ffa94d;
  --f-ui: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
  --f-story: 'Spectral', Georgia, 'Times New Roman', serif;
  --f-sys: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-ui);
  font-size: 15px;
  line-height: 1.45;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px 40px;
  background-image: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(124, 201, 255, .10), transparent 70%);
  min-height: 100vh;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--sys); outline-offset: 2px; }
[hidden] { display: none !important; }
.wrap { max-width: 1240px; margin: 0 auto; display: grid; gap: 18px; }

header.top {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px;
  border-bottom: 1px solid var(--line); padding-bottom: 14px;
}
.brand { display: grid; gap: 2px; }
.brand h1 { margin: 0; font-size: clamp(26px, 4vw, 38px); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; line-height: 1; }
.brand h1 span { color: var(--sys); }
.brand p { margin: 0; color: var(--muted); font-size: 14px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  font-family: var(--f-sys); font-size: 12px; padding: 6px 10px; border: 1px solid var(--line);
  border-radius: 4px; background: var(--panel); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.pill b { color: var(--sys); font-weight: 600; }
.pill.gold b { color: var(--gold); }

.cols { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 920px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.left, .right { display: grid; gap: 18px; min-width: 0; align-content: start; }

.win { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; min-width: 0; }
.win > h2 {
  margin: 0; padding: 9px 14px; font-family: var(--f-sys); font-size: 12px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--sys);
  border-bottom: 1px solid var(--line); background: var(--sys-dim);
  display: flex; justify-content: space-between; gap: 10px;
}
.win > h2 small { color: var(--muted); letter-spacing: .04em; font-weight: 400; text-transform: none; }
.pad { padding: 14px; display: grid; gap: 12px; }

/* Sign-in and pick-a-character screens */
.gate { max-width: 520px; margin: 8vh auto 0; }
.gate p { margin: 0; color: var(--muted); }
.field-row { display: flex; gap: 8px; flex-wrap: wrap; }
.field-row input { flex: 1 1 200px; }
input[type="text"], textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 9px 11px; min-width: 0;
}
textarea { width: 100%; resize: vertical; min-height: 70px; }
.choices { display: grid; gap: 8px; }
.choice {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 10px 12px;
  text-align: left; display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
}
.choice:hover { border-color: var(--sys); }
.choice small { color: var(--muted); }

/* Battlefield */
.field {
  display: grid; gap: 10px; padding: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-areas: "pb pf ef eb";
}
.zone { display: grid; align-content: start; gap: 8px; min-width: 0; }
.zone[data-z="pb"] { grid-area: pb; } .zone[data-z="pf"] { grid-area: pf; }
.zone[data-z="ef"] { grid-area: ef; } .zone[data-z="eb"] { grid-area: eb; }
.zone[data-z="pf"] { padding-right: 10px; border-right: 1px dashed var(--line); }
.zone h3 { margin: 0; font-family: var(--f-sys); font-size: 10.5px; font-weight: 400; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.zone.enemy h3 { color: var(--foe); opacity: .8; }
.empty { font-family: var(--f-sys); font-size: 11px; color: var(--muted); opacity: .6; padding: 8px 0; }
.units { display: grid; gap: 8px; }
@media (max-width: 640px) {
  .field { grid-template-columns: minmax(0, 1fr); grid-template-areas: "eb" "ef" "pf" "pb"; }
  .zone[data-z="pf"] { padding-right: 0; border-right: 0; padding-top: 10px; border-top: 1px dashed var(--line); }
  .units { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.unit {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 8px 9px;
  display: grid; gap: 4px; min-width: 0; text-align: left; width: 100%;
}
.unit.enemy { border-left: 3px solid var(--foe); }
.unit.party { border-left: 3px solid var(--sys); }
.unit.mine { box-shadow: 0 0 0 1px var(--sys); }
.unit.out { opacity: .38; filter: grayscale(.7); }
.unit.pickable { cursor: pointer; box-shadow: 0 0 0 1px var(--gold); }
.unit.pickable:hover { background: var(--gold-dim); }
.unit.picked { box-shadow: 0 0 0 2px var(--gold); background: var(--gold-dim); }
.u-top { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.u-top b { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-top span { font-family: var(--f-sys); font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.u-cls { font-size: 12px; color: var(--muted); line-height: 1.2; }
.u-cls i { font-style: normal; color: var(--sys); }
.bar { position: relative; height: 14px; background: rgba(0,0,0,.35); border-radius: 3px; overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; display: block; transition: width .5s ease; }
.bar.hp i { background: var(--hp); } .bar.mp i { background: var(--mp); }
.bar span { position: relative; font-family: var(--f-sys); font-size: 10px; line-height: 14px; padding-left: 5px; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px rgba(0,0,0,.8); }
.fx { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-family: var(--f-sys); font-size: 9.5px; padding: 1px 5px; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.good { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.chip.bad { color: var(--hp); border-color: color-mix(in srgb, var(--hp) 40%, transparent); }
.chip.seal { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }

/* Orders */
.hint { margin: 0; color: var(--muted); font-size: 13.5px; }
.hint b { color: var(--fg); font-weight: 600; }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.skill {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 8px 10px;
  text-align: left; display: grid; gap: 2px; align-content: start;
}
.skill:hover:not(:disabled) { border-color: var(--sys); }
.skill[aria-pressed="true"] { border-color: var(--sys); background: var(--sys-dim); }
.skill:disabled { opacity: .4; cursor: not-allowed; }
.skill .nm { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.skill .nm span { font-family: var(--f-sys); font-size: 11px; color: var(--mp); font-weight: 400; }
.skill .ds { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.skill .why { font-family: var(--f-sys); font-size: 10.5px; color: var(--hp); }
.targets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.targets > span { font-family: var(--f-sys); font-size: 11px; color: var(--muted); margin-right: 4px; }
.tgt { background: transparent; border: 1px solid var(--gold); color: var(--gold); border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.tgt[aria-pressed="true"] { background: var(--gold); color: var(--bg); font-weight: 600; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { border-radius: 5px; padding: 9px 16px; font-weight: 600; letter-spacing: .03em; border: 1px solid var(--sys); background: var(--sys); color: var(--bg); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--sys); }
.btn.gold { background: var(--gold); border-color: var(--gold); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.sealed {
  border: 1px dashed var(--gold); border-radius: 5px; padding: 12px; display: flex; flex-wrap: wrap;
  justify-content: space-between; align-items: center; gap: 10px; background: var(--gold-dim);
}
.sealed p { margin: 0; }
.sealed b { color: var(--gold); }
.party-status { display: flex; flex-wrap: wrap; gap: 6px; }
.roundbar { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.status { font-family: var(--f-sys); font-size: 12px; color: var(--muted); }
.status b { color: var(--fg); }
.notif { border: 1px solid var(--line); border-radius: 5px; padding: 10px 12px; background: var(--bg); font-family: var(--f-sys); font-size: 12px; display: grid; gap: 4px; }
.notif .lbl { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.notif .subj { color: var(--fg); font-weight: 600; }
.error { color: var(--hp); font-family: var(--f-sys); font-size: 12.5px; margin: 0; }
.end h3 { margin: 0; font-size: 24px; letter-spacing: .03em; }
.end.win h3 { color: var(--gold); } .end.lose h3 { color: var(--hp); }
.end ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
.lbl { font-family: var(--f-sys); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* Skills */
.skilltabs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.stab { background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; font-size: 13px; color: var(--muted); }
.stab[aria-pressed="true"] { border-color: var(--xp); color: var(--xp); }
.total { font-family: var(--f-sys); font-size: 12px; color: var(--muted); }
.total b { color: var(--xp); }
.sgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
@media (max-width: 420px) { .sgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stile { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; display: grid; gap: 4px; min-width: 0; }
.stile .top { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.stile .nm { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stile .lv { font-family: var(--f-sys); font-size: 13px; color: var(--xp); font-weight: 600; font-variant-numeric: tabular-nums; }
.stile .xpbar { height: 4px; background: rgba(0,0,0,.35); border-radius: 2px; overflow: hidden; }
.stile .xpbar i { display: block; height: 100%; background: var(--xp); }
.stile small { font-family: var(--f-sys); font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Suggestion box */
.sugg { display: grid; gap: 8px; }
.sugg-item { border: 1px solid var(--line); border-radius: 5px; padding: 8px 10px; display: grid; gap: 6px; background: var(--panel-2); }
.sugg-item p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.sugg-item .who { font-family: var(--f-sys); font-size: 11px; color: var(--muted); }
.sugg-item[data-status="done"] p, .sugg-item[data-status="nope"] p { opacity: .55; }
.sbtn { background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 12px; color: var(--muted); }
.sbtn[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.thanks { color: var(--ok); font-family: var(--f-sys); font-size: 12.5px; margin: 0; }

/* Recap */
.recap { padding: 6px 16px 16px; display: grid; gap: 4px; max-height: calc(100vh - 140px); overflow-y: auto; }
@media (max-width: 920px) { .recap { max-height: none; } }
details.rnd { border-bottom: 1px solid var(--line); padding: 10px 0; }
details.rnd:last-child { border-bottom: 0; }
details.rnd > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 700; font-size: 17px; letter-spacing: .02em; }
details.rnd > summary::-webkit-details-marker { display: none; }
details.rnd > summary small { font-family: var(--f-sys); font-size: 11px; color: var(--muted); font-weight: 400; text-align: right; }
.entries { display: grid; gap: 8px; padding-top: 8px; }
.narr { margin: 0; font-family: var(--f-story); font-size: 16px; line-height: 1.55; max-width: 65ch; }
.tag { display: inline-block; font-family: var(--f-sys); font-size: 11px; color: var(--sys); background: var(--sys-dim); border-radius: 3px; padding: 0 6px; margin-left: 4px; white-space: nowrap; vertical-align: 1px; font-variant-numeric: tabular-nums; }
.sub { font-family: var(--f-sys); font-size: 12px; color: var(--sys); padding-left: 14px; font-variant-numeric: tabular-nums; }
.sysbox { font-family: var(--f-sys); font-size: 12.5px; line-height: 1.5; color: var(--sys); border: 1px solid color-mix(in srgb, var(--sys) 45%, transparent); background: var(--sys-dim); border-radius: 4px; padding: 7px 10px; }
.sysbox::before { content: "SYSTEM ▸ "; opacity: .65; }
.titlebox { border: 1px solid var(--gold); background: var(--gold-dim); border-radius: 4px; padding: 8px 10px; display: grid; gap: 2px; font-family: var(--f-sys); font-size: 12.5px; }
.titlebox .lbl { font-size: 10px; letter-spacing: .14em; color: var(--gold); opacity: .8; }
.titlebox b { color: var(--gold); font-size: 14px; }
.titlebox small { color: var(--muted); }
.xpdrop { font-family: var(--f-sys); font-size: 11.5px; display: flex; flex-wrap: wrap; gap: 4px 10px; padding-left: 14px; color: var(--muted); }
.xpdrop .x { color: var(--xp); font-variant-numeric: tabular-nums; }
.lvlup { font-family: var(--f-sys); font-size: 12.5px; border: 1px solid var(--xp); background: color-mix(in srgb, var(--xp) 10%, transparent); color: var(--xp); border-radius: 4px; padding: 7px 10px; }
.lvlup b { color: var(--fg); }

footer { color: var(--muted); font-size: 12.5px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
footer button { background: none; border: 0; color: var(--sys); text-decoration: underline; padding: 0; }
@media (prefers-reduced-motion: reduce) { .bar i { transition: none; } }
