/* Puddlehold lobby (lobby.js). HerpDerp skin as in Survivor, Siege and Lords. Jersey 10 is sharp
   only at 56/3 px and twice that, so the lobby uses those two sizes: the title and "Schnell spielen"
   at --phl-px2, everything else at --phl-px. A page may override the --phl-* tokens; the font comes
   from the page (font-family inherits). The size rules below are !important and doubled (.phl.phl) so a
   game's own "every font-size is X !important" rule (Siege, Schlammschlacht) cannot resize the lobby. */
.phl {
  --phl-wood: #6e3f1c; --phl-wood-dark: #3a2210; --phl-parch: #ead6a4; --phl-parch-hi: #fff5d0; --phl-parch-lo: #efd48f;
  --phl-gold: #ffd43a; --phl-ink: #2b1a0e; --phl-text: #fff6dc; --phl-muted: #eed9a8; --phl-leaf: #9be07a; --phl-rust: #7a2f10;
  --phl-brown: #6b4a22; --phl-btn-hi: #ffb64a; --phl-btn-lo: #ec8c22;
  --phl-px: 18.667px; --phl-px2: 37.333px; --phl-rx: 16px; --phl-rx2: 22px;
  --phl-read: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; --phl-title: "Jersey 10", var(--phl-read);
  --phl-outline: 1px 0 0 var(--phl-ink), -1px 0 0 var(--phl-ink), 0 1px 0 var(--phl-ink), 0 -1px 0 var(--phl-ink), 1px 1px 0 var(--phl-ink), -1px 1px 0 var(--phl-ink), 1px -1px 0 var(--phl-ink), -1px -1px 0 var(--phl-ink);
  color: var(--phl-text); width: min(1040px, 100%); margin: 0 auto; text-align: left; font-size: var(--phl-px);
}
.phl * { box-sizing: border-box; }
.phl.phl, .phl.phl *, .phl.phl *::before, .phl.phl *::after { font-size: var(--phl-px) !important; font-weight: 400 !important; font-style: normal !important; letter-spacing: 0 !important; }
.phl.phl .phl-logo h2, .phl.phl .phl-quickplay .phl-big { font-size: var(--phl-px2) !important; }
.phl button, .phl input { font-family: inherit; }
/* Readable text everywhere (15.11.2026): a plain sans face for all text, the pixel face only for
   the gold titles (game name, home link, box headings). */
