:root {
  --bg: #121b16;
  --ink: #f1efe6;
  --muted: #b9c2b8;
  --felt-1: #2f6a47;
  --felt-2: #1f4a32;
  --felt-3: #183a28;
  --wood: #5a3a22;
  --gold: #ffd54a;
  --glow: #7fe0ff;
  --card: #fbfaf5;
  --red-ink: #c0262d;
  --black-ink: #1d1d1d;
  --cw: clamp(44px, 4.6vw, 74px);
  --ch: calc(var(--cw) * 1.42);
  --Red: #e0453a; --Green: #2f9e4c; --Blue: #3b7be0; --Gold: #d9a514; --Violet: #9b59d0; --Orange: #ea7a1f;
  --Martial: #56657a; --Faith: #c7365f; --Wealth: #1f9fb5;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 15px/1.35 system-ui, "Segoe UI", sans-serif; overflow: hidden; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }
kbd { font: 11px system-ui; background: #0006; border-radius: 4px; padding: 0 4px; margin-left: 4px; opacity: .8; }

#app { position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr auto; }

/* top bar */
#topbar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; min-height: 52px; }
#rolebox { flex: 0 1 auto; }
#status { flex: 1; min-width: 180px; text-align: center; color: var(--muted); font-size: 14px; }
@media (max-width: 1000px) { kbd { display: none; } .role .goal { max-width: 220px; } }
#tools { display: flex; gap: 6px; }
.tool { background: #ffffff14; border: 1px solid #ffffff22; border-radius: 9px; padding: 6px 10px; cursor: pointer; font-weight: 600; font-size: 13px; }
.tool:hover { background: #ffffff26; }
.tool.on { background: var(--gold); color: #222; }
.role { display: flex; gap: 10px; align-items: center; background: #0006; border: 1px solid #ffffff1c; border-radius: 12px; padding: 6px 12px; }
.role .rname { font: 700 16px Georgia, serif; }
.role .goal { font-size: 12.5px; color: var(--muted); max-width: 360px; }

/* table */
#table { position: relative; min-height: 0; }
#felt { position: absolute; left: 9%; right: 9%; top: 9%; bottom: 7%; border-radius: 50%;
  background: radial-gradient(ellipse at center, var(--felt-1) 0%, var(--felt-2) 68%, var(--felt-3) 100%);
  box-shadow: inset 0 0 60px #000a, 0 0 0 12px var(--wood), 0 0 0 16px #3d2716, 0 18px 40px #000c; }
#felt.drop { box-shadow: inset 0 0 60px #000a, 0 0 0 12px var(--wood), 0 0 0 16px var(--glow), 0 18px 40px #000c; }

.seat { position: absolute; transform: translate(-50%, -50%); text-align: center; z-index: 3; min-width: 130px; }
.plate { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; background: #000b; border: 2px solid #ffffff18; border-radius: 12px; padding: 5px 12px; transition: box-shadow .25s, border-color .25s; }
.plate .nm { font-weight: 700; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.plate .sub { font-size: 12px; color: var(--muted); }
.plate.turn { border-color: var(--gold); box-shadow: 0 0 18px #ffd54a99; }
.plate.off { opacity: .55; filter: grayscale(.6); }
.plate.you { border-color: #ffffff55; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid #fff; flex: none; }
.badge { font-size: 12px; background: #ffffff1f; border-radius: 8px; padding: 1px 6px; }
.fan { display: flex; justify-content: center; margin-top: 4px; height: 22px; }
.fan .mini { width: 15px; height: 21px; margin-left: -6px; border-radius: 3px; box-shadow: 0 1px 2px #000a; }
.sitbtn { margin-top: 4px; background: var(--gold); color: #222; border: 0; border-radius: 8px; padding: 4px 12px; font-weight: 800; cursor: pointer; }

/* cards */
.card { position: relative; width: var(--cw); height: var(--ch); border-radius: 7px; background: var(--card); color: var(--black-ink);
  box-shadow: 0 2px 6px #000a; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 800; user-select: none; flex: none; transition: transform .15s, box-shadow .15s, opacity .2s; }
.card .rk { font-size: calc(var(--cw) * .36); line-height: 1; }
.card .st { font-size: calc(var(--cw) * .40); line-height: 1; }
.card .corner { position: absolute; top: 3px; left: 5px; font-size: calc(var(--cw) * .2); line-height: 1; text-align: center; }
.card.red { color: var(--red-ink); }
.card.back, .mini.back { background: repeating-linear-gradient(45deg, #6b2130 0 5px, #7d2a3b 5px 10px); border: 2px solid #f3e7d0; }
.mini { display: inline-block; background: var(--card); }
.card.sm { --cw: clamp(32px, 3vw, 48px); }
.card.xs { --cw: 20px; border-radius: 3px; box-shadow: 0 1px 2px #000a; border-width: 1px; }
.card .mk { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 34%; aspect-ratio: 1; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 2px #0006; }
.card.face .mk { top: auto; bottom: -7px; transform: translateX(-50%); width: 16px; }
.card.xs .mk { border-width: 1px; box-shadow: none; }
.card.fate { outline: 3px solid #c9a7ff; }
.card .val { position: absolute; top: -9px; right: -9px; background: #222; color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 6px; font-weight: 700; }
.card.legal, .card.pickable { cursor: pointer; outline: 3px solid var(--glow); box-shadow: 0 0 16px #7fe0ff88; }
.card.legal:hover, .card.pickable:hover { transform: translateY(-12px); }
.card.dim { opacity: .45; filter: saturate(.6); }
.card.sel { outline: 4px solid var(--gold); box-shadow: 0 0 20px #ffd54aaa; transform: translateY(-14px); }
.card.peeked { outline: 3px solid #c9a7ff; }

/* heir strip */
#strip { position: absolute; left: 50%; top: 17%; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; z-index: 2; }
.heirmini { display: flex; align-items: center; gap: 5px; background: #0007; border-radius: 10px; padding: 5px 10px; font-size: 13px; font-weight: 700; border: 2px solid transparent; }
.heirmini.cr { border-color: var(--gold); }
.heirmini .cards { display: flex; gap: 2px; }
.cradle { background: var(--gold); color: #222; border-radius: 5px; padding: 0 5px; font-size: 10px; font-weight: 900; letter-spacing: .4px; }

/* center */
#center { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
#center > * { pointer-events: auto; }
.played { position: absolute; transform: translate(-50%, -50%); transition: left .45s cubic-bezier(.2,.8,.2,1), top .45s cubic-bezier(.2,.8,.2,1), opacity .4s; }
.played .who { position: absolute; left: 50%; bottom: -18px; transform: translateX(-50%); font-size: 11px; white-space: nowrap; color: var(--muted); }
.played.win .card { outline: 3px solid var(--gold); box-shadow: 0 0 18px #ffd54aaa; }
.pile { position: absolute; transform: translate(-50%, -50%); display: flex; opacity: .8; animation: sweep .6s ease-out; }
.pile .card { margin-left: calc(var(--cw) * -.7); }
.pile .lbl { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 8px; font-size: 12px; white-space: nowrap; background: #0009; padding: 2px 8px; border-radius: 8px; }
@keyframes sweep { from { opacity: 0; transform: translate(-50%, -50%) scale(1.25); } to { opacity: .8; transform: translate(-50%, -50%) scale(1); } }
.slot { position: absolute; transform: translate(-50%, -50%); width: var(--cw); height: var(--ch); border: 2px dashed #ffffff55; border-radius: 7px; }

.stage-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(70%, 920px); }
.trickrow.small { margin-bottom: 10px; }
.trickrow.small .card.sel { transform: none; }
.lines { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; width: 100%; }
.line { background: #0b2a1bcc; border-radius: 14px; padding: 10px 10px 16px; text-align: center; border: 2px solid #ffffff14; }
.line.cr { border-color: var(--gold); }
.line.pick { cursor: pointer; border-color: var(--glow); box-shadow: 0 0 18px #7fe0ff66; }
.line h3 { margin: 0 0 8px; font: 700 17px Georgia, serif; display: flex; justify-content: center; gap: 8px; align-items: center; }
.line .row { display: flex; justify-content: center; gap: 8px; min-height: var(--ch); }
.line .sub { font-size: 12px; color: var(--muted); margin-top: 12px; line-height: 2; }
.line .sub .chip { font-size: 11px; padding: 1px 7px; }
.trickrow { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.trickrow .card { position: relative; }
.trickrow .by { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; font-weight: 600; }
.note { font-size: 13px; color: var(--muted); text-align: center; max-width: 640px; }

#banner { position: absolute; left: 50%; top: 67%; transform: translateX(-50%); z-index: 4; pointer-events: none; }
#banner .msg { background: #000c; border: 1px solid #ffffff22; border-radius: 10px; padding: 6px 14px; font-weight: 600; animation: fadein .3s; }

/* bottom */
#bottom { padding: 4px 14px 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
#prompt:empty { display: none; }
.prompt { background: var(--gold); color: #222; border-radius: 10px; padding: 7px 16px; font-weight: 700; box-shadow: 0 4px 14px #0008; max-width: 900px; text-align: center; }
.waiting { background: #0008; color: var(--ink); border-radius: 10px; padding: 6px 16px; font-weight: 600; }
#controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
#controls:empty { display: none; }
.btn { background: var(--card); color: #222; border: 0; border-radius: 9px; padding: 8px 18px; font-weight: 800; cursor: pointer; box-shadow: 0 2px 6px #0008; }
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn.primary { background: var(--gold); }
.btn.danger { background: #ff8a7a; }
.btn.ghost { background: #ffffff1c; color: var(--ink); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.input { background: #0008; color: var(--ink); border: 1px solid #ffffff33; border-radius: 9px; padding: 8px 12px; min-width: 260px; font: inherit; }
#hand { display: flex; justify-content: center; gap: 8px; min-height: calc(var(--ch) + 14px); align-items: flex-end; }
#hand.small { --cw: clamp(34px, 3.2vw, 52px); min-height: calc(var(--ch) + 4px); }

/* chips */
.chip { display: inline-block; border-radius: 14px; padding: 3px 10px; font-weight: 800; font-size: 13px; color: #fff; box-shadow: 0 1px 3px #0008; white-space: nowrap; }
.chip.suit { border-radius: 5px; }
.chip.Gold { color: #231a00; }
.bg-Red { background: var(--Red); } .bg-Green { background: var(--Green); } .bg-Blue { background: var(--Blue); }
.bg-Gold { background: var(--Gold); } .bg-Violet { background: var(--Violet); } .bg-Orange { background: var(--Orange); }
.bg-Martial { background: var(--Martial); } .bg-Faith { background: var(--Faith); } .bg-Wealth { background: var(--Wealth); }

/* overlays */
#overlay { position: fixed; inset: 0; z-index: 20; background: #07100bd9; backdrop-filter: blur(4px); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 28px 24px 24px; overflow: auto; animation: fadein .15s; }
#overlay.under-hand { bottom: calc(var(--ch) + 90px); }
.ovhead { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.ovhead h2 { margin: 0; font: 700 24px Georgia, serif; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.sheetwrap { width: min(1100px, 100%); overflow-x: auto; }
.sheet { width: 100%; border-collapse: separate; border-spacing: 0 6px; color: var(--ink); }
.sheet th { font-size: 12px; color: var(--muted); padding: 2px 6px; }
.sheet th.hh { font: 700 15px Georgia, serif; color: var(--ink); letter-spacing: .5px; }
.sheet td { padding: 7px 6px; text-align: center; color: var(--ink); }
.sheet td.stg { text-align: left; font-weight: 800; padding-left: 10px; white-space: nowrap; }
.sheet .c1 { background: #ffffff08; } .sheet .c2 { background: #ffffff12; }
.sheet .claim { font-size: 19px; font-weight: 900; }
.sheet .blank { color: var(--muted); font-style: italic; font-size: 12px; }
.sheet tr.new td { box-shadow: inset 0 2px 0 var(--gold), inset 0 -2px 0 var(--gold); }
.sheet tr.total td { border-top: 2px solid #fff4; padding-top: 12px; }
.sheet tr.mon td.mcol { background: #ffd54a22; }
.lead { display: inline-block; background: var(--gold); color: #222; border-radius: 10px; padding: 2px 12px; font-size: 20px; font-weight: 900; box-shadow: 0 0 14px #ffd54a88; }
.legend { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; font-size: 12px; color: var(--muted); align-items: center; }

.log { width: min(1000px, 100%); background: #0006; border-radius: 12px; padding: 12px 16px; font-size: 13.5px; line-height: 1.6; }
.log div { border-bottom: 1px solid #ffffff10; padding: 4px 0; }

/* reveal */
.reveal .line .card { animation: flip .5s both; }
@keyframes flip { from { transform: rotateY(90deg); opacity: 0; } to { transform: rotateY(0); opacity: 1; } }
.res { background: #0006; border-radius: 9px; padding: 7px 10px; text-align: left; font-size: 13px; line-height: 1.8; margin-top: 14px; animation: fadein .5s both; }
.res .bar { display: inline-block; height: 10px; border-radius: 3px; vertical-align: middle; margin-right: 3px; }
.res .won { color: var(--gold); font-weight: 800; }
.readyrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
.pill { background: #ffffff18; border-radius: 12px; padding: 3px 10px; font-size: 13px; }
.pill.ok { background: #2f9e4c; }

/* game over */
.crown { font: 800 40px Georgia, serif; text-align: center; margin: 6px 0 2px; text-shadow: 0 0 24px #ffd54a88; }
.roles { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin: 16px 0; }
.rolecard { background: #0008; border-radius: 12px; padding: 10px 14px; min-width: 150px; text-align: center; border: 2px solid #ffffff1c; animation: flip .6s both; }
.rolecard.win { border-color: var(--gold); box-shadow: 0 0 20px #ffd54a77; }
.rolecard .w { font-weight: 900; color: var(--gold); letter-spacing: 1px; }

/* lobby */
.lobbybox { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.lobbybox h1 { margin: 0; font: 800 44px Georgia, serif; letter-spacing: 1px; text-shadow: 0 2px 12px #000; }
.lobbybox .tag { color: var(--muted); font-style: italic; }

/* toasts */
#toasts { position: fixed; left: 16px; bottom: 16px; z-index: 30; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; pointer-events: none; }
.toast { background: #000d; border: 1px solid #ffffff26; border-left: 4px solid var(--gold); border-radius: 10px; padding: 8px 14px; max-width: 360px; font-size: 14px; animation: toastin .25s; }
.toast.bad { border-left-color: #ff6b5a; }
.toast.good { border-left-color: #4fd17a; }
@keyframes toastin { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: none; } }
#conn { position: fixed; left: 50%; top: 10px; transform: translateX(-50%); background: #b3261e; padding: 6px 14px; border-radius: 10px; z-index: 40; font-weight: 700; }

.seatbtns { display: flex; gap: 4px; justify-content: center; white-space: nowrap; }
.sitbtn.bot { background: #ffffff26; color: var(--ink); }
.mini-btn { background: #ffffff1f; border: 0; border-radius: 6px; padding: 0 6px; margin-left: 3px; cursor: pointer; font-size: 12px; color: var(--ink); }
.mini-btn:hover { background: #ffffff40; }
@media (max-height: 720px) {
  :root { --cw: clamp(36px, 3.6vw, 58px); }
  .lobbybox h1 { font-size: 30px; }
  .lobbybox .tag { display: none; }
  .fan { display: none; }
  #strip { top: 13%; }
  .plate { padding: 3px 10px; }
}

/* title screen */
#title { position: fixed; inset: 0; z-index: 35; display: flex; align-items: center; justify-content: center; overflow: auto;
  background: radial-gradient(ellipse at 50% 38%, #2a5b3e 0%, #163524 45%, #0b1710 100%); animation: fadein .4s; }
#title::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 120%, #00000099, transparent 60%); }
.title-inner { position: relative; text-align: center; padding: 32px 24px; max-width: 760px; }
.title-fan { position: relative; height: 160px; margin: 0 auto 6px; width: 300px; }
.tcard { position: absolute; left: 50%; bottom: 0; width: 82px; height: 116px; margin-left: -41px; border-radius: 9px;
  background: var(--card); color: var(--black-ink); box-shadow: 0 6px 18px #000a; display: flex; flex-direction: column;
  align-items: flex-start; justify-content: flex-start; padding: 6px 8px; font: 800 22px/1 Georgia, serif;
  transform-origin: 50% 140%; transform: rotate(var(--r)); animation: deal .7s cubic-bezier(.2,.8,.2,1) both; }
.tcard .big { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); font-size: 46px; }
.tcard:nth-child(2) { animation-delay: .08s; } .tcard:nth-child(3) { animation-delay: .16s; }
.tcard:nth-child(4) { animation-delay: .24s; } .tcard:nth-child(5) { animation-delay: .32s; }
.tcard.red { color: var(--red-ink); }
.tcard.back { background: repeating-linear-gradient(45deg, #6b2130 0 6px, #7d2a3b 6px 12px); border: 3px solid #f3e7d0; }
.tcard .st { font-size: 22px; line-height: 1; }
@keyframes deal { from { transform: rotate(0deg) translateY(40px); opacity: 0; } to { transform: rotate(var(--r)); opacity: 1; } }
#title h1 { margin: 6px 0 10px; font: 800 clamp(40px, 7vw, 76px) Georgia, serif; letter-spacing: 1.5px;
  color: #f6ecd2; text-shadow: 0 3px 0 #0006, 0 0 30px #ffd54a44; }
.tagline { color: #d9d3bf; font: italic 17px/1.55 Georgia, serif; margin: 0 auto 18px; max-width: 620px; }
.title-status { color: var(--muted); font-size: 14px; margin-bottom: 18px; min-height: 18px; }
.title-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn.big { font-size: 17px; padding: 12px 26px; border-radius: 11px; }
.title-link { display: inline-block; margin-top: 16px; color: #cfe8d8; font-size: 14px; }
.title-link:hover { color: var(--gold); }
@media (max-height: 640px) { .title-fan { height: 110px; } .tcard { width: 62px; height: 88px; margin-left: -31px; font-size: 22px; } }

/* rules overview */
#rules { position: fixed; inset: 0; z-index: 40; background: #050b08e0; backdrop-filter: blur(4px); overflow: auto;
  display: flex; justify-content: center; align-items: flex-start; padding: 24px; animation: fadein .15s; }
.rules-box { width: min(1080px, 100%); background: #10241a; border: 1px solid #ffffff22; border-radius: 16px; padding: 20px 24px 24px; box-shadow: 0 20px 60px #000c; }
.rules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.rules-grid section { background: #0006; border-radius: 12px; padding: 12px 16px; line-height: 1.5; font-size: 14.5px; }
.rules-grid section.wide { grid-column: 1 / -1; }
.rules-grid h3 { margin: 0 0 6px; font: 700 18px Georgia, serif; color: #f6ecd2; }
.rules-grid ul, .rules-grid ol { margin: 6px 0; padding-left: 20px; }
.rules-grid li { margin: 4px 0; }
.rules-grid .chip { font-size: 12px; padding: 1px 8px; }
.rules-grid a { color: var(--gold); }
.vals > div { display: flex; align-items: center; gap: 6px; margin: 6px 0; }
.vals .card { box-shadow: 0 1px 3px #0008; }
.vals span { margin-left: 6px; font-size: 13.5px; }
.steps5 li { margin: 7px 0; }
.good { color: #6fe08f; font-weight: 700; } .bad { color: #ff8a7a; font-weight: 700; }
.key { display: inline-block; min-width: 22px; text-align: center; background: #ffffff22; border: 1px solid #ffffff44; border-bottom-width: 3px; border-radius: 6px; padding: 0 6px; font-weight: 800; font-size: 13px; }

/* ---- alternate rules ---- */
.hclaim { font: 600 12px system-ui, sans-serif; color: var(--muted); }
.heirmini .hclaim { margin-left: 4px; }
.line.shut { opacity: .55; }
.line.crowned { border-color: var(--gold); box-shadow: 0 0 22px #ffd54a55; }
.cradle.shut { background: #555; color: #ddd; }
.preview { margin-top: 10px; font-size: 13.5px; background: #0009; border-radius: 8px; padding: 4px 10px; display: inline-block; }
.preview b { color: var(--gold); font-size: 15px; }
.played.gone { opacity: .25; }
.card.gone { opacity: .3; }
.draftnote { position: absolute; left: 50%; top: 74%; transform: translateX(-50%); font-size: 13px; background: #000a; padding: 4px 12px; border-radius: 10px; white-space: nowrap; max-width: 90%; overflow: hidden; text-overflow: ellipsis; }
.guessbox { width: min(1100px, 100%); background: #0b2a1bcc; border-radius: 14px; padding: 12px 16px; margin: 14px 0; border: 2px solid var(--glow); }
.guessbox h3 { margin: 0 0 6px; font: 700 18px Georgia, serif; }
.guessrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0; }
.guessrow .who { min-width: 150px; font-weight: 800; }
.gchip { background: #ffffff14; color: var(--ink); border: 1px solid #ffffff33; border-radius: 999px; padding: 4px 11px; cursor: pointer; font-size: 13px; }
.gchip:hover { border-color: var(--glow); }
.gchip.on { background: var(--glow); color: #102; border-color: var(--glow); font-weight: 800; }
.sheet td.mcol, .sheet th.mcol { background: #ffd54a22; }
.sheet.court th.open { color: var(--gold); }
.sheet.court td { min-width: 120px; }
#strip { top: 23%; }
.heirmini { white-space: nowrap; }
.heirmini.shut { opacity: .6; }
@media (max-width: 1000px) { .heirmini .cards { display: none; } }
#toasts { left: auto; right: 14px; top: 86px; bottom: auto; align-items: flex-end; }
.line .row { flex-wrap: wrap; }
.stage-center .lines { width: 100%; }
.stage-center .line .row { gap: 4px; min-height: calc(var(--ch) * .7); }
.stage-center .line h3 { flex-wrap: wrap; }
.lines { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#overlay > * { flex-shrink: 0; }
