@import url("../fonts/fonts.css");
:root {
  --table: #0F2A2C; --zone: #163739; --rule: #2E5557; --saf: #E8B04A; --saf-t: rgba(232, 176, 74, .14);
  --txt: #EDEBE4; --lab: #8FA9A8; --back: #14303F; --red: #D2553A; --grn: #3E8E5A;
  --sans: "Barlow Semi Condensed", "Arial Narrow", system-ui, sans-serif; --serif: "EB Garamond", Georgia, serif;
  --gut: 12px; --shadow: 2px 2px 0 rgba(6, 18, 19, .3);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--table); color: var(--txt); font-family: var(--sans); -webkit-tap-highlight-color: transparent; }
body { overflow: hidden; }
button { font-family: var(--sans); color: inherit; cursor: pointer; }
.tab { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }

#app { position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr auto; gap: var(--gut); padding: var(--gut); }
body.scroll { overflow: auto; }
body.scroll #app { position: relative; min-height: 620px; height: 620px; }

/* ---------- top strip ---------- */
#top { display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--rule); padding: 0 4px 10px; min-width: 0; }
#title { color: var(--saf); font-weight: 600; letter-spacing: .08em; font-size: 30px; white-space: nowrap; text-transform: uppercase; }
#opps { flex: 1; display: flex; gap: 8px; min-width: 0; overflow-x: auto; scrollbar-width: none; justify-content: center; }
#opps::-webkit-scrollbar { display: none; }
.opp { flex: 0 0 auto; display: grid; grid-template-columns: auto auto; column-gap: 10px; align-items: center; background: var(--zone); border: 1px solid var(--rule); border-radius: 8px; padding: 4px 10px; min-width: 128px; position: relative; text-align: left; }
.opp.sel { border-color: var(--saf); }
.opp.active::before { content: ""; position: absolute; left: 6px; right: 6px; top: -1px; height: 3px; background: var(--saf); border-radius: 0 0 2px 2px; }
.opp.out { opacity: .45; }
.opp .nm { font-size: 13px; color: var(--txt); letter-spacing: .04em; white-space: nowrap; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.opp .sub { font-size: 11px; color: var(--lab); letter-spacing: .06em; white-space: nowrap; }
.opp .lf { grid-row: 1 / span 2; grid-column: 2; font-size: 26px; font-weight: 600; color: var(--txt); text-align: right; }
.opp .cmdd { color: var(--saf); }
#mana { display: flex; gap: 6px; }
.chip { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; position: relative; }
.chip svg { width: 22px; height: 22px; }
.chip i { position: absolute; right: -5px; bottom: -4px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--table); border: 1px solid var(--saf); color: var(--saf); font: 600 11px/15px var(--sans); text-align: center; font-style: normal; padding: 0 3px; }
.chip.dim { opacity: .35; }
#life { display: flex; align-items: center; gap: 6px; border: 2px solid var(--saf); border-radius: 30px; padding: 3px 6px; position: relative; }
#life b { color: var(--saf); font-size: 40px; font-weight: 600; min-width: 58px; text-align: center; line-height: 1; }
#life button { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--saf); background: none; color: var(--saf); font-size: 24px; line-height: 1; display: grid; place-items: center; padding: 0; }
.float { position: absolute; left: 50%; top: 0; transform: translate(-50%, 0); font: 700 22px var(--sans); pointer-events: none; animation: rise .9s ease-out forwards; z-index: 60; white-space: nowrap; }
.float.neg { color: var(--red); } .float.pos { color: #6CC08A; }
@keyframes rise { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, -34px); } }

/* ---------- zones ---------- */
#main { display: grid; gap: var(--gut); min-height: 0; grid-template-columns: minmax(150px, 19%) 1fr minmax(118px, 13%); grid-template-rows: 1fr minmax(150px, 38%);
  grid-template-areas: "cmd bf side" "hand hand side"; }
