/* The lobby: the honeycomb of time controls, open seeks, games in progress, players. */

.lobby {
  display: grid; gap: 16px; align-items: start;
  grid-template-columns: 360px minmax(0, 1fr) 290px;
  grid-template-areas: "create seeks right" "watch watch right";
}
.create-card { grid-area: create; }
.seeks-card { grid-area: seeks; min-height: 100%; display: flex; flex-direction: column; }
.watch-section { grid-area: watch; }
.lobby-right { grid-area: right; display: grid; gap: 12px; }

/* ---------------------------------------------------------------- return bar */

.return-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin-bottom: 16px; padding: 12px 16px;
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius-lg);
  color: var(--text-strong); font-weight: 600;
}
.return-text { margin-right: auto; }
.return-pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s ease-in-out infinite; flex: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px #f0b42900; } 0%, 100% { box-shadow: 0 0 0 0 #f0b42988; } }

/* ---------------------------------------------------------------- the honeycomb */

/* Pointy-top hexes in rows of 2, 3 and 2 with a gap of 6% of a hex's width: the
   cluster is 3.12 hexes wide and 2.99 tall; each row is 0.918 hex widths below the last. */
.honeycomb { position: relative; width: 100%; max-width: 340px; margin: 4px auto 18px; aspect-ratio: 3.12 / 2.9907; }
.hex-tile {
  position: absolute; width: 32.05%; height: 38.61%;
  left: calc(var(--col) * 33.974%); top: calc(var(--row) * 30.695%);
  padding: 0; border: 0; background: var(--line-2); color: var(--text);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  transition: background .15s, transform .15s; text-decoration: none; cursor: pointer;
}
.hex-inner {
  position: absolute; inset: 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: var(--panel-2); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  transition: background .15s;
}
.hex-tile svg { width: 24px; height: 24px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 2px; }
.hex-tile b { font-size: clamp(17px, 2.1vw, 23px); font-weight: 700; color: var(--text-strong); letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.hex-tile small { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); font-weight: 650; }
.hex-tile:hover, .hex-tile:focus-visible { background: var(--accent); text-decoration: none; outline: none; }
.hex-tile:hover .hex-inner, .hex-tile:focus-visible .hex-inner { background: color-mix(in srgb, var(--accent) 14%, var(--panel-2)); }
.hex-tile:active { transform: scale(.97); }
.hex-tile.custom b, .hex-tile.engine b { font-size: clamp(15px, 1.6vw, 17px); }
.hex-tile.engine .hex-inner { background: color-mix(in srgb, var(--accent) 9%, var(--panel)); }
.hex-tile.waiting { background: var(--accent); animation: seeking 1.6s ease-in-out infinite; }
.hex-tile.waiting .hex-inner { background: color-mix(in srgb, var(--accent) 24%, var(--panel-2)); }
.hex-tile.waiting small { color: var(--accent-2); }
:root[data-theme="light"] .hex-tile.waiting small { color: #8a5d00; }
@keyframes seeking { 50% { background: color-mix(in srgb, var(--accent) 35%, var(--line-2)); } }

.seek-options { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.seek-option { display: flex; flex-direction: column; gap: 5px; }
.seek-option .choice > button { min-height: 34px; padding: 5px 14px; display: inline-flex; align-items: center; justify-content: center; }
.colour-choice > button { padding: 5px 12px; }
.colour-choice .swatch { width: 16px; height: 16px; }
.create-note { text-align: center; margin: 14px 0 0; min-height: 2.6em; }

/* ---------------------------------------------------------------- seeks */

.seeks-table td { padding-top: 7px; padding-bottom: 7px; }
.seek-row:not(.own) { cursor: pointer; }
.seek-row:not(.own):hover, .seek-row:not(.own):focus-visible { background: var(--accent-soft) !important; outline: none; }
.seek-row.own { background: color-mix(in srgb, var(--accent) 7%, transparent) !important; }
.seek-action { text-align: right; width: 1%; white-space: nowrap; }
.seeks-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; line-height: 1.6; }
.seeks-empty strong { color: var(--text); }

/* ---------------------------------------------------------------- games in progress */

.section-head { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; }
.section-head h2 { margin: 0; font-size: 16px; }
.watch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.watch-empty { grid-column: 1 / -1; border: 1px dashed var(--line-2); border-radius: var(--radius-lg); padding: 22px 16px; }
.watch-tile { display: flex; flex-direction: column; color: var(--text); overflow: hidden; transition: border-color .15s, transform .15s; }
.watch-tile:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }
.watch-player { display: flex; align-items: center; gap: 7px; padding: 6px 10px; font-size: 13px; }
.watch-player .name { font-weight: 650; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.watch-player.to-move .name::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--good); margin-left: 6px; vertical-align: 2px; }
.watch-player .swatch { width: 11px; height: 11px; }
.thumb-wrap { background: var(--board); }
.thumb-board { display: block; width: 100%; aspect-ratio: 4 / 3; height: auto; }
.thumb-board.placeholder { background: var(--board); }
.thumb-last { fill: #f0b42933; stroke: #f0b429aa; stroke-width: 4; }
.watch-meta { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--dim); background: var(--panel-2); }