.phl.phl, .phl.phl *, .phl.phl *::before, .phl.phl *::after { font-family: var(--phl-read) !important; font-size: var(--phl-rx) !important; font-weight: 600 !important; -webkit-font-smoothing: antialiased; }
.phl.phl .phl-quickplay .phl-big { font-size: var(--phl-rx2) !important; font-weight: 700 !important; }
.phl.phl .phl-logo h2, .phl.phl .phl-home, .phl.phl .phl-box h3 { font-family: var(--phl-title) !important; font-size: var(--phl-px) !important; font-weight: 400 !important; -webkit-font-smoothing: none; }
.phl.phl .phl-logo h2 { font-size: var(--phl-px2) !important; }
.phl h2, .phl h3 { margin: 0; font-family: inherit; }
.phl [hidden] { display: none !important; }
.phl-panel {
  position: relative; background: var(--phl-wood); border: 12px solid var(--phl-ink); border-radius: 14px;
  border-image-source: url(panel.png); border-image-slice: 36 fill; border-image-width: 36px; border-image-repeat: round;
  box-shadow: 0 6px 0 rgba(0,0,0,.28); padding: 14px 18px; display: flex; flex-direction: column; gap: 10px;
  /* never taller than the window: the content scrolls inside, the main action stays visible */
  max-height: calc(100vh - 24px - var(--phl-cut, 0px)); max-height: calc(100dvh - 24px - var(--phl-cut, 0px));
}
.phl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.phl-home { color: var(--phl-gold); text-decoration: none; text-shadow: var(--phl-outline); }
.phl-logo { flex: 1 1 auto; display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.phl-logo h2 { line-height: 1; color: var(--phl-gold); text-shadow: var(--phl-outline); white-space: nowrap; }
.phl-logo small { color: var(--phl-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phl-pill { background: var(--phl-ink); color: var(--phl-leaf); border-radius: 20px; padding: 1px 12px; white-space: nowrap; }
.phl-pill::before { content: '● '; }
.phl-who { display: flex; align-items: center; gap: 6px; color: var(--phl-muted); }
.phl-who input { width: 120px; }
.phl-lang { display: flex; gap: 2px; }
.phl-lang button { background: none; border: 0; color: var(--phl-muted); cursor: pointer; padding: 0 4px; }
.phl-lang button.on { color: var(--phl-gold); text-decoration: underline; }
.phl-lang button[data-act="music"] { color: var(--phl-gold); display: flex; align-items: center; }
/* Pixel icons (make-icons.py): 2x art grid, shown at 1x or 1.5x so one art pixel stays a whole device pixel on 2x screens. */
.phl-ico { display: inline-block; flex: none; background: center / 100% 100% no-repeat; image-rendering: pixelated; vertical-align: -2px; }
.phl-ico-dice { width: 22px; height: 22px; background-image: url(ico_dice.png); vertical-align: middle; }
.phl-ico-user { width: 18px; height: 17px; background-image: url(ico_user.png); }
.phl-ico-lock { width: 15px; height: 18px; background-image: url(ico_lock.png); }
.phl-ico-note { width: 26px; height: 20px; background-image: url(ico_note.png); vertical-align: middle; }
.phl-lang button[data-act="music"].off .phl-ico { filter: grayscale(1) brightness(.8); opacity: .6; }
.phl input { background: var(--phl-parch-hi); color: var(--phl-ink); border: 3px solid var(--phl-ink); border-radius: 8px; padding: 2px 8px; min-width: 0; user-select: text; -webkit-user-select: text; }
.phl-box { background: rgba(43,26,14,.35); border: 3px solid var(--phl-ink); border-radius: 10px; padding: 8px 12px; min-width: 0; display: flex; flex-direction: column; gap: 6px; flex: none; }
.phl-box h3 { color: var(--phl-gold); text-shadow: var(--phl-outline); display: flex; gap: 8px; justify-content: space-between; align-items: center; }
.phl-sub { color: var(--phl-muted); }
.phl-btn {
  cursor: pointer; padding: 4px 14px; margin: 0; white-space: nowrap;
  background: linear-gradient(var(--phl-btn-hi), var(--phl-btn-lo)); color: var(--phl-ink); border: 3px solid var(--phl-ink); border-radius: 12px;
  box-shadow: 0 4px 0 var(--phl-ink), inset 0 2px 0 rgba(255,255,255,.45);
}
.phl-btn:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.phl-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--phl-ink); }
.phl-btn:disabled { background: #55361a; color: #c7ad84; box-shadow: 0 3px 0 var(--phl-ink); cursor: default; }
.phl-big { padding: 8px 22px; }
.phl-wide { width: 100%; }
.phl :focus-visible { outline: 3px solid var(--phl-gold); outline-offset: 2px; }
.phl-hint { color: var(--phl-muted); margin: 0; line-height: 1.1; }

.phl-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 12px; align-items: stretch; flex: 1 1 auto; min-height: 0; }
.phl-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; }
/* Scrolling content; the padding keeps button shadows and focus rings from being clipped. */
.phl-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 3px 3px 6px; margin: -3px -3px 0; scrollbar-width: thin; scrollbar-color: var(--phl-gold) var(--phl-wood-dark); }
.phl-act { flex: none; padding-top: 2px; }
.phl-tabs { display: flex; gap: 4px; border-bottom: 3px solid var(--phl-ink); }
.phl-tab { flex: 1; background: var(--phl-wood-dark); color: var(--phl-muted); border: 3px solid var(--phl-ink); border-bottom: 0; border-radius: 10px 10px 0 0; padding: 4px 6px; cursor: pointer; }
.phl-tab[aria-selected="true"] { background: var(--phl-parch); color: var(--phl-ink); }
.phl-chattab { display: none; }

