/* DDiB Live Auction - UZH Blockchain Center design system.
   Tokens follow blockchain.uzh.ch (Source Sans Pro, UZH blue #0028a5,
   BCC blue #334fbb, square buttons, hairline separators). */

:root {
  --bg: #ffffff;
  --header: #e3e2df;
  --ink: #111111;
  --muted: #575760;
  --faint: #b2b2be;
  --line: #111111;
  --uzh: #0028a5;
  --bcc: #334fbb;
  --ddib-yellow: #f2c235; /* Summer School flyer accent */
  --flash: #dce3f8;
  --highlight: #eef1fb;
  --accent: var(--uzh); /* campus accent: UZH blue by default */
  --error: #bf0d3e;
  --ok: #2a7f62;
  --font: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --max: min(72rem, 90vw);
  --narrow: 34rem;
  --col-rank: 7rem;
  --col-bid: 9.5rem;
  --rank-bar: 4px;
  --rank-gap: 0.9rem;
}

/* Stellenbosch runs in SU maroon: accents + tint surfaces follow the campus,
   site chrome (buttons, links, focus) stays UZH blue. */
body[data-theme="stellenbosch"] {
  --accent: #8c1d40;
  --highlight: #f7edf1;
  --flash: #efd9e2;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: light; }

body {
  min-height: 100vh;
  font-family: var(--font);
  font-size: clamp(1rem, 1.35vw, 1.2rem);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* ---------- chrome ---------- */

.topbar {
  /* Summer School 2026 block pattern under a light veil (subtle texture). */
  background:
    linear-gradient(rgba(240, 245, 252, 0.9), rgba(240, 245, 252, 0.9)),
    url("/assets/ddib-pattern.jpg");
  background-size: auto, 26rem auto;
  border-top: 4px solid var(--ddib-yellow);
  border-bottom: 1px solid var(--line);
}

.topbar-inner,
.main,
.foot-inner {
  width: min(100% - 4rem, var(--max));
  margin: 0 auto;
}

.topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.75rem;
  padding: 1.15rem 0;
  font-size: 0.95rem;
}

.brand {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.65rem;
}

.brand-org, .brand-unit { font-weight: 600; }
.brand-sub { color: var(--muted); }

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.topbar a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.topbar a:hover { text-decoration-thickness: 2px; }

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--uzh);
  outline-offset: 3px;
}

.gear-btn {
  appearance: none;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0.5rem 0.4rem;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
}
.gear-btn img { width: 1.25rem; height: 1.25rem; display: block; }
.gear-btn:hover { color: var(--uzh); }

.home-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0.28rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.home-btn img { width: 1.85rem; height: 1.85rem; display: block; }
.home-btn:hover { border-color: var(--uzh); background: var(--highlight); }
.home-btn:active { background: var(--flash); }

[hidden] { display: none !important; }

.main {
  flex: 1;
  padding: 2.5rem 0 3.5rem;
}

h1 {
  font-size: clamp(1.75rem, 3.2vw, 2.35rem);
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.65rem;
}

.lede {
  font-size: 1.02em;
  color: var(--muted);
  max-width: 42rem;
  margin-bottom: 1.5rem;
}

hr.hairline {
  border: none;
  border-top: 1px solid var(--line);
  margin: 1.5rem 0;
}

footer {
  margin-top: auto;
  background:
    linear-gradient(rgba(240, 245, 252, 0.9), rgba(240, 245, 252, 0.9)),
    url("/assets/ddib-pattern.jpg");
  background-size: auto, 26rem auto;
  border-top: 1px solid var(--line);
  border-bottom: 4px solid var(--ddib-yellow);
}

footer a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
footer a:hover { color: var(--uzh); }

.foot-inner {
  padding: 1.15rem 0 1.4rem;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  justify-content: space-between;
}

/* ---------- buttons & forms (UZH: square buttons, 4px inputs) ---------- */

.btn {
  appearance: none;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid var(--uzh);
  border-radius: 0;
  background: var(--uzh);
  color: #ffffff;
  padding: 0.65rem 1.35rem;
  cursor: pointer;
}
.btn:hover:not(:disabled) { background: var(--bcc); border-color: var(--bcc); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-outline:hover:not(:disabled) {
  background: transparent;
  color: var(--uzh);
  border-color: var(--uzh);
}

.btn-danger {
  background: transparent;
  color: var(--error);
  border-color: var(--error);
}
.btn-danger:hover:not(:disabled) { background: var(--error); border-color: var(--error); color: #fff; }

.btn-sm { font-size: 0.9rem; padding: 0.42rem 0.85rem; }

.field { margin-bottom: 1.15rem; }

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.field .hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.85rem;
}

.field input {
  width: 100%;
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}
.field input:focus-visible {
  outline: 2px solid var(--uzh);
  outline-offset: 1px;
}

.form-error {
  color: var(--error);
  font-size: 0.95rem;
  min-height: 1.3em;
  margin: 0.5rem 0 0.85rem;
}
.form-error:empty { min-height: 0; margin: 0; }

.form-note {
  margin: 0.15rem 0 1.15rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--ddib-yellow);
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 42rem;
}
.form-note a { color: var(--uzh); }