/* ---------------------------------------------------------------- players */

.player-search { padding: 10px 12px 6px; }
.player-search .input { min-height: 32px; padding: 5px 10px; }
.online-list { list-style: none; margin: 0; padding: 4px 0 8px; max-height: 360px; overflow-y: auto; }
.online-player { display: flex; align-items: center; gap: 8px; padding: 4px 12px; min-height: 34px; }
.online-player:hover { background: var(--hover); }
.online-player .player-link { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.online-player .rating { margin-left: auto; font-variant-numeric: tabular-nums; }
.online-empty { padding: 10px 14px; font-size: 13px; }
.challenge-btn { min-height: 26px; padding: 2px 8px; font-size: 12px; color: var(--link); }
.search-results { border-top: 1px solid var(--line); padding: 6px 0 8px; }
.search-results ul { list-style: none; margin: 0; padding: 0; }
.search-results li { display: flex; align-items: center; gap: 8px; padding: 4px 12px; }
.search-results li .muted { margin-left: auto; }
.search-results p { margin: 4px 12px; }
.results-head { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); padding: 2px 12px 4px; }
.outgoing { border-top: 1px solid var(--line); padding: 8px 12px; display: grid; gap: 6px; }
.outgoing-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.outgoing-item span:nth-child(2) { flex: 1; min-width: 0; }
.outgoing-item .spinner { width: 13px; height: 13px; }

.lobby-links { display: grid; gap: 10px; }
.lobby-links .entry { padding: 12px 14px; }
.lobby-links .entry h2 { font-size: 14.5px; }
.lobby-links .entry-icon { width: 38px; height: 38px; }
.lobby-links .entry-icon svg { width: 22px; height: 22px; }

/* ---------------------------------------------------------------- puzzle of the day */

.daily-puzzle { display: block; overflow: hidden; color: var(--text); transition: border-color .15s; }
.daily-puzzle:hover { text-decoration: none; border-color: var(--accent); }
.daily-more { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--link); }
.daily-text { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 13px; }
.daily-text strong { color: var(--text-strong); }
.daily-text .muted { margin-left: auto; font-size: 12px; }

/* ---------------------------------------------------------------- narrower windows */

@media (max-width: 1240px) {
  .lobby { grid-template-columns: 340px minmax(0, 1fr); grid-template-areas: "create seeks" "right watch"; }
}

@media (max-width: 860px) {
  .lobby { grid-template-columns: minmax(0, 1fr); grid-template-areas: "create" "seeks" "watch" "right"; gap: 12px; }
  .honeycomb { max-width: 330px; }
  .hex-tile b { font-size: 21px; }
  .seeks-empty { padding: 20px 14px; }
  .watch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .return-bar .btn { flex: 1; }
}
@media (max-width: 380px) {
  .watch-grid { grid-template-columns: minmax(0, 1fr); }
}
