/* NFCBOARD portal. Colours from the logo: cream, green, navy, red. No internet needed. */
:root {
  --cream: #F6F1E7; --paper: #FFFDF8; --green: #1F6E54; --green-soft: #E3EEE8; --navy: #12283F;
  --muted: #5A6878; --line: #DDD5C6; --line-soft: #ECE6DA; --red: #B3262D; --hl: #FFF3C4;
  --bar-made: #1F6E54; --bar-down: #9AA6B4;
  --cw: clamp(26px, 2.4vw, 36px);
  --step: calc(var(--cw) * -0.32);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--cream); color: var(--navy); font: 15px/1.45 "Segoe UI", -apple-system, Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--green); }
button, input, select { font: inherit; }
.s-S, .s-C { color: var(--navy); } .s-H, .s-D { color: var(--red); }

/* header */
.top { display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: var(--paper); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy); font-size: 22px; letter-spacing: .04em; }
.brand img { width: 34px; height: 34px; }
.brand b { font-weight: 800; } .brand span { font-weight: 300; }
.brand small { font-size: 13px; letter-spacing: 0; color: var(--muted); margin-left: 4px; }
nav { display: flex; gap: 4px; }
nav a { padding: 6px 14px; border-radius: 8px; text-decoration: none; color: var(--navy); }
nav a.on { background: var(--green-soft); color: var(--green); font-weight: 600; }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.banner { background: var(--hl); color: var(--navy); font-size: 13px; padding: 6px 24px; border-bottom: 1px solid #EBDDA0; }
main { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* shared bits */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
h1 { font-size: 26px; margin: 0 0 4px; } h2 { font-size: 18px; margin: 0 0 12px; } h3 { font-size: 15px; margin: 0 0 8px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.muted { color: var(--muted); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--navy); cursor: pointer; text-decoration: none; font-size: 14px; }
.btn:hover { border-color: var(--green); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .4; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.list td { padding: 8px; border-bottom: 1px solid var(--line-soft); }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.list tr.click { cursor: pointer; } table.list tr.click:hover td { background: var(--green-soft); }
.pos { color: var(--green); font-weight: 600; } .neg { color: var(--red); font-weight: 600; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--line-soft); color: var(--muted); }
.tag.me { background: var(--green-soft); color: var(--green); }

/* sign in */
.auth { max-width: 400px; margin: 40px auto; }
.auth form { display: flex; flex-direction: column; gap: 12px; }
.auth label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; }
.auth input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-weight: 400; }
.auth input:focus { outline: 2px solid var(--green); border-color: var(--green); }
.err { color: var(--red); font-size: 14px; min-height: 20px; margin: 0; }
.alt { margin-top: 16px; font-size: 14px; color: var(--muted); }
.bc-box { margin-top: 18px; padding: 12px; border: 1px dashed var(--line); border-radius: 8px; font-size: 13px; color: var(--muted); }

/* games list */
.session { margin-bottom: 20px; }
.session-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.session-head h2 { margin: 0; }
.seatline { font-size: 13px; color: var(--muted); margin-bottom: 8px; }