.form-narrow { max-width: var(--narrow); }

/* ---------- campus picker ---------- */

.campus-pick {
  display: grid;
  /* single card stays a compact tile instead of stretching to 44rem */
  grid-template-columns: repeat(auto-fit, minmax(15rem, 22rem));
  gap: 1.25rem;
  max-width: 44rem;
  margin-top: 2rem;
}

.campus-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  padding: 1.6rem 1.4rem;
  text-align: left;
  background: #fff;
  cursor: pointer;
  font: inherit;
  border-radius: 0;
}
.campus-card:hover { border-color: var(--accent); background: var(--highlight); }
.campus-card:active { background: var(--flash); }
.campus-card img { width: 3rem; height: 3rem; display: block; margin-bottom: 0.9rem; }
.campus-card .campus-name { font-weight: 700; font-size: 1.2rem; display: block; }
.campus-card .campus-sub { color: var(--muted); font-size: 0.95rem; }

/* ---------- stage panels ---------- */

.stagebar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.55rem 1.75rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 0.95em;
  margin-bottom: 1.75rem;
}
.stagebar .meta { color: var(--muted); }
.stagebar .meta strong { color: var(--ink); font-weight: 600; }
.stagebar .conn strong { color: var(--accent); }
.stagebar .conn.is-offline strong { color: var(--error); }
.stagebar .stage-meta strong { color: var(--uzh); }
.stagebar .stage-meta.is-live strong { color: var(--error); }

.product-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem 2.5rem;
  margin-bottom: 1.75rem;
}

.product-art {
  width: clamp(7.5rem, 18vw, 12rem);
  height: clamp(7.5rem, 18vw, 12rem);
  border: 1px solid var(--line);
  padding: 0;
  background: #fff;
  flex: 0 0 auto;
  overflow: hidden;
}
.product-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain; /* studio shots: never crop the product */
}

.product-info .kicker {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.product-info h2 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
}
.product-info .round-label { color: var(--muted); }

.countdown-wrap { margin-left: auto; text-align: right; }

.countdown {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-weight: 700;
  font-size: clamp(2.6rem, 7vw, 4.5rem);
  line-height: 1;
  color: var(--accent);
}
.countdown.is-ending { color: var(--error); }
.countdown-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.panel {
  border: 1px solid var(--line);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  background: #fff;
}

.panel-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.9rem;
}

.own-bid {
  max-width: var(--narrow);
  border: 1px solid var(--line);
  border-left: var(--rank-bar) solid var(--accent);
  background: #fff;
  padding: 0.9rem 1.1rem;
  margin: 1rem 0;
}
.own-bid strong { color: var(--accent); }