.zone { background: var(--zone); border: 1px solid var(--rule); border-radius: 4px; position: relative; min-width: 0; min-height: 0; }
.zone::before, .zone::after { content: ""; position: absolute; width: 5px; height: 5px; border-color: var(--lab); border-style: solid; pointer-events: none; }
.zone::before { left: -1px; top: -1px; border-width: 1px 0 0 1px; }
.zone::after { right: -1px; bottom: -1px; border-width: 0 1px 1px 0; }
.zlabel { position: absolute; left: 10px; top: 8px; font-size: 13px; letter-spacing: .14em; color: var(--lab); text-transform: uppercase; display: flex; gap: 8px; align-items: center; z-index: 3; white-space: nowrap; pointer-events: none; }
.zlabel .ct { border: 1px solid var(--saf); color: var(--saf); border-radius: 10px; padding: 0 7px; font-size: 12px; letter-spacing: .04em; }
.zone.drop { background: color-mix(in srgb, var(--zone), var(--saf) 14%); border-color: var(--saf); }
#cmd { grid-area: cmd; }
#bf { grid-area: bf; display: flex; flex-direction: column; }
#hand { grid-area: hand; overflow: hidden; }
#side { grid-area: side; display: flex; flex-direction: column; gap: var(--gut); min-height: 0; }
#gy, #ex { flex: 1 1 0; }
#lib { flex: 1.15 1 0; }
.pile { position: absolute; left: 50%; top: 34px; bottom: 10px; transform: translateX(-50%); }
#bfstatus { position: absolute; right: 10px; top: 7px; font-size: 13px; color: var(--lab); letter-spacing: .06em; z-index: 3; display: flex; gap: 10px; align-items: center; white-space: nowrap; }
#phase { display: flex; gap: 3px; }
#phase span { font-size: 11px; letter-spacing: .08em; padding: 2px 6px; border-radius: 3px; border: 1px solid var(--rule); color: var(--lab); text-transform: uppercase; }
#phase span.on { background: var(--saf); color: var(--table); border-color: var(--saf); font-weight: 600; }
#turnlab { color: var(--txt); letter-spacing: .1em; text-transform: uppercase; }
#turnlab b { color: var(--saf); font-weight: 600; }
.board { position: relative; flex: 1; min-height: 0; }
#oppboard { flex: 0 0 40%; border-bottom: 1px dashed var(--rule); margin: 30px 8px 0; }
#oppboard .blab { position: absolute; left: 0; top: -2px; font-size: 11px; letter-spacing: .14em; color: var(--lab); text-transform: uppercase; }
#myboard { margin: 6px 8px 8px; }
#status { position: absolute; left: 10px; bottom: 6px; right: 10px; font-size: 13px; color: var(--lab); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 4; pointer-events: auto; cursor: pointer; letter-spacing: .02em; }
#status b { color: var(--txt); font-weight: 500; }

/* ---------- rail ---------- */
#rail { display: flex; gap: 12px; justify-content: center; padding: 0 0 2px; }
.rb { display: flex; align-items: center; gap: 10px; background: var(--zone); border: 2px solid var(--saf); border-radius: 12px; padding: 0 18px; height: 58px; color: var(--saf); font-size: 17px; letter-spacing: .1em; text-transform: uppercase; font-weight: 500; white-space: nowrap; }
.rb svg { width: 28px; height: 28px; flex: 0 0 auto; }
.rb.primary { background: var(--saf); color: var(--table); }
.rb:disabled { opacity: .4; cursor: default; }
.rb:not(:disabled):active { transform: translateY(1px); }

