/* Concrete and line paint: cool greys, one road-marking blue for what you can act on,
   medal metals for the ranks, hazard hatching for what is locked. */
:root {
  --concrete: #d9dde0;
  --slab: #f4f5f6;
  --slab-2: #e9ecee;
  --line: #b9c0c6;
  --ink: #14181c;
  --ink-2: #4c565f;
  --paint: #1846e0;
  --paint-soft: #dfe6fd;
  --bronze: #a8632f;
  --silver: #7f8b96;
  --gold: #c99700;
  --warn: #b3261e;
  --ok: #1d7a46;
  --radius: 3px;
  font-family: "Archivo", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--concrete); }
#app { height: 100%; display: flex; flex-direction: column; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--paint); outline-offset: 1px; }
h1, h2, h3 { margin: 0; font-stretch: 80%; font-weight: 700; letter-spacing: 0; }
h2 { font-size: 22px; line-height: 1.15; }
h3 { font-size: 15px; margin: 22px 0 8px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }

/* ---- controls */
button {
  background: var(--slab); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 5px 10px; cursor: pointer;
}
button:hover { border-color: var(--ink-2); }
button.primary { background: var(--paint); border-color: var(--paint); color: #fff; font-weight: 600; }
button.primary:disabled { background: var(--line); border-color: var(--line); cursor: default; }
button.quiet { background: none; border-color: transparent; color: var(--paint); padding: 3px 6px; }
button.quiet:hover { background: var(--paint-soft); }
button.danger { color: var(--warn); }
input[type=text], input[type=number], input[type=password], input[type=search], select {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 6px; min-width: 0;
}
input[type=number] { width: 84px; text-align: right; font-variant-numeric: tabular-nums; }
label.check { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }

/* ---- top bar */
.bar {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  background: var(--ink); color: #fff; flex: none;
}
.bar .name { font-stretch: 70%; font-weight: 800; font-size: 19px; margin-right: 6px; }
.bar select, .bar button { background: #262c32; border-color: #3a434c; color: #fff; }
.bar button.primary { background: var(--paint); border-color: var(--paint); }
.bar button.primary:disabled { background: #3a434c; border-color: #3a434c; color: #8b959e; }
.bar .grow { flex: 1; }
.bar .state { font-size: 12px; color: #aab3bb; }
.bar .state.dirty { color: #ffd34d; }
.tabs { display: flex; gap: 2px; margin-left: 10px; }
.tabs button { border: 0; background: none; color: #aab3bb; padding: 6px 12px; border-radius: var(--radius); }
.tabs button.on { background: #fff; color: var(--ink); font-weight: 700; }

/* ---- layout */
.work { flex: 1; display: flex; min-height: 0; }
.list { width: 320px; flex: none; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--slab-2); }
.list .tools { padding: 10px; display: flex; gap: 6px; border-bottom: 1px solid var(--line); }
.list .tools input { flex: 1; }
.list .rows { overflow: auto; flex: 1; }
.group { padding: 10px 12px 4px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.row {
  display: flex; align-items: baseline; gap: 8px; padding: 6px 12px; cursor: pointer;
  border-left: 4px solid transparent;
}
.row:hover { background: var(--slab); }
.row.on { background: #fff; border-left-color: var(--paint); }
.row .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .n { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.detail { flex: 1; overflow: auto; padding: 20px 26px 60px; background: var(--slab); min-width: 0; }
.detail .lede { color: var(--ink-2); max-width: 70ch; margin: 4px 0 0; }
.note { background: #fff6d6; border-left: 4px solid var(--gold); padding: 6px 10px; margin: 10px 0; max-width: 78ch; }
.empty { color: var(--ink-2); padding: 40px 0; max-width: 56ch; }

/* ---- tables of medals and sub goals */
table.grid { border-collapse: collapse; width: 100%; max-width: 1100px; }
table.grid th { text-align: left; font-weight: 600; font-size: 12px; color: var(--ink-2); padding: 4px 8px; border-bottom: 1px solid var(--line); }
table.grid td { padding: 7px 8px; border-bottom: 1px solid var(--slab-2); vertical-align: top; }
.medal { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.medal::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--ink-2); }
.medal.Easy::before, .medal.Bronze::before { background: var(--bronze); }
.medal.Medium::before, .medal.Silver::before { background: var(--silver); }
.medal.Hard::before, .medal.Gold::before { background: var(--gold); }

/* ---- reward chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 2px 4px 2px 6px; max-width: 100%;
}
.chip img, .chip .sw { width: 26px; height: 26px; object-fit: cover; border-radius: 2px; background: var(--slab-2); flex: none; }
.chip .k { font-size: 12px; color: var(--ink-2); }
.chip input[type=number] { width: 64px; padding: 2px 4px; }
.chip input[type=text] { width: 150px; padding: 2px 4px; }
.chip .x { border: 0; background: none; padding: 0 4px; color: var(--ink-2); font-size: 15px; line-height: 1; }
.chip .x:hover { color: var(--warn); }
.chip.secret { border-style: dashed; }
.chip.bad { border-color: var(--warn); color: var(--warn); }

/* ---- conditions */
.checks { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.checkline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 6px; }
.checkline select { max-width: 320px; }

/* ---- item wall */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.tile {
  position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0; cursor: pointer; text-align: left; overflow: hidden; display: flex; flex-direction: column;
}
.tile .pic { aspect-ratio: 1; background: var(--slab-2) center/cover no-repeat; display: block; width: 100%; }
.tile .cap { padding: 4px 6px 5px; font-size: 12px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.on { outline: 3px solid var(--paint); outline-offset: -1px; }
/* Locked: hazard hatching over the picture and the medal that opens it in the corner. */
.tile.locked .pic::after {
  content: ""; position: absolute; inset: 0 0 auto 0; aspect-ratio: 1;
  background: repeating-linear-gradient(135deg, rgba(20,24,28,.0) 0 9px, rgba(20,24,28,.34) 9px 12px);
}
.tile .tagline { position: absolute; left: 4px; top: 4px; background: var(--ink); color: #fff; font-size: 11px; padding: 1px 5px; border-radius: 2px; max-width: calc(100% - 8px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side { width: 360px; flex: none; border-left: 1px solid var(--line); background: var(--slab-2); overflow: auto; padding: 16px; }
.side h3:first-child { margin-top: 0; }
.source { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 5px 8px; margin-bottom: 6px; }
.source .t { flex: 1; min-width: 0; }
.source a { color: var(--paint); cursor: pointer; text-decoration: underline; }
.field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.field > span { font-size: 12px; color: var(--ink-2); }
.filters { display: flex; gap: 6px; align-items: center; margin: 0 0 12px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: #fff; }
.seg button.on { background: var(--ink); color: #fff; }

/* ---- overlays */
.veil { position: fixed; inset: 0; background: rgba(20,24,28,.55); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 10; }
.sheet { background: var(--slab); border-radius: 4px; width: min(880px, 100%); max-height: 86vh; display: flex; flex-direction: column; }
.sheet header { padding: 12px 16px; display: flex; gap: 8px; align-items: center; border-bottom: 1px solid var(--line); }
.sheet header input { flex: 1; }
.sheet .body { padding: 14px 16px; overflow: auto; }
.login { margin: 12vh auto 0; width: min(360px, 92vw); background: var(--slab); padding: 24px; border-radius: 4px; }
.login h1 { font-size: 30px; font-stretch: 68%; font-weight: 800; line-height: 1; margin-bottom: 6px; }
.login .field input { width: 100%; padding: 7px 8px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 8px 14px; border-radius: var(--radius); z-index: 20; max-width: 90vw; }
.toast.bad { background: var(--warn); }

@media (max-width: 900px) {
  .work { flex-direction: column; overflow: auto; }
  .list, .side { width: auto; border: 0; border-bottom: 1px solid var(--line); max-height: 40vh; }
  .detail { overflow: visible; }
  .bar { flex-wrap: wrap; }
}

/* Nothing in the bar or a target cell breaks over two lines. */
.bar button, .bar .state, .tabs button { white-space: nowrap; }
.bar .state { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
table.grid td:nth-child(2) { white-space: nowrap; }
.bar .state.num { flex: none; }

/* ---- sections of the left column: one colour per mission type (or kind of table) */
.sect { --type: var(--ink-2); border-left: 5px solid var(--type); margin: 0 0 10px; background: var(--slab); }
.sect:first-child { margin-top: 0; }
.sect .group {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: baseline; gap: 8px;
  padding: 7px 12px 6px 10px; font-size: 13px; font-weight: 700; font-stretch: 85%;
  color: #fff; background: var(--type);
}
.sect .group .t { flex: 1; }
.sect .group .n { color: rgba(255,255,255,.8); font-weight: 500; font-variant-numeric: tabular-nums; }
.sect .row { border-left: 0; padding-left: 10px; border-bottom: 1px solid var(--slab-2); }
.sect .row:hover { background: #fff; }
.sect .row.on { background: #fff; font-weight: 700; box-shadow: inset 0 0 0 2px var(--type); }
.list .rows { padding: 10px 10px 10px 10px; }

/* ---- overview: one column per step of the unlock order */
.board { flex: 1; min-width: 0; overflow: auto; display: flex; align-items: flex-start; gap: 10px; padding: 16px; background: var(--concrete); }
.col { flex: none; width: 196px; background: var(--slab-2); border-radius: var(--radius); padding: 0 6px 6px; min-height: 120px; }
.col.off { background: repeating-linear-gradient(135deg, var(--slab-2) 0 9px, #dcdfe2 9px 12px); }
.colhead { position: sticky; top: -16px; z-index: 1; background: inherit; padding: 8px 4px 8px; display: grid; grid-template-columns: 1fr auto; gap: 0 6px; }
.col.off .colhead { background: var(--slab-2); }
.colhead .small { grid-column: 1 / 3; }
.colhead .t { font-weight: 700; font-stretch: 85%; line-height: 1.2; }
.colhead .n { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.card {
  --type: var(--ink-2); display: flex; flex-direction: column; gap: 1px; background: #fff;
  border: 1px solid var(--line); border-left: 5px solid var(--type); border-radius: var(--radius);
  padding: 5px 7px 6px; margin-top: 5px; cursor: pointer; user-select: none;
}
.card[draggable=true] { cursor: grab; }
.card .t { font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.card .meta { font-size: 11px; color: var(--ink-2); line-height: 1.25; }
.card:hover { border-color: var(--ink-2); border-left-color: var(--type); }
.card.on { outline: 3px solid var(--paint); outline-offset: 0; }
.card.need { outline: 2px solid var(--ink); }
.card.next { outline: 2px dashed var(--paint); }
.card.far { opacity: .32; }
.card.need::after, .card.next::after { font-size: 11px; font-weight: 700; margin-top: 2px; }
.card.need::after { content: "needed first"; color: var(--ink); }
.card.next::after { content: "opens next"; color: var(--paint); }
.card.drop { outline: 3px solid var(--ok); background: #e3f4ea; }
.col.drop { outline: 3px solid var(--ok); }
.legend { --type: var(--ink-2); border-left: 5px solid var(--type); padding: 2px 8px; margin-bottom: 4px; background: #fff; }
@media (max-width: 900px) { .board { min-height: 60vh; } }

/* ---- a mission that lacks something: red mark in the lists, on the cards and in its page */
.err {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 16px; height: 16px;
  border-radius: 50%; background: var(--warn); color: #fff; font-size: 12px; font-weight: 800; line-height: 1;
}
.row .err { align-self: center; }
.card .t .err { float: right; margin-left: 4px; }
.note.bad { background: #fde7e5; border-left-color: var(--warn); }

/* ---- what a medal pays: values on one line, unlocked items as small pictures under it */
.pays { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.addsel { color: var(--paint); border-color: transparent; background: none; padding: 3px 2px; cursor: pointer; }
.addsel:hover { background: var(--paint-soft); }
.unlocks { display: flex; flex-wrap: wrap; gap: 6px; }
.unlock {
  position: relative; width: 92px; display: flex; flex-direction: column; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; padding: 0 0 4px;
}
.unlock .pic { width: 100%; aspect-ratio: 1; background: var(--slab-2) center/cover no-repeat; }
.unlock .name { font-size: 12px; font-weight: 600; line-height: 1.2; padding: 4px 5px 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.unlock .from { font-size: 11px; color: var(--ink-2); padding: 1px 5px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unlock label.from { gap: 4px; padding-top: 3px; overflow: visible; }
.unlock label.from input { margin: 0; }
.unlock .x {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(20,24,28,.72); color: #fff; font-size: 14px; line-height: 1; opacity: 0;
}
.unlock:hover .x, .unlock .x:focus-visible { opacity: 1; }
.unlock .x:hover { background: var(--warn); }
.unlock.secret { border-style: dashed; border-color: var(--ink-2); }
.unlock.bad { border-color: var(--warn); }
.unlock.bad .name { color: var(--warn); }
.unlock.add {
  align-items: center; justify-content: center; gap: 4px; padding: 8px 6px; min-height: 92px; cursor: pointer;
  border-style: dashed; background: none; color: var(--paint); font-size: 12px; text-align: center; line-height: 1.2;
}
.unlock.add:hover { background: var(--paint-soft); border-color: var(--paint); }
.unlock.add .plus { font-size: 22px; line-height: 1; }
table.grid td { padding-top: 10px; padding-bottom: 10px; }
table.grid tr + tr td { border-top: 1px solid var(--line); border-bottom: 0; }
.addsel { width: auto; max-width: 190px; }
.unlock.add { width: 72px; }
.tag { margin-left: 8px; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 2px; background: var(--slab-2); color: var(--ink-2); }
.tag.net { background: var(--paint-soft); color: var(--paint); }

/* ---- what a sub goal asks */
.asks { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.ask { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ask.bad select, .ask.bad b { color: var(--warn); border-color: var(--warn); }
.tag.new { background: #fff6d6; color: #7a5a00; }
table.grid td:nth-child(2) { white-space: normal; }
table.grid td:first-child { min-width: 150px; }
table.grid td label.check.small { margin: 3px 12px 0 0; }

/* ---- Style Points: the player's portfolio, so they never look like one more number */
.spname { background: var(--ink); color: #ffd43b; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 2px; white-space: nowrap; }
.chip.sp { border-color: var(--ink); border-width: 2px; padding-left: 3px; }
.chip.sp input[type=number] { font-weight: 700; }
.spadd { background: var(--ink); color: #ffd43b; border-color: var(--ink); font-weight: 700; padding: 3px 9px; }
.spadd:hover { background: #2b333b; }
.row .spn { align-self: center; margin-right: 6px; background: var(--ink); color: #ffd43b; font-size: 11px; font-weight: 700; padding: 0 5px; border-radius: 2px; }
.totals { margin: 6px 0 0; }

/* ---- statistics */
.stats { max-width: 1180px; }
.stats h3 .spname { font-size: 13px; vertical-align: 2px; }
.stats h4 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.statrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin: 14px 0 6px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.stat .v { font-size: 30px; font-weight: 700; line-height: 1.1; }
.stat .l { font-weight: 600; }
.stat .s { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.stat.sp { background: var(--ink); border-color: var(--ink); color: #fff; }
.stat.sp .v { color: #ffd43b; }
.stat.sp .s { color: #c3cad1; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px 32px; }
.bars { display: flex; flex-direction: column; gap: 5px; }
.barrow { display: grid; grid-template-columns: 170px 1fr 70px; gap: 8px; align-items: center; }
.barrow .lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barrow .track { height: 14px; border-left: 1px solid var(--line); }
.barrow .fill { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.barrow .fill.xp { background: var(--paint); }
.barrow .fill.sp { background: var(--ink); }
.barrow:hover .lab { font-weight: 600; }
.barrow .val { text-align: right; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
table.grid.tight td { padding-top: 5px; padding-bottom: 5px; }
table.grid.tight td.num, table.grid.tight th:not(:first-child) { text-align: right; }
table.grid.tight td:nth-child(2) { white-space: nowrap; }
table.grid.tight tr.nosp td { background: #fff6d6; }
.warnText { color: var(--warn); }
.stat.short .v { color: var(--warn); }

/* ---- a price in Style Points */
input.price { width: 76px; font-weight: 700; text-align: right; }
.pricebox { display: flex; align-items: center; gap: 8px; margin: 2px 0 6px; }
.tile .tagline.price { color: #ffd43b; font-weight: 700; }
.source .spname { vertical-align: 1px; }

/* ---- team notes on a mission: for the people making the game, never in it */
.teamnote { width: 100%; max-width: 75ch; display: block; font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: #fffbe6; resize: vertical; }
.row .noted { align-self: center; margin-right: 6px; font-size: 11px; padding: 0 5px; border-radius: 2px; background: #fff6d6; color: #7a5a00; }

/* ---- variant, and the road from a change to the game */
.flow { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--slab); border-bottom: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.flow .grow { flex: 1; }
.flow .pick { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--ink-2); margin-right: 8px; }
.flow .pick select { font-size: 14px; font-weight: 600; }
.flow .step { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.flow .step i { font-style: normal; font-weight: 700; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--slab-2); color: var(--ink-2); }
.flow .step div { display: flex; flex-direction: column; line-height: 1.25; }
.flow .step span { font-size: 12px; color: var(--ink-2); }
.flow .step.done i { background: var(--ok); color: #fff; }
.flow .step.now { border-color: var(--paint); box-shadow: inset 3px 0 0 var(--paint); }
.flow .step.now i { background: var(--paint); color: #fff; }
.flow .step.wait { opacity: .55; }
.flow .arrow { color: var(--ink-2); }
.flow .extras { display: flex; gap: 6px; }
.flow .extras button { font-size: 12px; }