.winner-card {
  border: 1px solid var(--line);
  border-left: 6px solid var(--ddib-yellow);
  /* soft DDiB-yellow wash: the win moment gets the flyer accent */
  background: linear-gradient(90deg, rgba(242, 194, 53, 0.13), #fff 45%);
  padding: 1.5rem;
  margin: 1.25rem 0;
  display: flex;
  align-items: center;
  gap: 1.4rem;
}
.winner-card .trophy { flex: 0 0 auto; color: var(--accent); }
.winner-card .trophy svg { width: 3.2rem; height: 3.2rem; display: block; }
.winner-card .w-label { color: var(--muted); font-size: 0.92rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.winner-card .w-name { font-size: clamp(1.2rem, 2.1vw, 1.6rem); font-weight: 700; }
.winner-card .w-amount { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; font-size: clamp(1.4rem, 2.6vw, 1.9rem); letter-spacing: -0.01em; }

.copy-addr {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  appearance: none;
  font: inherit;
  border: 1px dashed var(--accent);
  border-radius: 0;
  background: var(--highlight);
  color: var(--ink);
  padding: 0.6rem 0.85rem;
  cursor: pointer;
  text-align: left;
}
.copy-addr:hover { background: var(--flash); }
.copy-addr .copy-addr-value {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.copy-addr .copy-hint {
  flex: 0 0 auto;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

/* ---------- payment confirmation ---------- */

.spin {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  border: 1.5px solid var(--faint);
  border-top-color: var(--muted);
  border-radius: 50%;
  vertical-align: -0.1em;
  animation: ddib-spin 0.8s linear infinite;
}
@keyframes ddib-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spin { animation-duration: 2.4s; }
}

.pay-status .pay-check { color: var(--ok); }
.pay-status .pay-cross { color: var(--error); }
.pay-status .pay-check svg,
.pay-status .pay-cross svg { width: 1em; height: 1em; vertical-align: -0.12em; }
.pay-status.is-ok { color: var(--ok); }
.pay-status.is-fail { color: var(--error); }
.pay-status a { color: inherit; }

/* status chip (etherscan-style soft tint; 4px radius echoes the inputs) */
.pay-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.25;
  padding: 0.2rem 0.55rem;
  border: 1px solid;
  border-radius: 4px;
  vertical-align: middle;
  white-space: nowrap;
}
.pay-badge svg { width: 0.85em; height: 0.85em; }
.pay-badge.is-ok { color: var(--ok); background: #e7f3ef; border-color: #c2ddd2; }
.pay-badge.is-fail { color: var(--error); background: #f9e8ed; border-color: #e8b3c2; }
.pay-badge.is-pending { color: #8a6407; background: #fdf6e2; border-color: #eddfad; }
.pay-badge.is-pending .spin {
  width: 0.8em;
  height: 0.8em;
  border-color: #eadfbe;
  border-top-color: #8a6407;
}

/* tx hash: monospace, middle-truncated, explorer link + copy button */
.tx-hash {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.82em;
  font-weight: 400;
}
.tx-hash .tx-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--bcc);
  text-decoration: none;
}
.tx-hash .tx-link:hover { text-decoration: underline; }
.tx-hash .tx-link svg { width: 0.78em; height: 0.78em; color: var(--faint); }
.tx-hash .tx-link:hover svg { color: var(--bcc); }
.tx-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  padding: 0.22rem;
  color: var(--faint);
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.12s ease, background 0.12s ease;
}
.tx-copy:hover { color: var(--uzh); background: var(--highlight); }
.tx-copy:active { background: var(--flash); }
.tx-copy.is-copied { color: var(--ok); background: #e7f3ef; }
.tx-copy svg { width: 0.95em; height: 0.95em; display: block; }

.prev-winners { margin: 1.25rem 0; }
.prev-winners .pw-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.98rem;
}
.prev-winners .pw-round { color: var(--muted); font-weight: 600; min-width: 5.4rem; }
.prev-winners .pw-name {
  font-weight: 600;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
  min-width: 0;
}
.prev-winners .pw-amount { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; margin-left: auto; }
.pw-unit { color: var(--muted); font-weight: 600; font-size: 0.85em; }

.waiting {
  padding: 1.75rem 0 2.25rem;
  color: var(--muted);
  text-align: left;
}
.waiting .waiting-big {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.4rem;
}

/* ---------- leaderboard ---------- */

.board-wrap { margin-top: 1.5rem; }

.cols, .row {
  display: grid;
  grid-template-columns: var(--col-rank) minmax(0, 1fr) var(--col-bid);
  gap: 0.9rem 1.5rem;
  align-items: baseline;
}

.cols {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95em;
  font-weight: 600;
  color: var(--muted);
}

.cols .bid-h, .bid { text-align: right; }

.board { list-style: none; }

.row {
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.4s ease;
}

/* yellow = you, campus accent = rank 1 (rank rail paints over this when both) */
.row.is-you { background: var(--highlight); box-shadow: inset var(--rank-bar) 0 0 var(--ddib-yellow); }
.row.is-you .name::after {
  content: " — you";
  color: var(--uzh);
  font-weight: 600;
  font-size: 0.85em;
  white-space: nowrap;
}

.cols #h-rank, .rank {
  border-left: var(--rank-bar) solid transparent;
  padding-left: var(--rank-gap);
}

.rank {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  font-size: clamp(1.05rem, 1.8vw, 1.45rem);
  color: var(--muted);
  line-height: 1;
}

.rank-mark { width: 1.35rem; height: 1.35rem; flex: 0 0 auto; display: block; }
.rank-mark svg { width: 100%; height: 100%; display: block; }
.rank-num { min-width: 1.1ch; }

.row.top1 .rank {
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}
.row.top1 .rank-mark { color: var(--accent); }
.row.top2 .rank, .row.top3 .rank { color: var(--ink); font-weight: 600; }
.row.top2 .rank-mark { color: var(--ink); }
.row.top3 .rank-mark { color: var(--muted); }
.row.top2 .name, .row.top3 .name { font-weight: 600; }

.name {
  font-size: clamp(1.05rem, 1.8vw, 1.45rem);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row.top1 .name { font-weight: 700; }
.row.top1 .bid { color: var(--accent); font-weight: 700; }

.bid {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: clamp(1.05rem, 1.8vw, 1.45rem);
  white-space: nowrap;
}

.empty {
  padding: 2.5rem 0;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

/* ---------- admin ---------- */

.admin-grid {
  display: grid;
  grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line);
}
.seg button {
  appearance: none;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  background: #fff;
  color: var(--ink);
  border: none;
  border-right: 1px solid var(--line);
  padding: 0.5rem 1.05rem;
  cursor: pointer;
}
.seg button:last-child { border-right: none; }
.seg button[aria-pressed="true"] { background: var(--uzh); color: #fff; }
.seg button:hover:not([aria-pressed="true"]) { color: var(--uzh); }

.control-block { margin-bottom: 1.6rem; }
.control-block > .panel-title { margin-bottom: 0.6rem; }
.control-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }

/* campus switch: yellow rail + full-width toggle so it reads as a scope
   change, not another round picker */
.admin-controls .control-block:first-child {
  border-left: 4px solid var(--ddib-yellow);
  padding-left: 0.65rem;
}
.admin-controls .control-block:first-child .seg { display: flex; width: 100%; }
.admin-controls .control-block:first-child .seg button { flex: 1; }

.admin-controls .field { margin-bottom: 0.6rem; }

/* while a round runs, End is the primary action; the dead Start ghosts out */
#btn-start:disabled {
  opacity: 1;
  background: #fff;
  color: var(--faint);
  border-color: var(--faint);
}

/* the nuclear option sits alone on its own row, dashed */
.control-row #btn-wipe {
  flex-basis: 100%;
  max-width: max-content;
  margin-top: 0.35rem;
  border-style: dashed;
}

