/* GK Planning Poker – look inspired by GK Software: deep navy blue, grey, plenty of white */
:root {
  --gk: #004587;
  --gk-dark: #002b57;
  --gk-deep: #001a36;
  --gk-light: #e6eef6;
  --grey: #acabab;
  --ink: #14243a;
  --muted: #5b6b7f;
  --line: #d9e1ea;
  --bg: #f2f5f8;
  --white: #fff;
  --ok: #2f8a4c;
  --bad: #c0392b;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 43, 87, .08), 0 2px 6px rgba(0, 43, 87, .06);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.5 var(--font); color: var(--ink); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
h1, h2 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* ---------- header ---------- */
.top { background: linear-gradient(110deg, var(--gk-deep) 0%, var(--gk-dark) 45%, var(--gk) 100%); color: #fff; position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 12px rgba(0, 26, 54, .35); }
.top-inner { max-width: 1440px; margin: 0 auto; padding: 12px clamp(16px, 3vw, 32px); display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; margin-right: auto; }
.brand-mark { font-weight: 800; font-size: 22px; letter-spacing: .02em; border: 2px solid #fff; border-radius: 8px; padding: 1px 8px; line-height: 1.3; }
.brand-text { font-weight: 600; font-size: 19px; }
.me-box span { font-weight: 600; }
body.offline .top { background: #5b6b7f; }
.conn-error { max-width: 1440px; margin: 16px auto 0; width: calc(100% - 2 * clamp(16px, 3vw, 32px)); background: #fdecea; border: 1px solid #f1b0a8; border-left: 6px solid var(--bad); color: #5c1a12; padding: 14px 18px; border-radius: 10px; line-height: 1.5; }

/* ---------- layout ---------- */
.layout { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: clamp(16px, 3vw, 32px); display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 24px; align-items: start; }
.board { display: grid; gap: 18px; }
.board > div:not([hidden]) { display: grid; gap: 18px; }
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(16px, 2.4vw, 26px); border: 1px solid var(--line); }
.eyebrow { display: block; text-transform: uppercase; letter-spacing: .1em; font-size: 12px; font-weight: 700; color: var(--gk); margin: 0 0 6px; }

/* ---------- buttons & inputs ---------- */
.btn { font: 600 15px var(--font); border-radius: 10px; padding: 10px 18px; min-height: 44px; border: 2px solid transparent; cursor: pointer; transition: background .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--gk); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--gk-dark); }
.btn.ghost { background: transparent; color: var(--gk); border-color: var(--gk); }
.btn.ghost:hover { background: var(--gk-light); }
.btn.ghost.light { color: #fff; border-color: rgba(255, 255, 255, .6); }
.btn.ghost.light:hover { background: rgba(255, 255, 255, .12); }
.btn.sm { min-height: 34px; padding: 4px 12px; font-size: 13px; }
.btn.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(0, 69, 135, .45); } 50% { box-shadow: 0 0 0 10px rgba(0, 69, 135, 0); } }
.linkish { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }
.linkish.light { color: #cfe0f2; font-size: 13px; }
input[type=text] { font: 16px var(--font); padding: 11px 14px; min-height: 46px; border-radius: 10px; border: 2px solid var(--line); background: #fff; color: var(--ink); width: 100%; }
input[type=text]:focus { border-color: var(--gk); outline: none; box-shadow: 0 0 0 3px rgba(0, 69, 135, .15); }
:focus-visible { outline: 3px solid #4a9be0; outline-offset: 2px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row input { flex: 1 1 220px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--gk); }
.error { color: var(--bad); margin: 0; min-height: 1em; }
.error:empty { display: none; }

/* ---------- join ---------- */
.join h1 { font-size: clamp(26px, 3.4vw, 36px); color: var(--gk-dark); }
.join-form { display: grid; gap: 10px; max-width: 560px; }
.join-form label:first-child { font-weight: 600; }

/* ---------- topic ---------- */

/* ---------- table ---------- */
.table-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.table-head h2 { font-size: 20px; color: var(--gk-dark); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.progress { height: 6px; background: var(--gk-light); border-radius: 6px; overflow: hidden; margin: 14px 0 6px; }
.progress span { display: block; height: 100%; width: 0; background: var(--gk); transition: width .3s; }
.players { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 18px 14px; }
.players li { display: grid; justify-items: center; gap: 8px; width: 92px; text-align: center; }
.players li.away { opacity: .45; }
.pname { font-size: 14px; font-weight: 600; word-break: break-word; line-height: 1.25; }
.pname small { color: var(--muted); font-weight: 400; }
.pcard { width: 64px; height: 90px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 28px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); }
.pcard.empty { border-style: dashed; }
.pcard.down { background: repeating-linear-gradient(45deg, var(--gk) 0 8px, var(--gk-dark) 8px 16px); border-color: var(--gk-dark); color: #fff; font-size: 22px; }
.pcard.down span { background: var(--gk-dark); border-radius: 50%; width: 32px; height: 32px; display: grid; place-items: center; }
.pcard.up { background: var(--c); border-color: rgba(0, 0, 0, .12); animation: flip .45s ease; }
.players li .pcard.up.outlier { box-shadow: 0 0 0 3px var(--bad); }
.pcard.obs { font-size: 24px; background: #fff; }
.players li.me .pcard { box-shadow: 0 0 0 3px rgba(0, 69, 135, .35); }
@keyframes flip { from { transform: rotateY(90deg); } to { transform: rotateY(0); } }

/* ---------- result ---------- */
.result { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); display: grid; gap: 18px; }
.res-main { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.res-sp { background: var(--c); border-radius: 14px; width: 118px; height: 136px; display: grid; place-items: center; align-content: center; gap: 0; border: 1px solid rgba(0, 0, 0, .1); }
.res-sp b { font-size: 52px; line-height: 1; }
.res-sp small { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.res-facts { flex: 1 1 300px; display: grid; gap: 8px; }
.res-facts p { margin: 0; }
.consensus { font-size: 20px; font-weight: 700; color: var(--ok); }
.discuss { font-weight: 600; color: var(--bad); }
.close { font-weight: 600; color: var(--gk); }
.res-facts dl { display: flex; gap: 22px; flex-wrap: wrap; margin: 0; }
.res-facts dt { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.res-facts dd { margin: 0; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dist { display: grid; gap: 6px; max-width: 520px; }
.dist-row { display: grid; grid-template-columns: 44px 1fr 40px; gap: 10px; align-items: center; }
.dist-bar { height: 14px; background: var(--bg); border-radius: 7px; overflow: hidden; }
.dist-bar i { display: block; height: 100%; border-radius: 7px; filter: saturate(1.3) brightness(.92); }

/* ---------- deck ---------- */
.deck-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.deck-head h2 { font-size: 18px; color: var(--gk-dark); }
.deck { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; margin: 14px 0 8px; }
.vcard { background: var(--c); border: 2px solid rgba(0, 0, 0, .08); border-radius: 12px; min-height: 112px; display: grid; place-items: center; align-content: center; gap: 4px; padding: 8px 4px; cursor: pointer; color: var(--ink); font-family: var(--font); transition: transform .15s ease, box-shadow .15s ease; }
.vcard b { font-size: 32px; line-height: 1; }
.vcard small { font-size: 11px; line-height: 1.2; color: rgba(20, 36, 58, .75); }
.vcard:hover:not(:disabled) { transform: translateY(-6px); box-shadow: 0 10px 20px rgba(0, 43, 87, .18); }
.vcard.sel { transform: translateY(-10px); border-color: var(--gk); box-shadow: 0 0 0 3px var(--gk), 0 12px 24px rgba(0, 43, 87, .25); }
.vcard:disabled { cursor: not-allowed; opacity: .5; }
.deck-card.locked .vcard.sel { opacity: 1; }
.deck-card p { margin: 0; }

/* ---------- history ---------- */

/* ---------- hints ---------- */
.hints { position: sticky; top: 92px; background: linear-gradient(160deg, var(--gk-deep), var(--gk-dark)); color: #fff; border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.hints-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.sp-badge { background: #5cc56a; color: #fff; font-weight: 800; font-size: 22px; border-radius: 10px; padding: 6px 12px; }
.hints h2 { font-size: 20px; }
.hints-head p { margin: 2px 0 0; color: #b9cde3; font-size: 14px; }
.scale { width: 100%; border-collapse: separate; border-spacing: 5px; table-layout: fixed; }
.scale thead th { color: #9fb6cf; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; text-align: center; padding-bottom: 2px; }
.scale thead th:first-child { width: 54px; }
.scale td, .scale tbody th { background: var(--c); color: var(--ink); border-radius: 6px; padding: 8px 6px; font-size: 13px; line-height: 1.3; text-align: center; vertical-align: middle; font-weight: 500; }
.sp-chip { display: inline-grid; place-items: center; min-width: 34px; height: 30px; border-radius: 6px; font-weight: 800; font-size: 18px; background: var(--c); color: var(--ink); }
.scale tbody th { padding: 6px 2px; }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 18px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--gk-dark); color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); z-index: 20; max-width: calc(100% - 32px); }
.toast.err { background: var(--bad); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .hints { position: static; }
}
@media (max-width: 640px) {
  .deck { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .vcard { min-height: 92px; }
  .players li { width: 76px; }
  .pcard { width: 56px; height: 78px; font-size: 24px; }
  .scale td { font-size: 12px; padding: 6px 3px; }
  .hints { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- scale switch ---------- */
.mode-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mode-label { text-transform: uppercase; letter-spacing: .1em; font-size: 12px; font-weight: 700; color: var(--gk); }
.seg { display: inline-flex; border: 2px solid var(--gk); border-radius: 10px; overflow: hidden; }
.seg button { font: 600 14px var(--font); background: #fff; color: var(--gk); border: 0; padding: 8px 16px; min-height: 40px; cursor: pointer; }
.seg button + button { border-left: 2px solid var(--gk); }
.seg button[aria-pressed=true] { background: var(--gk); color: #fff; }
.seg button:hover:not([aria-pressed=true]) { background: var(--gk-light); }

/* ---------- t-shirt hints ---------- */
.tss { display: grid; gap: 10px; margin-bottom: 10px; }
.tss-item { background: var(--c); color: var(--ink); border-radius: 18px; padding: 12px 14px; display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; }
.tss-size { font-size: 26px; font-weight: 800; text-align: center; }
.tss-item b { font-size: 15px; }
.tss-item ul { margin: 2px 0 0; padding-left: 1.1em; font-size: 13px; line-height: 1.35; }
.tss-item li.lead { font-weight: 700; }
.scale.extras { margin-top: 2px; }
.scale.extras th { width: 54px; }

/* ---------- coffee ---------- */
.vcard.cup b, .pcard.cup { font-size: 30px; }
.coffee { font-size: 18px; font-weight: 700; color: #7a4a1d; }
.deck.tss-deck { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.sp-badge { min-width: 52px; text-align: center; }
@media (max-width: 640px) { .deck.tss-deck { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