/* replay */
.replay { display: grid; gap: 16px; grid-template-columns: 220px minmax(0, 1fr) 260px; align-items: start; }
.crumbs { margin-bottom: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.contract-line { display: flex; flex-wrap: wrap; gap: 4px 22px; margin-bottom: 14px; font-size: 16px; }
.contract-line span { color: var(--muted); }
.board { display: grid; gap: 14px; align-items: center; justify-items: center;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-template-areas: ". n ." "w c e" ". s ."; }
.seat { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.seat.n { grid-area: n; } .seat.s { grid-area: s; } .seat.w { grid-area: w; } .seat.e { grid-area: e; }
.seat-name { font-weight: 700; font-size: 14px; text-align: center; }
.seat-name small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.seat-name.turn::before { content: "\25B6  "; color: var(--green); font-size: 10px; }
.hand { display: flex; padding: 8px 10px 8px calc(10px - var(--step)); background: #fff; border: 1px solid var(--line); border-radius: 8px;
  min-height: calc(var(--cw) * 1.42 + 18px); min-width: calc(var(--cw) + 20px); }
.hand > .card { margin-left: var(--step); }
.seat.w, .seat.e { --step: calc(var(--cw) * -0.45); }
.seat.w .hand, .seat.e .hand { flex-direction: column; gap: 4px; padding-left: 10px; }
.hand-line { display: flex; padding-left: calc(-1 * var(--step)); }
.hand-line .card { margin-left: var(--step); }
.card { width: var(--cw); height: calc(var(--cw) * 1.42); flex: none; background: #fff; border: 1px solid #B9B2A4; border-radius: 4px;
  display: flex; flex-direction: column; align-items: flex-start; padding: 2px 0 0 3px; font-weight: 700; line-height: 1;
  font-size: calc(var(--cw) * .48); box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.card .r { letter-spacing: -.08em; } .card .r.ten { font-size: .86em; } .card .su { margin-top: 2px; }
.center { grid-area: c; position: relative; width: 184px; height: 200px; border: 1px dashed var(--line); border-radius: 10px; background: var(--green-soft); }
.center .card { position: absolute; --cw: 42px; }
.center .p-N { left: 50%; top: 10px; transform: translateX(-50%); }
.center .p-S { left: 50%; bottom: 10px; transform: translateX(-50%); }
.center .p-W { left: 10px; top: 50%; transform: translateY(-50%); }
.center .p-E { right: 10px; top: 50%; transform: translateY(-50%); }
.center .card.winner { outline: 3px solid #E2B400; outline-offset: 1px; }
.center .label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 13px; color: var(--muted); padding: 0 40px; }
.controls { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.controls button { width: 40px; height: 34px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; color: var(--navy); font-size: 15px; }
.controls button:disabled { opacity: .35; cursor: default; }
.controls .pos-text { min-width: 140px; text-align: center; font-size: 14px; }
.slider { width: 100%; margin-top: 10px; accent-color: var(--green); }
.hint { font-size: 12px; color: var(--muted); text-align: center; margin-top: 4px; }
.tricks table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tricks th { font-size: 12px; color: var(--muted); font-weight: 600; padding: 2px 0 6px; text-align: center; }
.tricks td { text-align: center; padding: 4px 0; border-top: 1px solid var(--line-soft); white-space: nowrap; }
.tricks td.n { color: var(--muted); width: 22px; text-align: left; font-size: 12px; }
.tricks tr.rowt { cursor: pointer; } .tricks tr.rowt:hover td { background: var(--green-soft); }
.tricks tr.sel td { background: #E8EEF5; }
.tricks td.lead { text-decoration: underline; text-underline-offset: 3px; }
.tricks td.win { font-weight: 800; }
.score-line { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 14px; }
.side { display: flex; flex-direction: column; gap: 16px; }
.grid4 { width: 100%; border-collapse: collapse; font-size: 15px; table-layout: fixed; }
.grid4 th { font-size: 12px; color: var(--muted); font-weight: 600; padding-bottom: 6px; }
.grid4 td { text-align: center; padding: 4px 0; border-top: 1px solid var(--line-soft); }
.grid4 th.dealer::after { content: " (D)"; font-weight: 400; }
.bid-p { color: var(--muted); } .bid-x { color: var(--red); font-weight: 700; } .bid-xx { color: #2463B5; font-weight: 700; }
.export { display: flex; flex-direction: column; gap: 8px; }

/* statistics */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile .big { font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .lbl { font-size: 13px; color: var(--muted); }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 90px minmax(0, 1fr) 70px; gap: 10px; align-items: center; font-size: 14px; }
.bar-track { display: flex; height: 18px; gap: 2px; }
.bar-track span { display: block; height: 100%; border-radius: 0 4px 4px 0; min-width: 0; }
.bar-track span.made { background: var(--bar-made); }
.bar-track span.down { background: var(--bar-down); }
.bar-track span.made + span.down { border-radius: 0 4px 4px 0; }
.bar-track span.made:has(+ span.down) { border-radius: 0; }
.bar-row .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.hist { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 8px; border-bottom: 1px solid var(--line); }
.hist div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; font-size: 12px; color: var(--muted); }
.hist div span { width: 100%; max-width: 44px; border-radius: 4px 4px 0 0; }
.hist-x { display: flex; gap: 6px; font-size: 12px; color: var(--muted); }
.hist-x div { flex: 1; text-align: center; }
.empty { text-align: center; padding: 40px; color: var(--muted); }

/* account */
.acct { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.drop { border: 2px dashed var(--line); border-radius: 10px; padding: 20px; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--green); background: var(--green-soft); }
textarea { width: 100%; min-height: 120px; font: 12px/1.4 Consolas, monospace; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }

@media (max-width: 1100px) {
  .replay { grid-template-columns: 200px minmax(0, 1fr); }
  .replay .side { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .replay .side > .panel { flex: 1 1 240px; }
}
@media (max-width: 760px) {
  main { padding: 16px; }
  .top { padding: 10px 16px; gap: 10px; } .banner { padding: 6px 16px; }
  .who { margin-left: 0; width: 100%; }
  .replay { grid-template-columns: minmax(0, 1fr); }
  .replay .table-wrap { order: -1; }
  :root { --cw: clamp(20px, 6.2vw, 30px); }
  .board { grid-template-columns: 1fr; grid-template-areas: "n" "w" "c" "e" "s"; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols, .acct { grid-template-columns: minmax(0, 1fr); }
  table.list .hide-sm { display: none; }
}

/* sit at a table (QR scan) */
nav a.scan-tab { background: var(--green); color: #fff; font-weight: 600; }
nav a.scan-tab.on { background: var(--navy); color: #fff; }
.scan { max-width: 480px; margin: 0 auto; }
.scan h1 { margin-top: 0; }
.camera { position: relative; width: 100%; aspect-ratio: 1; background: #0d1b2a; border-radius: 12px; overflow: hidden; margin: 12px 0 16px; }
.camera video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera .frame { position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.85); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0,0,0,.25); pointer-events: none; }
.camera .cam-msg { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 12px 16px; background: rgba(13,27,42,.85); color: #fff; font-size: 14px; }
.code-row input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; text-transform: uppercase; letter-spacing: .08em; }
.seated { text-align: center; }
.seat-big { width: 72px; height: 72px; margin: 0 auto 8px; border-radius: 50%; background: var(--green); color: #fff; font-size: 38px; font-weight: 700; line-height: 72px; }
nav a { white-space: nowrap; }
@media (max-width: 760px) { nav { width: 100%; } nav a { padding: 6px 10px; } }
nav[hidden] { display: none; }
.code-row input::placeholder { text-transform: none; letter-spacing: 0; }