.board .name .addr-hint {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72em;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: -0.01em;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}
.product-grid button {
  appearance: none;
  font: inherit;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  padding: 0.55rem 0.3rem 0.45rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
}
.product-grid button img {
  width: 3rem;
  height: 3rem;
  display: block;
  margin: 0 auto 0.35rem;
  object-fit: cover;
  border: 1px solid var(--line);
}
.product-grid button[aria-pressed="true"] {
  border-color: var(--uzh);
  box-shadow: inset 0 0 0 1px var(--uzh);
  color: var(--uzh);
}
.product-grid button:hover { color: var(--uzh); }

/* Running round: red marker on the live product / round, wins over the blue selection. */
.product-grid button.is-live,
.product-grid button.is-live[aria-pressed="true"] {
  border-color: var(--error);
  box-shadow: inset 0 0 0 1px var(--error);
}
.product-grid button.is-live::after {
  content: "\25CF live";
  display: block;
  color: var(--error);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.25rem;
}
.seg button.is-live { color: var(--error); box-shadow: inset 0 0 0 2px var(--error); }
.seg button.is-live[aria-pressed="true"] {
  box-shadow: none;
  background: var(--error);
  color: #fff;
}

.admin-status {
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 0.5rem;
  min-height: 1.3em;
}
.admin-status.is-error { color: var(--error); }

/* ---------- live / projector (legible from the back of a lecture hall) ---------- */

.live .main { max-width: none; }
.live h1 { font-size: clamp(2rem, 4vw, 3rem); }
.live .countdown { font-size: clamp(4rem, 14vw, 10rem); }
.live .countdown-label { font-size: clamp(0.95rem, 1.6vw, 1.25rem); color: var(--ink); }
.live .stagebar { font-size: clamp(1.1rem, 2vw, 1.45rem); }
.live .name, .live .bid, .live .rank { font-size: clamp(1.3rem, 2.6vw, 2rem); }
.live .cols { font-size: clamp(1rem, 1.8vw, 1.35rem); color: var(--ink); }
.live .product-info .kicker,
.live .product-info .round-label { font-size: clamp(1.05rem, 1.9vw, 1.4rem); color: var(--ink); }
.live .product-art {
  width: clamp(10rem, 22vw, 16rem);
  height: clamp(10rem, 22vw, 16rem);
}
.live .winner-card { padding: 2rem 2.5rem; border-left-width: 8px; }
.live .winner-card .trophy svg { width: 4.5rem; height: 4.5rem; }
.live .winner-card .w-label { font-size: clamp(1.05rem, 1.9vw, 1.4rem); color: var(--ink); }
/* the winning bid is the punchline: it outranks the name on the beamer */
.live .winner-card .w-name { font-size: clamp(1.6rem, 3.2vw, 2.4rem); }
.live .winner-card .w-amount { font-size: clamp(2.4rem, 5.4vw, 4rem); line-height: 1.05; }
.live .waiting .waiting-big { font-size: clamp(1.6rem, 3vw, 2.4rem); }
.live .waiting { font-size: clamp(1.05rem, 1.9vw, 1.4rem); }
.live .prev-winners .pw-row,
.live .prev-winners .panel-title { font-size: clamp(1.05rem, 1.9vw, 1.4rem); }