.phl-quickplay { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.phl-quickplay .phl-big { flex: 1 1 200px; line-height: 1; }
.phl-quickplay p { margin: 0; color: var(--phl-muted); flex: 1 1 160px; line-height: 1.25; }

.phl-gpick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.phl-gp, .phl-mode { background: linear-gradient(var(--phl-parch-hi), var(--phl-parch-lo)); color: var(--phl-ink); border: 3px solid var(--phl-ink); border-radius: 10px; cursor: pointer; box-shadow: 0 3px 0 var(--phl-ink); text-align: left; }
.phl-gp { display: flex; flex-direction: column; padding: 4px 10px; line-height: 1; }
.phl-gp small { color: var(--phl-brown); }
.phl-gp[aria-pressed="true"], .phl-mode[aria-pressed="true"] { background: #fff1c2; box-shadow: 0 0 0 3px var(--phl-gold), 0 3px 0 var(--phl-ink); }
.phl-modes { display: grid; gap: 6px; }
.phl-mode { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; align-items: center; padding: 3px 10px; }
.phl-mn, .phl-md { line-height: 1.05; }
.phl-md { grid-column: 1 / -1; color: var(--phl-brown); }
.phl-mp { color: var(--phl-rust); white-space: nowrap; }
.phl-tag { background: var(--phl-rust); color: var(--phl-parch-hi); border-radius: 6px; padding: 0 6px; margin-left: 6px; }

.phl-form { display: grid; gap: 6px; }
@media (min-width: 761px) {
  .phl-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 10px; }
  .phl-form .phl-slotsrow { grid-column: 1 / -1; }
}
.phl-field { display: flex; flex-direction: column; gap: 2px; color: var(--phl-muted); }
.phl-field input { width: 100%; }
.phl-with { display: flex; gap: 6px; align-items: center; }
.phl-with input { flex: 1; }
.phl-with .phl-btn { padding: 1px 10px; }
.phl-slots { display: flex; gap: 4px; flex-wrap: wrap; }
.phl-slots button { width: 32px; height: 30px; padding: 0; border: 2px solid var(--phl-ink); border-radius: 6px; background: var(--phl-parch); color: var(--phl-ink); cursor: pointer; }
.phl-slots button[aria-pressed="true"] { background: var(--phl-gold); }

.phl-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.phl-tools input { flex: 1 1 120px; }
.phl-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; }
/* Selects a game puts into extra(): short ones become a .phl-seg row (lobby.js); long ones keep the select, styled like the inputs. */
.phl-sel-hid { display: none !important; }
.phl select { background: var(--phl-parch-hi); color: var(--phl-ink); border: 3px solid var(--phl-ink); border-radius: 8px; padding: 2px 6px; min-width: 0; max-width: 100%; font-family: inherit; }
.phl-seg button, .phl-chans button { background: rgba(43,26,14,.6); color: var(--phl-muted); border: 2px solid var(--phl-ink); border-radius: 8px; padding: 1px 8px; cursor: pointer; }
.phl-seg button[aria-pressed="true"] { background: var(--phl-gold); color: var(--phl-ink); }
.phl-chans button[aria-pressed="true"] { background: var(--phl-parch); color: var(--phl-ink); }
.phl-rooms { background: linear-gradient(var(--phl-parch-hi), var(--phl-parch-lo)); border: 3px solid var(--phl-ink); border-radius: 8px; color: var(--phl-ink); overflow: hidden auto; }
.phl-tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 2px 10px; align-items: center; padding: 6px 10px; border-bottom: 2px solid rgba(43,26,14,.18); cursor: pointer; }
.phl-tr:hover:not(.phl-off), .phl-tr.phl-open { background: #ffe89a; }
.phl-tr.phl-off { opacity: .55; cursor: default; }
.phl-nm, .phl-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.05; }
.phl-meta { grid-column: 1 / -1; color: var(--phl-brown); }
.phl-cnt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.phl-st { color: var(--phl-rust); white-space: nowrap; }
.phl-gm { background: var(--phl-ink); color: var(--phl-parch); border-radius: 6px; padding: 0 6px; }
.phl-pwrow { grid-column: 1 / -1; display: flex; gap: 6px; margin: 0; }
.phl-pwrow input { flex: 1; }
.phl-pwrow .phl-btn { padding: 0 12px; }
.phl-none { margin: 0; padding: 12px; }