/* ---------- cards ---------- */
.card { position: absolute; width: var(--w, 120px); aspect-ratio: 63 / 88; border-radius: 4.4% / 3.15%; background: var(--fr); container-type: inline-size; box-shadow: var(--shadow); user-select: none; -webkit-user-select: none; touch-action: none; transition: transform .12s ease-out, box-shadow .12s ease-out; color: #1C1B1A; cursor: pointer; }
.card > .in { position: absolute; inset: 3.3cqw; background: var(--ti); border-radius: 2.5cqw; display: flex; flex-direction: column; padding: 1.6cqw; gap: 1.4cqw; overflow: hidden; }
.card .tt { flex: 0 0 auto; height: 12cqw; display: flex; align-items: center; gap: 1cqw; background: var(--ba); border: .7cqw solid var(--frd); border-radius: 2.2cqw; padding: 0 1.8cqw; font: 600 7.4cqw/1 var(--serif); }
.card .tt .n { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .tt .co { display: flex; gap: .5cqw; flex: 0 0 auto; }
.pip { width: 1.05em; height: 1.05em; border-radius: 50%; display: inline-grid; place-items: center; font: 700 .72em/1 var(--sans); color: #1C1B1A; flex: 0 0 auto; }
.pip svg { width: 76%; height: 76%; }
.card .tt .pip { width: 7.6cqw; height: 7.6cqw; font-size: 5.4cqw; }
.card .art { flex: 0 0 43%; background: #33504f center / cover no-repeat; border: .7cqw solid var(--frd); border-radius: 1cqw; }
.card .tl { flex: 0 0 auto; height: 10cqw; display: flex; align-items: center; background: var(--ba); border: .7cqw solid var(--frd); border-radius: 2.2cqw; padding: 0 1.8cqw; font: 500 6cqw/1 var(--serif); white-space: nowrap; overflow: hidden; }
.card .tl span { overflow: hidden; text-overflow: ellipsis; }
.card .rx { flex: 1; min-height: 0; padding: 1.2cqw 2.4cqw 5cqw; font: 400 6cqw/1.16 var(--serif); overflow: hidden; background: rgba(255, 255, 255, .55); border-radius: 1cqw; }
.card .rx p { margin: 0 0 1.4cqw; }
.card .pt { position: absolute; right: 1.6cqw; bottom: 1.6cqw; background: var(--ba); border: .7cqw solid var(--frd); border-radius: 2.2cqw; font: 600 8.2cqw/1 var(--serif); padding: 1.2cqw 2.8cqw; }
.card .pt.up { color: #1d6b3a; } .card .pt.dn { color: #a33a22; }
.card.c-B { color: #1C1B1A; }
.card.back { background: var(--back) url(../art/card_back.webp) center / 100% 100%; padding: 0; }
.card.back > .in { display: none; }
.card.cmdr { outline: 2px solid var(--saf); outline-offset: 2px; }
.card.sel { outline: 2px solid var(--saf); outline-offset: 2px; }
.card.atk { outline: 2px solid var(--saf); outline-offset: 2px; }
.card.lift, .card:hover { box-shadow: 3px 5px 0 rgba(6, 18, 19, .32); }
.card .badges { position: absolute; left: -4px; top: 18%; display: flex; flex-direction: column; gap: 3px; z-index: 2; }
.badge { background: var(--table); color: var(--saf); border: 1px solid var(--saf); border-radius: 9px; font: 600 12px/16px var(--sans); padding: 0 5px; white-space: nowrap; }
.badge.red { color: #F0A08C; border-color: var(--red); }
.card .stackn { position: absolute; right: -6px; top: -6px; background: var(--saf); color: var(--table); border-radius: 10px; font: 700 12px/18px var(--sans); padding: 0 6px; z-index: 3; }
.card.exiled { filter: saturate(.45) brightness(.92); }
.card.sick > .in::after { content: ""; position: absolute; inset: 0; background: rgba(15, 42, 44, .12); pointer-events: none; }
@container (max-width: 96px) {
  .card .rx { visibility: hidden; }
  .card .tt { height: 17cqw; font-size: 11cqw; }
  .card .tt .co { display: none; }
  .card .tl { visibility: hidden; }
  .card .pt { font-size: 14cqw; }
}
.fr-W { --fr: #EFE6CF; --frd: #C9BB97; --ti: #F7F2E4; --ba: #E8DDC2; }
.fr-U { --fr: #3E7CC0; --frd: #2D5E95; --ti: #DCE8F4; --ba: #B4CDE9; }
.fr-B { --fr: #2B2A2E; --frd: #19181B; --ti: #DAD7D3; --ba: #BDB8B2; }
.fr-R { --fr: #D2553A; --frd: #A23E28; --ti: #F6DFD7; --ba: #EDB9A9; }
.fr-G { --fr: #3E8E5A; --frd: #2C6B42; --ti: #DDECDF; --ba: #B3D5BA; }
.fr-C { --fr: #A7A9A6; --frd: #7F827E; --ti: #E8E9E7; --ba: #CDCFCB; }
.fr-M { --fr: #C9A44B; --frd: #9E7F33; --ti: #F4EACD; --ba: #E5D196; }
.fr-L { --fr: #8D8A7E; --frd: #6B6960; --ti: #ECE8DE; --ba: #D4CEBF; }

.pip-W { background: #EFE6CF; } .pip-U { background: #3E7CC0; } .pip-B { background: #2B2A2E; color: #EDEBE4; } .pip-R { background: #D2553A; } .pip-G { background: #3E8E5A; } .pip-C, .pip-N { background: #A7A9A6; } .pip-H { background: linear-gradient(135deg, #C9A44B 50%, #A7A9A6 50%); }
.pip-W svg { fill: #6F6450; color: #6F6450; } .pip-U svg { fill: #E3EEF8; } .pip-B svg { fill: #EDEBE4; } .pip-R svg { fill: #FBE3DA; } .pip-G svg { fill: #E1F1E4; } .pip-C svg { fill: #4F524E; }
.card .pip { box-shadow: 0 .3cqw 0 rgba(0, 0, 0, .25); }

/* ---------- inspector / preview ---------- */
#preview { position: fixed; z-index: 40; pointer-events: none; display: none; }
#preview.on { display: block; }
#preview .card { position: relative; --w: 100%; }
#insp { position: fixed; z-index: 45; display: none; gap: 10px; }
#insp.on { display: flex; }
#insp .cardwrap { position: relative; flex: 0 0 auto; }
#insp .cardwrap .card { position: relative; }
#insp .acts { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.act { background: var(--zone); border: 1px solid var(--rule); color: var(--txt); text-align: left; padding: 8px 12px; border-radius: 6px; font-size: 15px; letter-spacing: .03em; line-height: 1.2; }
.act.go { border-color: var(--saf); color: var(--saf); font-weight: 600; }
.act.small { font-size: 13px; color: var(--lab); padding: 6px 10px; }
.act:disabled { color: #5E7877; border-color: #24484A; cursor: default; }
.note { font-size: 13px; color: var(--lab); max-width: 280px; line-height: 1.3; }
#scrim { position: fixed; inset: 0; z-index: 44; display: none; background: rgba(10, 28, 30, .55); }
#scrim.on { display: block; }

/* ---------- sheets (choices) ---------- */
#sheet { position: fixed; z-index: 50; left: 50%; bottom: 12px; transform: translateX(-50%); width: min(980px, calc(100vw - 24px)); max-height: min(78vh, 720px); display: none; flex-direction: column; background: var(--zone); border: 1px solid var(--saf); border-radius: 6px; box-shadow: 3px 3px 0 rgba(6, 18, 19, .45); }
#sheet.on { display: flex; }
#sheet .hd { padding: 12px 16px 6px; position: relative; padding-right: 120px; }
#sheet .hd .peek { position: absolute; right: 12px; top: 10px; padding: 6px 10px; font-size: 13px; }
#sheet.min .hd p { display: none; }
#sheet.min .ft { display: none; }
#sheet .hd h3 { margin: 0; color: var(--saf); font-weight: 600; letter-spacing: .1em; font-size: 18px; text-transform: uppercase; }
#sheet .hd p { margin: 4px 0 0; color: var(--txt); font-size: 15px; line-height: 1.3; }
#sheet .bd { overflow: auto; padding: 8px 16px; flex: 1; min-height: 0; }
#sheet .ft { display: flex; gap: 10px; justify-content: flex-end; padding: 10px 16px 14px; border-top: 1px solid var(--rule); flex-wrap: wrap; }
.btn { border: 2px solid var(--saf); background: var(--zone); color: var(--saf); border-radius: 10px; padding: 10px 18px; font-size: 16px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
.btn.go { background: var(--saf); color: var(--table); }
.btn:disabled { opacity: .4; }
.btn.ghost { border-color: var(--rule); color: var(--lab); }
.grid { display: flex; flex-wrap: wrap; gap: 10px; padding: 5px 3px; }
.opt { position: relative; flex: 0 0 auto; width: var(--ow, 118px); cursor: pointer; }
.opt .card { position: relative; --w: 100%; }
.opt .cap { font-size: 12px; color: var(--lab); text-align: center; margin-top: 4px; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt.on .card { outline: 3px solid var(--saf); outline-offset: 2px; }
.opt.on .cap { color: var(--saf); }
.opt.no { opacity: .35; pointer-events: none; }
.prow { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.pbtn { background: var(--table); border: 1px solid var(--rule); border-radius: 8px; padding: 8px 14px; color: var(--txt); font-size: 15px; letter-spacing: .04em; }
.pbtn.on { border-color: var(--saf); color: var(--saf); background: var(--saf-t); }
.pbtn b { font-weight: 600; margin-left: 6px; }
.grp { color: var(--lab); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; margin: 8px 0 6px; }
.brow { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.brow .vs { color: var(--lab); font-size: 13px; letter-spacing: .1em; align-self: center; text-transform: uppercase; }
.brow .grid { flex: 1; }
input[type=range] { width: 100%; accent-color: var(--saf); }
.bignum { font-size: 44px; color: var(--saf); text-align: center; font-weight: 600; }

/* ---------- panels (decks, rules, log, menu) ---------- */
.panel { position: fixed; inset: 0; z-index: 70; background: var(--table); display: none; flex-direction: column; }
.panel.on { display: flex; }
.panel .ph { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.panel .ph h2 { margin: 0; color: var(--saf); font-weight: 600; letter-spacing: .1em; font-size: 22px; text-transform: uppercase; flex: 1; white-space: nowrap; }
.panel .pb { flex: 1; overflow: auto; padding: 14px 16px; min-height: 0; }
.tabs { display: flex; gap: 6px; }
.tabs button { background: var(--zone); border: 1px solid var(--rule); border-radius: 6px; padding: 8px 14px; letter-spacing: .12em; font-size: 14px; color: var(--lab); text-transform: uppercase; }
.tabs button.on { border-color: var(--saf); color: var(--saf); }
.x { background: none; border: 1px solid var(--rule); border-radius: 6px; color: var(--lab); font-size: 15px; padding: 8px 12px; letter-spacing: .1em; }
.rules { max-width: 760px; line-height: 1.5; font-size: 16px; color: var(--txt); }
.rules h3 { color: var(--saf); letter-spacing: .1em; font-weight: 600; text-transform: uppercase; font-size: 16px; margin: 22px 0 6px; }
.rules p, .rules li { color: #D9DDD6; }
.rules b { color: var(--txt); }
#log .pb div { padding: 4px 0; border-bottom: 1px solid rgba(46, 85, 87, .5); font-size: 14px; color: #D6DBD4; }
#log .pb div.t { color: var(--saf); letter-spacing: .1em; text-transform: uppercase; font-size: 12px; padding-top: 12px; }

.dk-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.dk { background: var(--zone); border: 1px solid var(--rule); border-radius: 6px; padding: 12px; display: flex; gap: 12px; }
.dk.cur { border-color: var(--saf); }
.dk .mini { width: 74px; flex: 0 0 auto; position: relative; }
.dk .mini .card { position: relative; --w: 100%; }
.dk h4 { margin: 0 0 4px; font-size: 17px; letter-spacing: .04em; font-weight: 600; }
.dk .meta { font-size: 13px; color: var(--lab); margin-bottom: 8px; }
.dk .bt { display: flex; gap: 6px; flex-wrap: wrap; }
.sbtn { background: var(--table); border: 1px solid var(--rule); color: var(--txt); border-radius: 6px; padding: 6px 10px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.sbtn.go { border-color: var(--saf); color: var(--saf); }
.build { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; min-height: 0; }
.build .col { min-width: 0; }
.field { width: 100%; background: var(--zone); border: 1px solid var(--rule); color: var(--txt); border-radius: 6px; padding: 10px 12px; font: 16px var(--sans); }
.field:focus { outline: 1px solid var(--saf); border-color: var(--saf); }
textarea.field { min-height: 260px; font: 14px/1.4 ui-monospace, Menlo, monospace; }
.row { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid rgba(46, 85, 87, .6); font-size: 15px; cursor: pointer; }
.row:hover { background: rgba(232, 176, 74, .06); }
.row .q { color: var(--saf); width: 26px; text-align: right; flex: 0 0 auto; }
.row .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .ty { color: var(--lab); font-size: 12px; flex: 0 1 30%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.row .co { display: flex; gap: 2px; font-size: 14px; }
.row button { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--rule); background: var(--table); color: var(--saf); font-size: 18px; line-height: 1; }
.check { font-size: 14px; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--rule); margin: 8px 0; line-height: 1.4; }
.check.ok { border-color: var(--grn); color: #9ED3AE; }
.check.bad { border-color: var(--red); color: #F0A08C; }
.lab { color: var(--lab); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; margin: 12px 0 6px; }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dbcard { display: flex; gap: 14px; margin: 10px 0; }
.dbcard .card { position: relative; --w: 200px; }
select.field { appearance: none; }
#toast { position: fixed; left: 50%; top: 82px; transform: translateX(-50%); background: var(--zone); border: 1px solid var(--saf); color: var(--txt); padding: 8px 16px; border-radius: 6px; z-index: 80; font-size: 15px; display: none; max-width: calc(100vw - 30px); text-align: center; box-shadow: var(--shadow); }
#toast.on { display: block; }
.ghostcard { position: fixed; z-index: 90; pointer-events: none; opacity: .92; }

/* ---------- portrait / narrow ---------- */
body.port #app { --gut: 8px; padding: 8px; gap: 8px; }
body.port #top { flex-wrap: wrap; gap: 6px 8px; padding: 0 2px 6px; }
body.port #title { font-size: 19px; order: 1; flex: 1; }
body.port #life { order: 2; }
body.port #topB { display: flex; order: 3; width: 100%; gap: 8px; align-items: center; min-width: 0; }
body.port #opps { justify-content: flex-start; }
body.port #life b { font-size: 28px; min-width: 40px; }
body.port #life button { width: 30px; height: 30px; font-size: 20px; }
body.port #mana .chip { width: 26px; height: 26px; } body.port #mana .chip svg { width: 17px; height: 17px; }
body.port #main { grid-template-columns: 1fr 1fr 1fr 1fr; grid-template-rows: 1fr 118px 150px; grid-template-areas: "bf bf bf bf" "cmd gy ex lib" "hand hand hand hand"; }
body.port #side { display: contents; }
body.port #gy { grid-area: gy; } body.port #ex { grid-area: ex; } body.port #lib { grid-area: lib; }
body.port .zlabel { font-size: 10px; letter-spacing: .1em; left: 6px; top: 5px; gap: 4px; }
body.port .zlabel .ct { font-size: 10px; padding: 0 5px; }
body.port .pile { top: 24px; bottom: 6px; }
body.port #oppboard { margin-top: 26px; }
body.port #bfstatus { top: 4px; font-size: 11px; }
body.port #phase span { font-size: 9px; padding: 1px 4px; }
body.port #rail { gap: 5px; justify-content: space-between; }
body.port .rb { flex-direction: column; gap: 2px; height: 52px; padding: 4px 2px; font-size: 9.5px; letter-spacing: .04em; border-radius: 10px; flex: 1 1 0; min-width: 0; justify-content: center; border-width: 1.5px; }
body.port .rb svg { width: 21px; height: 21px; }
body.port .rb span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
body.port .opp { min-width: 104px; padding: 3px 8px; }
body.port .opp .lf { font-size: 21px; }
body.port .opp .nm { max-width: 80px; font-size: 12px; }
body.port .build { grid-template-columns: 1fr; }
#topA, #topB { display: contents; }

/* ---------- short landscape (phone held sideways) ---------- */
body.short #app { --gut: 6px; padding: 6px 8px; gap: 6px; }
body.short #top { padding: 0 2px 4px; gap: 10px; }
body.short #title { font-size: 18px; }
body.short #life { padding: 1px 4px; border-width: 1.5px; }
body.short #life b { font-size: 22px; min-width: 34px; }
body.short #life button { width: 24px; height: 24px; font-size: 17px; border-width: 1.5px; }
body.short .chip { width: 22px; height: 22px; } body.short .chip svg { width: 15px; height: 15px; }
body.short .chip i { min-width: 14px; height: 14px; font-size: 9px; line-height: 12px; }
body.short .opp { padding: 1px 8px; min-width: 104px; border-radius: 6px; }
body.short .opp .lf { font-size: 18px; } body.short .opp .nm { font-size: 11px; } body.short .opp .sub { font-size: 9.5px; }
body.short #main { grid-template-rows: 1fr 38%; grid-template-columns: minmax(110px, 15%) 1fr minmax(84px, 11%); }
body.short .zlabel { font-size: 9.5px; letter-spacing: .1em; left: 6px; top: 4px; gap: 4px; }
body.short .zlabel .ct { font-size: 9.5px; padding: 0 5px; }
body.short #bfstatus { top: 3px; font-size: 10px; }
body.short #phase span { font-size: 8.5px; padding: 1px 4px; }
body.short #oppboard { margin-top: 20px; }
body.short #oppboard .blab { font-size: 9px; }
body.short #status { font-size: 11px; bottom: 3px; }
body.short #rail { gap: 6px; }
body.short .rb { height: 34px; font-size: 11.5px; padding: 0 10px; gap: 6px; border-width: 1.5px; border-radius: 9px; letter-spacing: .06em; }
body.short .rb svg { width: 18px; height: 18px; }
body.short #sheet { bottom: 6px; max-height: 74vh; width: min(980px, calc(100vw - 16px)); }
body.short #sheet .hd { padding: 7px 12px 3px; padding-right: 110px; }
body.short #sheet .hd h3 { font-size: 14px; }
body.short #sheet .hd p { font-size: 12.5px; margin-top: 2px; }
body.short #sheet .hd .peek { top: 5px; padding: 4px 8px; font-size: 12px; }
body.short #sheet .bd { padding: 6px 12px; }
body.short #sheet .ft { padding: 6px 12px 8px; gap: 8px; }
body.short #sheet .btn { padding: 6px 14px; font-size: 13px; border-width: 1.5px; }
body.short #sheet .grid { flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding-bottom: 4px; }
body.short #sheet .brow .grid { flex-wrap: nowrap; }
body.short #sheet .opt .cap { font-size: 10px; margin-top: 2px; }
body.short #sheet .grp { margin: 4px 0 4px; font-size: 10px; }
body.short #sheet .pbtn { padding: 5px 10px; font-size: 13px; }
body.short .panel .ph { padding: 6px 12px; } body.short .panel .ph h2 { font-size: 17px; }
