/* Team page: the whole game fits one laptop screen and scales up with it (sizes are rem, see app.css). */
html, body { height: 100%; }
body { display: grid; grid-template-rows: auto auto minmax(0, 1fr); height: 100dvh; overflow: hidden; }

/* ---------- top bar: who / where in the round / time ---------- */
.bar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 1.5rem; padding: .7rem 1.5rem; border-bottom: 1.5px solid var(--ink); }
.bar .who { display: grid; line-height: 1.1; min-width: 0; }
.bar .who b { font-stretch: 72%; font-weight: 800; font-size: 1.5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .who span { font-size: .8125rem; color: var(--ink-3); }
.bar .right { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; }
.bar .rnd { text-align: right; line-height: 1.15; font-size: .875rem; color: var(--ink-3); }
.bar .rnd b { display: block; color: var(--ink); font-stretch: 72%; font-size: 1.0625rem; }
.bar .clock { font-size: 2.6rem; min-width: 4.3ch; text-align: right; }

/* ---------- "what to do now" strip: one plain sentence, coloured by step ---------- */
.nowbar { display: flex; align-items: center; gap: .75rem; padding: .55rem 1.5rem; font-weight: 600; font-size: 1.0625rem; background: var(--rule-2); color: var(--ink); }
.nowbar b { font-stretch: 72%; font-weight: 800; }
.nowbar.buying { background: var(--red); color: #fff; }
.nowbar.disputes { background: var(--hivis); color: #fff; }
.nowbar.revealed, .nowbar.finished { background: var(--green-soft); color: var(--green); }

main { min-height: 0; padding: 1.1rem 1.5rem 1.25rem; }

/* ---------- join + waiting ---------- */
.join { height: 100%; display: grid; align-content: center; justify-items: start; gap: 1.6rem; max-width: 36rem; margin: 0 auto; }
.join h1 { font-stretch: 62%; font-weight: 850; font-size: 5rem; line-height: .86; }
.join .lede { font-family: var(--f-brief); font-size: 1.1875rem; line-height: 1.55; color: var(--ink-2); max-width: 44ch; }
.join form { display: flex; gap: .6rem; width: 100%; flex-wrap: wrap; }
.join .code-input { flex: 1 1 12rem; min-height: 3.5rem; font-stretch: 72%; font-weight: 750; font-size: 1.75rem; letter-spacing: .18em; text-transform: uppercase; text-align: center; border: 2px solid var(--ink); border-radius: var(--r-s); background: var(--sheet); }
.join .name-input { letter-spacing: .02em; text-transform: none; font-size: 1.5rem; }
.join .joinopt { display: grid; gap: .6rem; width: 100%; }
.join .joinopt h2 { font-size: 1.25rem; }
.join .joinor { width: 100%; display: flex; align-items: center; gap: .8rem; color: var(--ink-3); font-size: .875rem; }
.join .joinor::before, .join .joinor::after { content: ''; flex: 1; border-top: 1px solid var(--rule); }
.hold { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3rem; align-items: center; max-width: 72rem; margin: 0 auto; }
.hold h1 { font-stretch: 62%; font-weight: 850; font-size: 4.5rem; line-height: .88; margin-bottom: 1rem; }
.hold .lede { font-family: var(--f-brief); font-size: 1.125rem; line-height: 1.6; color: var(--ink-2); max-width: 52ch; }

/* ---------- the desk: brief | price list | worksheet ---------- */
.desk { height: 100%; display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 2fr) minmax(16.5rem, .8fr); gap: 1.5rem; min-height: 0; }
.desk > * { min-height: 0; }

.brief { overflow: auto; padding-right: .5rem; font-family: var(--f-brief); scrollbar-width: thin; }
.brief .k { font-family: var(--f-ui); font-size: .875rem; color: var(--ink-3); margin-bottom: .3rem; }
.brief h1 { font-family: var(--f-ui); font-stretch: 62%; font-weight: 850; font-size: 2.6rem; line-height: .9; margin-bottom: .8rem; }
.brief .story { font-size: 1rem; line-height: 1.55; }
.brief h3 { font-family: var(--f-ui); font-size: .9375rem; margin: 1rem 0 .4rem; }
.brief ul { margin: 0; padding-left: 1.05em; display: grid; gap: .4rem; font-size: .9375rem; line-height: 1.5; }

.shop { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: .5rem; }
.shop-h { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.shop-h h2 { font-size: 1.0625rem; }
.shop-h span { font-size: .8125rem; color: var(--ink-3); }

/* the price list is one ruled panel of switches, not a pile of cards */
.tiles {
  display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr);
  border-top: 1.5px solid var(--ink); border-left: 1px solid var(--rule);
}
.tile {
  container-type: size; position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; column-gap: .65rem;
  align-items: start; text-align: left; padding: .6rem .7rem .5rem; min-height: 0; overflow: hidden;
  border: 0; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--sheet); cursor: pointer;
}
.tile .ico { grid-row: 1 / 3; width: clamp(2.4rem, min(66cqh, 30cqw), 6rem); height: clamp(2.4rem, min(66cqh, 30cqw), 6rem); align-self: center; }
.tile .nm { font-size: clamp(.875rem, 15cqh, 1.25rem) !important; }
.tile .pr { font-size: clamp(1.35rem, 24cqh, 2.4rem) !important; }
.tile .nm { font-weight: 650; font-size: .9375rem; line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .ft { display: flex; align-items: center; gap: .4rem; }
.tile .ft .cd { margin-right: auto; }
.tile .cd { font-size: .75rem; color: var(--ink-3); font-stretch: 72%; font-weight: 700; letter-spacing: .03em; }
.tile .pr { font-stretch: 62%; font-weight: 850; font-size: 1.5rem; line-height: 1; }
.tile .mk {
  width: 1.35rem; height: 1.35rem; flex: none; border-radius: 50%;
  display: grid; place-items: center; border: 1.5px solid var(--ink-3); color: var(--ink-2); font-weight: 700; font-size: .9rem; line-height: 1;
}
.tile:hover:not(:disabled):not(.on) { background: color-mix(in srgb, var(--ink) 6%, var(--sheet)); }
.tile.on:hover:not(:disabled) { background: #333333; }
.tile:hover:not(:disabled):not(.on) .mk { border-color: var(--ink); color: var(--ink); }
.tile.on { background: var(--ink); color: var(--paper); }
.tile.on .cd { color: var(--paper); opacity: .75; }
.tile.on .mk { background: var(--red); border-color: var(--red); color: #fff; }
.tile.on .ico .on-light { display: none; }
.tile.on .ico .on-dark { display: block; }
.tile:disabled { cursor: not-allowed; }
.tile.cant { color: var(--ink-3); }
.tile.cant .ico { opacity: .4; }
.tile.cant .pr { text-decoration: line-through; text-decoration-thickness: 2px; }
.tile.cant .mk { visibility: hidden; }
.tiles.locked .tile:not(.on) { color: var(--ink-3); }
.tiles.locked .tile:not(.on) .ico { opacity: .45; }
.tiles:is(.locked, .briefing) .mk { display: none; }

/* worksheet */
.sheet { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; gap: .85rem; padding: 1rem; background: var(--sheet); border: 1.5px solid var(--ink); border-radius: var(--r-m); }
.sheet h2 { font-size: 1.0625rem; }
.lines { min-height: 5.5rem; overflow: auto; display: grid; align-content: start; gap: .25rem; scrollbar-width: thin; }
.lines .empty { color: var(--ink-3); font-size: .9375rem; padding: .75rem 0; }
.line { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: .55rem; align-items: center; padding: .3rem .35rem; border-radius: var(--r-s); background: var(--paper); }
.line .ico { width: 2.1rem; height: 2.1rem; }
.line .nm { font-size: .875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line .pr { font-stretch: 72%; font-weight: 750; }
.line .x { border: 0; background: transparent; width: 1.75rem; height: 1.75rem; border-radius: var(--r-s); cursor: pointer; font-size: 1.1rem; color: var(--ink-3); }
.line .x:hover { background: var(--red-soft); color: var(--red); }
.foot { display: grid; gap: .6rem; }
.foot .btn-big { width: 100%; }
.stamp { display: flex; gap: .6rem; align-items: center; padding: .65rem .8rem; border-radius: var(--r-s); background: var(--green-soft); color: var(--green); font-weight: 600; }
.strip { display: flex; flex-wrap: wrap; gap: .3rem; font-size: .75rem; }
.foot .note { font-size: .75rem; color: var(--ink-3); }

/* ---------- results: three full-height columns, lists stretch to fill ---------- */
.results { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: .8rem; }
.res-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(16rem, .9fr); gap: 1.75rem; min-height: 0; }
.res-cols > section { display: flex; flex-direction: column; min-height: 0; }
.res-cols h2 { font-size: 1.125rem; margin-bottom: .4rem; }
.res-cols .note { font-size: .8125rem; color: var(--ink-3); margin-top: .5rem; }
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: .35rem .7rem; border-radius: var(--r-s); cursor: pointer; font-weight: 600; color: var(--ink-3); }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.hero { display: flex; align-items: flex-end; gap: 1.25rem; padding-bottom: .8rem; border-bottom: 1.5px solid var(--ink); margin-bottom: .6rem; }
.hero .big { font-stretch: 62%; font-weight: 850; font-size: 6rem; line-height: .8; color: var(--green); }
.hero .meta { display: grid; gap: .1rem; padding-bottom: .3rem; font-size: .9375rem; }
.hero .meta b { font-size: 1.125rem; }

/* a list that fills its column: the row count is set inline so columns line up */
.fill-list { flex: 1; min-height: 0; display: grid; grid-auto-rows: minmax(2.5rem, 1fr); border-top: 1.5px solid var(--ink); }
.rl { container-type: size; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .8rem; align-items: center; border-bottom: 1px solid var(--rule); min-height: 0; padding: 0 .2rem; }
.rl .ico { width: clamp(1.6rem, 72cqh, 4.25rem); height: clamp(1.6rem, 72cqh, 4.25rem); }
.rl .nm { font-weight: 600; font-size: clamp(.9375rem, 26cqh, 1.25rem); line-height: 1.15; }
.rl .nm small { display: block; font-weight: 400; font-size: .8125rem; color: var(--ink-3); }
.rl .p { font-stretch: 62%; font-weight: 850; font-size: clamp(1.4rem, 48cqh, 2.6rem); line-height: 1; min-width: 2ch; text-align: right; color: var(--green); }
.rl .p.zero { color: var(--ink-3); }
.rl.miss { color: var(--ink-3); }
.rl.miss .ico { opacity: .45; }
.rl.miss .p { color: var(--ink-3); }
.rl .got { display: inline-block; margin-left: .5rem; padding: .05rem .45rem; border-radius: 99px; background: var(--green); color: #fff; font-size: .75rem; font-weight: 700; vertical-align: middle; }
.rl.blank { border-bottom-style: dashed; }
.empty-big { flex: 1; display: grid; place-content: center; text-align: center; gap: .3rem; border: 1.5px dashed var(--rule); border-radius: var(--r-m); color: var(--ink-3); padding: 1rem; }
.empty-big b { color: var(--ink-2); font-size: 1.125rem; }

.board .rowx { container-type: size; display: grid; grid-template-columns: 2.2ch minmax(0, 1fr) auto; gap: .8rem; align-items: center; border-bottom: 1px solid var(--rule); min-height: 0; }
.board .rowx.me { background: color-mix(in srgb, var(--red) 8%, transparent); }
.board .rowx.me .n::after { content: 'You'; margin-left: .5rem; padding: .05rem .45rem; border-radius: 99px; background: var(--red); color: #fff; font-size: .75rem; font-weight: 700; vertical-align: middle; }
.board .p { font-stretch: 62%; font-weight: 850; font-size: clamp(1.2rem, 40cqh, 2.2rem); color: var(--ink-3); text-align: right; }
.board .n { font-weight: 700; font-size: clamp(1rem, 26cqh, 1.375rem); }
.board .t small { display: block; font-stretch: 100%; font-weight: 500; font-size: .75rem; color: var(--ink-3); text-align: right; }
.board .t { text-align: right; font-stretch: 62%; font-weight: 850; font-size: clamp(1.5rem, 50cqh, 3rem); line-height: 1; padding-right: .3rem; }
.dispute { margin-top: .9rem; padding: .9rem; border-radius: var(--r-m); border: 2px solid var(--hivis); display: grid; gap: .6rem; font-size: .9375rem; }
.dispute h3 { font-size: 1rem; }
.dispute textarea.input { min-height: 3.5rem; }

/* ---------- phones and narrow windows: let the page scroll ---------- */
@media (max-width: 1000px) {
  .desk { grid-template-columns: minmax(0, 1fr) minmax(15rem, .8fr); grid-template-rows: auto minmax(0, 1fr); }
  .desk .brief { grid-column: 1 / -1; max-height: 30vh; }
}
@media (max-width: 760px), (max-height: 520px) {
  body { height: auto; overflow: auto; display: block; }
  .bar { grid-template-columns: 1fr auto; padding: .6rem 1rem; }
  .bar .steps { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
  .bar .rnd { display: none; }
  .steps li span:last-child { display: none; }
  .nowbar { padding: .5rem 1rem; font-size: .9375rem; }
  main { padding: 1rem; }
  .desk, .res-cols, .hold { grid-template-columns: 1fr; height: auto; }
  .desk .brief { max-height: none; }
  .sheet { order: -1; }
  .tiles { --cols: 2 !important; grid-auto-rows: minmax(4.5rem, auto); }
  .join h1, .hold h1 { font-size: 3.25rem; }
}

/* ---------- dispute panel (worksheet column) ---------- */
.dbox { display: grid; gap: .55rem; padding: .8rem .9rem; border-radius: var(--r-m); border: 1.5px dashed var(--rule); font-size: .875rem; color: var(--ink-2); }
.dbox h3 { font-size: 1rem; color: var(--ink); }
.dbox.open { border: 2px solid var(--hivis); background: color-mix(in srgb, var(--hivis) 7%, var(--sheet)); color: var(--ink); }
.btn-dispute { width: 100%; min-height: 3rem; font-size: 1.0625rem; background: var(--hivis); border-color: var(--hivis); color: #fff; }
.btn-dispute:hover:not(:disabled) { background: #A6650B; border-color: #A6650B; }
.btn-dispute:disabled { background: transparent; color: var(--ink-3); border-color: var(--rule); opacity: 1; }
.btn-dispute[data-armed] { background: var(--ink); border-color: var(--ink); }

.dbox.mini { display: block; padding: .5rem .7rem; font-size: .8125rem; color: var(--ink-3); }
.dbox.mini b { color: var(--ink-2); }

.dbox.compact { padding: .6rem .75rem; gap: .4rem; font-size: .8125rem; }
.dbox.compact h3 { font-size: .9375rem; }
.dbox.compact .btn-dispute { min-height: 2.5rem; font-size: .9375rem; }
.dbox textarea.dreason { min-height: 3.6rem; font-size: .875rem; resize: none; }
.dbox.compact textarea.dreason { min-height: 3rem; }
.bar .who b .sw { width: .7em; height: .7em; }