.phl-chat { display: flex; flex-direction: column; gap: 6px; }
.phl-dock { overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--phl-gold) var(--phl-wood-dark); }
.phl-dock .phl-chat { flex: 1 1 auto; min-height: 0; }
.phl-dock .phl-log { flex: 1 1 auto; height: auto; min-height: 70px; }
.phl-chans { display: flex; gap: 4px; }
.phl-chans button { flex: 1; }
.phl-log { background: rgba(20,12,4,.5); border: 3px solid var(--phl-ink); border-radius: 8px; padding: 6px 8px; height: 220px; flex: none; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; user-select: text; -webkit-user-select: text; }
.phl-line { margin: 0; line-height: 1.05; text-shadow: var(--phl-outline); overflow-wrap: anywhere; }
.phl-line b { color: var(--phl-gold); }
.phl-src { color: var(--phl-leaf); }
.phl-sys { color: var(--phl-muted); }
.phl-quick { display: flex; gap: 4px; flex-wrap: wrap; }
.phl-quick button { background: var(--phl-parch); color: var(--phl-ink); border: 2px solid var(--phl-ink); border-radius: 14px; padding: 0 10px; cursor: pointer; }
.phl-say { display: flex; gap: 6px; margin: 0; }
.phl-say input { flex: 1; }
.phl-note { margin: 0; color: var(--phl-muted); opacity: .85; }
.phl-note a { color: inherit; text-decoration: underline; }
.phl-foot { color: var(--phl-muted); text-align: center; }
.phl-toast { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); background: var(--phl-ink); color: var(--phl-gold); border: 3px solid var(--phl-gold); border-radius: 10px; padding: 4px 14px; z-index: 5; max-width: calc(100% - 32px); text-align: center; }

/* Phones: one column, the chat becomes a tab. */
@media (max-width: 760px) {
  .phl-panel { padding: 12px; }
  .phl-grid { grid-template-columns: minmax(0, 1fr); }
  .phl-chattab { display: block; }
  .phl-dock { display: none; }
  .phl-who input { width: 96px; }
  .phl-logo small { display: none; }
  .phl-gpick { grid-template-columns: 1fr 1fr; }
}
/* Short windows (phone in landscape): trim the head and the quick play text. */
@media (max-height: 520px) {
  .phl-panel { padding: 8px 12px; gap: 6px; border-width: 10px; max-height: calc(100vh - 12px - var(--phl-cut, 0px)); max-height: calc(100dvh - 12px - var(--phl-cut, 0px)); }
  .phl-logo small, .phl-quickplay p { display: none; }
  .phl-box { padding: 6px 10px; }
}
/* Touch: head controls and tabs at least 40 px; desktop look stays as is. */
@media (pointer: coarse) {
  .phl-home { display: inline-flex; align-items: center; min-height: 40px; }
  .phl input { min-height: 40px; }
  .phl-lang button { min-width: 40px; min-height: 40px; padding: 0 8px; }
  .phl-tab, .phl-btn, .phl-seg button, .phl-chans button, .phl-quick button { min-height: 40px; }
  .phl-slots button { width: 40px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) { .phl-btn { transform: none !important; } }
