/* Catan - a small, deliberately calm interface.
   Ocean-dark chrome so the warm board art carries all the colour. */

:root {
  --bg:        #121a24;
  --sea:       #17303f;
  --sea-deep:  #102431;
  --panel:     #1b2634;
  --panel-2:   #223042;
  --raised:    #2a3a4e;
  --ink:       #ece4d3;
  --ink-dim:   #b9c4d1;
  --muted:     #8695a6;
  --line:      rgba(255, 255, 255, .10);
  --line-soft: rgba(255, 255, 255, .06);
  --gold:      #e0a94a;
  --gold-dim:  #a97f34;
  --good:      #4aa96c;
  --bad:       #d2564b;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 6px 24px rgba(0, 0, 0, .38);
  --dock-h:    168px;
  --side-w:    330px;

  --brick:  #b4552f;
  --lumber: #2f7a45;
  --wool:   #7fb551;
  --grain:  #dfa92c;
  --ore:    #7b8ea3;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- buttons */
.btn {
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--ink);
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 560;
  line-height: 1.1;
  transition: background .13s, border-color .13s, transform .06s, opacity .13s;
  white-space: nowrap;
}
.btn:hover:not(:disabled)  { background: #33465e; border-color: rgba(255,255,255,.18); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn--primary { background: var(--gold); border-color: var(--gold); color: #23180a; }
.btn--primary:hover:not(:disabled) { background: #eeba5e; border-color: #eeba5e; }
.btn--ghost   { background: transparent; }
.btn--ghost:hover:not(:disabled) { background: var(--panel-2); }
.btn--small   { padding: 6px 11px; font-size: 13px; }
.btn--danger  { border-color: rgba(210,86,75,.5); color: #ffb3ab; }
.btn--danger:hover:not(:disabled) { background: rgba(210,86,75,.16); }

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  background: rgba(18, 26, 36, .82);
  backdrop-filter: blur(6px);
  color: var(--ink);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 17px; line-height: 1;
}
.icon-btn:hover { background: var(--raised); }
.icon-btn--fit { width: auto; min-width: 34px; padding: 0 8px; font-size: 12px; font-weight: 700; }

input, select {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--gold-dim); outline-offset: -1px; }
select { width: 100%; cursor: pointer; }
select option { background: var(--panel); color: var(--ink); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > input { flex: 1 1 8rem; }

/* ---------------------------------------------------------------- layout */
.app { height: 100%; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: none;
}
.topbar__home {
  background: none; border: 0; cursor: pointer; flex: none;
  padding: 6px 4px;                 /* keeps the logo a comfortable tap target */
  display: grid; place-items: center; min-height: 40px;
  border-radius: var(--radius-sm);
}
.topbar__home:hover { background: var(--panel-2); }
.topbar__home img { height: 30px; width: auto; }
html[data-game-type="kakure"] .topbar__home img {
  width: 34px; height: 34px; object-fit: cover; border-radius: 50%;
  box-shadow: 0 0 0 1px var(--gold-dim);
}
.topbar__title { min-width: 0; flex: 1; }
.topbar__title h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__title p  { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__right { display: flex; align-items: center; gap: 8px; flex: none; }
.mobile-chat-toggle, .own-identity, .mobile-players, .mobile-chat-notice, .mobile-chat-close { display: none; }
.chat-badge { min-width: 1.2rem; padding: 1px 5px; border-radius: 999px; background: var(--gold); color: #23180a; font-size: 11px; font-weight: 750; }
.own-identity { align-items: center; gap: 5px; color: var(--ink-dim); font-size: 12px; white-space: nowrap; }

.clock {
  font-variant-numeric: tabular-nums;
  font-size: 12.5px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 20px; padding: 4px 10px;
}
.clock.is-urgent { color: #ffbdb6; border-color: rgba(210,86,75,.45); }

/* ---------------------------------------------------------------- lobby */
.lobby { flex: 1; overflow: auto; padding: 26px 18px 60px; }
.lobby__inner { max-width: 820px; margin: 0 auto; display: grid; gap: 18px; }
.lobby__logo { width: min(320px, 68%); margin: 4px auto 6px; }
.lobby__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.game-list { display: grid; gap: 10px; }
.game-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
  cursor: pointer; text-align: left; width: 100%;
  transition: border-color .13s, background .13s;
}
.game-card:hover { border-color: var(--gold-dim); background: var(--panel-2); }
.game-card.is-yours { border-color: var(--gold); background: linear-gradient(180deg, rgba(224,169,74,.11), transparent); }
.game-card__art {
  width: 72px; height: 54px; flex: none; object-fit: contain;
  border: 1px solid var(--line); border-radius: 7px; background: #111923;
}
.game-card__art.is-kakure { object-fit: cover; }
.game-card__main { flex: 1; min-width: 0; }
.game-card__name { font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-card__meta {
  font-size: 12.5px; color: var(--muted); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.game-card__badge {
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 20px; background: var(--gold); color: #23180a; flex: none;
}
.game-card__badge.is-done { background: var(--raised); color: var(--ink-dim); }
.seats { display: flex; gap: 4px; flex: none; }
.seat-dot { width: 13px; height: 13px; border-radius: 50%; border: 1px solid rgba(0,0,0,.45); }

.notice {
  background: rgba(224, 169, 74, .10);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: grid; gap: 6px;
}
.notice h4 { margin: 0; font-size: 14.5px; font-weight: 650; color: var(--gold); }
.notice p { font-size: 13px; color: var(--ink-dim); line-height: 1.5; }
.notice code {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px;
  background: rgba(0,0,0,.28); padding: 1px 6px; border-radius: 4px;
}
.warn { color: #e8b06a; }

.admin { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; }
.user-list { display: grid; gap: 8px; }
.user-row { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border-radius: var(--radius-sm); padding: 9px 12px; flex-wrap: wrap; }
.user-row__name { font-weight: 580; display: flex; align-items: center; gap: 7px; }
.tag--bot { background: var(--raised); color: var(--ink-dim); }
.tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 20px; background: var(--gold); color: #23180a;
}
/* One tidy line with an ellipsis: the full link is behind "Copy link", and
   letting it wrap made every row a different height. */
.user-row__link {
  font-size: 12px; color: var(--muted);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  flex: 1 1 12rem; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------------------------------------------------------------- game */
.game {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 1fr var(--side-w);
  grid-template-rows: 1fr var(--dock-h);
  grid-template-areas: "board side" "dock dock";
}

.board-wrap {
  grid-area: board; position: relative; min-width: 0; min-height: 0;
  background: radial-gradient(120% 110% at 50% 38%, var(--sea) 0%, var(--sea-deep) 62%, #0c1a24 100%);
  /* Dragging to pan would otherwise sweep-select every number and harbour
     label, leaving the board covered in blue highlight. */
  user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
html[data-game-type="kakure"] .board-wrap {
  background:
    radial-gradient(120% 110% at 50% 38%, rgba(18,35,31,.28), rgba(9,14,16,.90) 72%),
    url('/img/kakure/floral-pattern.jpeg') center / 240px 180px repeat;
}
.board-host { position: absolute; inset: 0; touch-action: none; }
.board-host svg { width: 100%; height: 100%; display: block; }

.board-tools { position: absolute; right: 12px; bottom: 12px; display: grid; gap: 6px; }

.banner {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  background: rgba(18,26,36,.9); backdrop-filter: blur(8px);
  border: 1px solid var(--gold-dim); color: var(--ink);
  padding: 9px 15px; border-radius: 22px; box-shadow: var(--shadow);
  font-weight: 560; font-size: 14px; max-width: calc(100% - 24px);
  z-index: 5;
}
.banner.is-waiting { border-color: var(--line); color: var(--ink-dim); font-weight: 500; }

.dice-tray {
  position: absolute; left: 12px; top: 12px;
  display: flex; align-items: center; gap: 8px;
  background: rgba(18,26,36,.86); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 7px 12px 7px 8px; box-shadow: var(--shadow);
  user-select: none;
}
.dice-tray__dice { display: flex; align-items: center; gap: 7px; }
.dice-tray img { width: 38px; height: 38px; }
.dice-tray #dice-total {
  font-weight: 700; font-size: 19px; font-variant-numeric: tabular-nums;
  min-width: 1.3em; text-align: center;
}
.dice-tray.is-seven #dice-total { color: var(--bad); }
.dice-tray__roll { padding: 10px 16px; }

/* Tumbling while the roll is in flight... */
@keyframes tumble {
  0%   { transform: rotate(0deg)    scale(1);    }
  25%  { transform: rotate(160deg)  scale(1.14); }
  50%  { transform: rotate(300deg)  scale(.94);  }
  75%  { transform: rotate(470deg)  scale(1.12); }
  100% { transform: rotate(720deg)  scale(1);    }
}
.dice-tray.is-rolling img { animation: tumble .55s linear infinite; }
.dice-tray.is-rolling img:nth-child(2) { animation-duration: .47s; animation-direction: reverse; }
.dice-tray.is-rolling #dice-total { opacity: .25; }

/* ...then a short overshoot as they land. */
@keyframes settle {
  0%   { transform: scale(1.4) rotate(-22deg); }
  55%  { transform: scale(.9)  rotate(7deg);   }
  80%  { transform: scale(1.05) rotate(-2deg); }
  100% { transform: none; }
}
.dice-tray.is-new img { animation: settle .45s cubic-bezier(.2, 1.3, .4, 1) both; }
.dice-tray.is-new img:nth-child(2) { animation-delay: .08s; }
@keyframes pop { from { opacity: 0; transform: scale(.6); } }
.dice-tray.is-new #dice-total { animation: pop .3s .22s ease-out both; }

/* ---------------------------------------------------------------- side */
.side {
  grid-area: side; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--panel); border-left: 1px solid var(--line);
}
.players { user-select: none; padding: 10px; display: grid; gap: 7px; border-bottom: 1px solid var(--line); }

.pcard {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  background: var(--panel-2); border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 8px 10px;
}
.pcard.is-turn { border-color: var(--gold); background: linear-gradient(180deg, rgba(224,169,74,.14), rgba(224,169,74,.03)); }
.pcard.is-you .pcard__name::after { content: " (you)"; color: var(--muted); font-weight: 500; }
.pcard__pip { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0,0,0,.5); }
.pcard__name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.pcard__meta { font-size: 12px; color: var(--muted); display: flex; gap: 9px; margin-top: 2px; flex-wrap: wrap; }
.pcard__vp { font-weight: 720; font-size: 18px; font-variant-numeric: tabular-nums; }
/* Longest Road and Largest Army are two points each - worth actually seeing.
 * These used to be 17px thumbnails and people missed them entirely. */
.pcard__awards { display: flex; gap: 4px; }
.pcard__awards img {
  width: 30px; height: 37px; border-radius: 3px;
  box-shadow: 0 0 0 1.5px var(--gold), 0 2px 8px rgba(0,0,0,.5);
}
html[data-game-type="kakure"] .pcard__awards img {
  width: 37px; height: 37px; object-fit: cover; border-radius: 50%;
}
.pcard.is-you .pcard__awards img { animation: award-in .5s cubic-bezier(.2,1.5,.4,1) both; }
@keyframes award-in {
  0%   { transform: scale(.3) rotate(-12deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .pcard.is-you .pcard__awards img { animation: none; }
}
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); flex: none; }

.side__tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.tab { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 9px 4px; color: var(--muted); cursor: pointer; font-weight: 560; font-size: 13.5px; }
.tab.is-active { color: var(--ink); border-bottom-color: var(--gold); }
.side__panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.side__panel > form { padding: 8px; border-top: 1px solid var(--line); }

.log { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.log__row { display: flex; gap: 7px; align-items: baseline; line-height: 1.45; }
.log__pip { width: 8px; height: 8px; border-radius: 2px; flex: none; transform: translateY(1px); border: 1px solid rgba(0,0,0,.4); }
.log__text { color: var(--ink-dim); }
.log__row.is-turn  { margin-top: 6px; padding-top: 7px; border-top: 1px solid var(--line-soft); }
.log__row.is-turn  .log__text { color: var(--ink); font-weight: 600; }
.log__row.is-roll  .log__text { color: var(--ink); }
.log__row.is-win   .log__text { color: var(--gold); font-weight: 700; }
.log__row.is-chat  .log__text { color: var(--ink); }
.log__row.is-chat  .log__text b { color: var(--gold); font-weight: 620; }
.log__row.is-award .log__text { color: var(--gold); }

.bank { padding: 12px; display: grid; gap: 9px; }
.bank__row { display: flex; align-items: center; gap: 10px; }
.bank__bar { flex: 1; height: 7px; border-radius: 4px; background: var(--raised); overflow: hidden; }
.bank__fill { height: 100%; border-radius: 4px; }
.bank__n { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; min-width: 3.4rem; text-align: right; }

/* ---------------------------------------------------------------- dock */
.dock {
  grid-area: dock; min-height: 0;
  display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center;
  padding: 10px 14px;
  background: var(--panel); border-top: 1px solid var(--line);
}
.dock__hand { user-select: none; display: flex; align-items: center; gap: 18px; min-width: 0; overflow-x: auto; padding-bottom: 2px; }
.hand, .devhand { display: flex; gap: 7px; align-items: flex-end; }
.devhand { padding-left: 18px; border-left: 1px solid var(--line); }

/* Longest Road / Largest Army, sat with your cards where you will see them. */
.awards { display: flex; gap: 8px; }
.awards:not(:empty) { padding-left: 18px; border-left: 1px solid var(--line); }
.award img {
  display: block; height: 74px; border-radius: 4px;
  box-shadow: 0 0 0 2px var(--gold), 0 3px 12px rgba(0, 0, 0, .55);
}
html[data-game-type="kakure"] .award img {
  width: 74px; object-fit: cover; border-radius: 50%;
}

.react-btn {
  margin-left: auto; flex: none; cursor: pointer;
  width: 42px; height: 42px; border-radius: 50%;
  font-size: 21px; line-height: 1;
  background: var(--panel-2); border: 1px solid var(--line); color: inherit;
  transition: transform .12s ease, border-color .12s ease;
}
.react-btn:hover { transform: scale(1.08); border-color: var(--gold); }
.react-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.react-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.react-cell {
  aspect-ratio: 1; cursor: pointer; font-size: 25px; line-height: 1;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  color: inherit; transition: transform .12s ease, border-color .12s ease;
}
.react-cell:hover { transform: scale(1.12); border-color: var(--gold); }
.react-cell.is-picked { border-color: var(--gold); background: rgba(224, 169, 74, .16); }
.react-cell:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.pcard__reaction { font-size: 17px; line-height: 1; animation: react-pop .35s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes react-pop { from { transform: scale(.2) rotate(-15deg); opacity: 0; } }

@media (max-width: 640px) {
  .react-grid { grid-template-columns: repeat(4, 1fr); }
  .award img { height: 56px; }
  .react-btn { width: 38px; height: 38px; font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  .react-btn, .react-cell { transition: none; }
  .pcard__reaction { animation: none; }
}

.rescard {
  position: relative; width: 62px; flex: none;
  border-radius: 6px; overflow: hidden;
  border: 1px solid rgba(0,0,0,.45);
  box-shadow: 0 3px 9px rgba(0,0,0,.35);
  background: var(--panel-2);
  transition: transform .12s;
}
.rescard img { width: 100%; height: auto; }
.rescard.is-zero { opacity: .26; filter: grayscale(.75); }
.rescard__n {
  position: absolute; right: 3px; bottom: 3px;
  background: rgba(12,18,26,.9); color: #fff;
  border-radius: 12px; min-width: 21px; height: 21px;
  display: grid; place-items: center; font-size: 12.5px; font-weight: 700;
  padding: 0 5px;
}
.devcard {
  width: 58px; flex: none; border-radius: 6px; overflow: hidden; cursor: pointer;
  border: 1px solid rgba(0,0,0,.45); box-shadow: 0 3px 9px rgba(0,0,0,.35);
  transition: transform .12s, box-shadow .12s; background: none; padding: 0;
}
.devcard:hover:not(:disabled) { transform: translateY(-5px); box-shadow: 0 8px 16px rgba(0,0,0,.45); }
.devcard:disabled { cursor: default; opacity: .55; }
.devcard.is-vp { cursor: default; }

.dock__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; max-width: 62%; }
.dock__actions .btn { position: relative; }
.cost {
  display: flex; gap: 2px; justify-content: center; margin-top: 3px;
}
.cost i { width: 7px; height: 7px; border-radius: 2px; display: block; }

.empty-hand { color: var(--muted); font-size: 13px; padding: 8px 2px; }

/* ---------------------------------------------------------------- board pieces */
.hex-clickable { cursor: pointer; }


/* ---- Kakure v3: Orasho tokens vs permanent VP coins (T252) ---- */
.orasho-token { pointer-events: none; }
.orasho-count { pointer-events: none; }
.ug-cross.is-cut-off { opacity: 0.72; }
.pcard__coins {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-variant-numeric: tabular-nums;
}
.pcard__coin {
  width: 0.85rem; height: 0.85rem; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f2e6b8, #c9a227 55%, #7a5a12);
  border: 1px solid #5b4416; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
  display: inline-block;
}
.pcard__token-pip {
  width: 0.55rem; height: 0.55rem; border-radius: 50%;
  background: #B08D3F; border: 1px solid #5b4416;
  display: inline-block;
}
.pcard__progress {
  font-size: 0.78rem; color: var(--muted, #8a7f6e);
}
.pcard__score-break {
  display: flex; flex-wrap: wrap; gap: 0.35rem 0.6rem;
  font-size: 0.72rem; color: var(--muted, #8a7f6e); margin-top: 0.15rem;
}
.coin-fly {
  position: fixed; z-index: 80; width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f2e6b8, #c9a227 55%, #7a5a12);
  border: 1px solid #5b4416; pointer-events: none;
  transition: transform 480ms ease-out, opacity 480ms ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .coin-fly { transition: none; display: none; }
}

/* Recolor only the Kakure artwork; tokens, pieces and hit targets stay crisp. */
.kakure-terrain--rice,
.kakure-terrain--iron,
.kakure-terrain--forest,
.kakure-terrain--silk,
.kakure-terrain--clay,
.kakure-terrain--barren {
  /* T220: Hickok's painted hex art carries the palette — no CSS tint overlay. */
  filter: none;
}

/* A build target is a group: a transparent finger-sized hit area wrapping the
   smaller visible marker, so tapping works on a phone. */
.spot-hit { cursor: pointer; }
.spot-hit > .spot, .spot-hit > .spot-road { pointer-events: none; }
.spot {
  fill: var(--gold); fill-opacity: .9;
  stroke: #23180a; stroke-width: .04;
  animation: pulse 1.7s ease-in-out infinite;
}
.spot-hit:hover > .spot { fill: #fff; }
@keyframes pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.spot-road { stroke: var(--gold); stroke-opacity: .9; stroke-width: .17; stroke-linecap: round; animation: pulse 1.7s ease-in-out infinite; }
.spot-hit:hover > .spot-road { stroke: #fff; stroke-opacity: 1; }

/* On a touchscreen the marker itself is the aiming point, so make it bigger.
   The invisible hit circle stays at 0.46 units - half the spacing between two
   intersections - because during setup adjacent spots are both legal and any
   larger would make them overlap. Pinch to zoom for finer work. */
@media (pointer: coarse) {
  .spot { r: 0.25; }
  .spot-road { stroke-width: 0.22; }
}
.spot-hex { fill: var(--gold); fill-opacity: .001; stroke: var(--gold); stroke-width: .07; cursor: pointer; animation: pulse 1.7s ease-in-out infinite; }
.spot-hex:hover { fill-opacity: .3; }

.tok-circle { fill: #f0e4c8; stroke: rgba(0,0,0,.4); stroke-width: .02; }
.tok-text { font: 700 .40px var(--font); text-anchor: middle; fill: #2b2318; }
.tok-text.is-red { fill: #b3271c; }
.tok-pips { fill: #2b2318; }
.tok-pips.is-red { fill: #b3271c; }
.tok-blocked { opacity: .35; }

.port-badge { fill: rgba(12, 26, 36, .82); stroke: rgba(240,228,200,.5); stroke-width: .025; }
.port-text  { font: 700 .26px var(--font); text-anchor: middle; fill: #f0e4c8; }
.port-line  { stroke: rgba(240,228,200,.42); stroke-width: .05; stroke-linecap: round; }

.road-piece { stroke-linecap: round; stroke-width: .19; }
.road-piece__edge { stroke: rgba(0,0,0,.55); stroke-width: .27; stroke-linecap: round; }
.piece-stroke { stroke: rgba(0,0,0,.6); stroke-width: .035; stroke-linejoin: round; }

.robber-shadow { fill: rgba(0,0,0,.4); }

/* ---------------------------------------------------------------- celebrating */
.party {
  position: fixed; inset: 0; z-index: 95; pointer-events: none;
  display: grid; place-items: center; overflow: hidden;
}
.party.is-going { animation: party-out .5s ease-in both; }
@keyframes party-out { to { opacity: 0; } }

/* The board underneath is busy, so darken it behind the words - otherwise the
 * subtitle lands on top of a button and neither is readable. */
.party::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 42% at 50% 50%, rgba(6,12,20,.82), rgba(6,12,20,0) 70%);
}
.party__words {
  position: relative; text-align: center; padding: 0 16px;
  animation: party-in .5s cubic-bezier(.2,1.5,.4,1) both;
}
@keyframes party-in {
  0%   { opacity: 0; transform: scale(.35) rotate(-8deg); }
  65%  { opacity: 1; transform: scale(1.1) rotate(2.5deg); }
  100% { opacity: 1; transform: scale(1) rotate(-1deg); }
}
.party__shout {
  font-weight: 800; letter-spacing: -.02em; line-height: 1;
  font-size: clamp(26px, 6vw, 58px); color: var(--gold);
  text-shadow: 0 3px 0 rgba(0,0,0,.6), 0 0 38px rgba(224,169,74,.5);
}
.party__shout--punch {
  font-size: clamp(38px, 9vw, 88px); color: #ff6f61; text-transform: uppercase;
  text-shadow: 0 4px 0 rgba(0,0,0,.6), 0 0 44px rgba(255,111,97,.55);
  animation: punch .35s .16s cubic-bezier(.2,1.8,.4,1) both;
}
@keyframes punch { from { transform: scale(.5) rotate(6deg); opacity: 0; } }
.party__sub {
  margin-top: 12px; font-size: clamp(13px, 2.4vw, 18px); font-weight: 600;
  color: var(--ink); text-transform: uppercase; letter-spacing: .16em;
  text-shadow: 0 2px 6px rgba(0,0,0,.8);
}
[data-tier="huge"] .party__shout--punch { font-size: clamp(46px, 12vw, 128px); }

.party__confetti { position: absolute; inset: 0; }
.confetto {
  position: absolute; top: -6vh; display: block; border-radius: 2px;
  animation-name: fall; animation-timing-function: linear; animation-fill-mode: both;
}
@keyframes fall {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  100% { opacity: 0; transform: translate(var(--drift), 108vh) rotate(var(--spin)); }
}

@media (prefers-reduced-motion: reduce) {
  .party__confetti { display: none; }
}

/* ---------------------------------------------------------------- the yelling */
.yell {
  position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%);
  z-index: 90; pointer-events: none; text-align: center;
  max-width: min(46rem, calc(100% - 32px));
  font-size: clamp(28px, 6.5vw, 62px); font-weight: 800; line-height: 1.05;
  letter-spacing: -.02em; text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 3px 0 rgba(0,0,0,.55), 0 0 34px rgba(224,169,74,.45);
  animation: yell-in .42s cubic-bezier(.2, 1.5, .4, 1) both;
}
.yell.is-scold {
  color: #ffb3ab; text-transform: none; font-size: clamp(21px, 4vw, 38px);
  text-shadow: 0 3px 0 rgba(0,0,0,.55), 0 0 30px rgba(210,86,75,.45);
}
.yell.is-going { animation: yell-out .38s ease-in both; }
@keyframes yell-in {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.4) rotate(-9deg); }
  60%  { opacity: 1; transform: translate(-50%, -50%) scale(1.12) rotate(3deg); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-1.5deg); }
}
@keyframes yell-out {
  to { opacity: 0; transform: translate(-50%, -50%) scale(1.5) rotate(4deg); }
}

/* ---------------------------------------------------------------- toasts + modal */
.toasts { position: fixed; left: 50%; bottom: calc(var(--dock-h) + 16px); transform: translateX(-50%);
  display: grid; gap: 8px; z-index: 60; pointer-events: none; width: min(30rem, calc(100% - 24px)); }
.toast {
  background: var(--raised); border: 1px solid var(--line); color: var(--ink);
  border-radius: var(--radius-sm); padding: 11px 15px; box-shadow: var(--shadow);
  font-size: 14px; animation: rise .2s ease-out;
}
.toast.is-bad  { border-color: rgba(210,86,75,.6); background: #40222133; backdrop-filter: blur(8px); }
.toast.is-good { border-color: rgba(74,169,108,.5); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.modal-back {
  position: fixed; inset: 0; background: rgba(6, 12, 18, .7); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 18px; z-index: 80;
  animation: fade .15s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); width: min(34rem, 100%); max-height: 88vh; overflow: auto;
  padding: 20px; display: grid; gap: 14px;
}
.modal h3 { font-size: 17px; }
.modal__actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.game-type-field {
  display: grid; grid-template-columns: minmax(0, 1fr) 112px;
  align-items: center; gap: 12px;
}
.game-type-preview {
  width: 112px; height: 84px; object-fit: contain;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #111923;
}
.game-type-preview.is-kakure { object-fit: cover; }

.picker { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.picker__cell { display: grid; gap: 5px; justify-items: center; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 4px; }
.picker__cell.is-selected { border-color: var(--gold); background: rgba(224,169,74,.14); }
.picker__cell img { width: 42px; border-radius: 4px; }
.picker__cell .name { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 24px; height: 24px; border-radius: 5px; border: 1px solid var(--line);
  background: var(--raised); cursor: pointer; display: grid; place-items: center; line-height: 1; }
.stepper button:disabled { opacity: .3; cursor: not-allowed; }
.stepper span { min-width: 1.4rem; text-align: center; font-variant-numeric: tabular-nums; font-weight: 650; }

.invite { display: grid; gap: 8px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.invite h4 { margin: 0; font-size: 14px; font-weight: 640; }
.invite code { font-size: 12px; color: var(--gold); font-family: ui-monospace, Menlo, Consolas, monospace;
  word-break: break-all; }

.avatar-grid {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px;
  max-height: 40vh; overflow-y: auto;
}
.avatar-cell {
  aspect-ratio: 1; font-size: 21px; line-height: 1;
  display: grid; place-items: center; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 0;
}
.avatar-cell:hover { background: var(--raised); }
.avatar-cell.is-selected { border-color: var(--gold); background: rgba(224,169,74,.18); }

/* A player's emoji, shown wherever their name appears. */
.avatar { font-size: 17px; line-height: 1; flex: none; }
.avatar--lg { font-size: 24px; }
.avatar--sm { font-size: 13px; }
.seat-dot { position: relative; }

.costs-table { display: grid; gap: 10px; }
.costs-row { display: flex; align-items: center; gap: 12px; background: var(--panel-2);
  border-radius: var(--radius-sm); padding: 10px 12px; }
.costs-row__what { font-weight: 600; flex: 1; }
.costs-row__cost { display: flex; gap: 5px; }
.costs-row__cost img { width: 26px; border-radius: 3px; }

.trade-offer { background: var(--panel-2); border: 1px solid var(--gold-dim); border-radius: var(--radius-sm); padding: 12px; display: grid; gap: 10px; }
.trade-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.trade-side img { width: 34px; border-radius: 3px; }
.trade-arrow { color: var(--muted); }
.trade-statuses { display: grid; gap: 4px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px 0; }
.trade-status { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.trade-status__value { color: var(--gold); font-weight: 650; }
.trade-private-warning { margin: 0; color: #e8b06a; font-size: 12.5px; line-height: 1.4; }

/* ---------------------------------------------------------------- sign in */
.signin { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.signin__card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px; width: min(28rem, 100%); display: grid; gap: 14px; box-shadow: var(--shadow); }
.signin__logo { width: 74%; margin: 0 auto 4px; }
.signin__form { display: grid; gap: 7px; }
.signin__form .btn { margin-top: 3px; }
.signin__recovery { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1080px) { :root { --side-w: 290px; } }

@media (max-width: 860px) {
  :root { --dock-h: auto; }
  /* Flex, not grid: a fixed-height grid squeezes the auto rows and the action
     buttons spill over the panel below. A column lets each block take the
     height it needs and the page scroll. */
  .game {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }
  .mobile-players {
    display: flex; order: 0; flex: none; gap: 7px; overflow-x: auto;
    padding: 7px 10px; background: var(--panel); border-bottom: 1px solid var(--line);
    scrollbar-width: thin;
  }
  .mobile-player {
    display: flex; align-items: center; gap: 5px; flex: none; max-width: 8.5rem;
    padding: 6px 8px; border: 1px solid var(--line); border-radius: 999px;
    background: var(--panel-2); font-size: 12px;
  }
  .mobile-player.is-you { border-color: var(--gold-dim); }
  .mobile-player.is-turn { box-shadow: inset 0 0 0 1px var(--gold); }
  .mobile-player__pip { width: 11px; height: 11px; border-radius: 3px; border: 1px solid rgba(0,0,0,.45); flex: none; }
  .mobile-player__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-player__reaction { font-size: 15px; }
  .mobile-chat-notice {
    display: block; order: 0; flex: none; border: 0; padding: 7px 12px;
    background: rgba(224,169,74,.18); color: var(--ink); text-align: left; font-weight: 650;
    cursor: pointer;
  }
  /* Explicit order: the DOM has the side panel before the dock, but on a phone
     your own hand and buttons belong directly under the board. */
  .board-wrap { flex: none; order: 1; height: 52vh; min-height: 300px; }
  .dock       { flex: none; order: 2; }
  .side {
    position: fixed; z-index: 70; top: 0; right: 0; bottom: 0; width: min(26rem, 94vw);
    transform: translateX(105%); transition: transform .18s ease; box-shadow: var(--shadow);
    border-left: 1px solid var(--line); border-top: 0;
  }
  .side.is-chat-open { transform: translateX(0); }
  .side .players { display: none; }
  .mobile-chat-close { display: block; flex: none; border: 0; border-bottom: 1px solid var(--line); background: var(--panel-2); color: var(--ink); padding: 13px; text-align: right; cursor: pointer; }
  /* A definite height here is what makes the log scroll inside itself instead
     of stretching to fit every entry. */
  .side__panel { flex: none; height: 40vh; min-height: 200px; }
  .dock { grid-template-columns: 1fr; gap: 10px; }
  .dock__actions { max-width: none; justify-content: stretch; }
  .dock__actions .btn { flex: 1 1 8rem; min-height: 46px; }
  .toasts { bottom: 16px; }
  .picker { grid-template-columns: repeat(3, 1fr); }
  .side__panel > form { padding: 10px 8px; }

  /* The dice sit top-left, so keep the status message out of their way, and
     let it span the width so it stays one line instead of a wrapped block. */
  .banner {
    top: auto; bottom: 8px; left: 8px; right: 8px;
    transform: none; max-width: none; justify-content: center;
    font-size: 13.5px; padding: 9px 12px; border-radius: 12px;
  }
  .dice-tray { padding: 5px 10px 5px 6px; }
  .dice-tray img { width: 28px; height: 28px; }

  /* Comfortable thumb targets. */
  .icon-btn { width: 44px; height: 44px; font-size: 19px; }
  /* Sit above the full-width status bar rather than under it. */
  .board-tools { right: 8px; bottom: 66px; }
  .tab { padding: 13px 4px; }
  .mobile-chat-toggle { display: inline-flex; align-items: center; gap: 4px; }
  .own-identity { display: flex; }
}

@media (max-width: 620px) {
  /* Give the game name and status a full row of their own instead of
     squeezing them between the logo and the buttons. */
  .topbar { flex-wrap: wrap; gap: 10px 12px; padding: 8px 12px; }
  .topbar__title { order: 3; flex: 1 0 100%; }
  .topbar__title h1 { font-size: 15px; }
  .topbar__right { margin-left: auto; }
  .topbar__right { flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
  .own-identity { order: -1; font-size: 11px; }
  .topbar__right .btn { padding: 9px 12px; font-size: 13.5px; min-height: 40px; }
  .topbar__home img { height: 26px; }
  html[data-game-type="kakure"] .topbar__home img { width: 30px; height: 30px; }

  .game-card { gap: 10px; padding: 12px; }
  .game-card__art { width: 56px; height: 42px; }

  /* Stack the two hands instead of side-scrolling them off the edge. */
  .dock__hand { flex-wrap: wrap; gap: 10px; overflow-x: visible; }
  .hand, .devhand { gap: 6px; flex: 1 0 100%; overflow-x: auto; padding-bottom: 2px; }
  .devhand {
    padding-left: 0; border-left: 0;
    border-top: 1px solid var(--line); padding-top: 9px;
  }
  .rescard { width: 52px; }
  .devcard { width: 48px; }
  .empty-hand { white-space: nowrap; font-size: 12px; padding: 2px; }
  .pcard { grid-template-columns: auto 1fr auto; }
  /* No room for a 60-character URL on a phone - "Copy link" covers it. */
  .user-row__link { display: none; }
  .user-row { gap: 8px; }
  .user-row .btn { flex: 1 1 auto; }

  /* Nothing tappable should be smaller than a fingertip. */
  .btn { min-height: 42px; }
  .btn--small { min-height: 40px; padding: 8px 14px; }
  .stepper button { width: 36px; height: 36px; font-size: 17px; }
  .stepper span { min-width: 1.8rem; }
  .picker__cell { padding: 10px 6px; }
  .game-type-field { grid-template-columns: minmax(0, 1fr) 88px; }
  .game-type-preview { width: 88px; height: 66px; }
}

@media (max-width: 620px) {
  .invite { display: grid; gap: 8px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.invite h4 { margin: 0; font-size: 14px; font-weight: 640; }
.invite code { font-size: 12px; color: var(--gold); font-family: ui-monospace, Menlo, Consolas, monospace;
  word-break: break-all; }

.avatar-grid { grid-template-columns: repeat(8, 1fr); }
  .avatar-cell { font-size: 22px; }
}

@media (max-width: 400px) {
  .game-card .seats { display: none; }
  .rescard { width: 46px; }
  .devcard { width: 44px; }
  .picker { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ================================================================ KAKURE
   A second game sharing this interface. The palette is the one delivered with
   the art: oyster paper, lacquer red for anything public and official, gold
   reserved strictly for hidden things, pine as the quiet secondary.

   The one rule the art direction insists on: nothing public is ever gold, and
   nothing hidden is ever lacquer red. */
:root[data-game="kakure"] {
  --oyster:    #E9E2D4;
  --lacquer:   #8E2116;
  --kakure-ink:#14110F;
  --kgold:     #B08D3F;
  --pine:      #4A5B4E;

  --bg:        #14110F;
  --sea:       #1d1916;
  --sea-deep:  #17130F;
  --panel:     #201b17;
  --panel-2:   #2a231d;
  --raised:    #352c24;
  --ink:       var(--oyster);
  --ink-dim:   #c9bfae;
  --muted:     #9a8e7c;
  --line:      rgba(233, 226, 212, .12);
  --line-soft: rgba(233, 226, 212, .06);
  --gold:      var(--lacquer);
  --gold-dim:  #8E2116;
  --good:      var(--pine);
  --bad:       var(--lacquer);

  --display: Spectral, Georgia, "Times New Roman", serif;
  --labels: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;

  --clay: #8E2116;
  --wood: #4A5B4E;
  --silk: #C9BFAE;
  --rice: #7d8c5c;
  --iron: #5a6472;
}

:root[data-game="kakure"] body { font-family: var(--display); }
:root[data-game="kakure"] h1,
:root[data-game="kakure"] h2,
:root[data-game="kakure"] h3,
:root[data-game="kakure"] .pcard__name,
:root[data-game="kakure"] .modal h3 { font-family: var(--display); font-weight: 600; }
:root[data-game="kakure"] .small,
:root[data-game="kakure"] .muted.small,
:root[data-game="kakure"] .btn,
:root[data-game="kakure"] .pcard__meta,
:root[data-game="kakure"] .tok-num,
:root[data-game="kakure"] .rescard__n,
:root[data-game="kakure"] .topbar__sub {
  font-family: var(--labels);
  letter-spacing: .04em;
}
:root[data-game="kakure"] .btn { text-transform: uppercase; letter-spacing: .13em; }

/* The board reads better on ink than on ocean blue. */
:root[data-game="kakure"] .board-wrap { background:
  radial-gradient(ellipse 70% 60% at 50% 42%, #221c16 0%, #14110F 75%); }

/* A hidden building is the same piece, darkened, ringed in gold. */
.piece-stroke.is-hidden {
  filter: brightness(.45) saturate(.6);
  stroke: #B08D3F;
  stroke-width: 0.9;
}
.ug-cross { pointer-events: none; }


:root[data-game="kakure"] .btn--primary { color: #E9E2D4; }
:root[data-game="kakure"] .rescard,
:root[data-game="kakure"] .devcard { background: #E9E2D4; color: #8E2116; }
:root[data-game="kakure"] .rescard img { aspect-ratio: 1; object-fit: cover; }
:root[data-game="kakure"] .devcard img { width: 100%; aspect-ratio: 1; object-fit: cover; }
:root[data-game="kakure"] .kakure-card-label {
  display: block; font-family: var(--labels); font-size: 10px;
  line-height: 1.2; text-align: center; padding: 4px 2px;
}
:root[data-game="kakure"] .rescard__n { top: 3px; bottom: auto; }
:root[data-game="kakure"] .devcard.is-vp { color: #B08D3F; background: #14110F; }
@media (max-width: 620px) {
  :root[data-game="kakure"] .topbar__right { max-width: 100%; min-width: 0; }
}


/* ===== T243 Priority 1: guidance, results, phone composition ===== */
.turn-guide {
  flex: 1 1 100%;
  display: flex; flex-direction: column; gap: 1px;
  padding: 4px 8px; margin-bottom: 2px;
  border: 1px solid var(--line); border-radius: 10px;
  background: rgba(224,169,74,.08);
  font-size: 12.5px; line-height: 1.3;
}
.dock__actions .btn-reason { max-height: 2.6em; overflow: hidden; }
.turn-guide__row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.turn-guide__next { color: var(--ink); font-weight: 600; }
.btn-reason {
  display: block; width: 100%; margin-top: 2px;
  font-size: 11px; font-weight: 500; opacity: .85; white-space: normal; line-height: 1.25;
  text-align: left;
}
/* T247: label on its own row, costs below — stops MISSION/CHURCH/BUY ACTION
   CARD text overlapping the cost icons on the narrow dock. */
.dock__actions .btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  white-space: normal;
  text-align: center;
  gap: 3px;
  padding: 8px 10px;
  max-width: 12.5rem;
  min-width: 6.5rem;
}
.dock__actions .btn > span:first-child {
  display: block;
  line-height: 1.15;
  font-size: 12px;
}
.dock__actions .cost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
}
.cost { display: inline-flex; align-items: center; gap: 4px; margin-left: 0; }
.cost-item { display: inline-flex; align-items: center; gap: 2px; }
.cost-item__icon { width: 16px; height: 16px; border-radius: 3px; object-fit: cover; flex: none; }
.cost-item__n { font-size: 11px; font-variant-numeric: tabular-nums; }

.results-panel {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel-2); max-width: 28rem;
}
.results-panel h3 { margin: 0; font-family: Georgia, 'Times New Roman', serif; }
.results-rule { margin: 0; font-size: 14px; line-height: 1.4; }
.results-board { display: flex; flex-direction: column; gap: 6px; }
.results-row {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px;
  padding: 6px 8px; border-radius: 8px; background: var(--panel);
  border: 1px solid transparent;
}
.results-row.is-winner { border-color: var(--gold-dim); background: rgba(224,169,74,.12); }
.results-name { font-weight: 650; }
.results-score { font-weight: 700; font-size: 16px; }
.results-meta { grid-column: 1 / -1; }

.since-last {
  margin: 0 0 10px; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--gold-dim); background: rgba(224,169,74,.1);
}
.since-last__title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 14px; font-weight: 700; margin-bottom: 6px;
}
.since-last__item {
  display: block; width: 100%; text-align: left;
  border: 0; background: transparent; color: var(--ink);
  padding: 5px 0; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--line);
}
.since-last__item:last-of-type { border-bottom: 0; }
.since-last__item.is-threat { color: #e8b4a0; }
.since-last__item.is-unresolved { font-weight: 650; }

.placement-preview { margin-top: 6px; }
.payment-count { font-weight: 650; margin: 4px 0; }
.picker { max-width: 100%; overflow-x: auto; }

.topbar__overflow { position: relative; display: flex; align-items: center; gap: 6px; }
.topbar-menu { display: flex; align-items: center; gap: 6px; }
#btn-more { display: none; }
.topbar-menu { display: flex; align-items: center; gap: 6px; }

@media (max-width: 860px) {
  /* R10: compact phone header ~64–80px */
  .topbar {
    flex-wrap: nowrap; align-items: center;
    min-height: 64px; max-height: 80px;
    padding: 6px 10px; gap: 8px;
  }
  .topbar__title { order: 0; flex: 1 1 auto; min-width: 0; }
  .topbar__title h1 { font-size: 15px; }
  .topbar__title p { font-size: 11.5px; }
  .topbar__right { flex: none; flex-wrap: nowrap; gap: 4px; max-width: 58%; }
  .topbar__right .btn { padding: 8px 10px; min-height: 40px; font-size: 13px; }
  .own-identity { display: none; } /* available via Account overflow */
  #btn-more { display: inline-flex; }
  .topbar-menu {
    display: none;
    position: absolute; right: 0; top: calc(100% + 4px); z-index: 80;
    flex-direction: column; align-items: stretch; gap: 4px;
    padding: 8px; border-radius: 10px; border: 1px solid var(--line);
    background: var(--panel); box-shadow: var(--shadow); min-width: 9rem;
  }
  .topbar-menu.is-open { display: flex; }
  .topbar-menu .btn { width: 100%; justify-content: flex-start; }

  /* One phase instruction: hide duplicate status under map when banner shows */
  .board-tools { right: 8px; bottom: 12px; }
  .banner { bottom: 58px; }
  .mobile-players { padding: 4px 8px; gap: 5px; }
  .mobile-player { padding: 5px 7px; font-size: 11.5px; max-width: 7.5rem; }
  .dock__actions .btn { min-height: 44px; }
  .modal, .modal__card, .dialog, [role="dialog"] { max-width: min(100vw - 16px, 28rem); }
}

@media (max-width: 620px) {
  .topbar { flex-wrap: nowrap; padding: 6px 8px; }
  .topbar__title { flex: 1 1 auto; order: 0; }
  .clock { font-size: 11px; max-width: 9.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Production highlight caption (R11) */
.board-wrap.is-produced::after {
  content: 'Highlighted hexes produced on the latest roll';
  position: absolute; left: 8px; top: 8px; z-index: 5;
  font-size: 11px; padding: 4px 8px; border-radius: 8px;
  background: rgba(20,24,30,.72); color: var(--ink); pointer-events: none;
}


/* T243 dock containment — fixed dock height must not spill onto the board */
.dock {
  overflow-x: hidden;
  overflow-y: auto;
  align-content: start;
  max-height: var(--dock-h);
}
.board-wrap { z-index: 1; }
.dock { z-index: 2; }
.dock__actions .btn-reason {
  display: none; /* titles/aria already carry the shortage text */
}
.dock__actions .btn { max-width: 12.5rem; }
@media (max-width: 860px) {
  .dock__actions .btn-reason { display: block; }
  .dock { max-height: 42vh; }
  :root { --dock-h: auto; }
}


/* T247: private hand strip above discard / Endure pickers */
.hand-summary {
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px 10px; margin: 6px 0 10px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2);
}
.hand-summary__title { font-size: 13px; }
.hand-summary__cards {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.hand-summary__card {
  display: grid; justify-items: center; gap: 2px;
  min-width: 44px;
}
.hand-summary__card img {
  width: 36px; height: 36px; border-radius: 4px; object-fit: cover;
}
.hand-summary__card b { font-variant-numeric: tabular-nums; font-size: 13px; }
.hand-summary__card.is-zero { opacity: .35; }