/* ---------- dialog (gear / confirmations) ---------- */

dialog.modal {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 1.75rem;
  max-width: 26rem;
  width: calc(100% - 2rem);
  font: inherit;
}
dialog.modal::backdrop { background: rgba(17, 17, 17, 0.62); }
dialog.modal h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.75rem; }
dialog.modal p { color: var(--muted); font-size: 0.98rem; margin-bottom: 1.1rem; }
dialog.modal #gear-details { color: var(--ink); font-weight: 600; word-break: break-all; }
/* destructive action isolated left, safe filled dismiss right */
dialog.modal .modal-actions { display: flex; gap: 0.75rem; justify-content: space-between; flex-wrap: wrap; }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar-inner, .main, .foot-inner { width: min(100% - 2rem, var(--max)); }
  :root { --col-rank: 4.75rem; --col-bid: minmax(6.5rem, 8.5rem); --rank-gap: 0.55rem; }
  .cols, .row {
    grid-template-columns: 4.75rem minmax(0, 1fr) minmax(6.5rem, 8.5rem);
    gap: 0.65rem 0.9rem;
  }
  .rank { gap: 0.4rem; }
  .rank-mark { width: 1.15rem; height: 1.15rem; }
  .name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .main { padding: 2rem 0 2.75rem; }
  /* the own-result box drops below the winner text instead of squeezing beside it */
  .winner-card { flex-wrap: wrap; }
  .winner-card > div { flex: 1 1 0; min-width: 12rem; }
  .winner-card .own-bid { flex-basis: 100%; min-width: 0; margin: 0.5rem 0 0; }
  /* full-width thumb-sized primary actions on phones */
  .form-narrow .btn, #bid-form .btn {
    width: 100%;
    min-height: 2.9rem;
    padding: 0.8rem 1.35rem;
  }
  .countdown-wrap { margin-left: 0; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .row { transition: none; }
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* EWA grading */
.pa-pick { max-width: 48rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }

.field select {
  width: 100%;
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}

/*
  Dropzone, 5 iterations:
  1. card with hidden input inside (broken: browser navigates on miss)
  2. dashed border
  3. isometric stack icon + Datei-auswählen button, input outside
  4. drag-depth + is-over
  5. shipped: white card, dashed rail, page veil, file chip, window-level drop
*/
.dropzone {
  border: 1px dashed var(--line);
  border-left: 4px solid var(--uzh);
  padding: 2.15rem 1.5rem 1.85rem;
  min-height: 14.5rem;
  background: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
}
.dropzone:hover { border-color: var(--uzh); }
.dropzone.is-over {
  background: var(--highlight);
  border-style: solid;
  border-color: var(--uzh);
}
.dropzone.has-file {
  border-style: solid;
  background: var(--flash);
}
.drop-icon { width: 4.4rem; height: 3.85rem; display: block; margin-bottom: 0.45rem; }
.drop-lead { font-weight: 700; color: var(--ink); }
.drop-or { color: var(--muted); font-size: 0.9rem; }
.drop-hint { color: var(--muted); font-size: 0.9rem; margin-top: 0.35rem; }
.btn-file { margin-top: 0.15rem; }

#drop-veil {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 40, 165, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
#drop-veil[hidden] { display: none !important; }
.drop-veil-card {
  border: 2px dashed var(--uzh);
  background: #fff;
  padding: 2rem 2.4rem;
  text-align: center;
  min-width: min(22rem, 100%);
}
.drop-veil-card .drop-icon,
.drop-veil-card img { width: 4.4rem; height: 3.85rem; display: block; margin: 0 auto 0.7rem; }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); }
.grade-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.grade-table th, .grade-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 0.7rem;
  text-align: left;
  vertical-align: top;
}
.grade-table th {
  font-weight: 600;
  color: var(--muted);
  background: var(--highlight);
}
.form-note ul { margin: 0.3rem 0 0 1.1rem; }
