:root {
  --ink: #dff3ee;
  --muted: #8fb0aa;
  --panel: rgba(6, 18, 26, 0.86);
  --panel2: rgba(12, 30, 40, 0.92);
  --line: rgba(120, 200, 190, 0.22);
  --accent: #7fffd4;
  --brass: #d9a75a;
  --warn: #ff6a55;
  --safe: #7fe07f;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: #02080e; color: var(--ink); font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
#cv { position: fixed; inset: 0; display: block; touch-action: none; }

/* ---------- top bar ---------- */
#topbar { position: fixed; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); background: linear-gradient(180deg, rgba(3, 10, 16, 0.95), rgba(3, 10, 16, 0.75)); border-bottom: 1px solid var(--line); z-index: 5; font-size: 13px; }
.brand { font-family: var(--mono); font-weight: 800; letter-spacing: 0.25em; color: var(--brass); font-size: 14px; }
.stat { display: flex; align-items: center; gap: 6px; }
.stat .lbl { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; color: var(--muted); }
.num { font-family: var(--mono); font-weight: 700; font-size: 14px; }
.num.warn, .warn { color: var(--warn) !important; }
.hullbar { display: flex; gap: 2px; }
.hullbar i { display: block; width: 5px; height: 14px; background: rgba(255, 255, 255, 0.08); border-radius: 1px; }
.hullbar i.on { background: var(--safe); box-shadow: 0 0 4px rgba(111, 227, 154, 0.5); }
.hullbar i.on.low { background: #ff6a55; box-shadow: 0 0 4px rgba(255, 106, 85, 0.6); }
.tchip { font-family: var(--mono); font-size: 11px; border: 1px solid; border-radius: 10px; padding: 1px 7px; margin-right: 4px; white-space: nowrap; }
.sector { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.spacer { flex: 1; }

/* ---------- crew list ---------- */
#crew { position: fixed; left: 54px; top: 62px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 4; max-width: calc(100vw - 230px); }
.crewcard { display: flex; align-items: center; gap: 7px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; min-width: 150px; cursor: pointer; position: relative; }
.crewcard.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 12px rgba(127, 255, 212, 0.25); }
.swatch { width: 10px; height: 26px; border-radius: 3px; }
.cname { font-size: 12px; font-weight: 600; white-space: nowrap; }
.crole { font-size: 10px; color: var(--muted); font-family: var(--mono); white-space: nowrap; }
.chp { position: absolute; left: 8px; right: 8px; bottom: 2px; height: 2px; background: rgba(255, 255, 255, 0.1); }
.chpfill { height: 100%; }

#log { position: fixed; left: 50%; transform: translateX(-50%); top: 112px; z-index: 3; font-family: var(--mono); font-size: 12px; color: #c9fff0; text-align: center; text-shadow: 0 1px 3px #000; pointer-events: none; width: min(560px, 90vw); }

/* ---------- bottom panel ---------- */
#bottom { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; padding: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); background: linear-gradient(0deg, rgba(3, 10, 16, 0.97), rgba(3, 10, 16, 0.82)); border-top: 1px solid var(--line); z-index: 5; overflow-x: auto; align-items: stretch; }
.panel { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; flex: 0 0 auto; }
.ptitle { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; color: var(--muted); margin-bottom: 4px; white-space: nowrap; }
.ptitle span { color: var(--ink); }
.syscols { display: flex; gap: 5px; }
.syscol { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 40px; }
.syscol.flooded { outline: 1px solid #4f8fe8; border-radius: 6px; background: rgba(79, 143, 232, 0.15); }
.bars { display: flex; flex-direction: column-reverse; gap: 2px; min-height: 52px; justify-content: flex-start; cursor: pointer; padding: 2px; }
.bar { width: 26px; height: 9px; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 2px; }
.bar.on { background: var(--c); border-color: var(--c); box-shadow: 0 0 5px var(--c); }
.bar.dmg { background: #b8302a; border-color: #ff6a55; }
.bar.ion { background: #a07cff; }
.slbl { font-family: var(--mono); font-size: 10px; font-weight: 700; }
.btn { font: inherit; color: var(--ink); background: rgba(40, 70, 80, 0.7); border: 1px solid rgba(140, 220, 210, 0.35); border-radius: 7px; padding: 6px 10px; cursor: pointer; font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; touch-action: manipulation; }
.btn:hover { background: rgba(60, 100, 110, 0.85); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: 0.4; cursor: not-allowed; }
.btn.small { padding: 4px 9px; font-size: 11px; }
.btn.big { padding: 11px 18px; font-size: 14px; }
.btn.primary { background: linear-gradient(180deg, #2d8b78, #1b5e52); border-color: var(--accent); }
.btn.active { background: #2d6b5e; border-color: var(--accent); color: #fff; }
.btn.warn { border-color: #ff6a55; color: #ffb4a8; }
.pbtn { width: 30px; height: 22px; padding: 0; font-size: 14px; line-height: 1; }
.doors { display: flex; flex-direction: column; gap: 4px; }

.tubes { display: flex; gap: 6px; }
.tube { width: 112px; background: rgba(30, 40, 46, 0.9); border: 1px solid rgba(255, 210, 122, 0.25); border-radius: 8px; padding: 5px 6px; cursor: pointer; position: relative; }
.tube.ready { border-color: rgba(255, 210, 122, 0.7); }
.tube.armed { border-color: #ffcf6a; box-shadow: 0 0 10px rgba(255, 207, 106, 0.4); }
.tube.targeting { border-color: #fff; animation: pulse 0.7s infinite alternate; }
.tube.off { opacity: 0.45; }
@keyframes pulse { from { box-shadow: 0 0 2px #ffcf6a; } to { box-shadow: 0 0 16px #ffcf6a; } }
.tname { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.ttype { display: block; width: 100%; text-align: left; background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 5px; color: inherit; font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 3px 5px; margin: 2px 0; cursor: pointer; }
.ttype.static { cursor: default; }
.tprog { height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 3px; overflow: hidden; }
.tfill { height: 100%; background: linear-gradient(90deg, #a07a30, #ffd27a); }
.tstate { font-family: var(--mono); font-size: 10px; margin-top: 3px; color: #ffe2a8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.depthbtns { display: grid; grid-template-columns: repeat(4, auto); gap: 4px; }
.dbtn { padding: 5px 7px; font-size: 11px; }
.meter { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10px; color: var(--muted); margin: 2px 0; }
.meter span { width: 70px; }
.mbar { flex: 1; min-width: 100px; height: 7px; background: rgba(255, 255, 255, 0.08); border-radius: 4px; overflow: hidden; }
.mfill { height: 100%; transition: width 0.15s; }
.mfill.ours { background: linear-gradient(90deg, #2b8a74, #7fffd4); }
.mfill.theirs { background: linear-gradient(90deg, #8a2b2b, #ff6a55); }
.tacbtns { display: flex; gap: 4px; margin: 5px 0 3px; }
.tbtn { font-size: 11px; padding: 6px 8px; }
.tacinfo { font-family: var(--mono); font-size: 10px; color: var(--muted); max-width: 300px; }
.tacinfo b { color: var(--warn); }
.warnc { color: var(--warn); }
.navbtns { display: flex; gap: 6px; margin-bottom: 4px; }

#pausebanner { display: none; position: fixed; left: 50%; transform: translateX(-50%); top: 160px; z-index: 6; font-family: var(--mono); font-weight: 700; letter-spacing: 0.15em; font-size: 12px; background: rgba(0, 0, 0, 0.65); border: 1px solid var(--accent); color: var(--accent); padding: 6px 14px; border-radius: 20px; pointer-events: none; }
body.paused #pausebanner { display: block; }

#toast { position: fixed; right: 12px; top: 120px; z-index: 7; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; }
.toastmsg { background: rgba(8, 26, 32, 0.92); border: 1px solid var(--line); border-left: 3px solid var(--accent); padding: 6px 10px; border-radius: 6px; font-size: 12px; transition: opacity 0.5s, transform 0.5s; }
.toastmsg.bad { border-left-color: var(--warn); }
.toastmsg.out { opacity: 0; transform: translateY(-8px); }

/* ---------- overlay dialogs ---------- */
#overlay { position: fixed; inset: 0; z-index: 10; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(1, 6, 10, 0.45); }
#overlay.show { display: flex; }
#overlay.title { align-items: flex-start; padding-top: 7vh; background: radial-gradient(ellipse at center, rgba(1, 8, 14, 0.15), rgba(1, 6, 10, 0.75)); }
#overlay.mapd { background: rgba(1, 6, 10, 0.6); }
.dialog { background: linear-gradient(180deg, rgba(10, 28, 36, 0.97), rgba(5, 16, 22, 0.97)); border: 1px solid rgba(140, 220, 210, 0.35); border-radius: 14px; padding: 20px 22px; max-width: 640px; width: 100%; max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05); }
.dialog h2 { margin: 0 0 8px; font-size: 22px; font-weight: 700; letter-spacing: 0.01em; }
.ekicker { font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; color: var(--brass); text-transform: uppercase; margin-bottom: 4px; }
.etext { line-height: 1.55; font-size: 15px; color: #d7ece8; }
.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.choice { text-align: left; font-family: system-ui, sans-serif; font-size: 14px; font-weight: 500; padding: 11px 14px; letter-spacing: 0; }
.req { color: var(--brass); font-family: var(--mono); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.chip { font-family: var(--mono); font-size: 12px; padding: 3px 9px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); }
.chip.good { border-color: rgba(127, 255, 212, 0.5); color: #b9ffe6; }
.chip.bad { border-color: rgba(255, 106, 85, 0.6); color: #ffc1b6; }
.dialog.title { text-align: center; max-width: 520px; background: rgba(4, 14, 20, 0.72); backdrop-filter: blur(3px); }
.logo { font-family: var(--mono); font-weight: 900; font-size: clamp(40px, 9vw, 72px); letter-spacing: 0.18em; color: #e9d6a8; text-shadow: 0 0 30px rgba(127, 255, 212, 0.25), 0 3px 0 #000; margin: 8px 0; }
.logo.win { color: #9fffd8; font-size: clamp(28px, 6vw, 48px); }
.logo.lose { color: #ff9a88; font-size: clamp(26px, 6vw, 44px); }
.tag { color: var(--muted); margin-bottom: 22px; font-size: 15px; }
.col { display: flex; flex-direction: column; gap: 10px; align-items: stretch; max-width: 280px; margin: 0 auto 16px; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }
.dialog.help { max-width: 760px; }
.helpgrid p { line-height: 1.5; font-size: 14px; margin: 8px 0; color: #d0e6e2; }
.helpgrid b { color: #fff; }

.dialog.mapd { max-width: 1100px; padding: 14px; }
.maphead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.maphead h2 { margin: 0; }
.chart { width: 100%; height: auto; display: block; background: radial-gradient(ellipse at 40% 40%, #12384a, #071a26); border-radius: 10px; border: 1px solid var(--line); }
.chart .grid { stroke: rgba(140, 210, 230, 0.07); stroke-width: 1; }
.chart .contour { fill: none; stroke: rgba(140, 210, 230, 0.08); stroke-width: 1.5; }
.chart .front { fill: rgba(200, 40, 30, 0.18); }
.chart .frontline { stroke: rgba(255, 90, 70, 0.7); stroke-width: 2; stroke-dasharray: 6 5; }
.chart .fronttxt { fill: rgba(255, 140, 120, 0.85); font: 700 12px var(--mono); letter-spacing: 0.15em; }
.chart .edge { stroke: rgba(160, 220, 230, 0.2); stroke-width: 2; }
.chart .edge.live { stroke: rgba(127, 255, 212, 0.75); stroke-width: 3; stroke-dasharray: 8 6; animation: dash 1s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -14; } }
.chart .dot { stroke: rgba(0, 0, 0, 0.6); stroke-width: 2; fill: #8aa; }
.dot.k-unknown { fill: #7a96a0; }
.dot.k-port { fill: #ffd27a; }
.dot.k-distress { fill: #ff8a6a; }
.dot.k-exit { fill: #7fffd4; }
.dot.k-boss { fill: #ff4040; }
.dot.k-start { fill: #4a6a70; }
.chart .node .hitc { fill: transparent; }
.chart .node.reach { cursor: pointer; }
.chart .node.reach .dot { stroke: #7fffd4; stroke-width: 3; }
.chart .node.reach:hover .dot { fill: #fff; }
.chart .node.visited .dot { opacity: 0.45; }
.chart .node.caught .dot { fill: #b33; }
.chart .curring { fill: none; stroke: #fff; stroke-width: 2; animation: ring 1.4s ease-in-out infinite alternate; }
@keyframes ring { from { stroke-opacity: 1; } to { stroke-opacity: 0.3; } }
.chart .nlabel { fill: rgba(225, 245, 240, 0.85); font: 700 11px var(--mono); letter-spacing: 0.06em; pointer-events: none; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 12px; align-items: center; }
.legend svg { vertical-align: middle; }

.dialog.shop { max-width: 620px; }
.shoplist { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.shopitem { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.shopitem.sold { opacity: 0.45; }
.cost { font-family: var(--mono); color: var(--brass); font-weight: 700; }


.chart.vert { max-height: calc(100vh - 200px); max-height: calc(100dvh - 200px); width: auto; max-width: 100%; margin: 0 auto; }
.chart.vert .nlabel { font-size: 17px; }
.mapsub { font-size: 13px; margin: 0 0 8px; }

/* ---------- v0.2 shared bits ---------- */
#actbar, #sheet { display: none; }
.ptitle { display: flex; align-items: center; gap: 6px; }
.ptitle .spacer { flex: 1; }
.thead { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.tswap { display: block; width: 100%; margin-top: 4px; font: 700 10px var(--mono); color: #ffd27a; background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(255, 210, 122, 0.35); border-radius: 5px; padding: 4px 5px; cursor: pointer; }
.tube .tstate { margin: 0; text-align: right; max-width: 70%; }
.ctl { font-size: 12px; padding: 5px 10px; }
.btn.part { border-color: #e4d35a; color: #ffeaa0; }
.autosw { display: inline-flex; align-items: center; gap: 6px; font: 700 10px var(--mono); letter-spacing: 0.06em; color: var(--muted); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-radius: 20px; padding: 3px 8px 3px 4px; cursor: pointer; white-space: nowrap; }
.autosw .knob { width: 22px; height: 12px; border-radius: 6px; background: rgba(255, 255, 255, 0.15); position: relative; transition: background 0.15s; }
.autosw .knob::after { content: ''; position: absolute; left: 1px; top: 1px; width: 10px; height: 10px; border-radius: 50%; background: #9ab; transition: left 0.15s; }
.autosw.on { color: #c9fff0; border-color: var(--accent); background: rgba(45, 139, 120, 0.3); }
.autosw.on .knob { background: #2d8b78; }
.autosw.on .knob::after { left: 11px; background: #7fffd4; }
.crewcard .pin { margin-left: auto; font: 700 9px var(--mono); color: var(--muted); background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); border-radius: 4px; padding: 3px 5px; cursor: pointer; }
.pin.on { color: #ffe9a8; border-color: #d9a75a; background: rgba(217, 167, 90, 0.2); }
.crewcard.pinned { border-style: dashed; }
.tgtpick:empty { display: none; }
.tgtpick { margin-top: 6px; }
.tgthead { font: 700 11px var(--mono); color: #ffe2a8; margin-bottom: 4px; }
.tgtgrid { display: flex; flex-wrap: wrap; gap: 4px; }
.tgtbtn { font-size: 11px; padding: 5px 8px; border-color: rgba(255, 210, 122, 0.5); }
.tgtbtn.dmg { opacity: 0.6; text-decoration: line-through; }
.tgtbtn.cancel { border-color: var(--line); }
.meter b { font-family: var(--mono); font-size: 11px; min-width: 34px; text-align: right; color: var(--ink); }
#log .al2 b { color: #0a1a16; background: var(--accent); border-radius: 3px; padding: 0 4px; margin-right: 4px; font-size: 11px; }
#log .al2 { color: #b9ffe8; }
.sumgrid { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 6px 0 16px; font-size: 14px; }
.sumgrid .sk { color: var(--muted); font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; padding-top: 2px; }
.sumgrid .sv { color: var(--ink); }
.crewgrid, .roomgrid, .menulist { display: grid; gap: 8px; }
.menulist { grid-template-columns: 1fr; }
.sendto { font: 700 12px var(--mono); color: var(--accent); margin: 12px 0 6px; }
.hatchp .tacinfo { margin-top: 4px; }

/* tutorial coach card */
#coach { display: none; position: fixed; z-index: 9; left: 50%; transform: translateX(-50%); bottom: 230px; width: min(460px, calc(100vw - 24px)); background: linear-gradient(180deg, rgba(12, 40, 44, 0.97), rgba(6, 22, 28, 0.97)); border: 1px solid var(--accent); border-radius: 14px; padding: 14px 16px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6); }
#coach.show { display: block; animation: coachin 0.25s ease-out; }
@keyframes coachin { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%); } }
.ckicker { font: 700 11px var(--mono); letter-spacing: 0.18em; color: var(--brass); text-transform: uppercase; }
.ctitle { font-size: 18px; font-weight: 700; margin: 4px 0; }
.ctext { font-size: 15px; line-height: 1.45; color: #d7ece8; }
.crow2 { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.crow2 .spacer { flex: 1; }
.coach-target { outline: 3px solid #ffd27a !important; outline-offset: 2px; animation: coachpulse 0.9s ease-in-out infinite alternate; position: relative; z-index: 2; }
@keyframes coachpulse { from { outline-color: rgba(255, 210, 122, 1); } to { outline-color: rgba(255, 210, 122, 0.25); } }

/* ---------- phone layout (portrait and landscape) ---------- */
body.phone #bottom { display: none; }
body.phone.notitle #actbar { display: flex; }
body.phone .brand, body.phone .sector { display: none; }
body.phone #topbar { display: block; padding: 6px 8px; padding-top: max(6px, env(safe-area-inset-top)); padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); font-size: 14px; }
body.phone .srow { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
body.phone .st { display: flex; flex-direction: column; align-items: center; min-width: 0; padding: 2px 0; border-radius: 8px; background: rgba(255, 255, 255, 0.03); position: relative; }
body.phone .st .lbl { font: 700 11px var(--mono); letter-spacing: 0.06em; color: var(--muted); }
body.phone .st .val { font: 800 18px var(--mono); line-height: 1.15; white-space: nowrap; }
body.phone .st.warn .val { color: var(--warn); }
body.phone .st.warn { background: rgba(255, 106, 85, 0.12); }
body.phone .hullmini { position: absolute; left: 6px; right: 6px; bottom: 1px; height: 3px; background: rgba(255, 255, 255, 0.1); border-radius: 2px; overflow: hidden; }
body.phone .hullmini i { display: block; height: 100%; background: var(--safe); }
body.phone .hullmini i.low { background: var(--warn); }
body.phone .crow { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
body.phone .crow .spacer { flex: 1; }
body.phone .ctl { min-height: 44px; min-width: 58px; font-size: 14px; padding: 6px 12px; border-radius: 10px; }
body.phone .autobtn { min-width: 96px; }
body.phone .autobtn.active { background: linear-gradient(180deg, #2d8b78, #1b5e52); border-color: var(--accent); box-shadow: 0 0 12px rgba(127, 255, 212, 0.35); }
body.phone .menubtn { min-width: 48px; padding: 6px 10px; display: inline-flex; align-items: center; justify-content: center; }
.ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* crew row: big cards, swipe sideways */
body.phone #crew { position: fixed; left: 0; right: 0; top: auto; max-width: none; display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; padding: 6px max(8px, env(safe-area-inset-left)); background: linear-gradient(0deg, rgba(3, 10, 16, 0.92), rgba(3, 10, 16, 0.55)); scrollbar-width: none; -webkit-overflow-scrolling: touch; z-index: 5; }
body.phone #crew::-webkit-scrollbar { display: none; }
body.phone .crewcard { flex: 0 0 auto; width: 158px; min-width: 0; min-height: 52px; padding: 6px 8px 8px; scroll-snap-align: start; gap: 8px; }
body.phone .crewcard .swatch { width: 8px; height: 34px; }
body.phone .crewcard .cname { font-size: 15px; max-width: 128px; overflow: hidden; text-overflow: ellipsis; }
body.phone .crewcard .crole { display: block; font-size: 12px; max-width: 128px; overflow: hidden; text-overflow: ellipsis; color: #a9cbc4; font-family: system-ui, sans-serif; }
body.phone .chp { height: 3px; bottom: 3px; }
body.phone.sheetopen.port #crew { display: none; }

/* action bar */
body.phone #actbar { position: fixed; z-index: 6; background: rgba(3, 10, 16, 0.97); border-top: 1px solid var(--line); }
body.port #actbar { left: 0; right: 0; bottom: 0; padding: 4px max(4px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left)); gap: 4px; }
body.phone .act { flex: 1 1 0; min-width: 0; min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: rgba(255, 255, 255, 0.03); border: 1px solid transparent; border-radius: 10px; color: #cfe7e2; font: 700 12px var(--mono); letter-spacing: 0.02em; cursor: pointer; position: relative; padding: 4px 0; }
body.phone .act .al { white-space: nowrap; }
body.phone .act.on { background: rgba(45, 139, 120, 0.4); border-color: var(--accent); color: #fff; }
body.phone .act .abadge { display: none; position: absolute; top: 4px; right: 6px; font: 800 9px var(--mono); font-style: normal; color: #0a1a16; background: var(--accent); border-radius: 4px; padding: 0 3px; }
body.phone .act.auto .abadge { display: block; }
body.phone .act.auto .abadge::after { content: 'A'; }
body.phone .act.alert { color: #ffb4a8; }
body.phone .act.alert::before { content: ''; position: absolute; top: 6px; left: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 8px var(--warn); animation: pulse2 0.8s infinite alternate; }
@keyframes pulse2 { from { opacity: 1; } to { opacity: 0.3; } }

/* the sheet */
body.phone.sheetopen #sheet { display: block; position: fixed; z-index: 6; overflow-y: auto; overscroll-behavior: contain; background: linear-gradient(180deg, rgba(10, 28, 36, 0.98), rgba(5, 16, 22, 0.98)); border: 1px solid rgba(140, 220, 210, 0.3); -webkit-overflow-scrolling: touch; }
body.port.sheetopen #sheet { left: 0; right: 0; max-height: 50vh; max-height: 50dvh; border-radius: 16px 16px 0 0; border-bottom: 0; padding: 0 max(10px, env(safe-area-inset-right)) 10px max(10px, env(safe-area-inset-left)); animation: sheetup 0.18s ease-out; }
@keyframes sheetup { from { transform: translateY(30px); opacity: 0.5; } to { transform: none; opacity: 1; } }
.shead { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 6px; padding: 8px 0 8px; background: rgba(10, 28, 36, 0.98); border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.stitle { font: 800 14px var(--mono); letter-spacing: 0.12em; color: var(--ink); display: flex; flex-direction: column; }
.stitle span { font-size: 13px; letter-spacing: 0; color: var(--accent); font-weight: 700; }
.shead .spacer { flex: 1; }
body.phone .autosw { min-height: 44px; font-size: 12px; padding: 4px 10px 4px 6px; }
body.phone .autosw .knob { width: 32px; height: 18px; border-radius: 9px; }
body.phone .autosw .knob::after { width: 14px; height: 14px; top: 2px; left: 2px; }
body.phone .autosw.on .knob::after { left: 16px; }
.sclose { min-width: 44px; min-height: 44px; font-size: 26px; line-height: 1; color: var(--ink); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
body.phone .btn { min-height: 44px; font-size: 14px; }
body.phone .sbody .tacbtns { display: flex; gap: 8px; margin: 8px 0; }
body.phone .sbody .tbtn { flex: 1; min-height: 48px; font-size: 13px; padding: 6px 4px; }
body.phone .tacinfo { font-size: 13px; color: #a9cbc4; max-width: none; line-height: 1.4; }
body.phone .meter { font-size: 13px; margin: 6px 0; gap: 8px; }
body.phone .meter span { width: 86px; }
body.phone .meter b { font-size: 14px; }
body.phone .mbar { height: 10px; }
/* tubes */
body.phone .sb-tubes .tubes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
body.phone .tube { width: auto; min-height: 110px; padding: 10px; border-radius: 12px; }
body.phone .tname { font-size: 13px; font-weight: 700; color: #e8d9b0; }
body.phone .tube .tstate { font-size: 12px; white-space: normal; text-align: right; }
body.phone .ttype { font-size: 15px; padding: 6px 8px; margin: 6px 0; }
body.phone .tprog { height: 8px; }
body.phone .tswap { min-height: 44px; font-size: 12px; margin-top: 8px; }
body.phone .tgthead { font-size: 13px; margin: 8px 0 6px; }
body.phone .tgtgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
body.phone .tgtbtn { min-height: 48px; font-size: 14px; }
/* depth */
body.phone .depthbtns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
body.phone .dbtn { min-height: 48px; font-size: 14px; padding: 6px 4px; }
body.phone #blowbtn { grid-column: span 3; }
/* power */
body.phone .sb-power .syscols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
body.phone .prow { display: grid; grid-template-columns: 38px 44px minmax(0, 1fr) 44px; align-items: center; gap: 4px; width: auto; padding: 2px 4px; background: rgba(255, 255, 255, 0.03); border-radius: 10px; }
body.phone .prow .slbl { font-size: 13px; }
body.phone .prow .bars { flex-direction: row; min-height: 44px; align-items: center; gap: 3px; padding: 0; }
body.phone .prow .bar { flex: 1; width: auto; min-width: 6px; height: 22px; }
body.phone .pbtn { width: 44px; height: 44px; font-size: 22px; padding: 0; }
/* crew sheet */
body.phone .crewgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ccard { display: flex; align-items: center; gap: 8px; position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 8px 10px; min-height: 64px; cursor: pointer; }
.ccard.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ccard .swatch { width: 8px; height: 40px; }
.ccard .cinfo { min-width: 0; flex: 1; }
.ccard .cname { font-size: 14px; white-space: normal; line-height: 1.2; }
.ccard .crole { font-size: 12px; white-space: normal; color: #a9cbc4; font-family: system-ui, sans-serif; }
.ccard .pin { min-width: 64px; min-height: 44px; font: 700 11px var(--mono); color: var(--accent); background: rgba(45, 139, 120, 0.2); border: 1px solid var(--accent); border-radius: 8px; cursor: pointer; }
.ccard .pin.on { color: #ffe9a8; border-color: #d9a75a; background: rgba(217, 167, 90, 0.2); }
body.phone .roomgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
body.phone .rbtn { min-height: 48px; font-size: 14px; }
body.phone .menulist .btn { min-height: 52px; }
body.phone .muted.small, body.phone .small.muted { font-size: 13px; }
body.phone .navbtns .btn { min-height: 48px; }

/* log and toasts */
body.phone #log { left: 8px; right: 8px; transform: none; width: auto; text-align: left; font-size: 13px; line-height: 1.35; }
body.phone .toastmsg { font-size: 14px; padding: 8px 12px; max-width: 100%; }
body.phone #toast { align-items: flex-end; }
body.phone #pausebanner { font-size: 13px; white-space: nowrap; }
body.phone #coach { top: auto; bottom: auto; }
body.port #coach { top: 104px; transform: translateX(-50%); }
body.land #coach { left: max(10px, env(safe-area-inset-left)); transform: none; top: 56px; width: min(380px, 52vw); }
body.land #coach.show { animation: none; }

/* dialogs on phones */
body.phone #overlay { padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
body.phone .dialog, .dialog { -webkit-overflow-scrolling: touch; }
@media (max-width: 760px), (max-height: 500px) {
  .dialog { padding: 16px; border-radius: 12px; max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); }
  .dialog h2 { font-size: 20px; }
  .etext { font-size: 15px; }
  .choice { min-height: 48px; font-size: 15px; }
  .btn.big { min-height: 48px; }
  .btn.small { min-height: 44px; min-width: 64px; font-size: 13px; }
  .shopitem { grid-template-columns: 1fr auto 84px; font-size: 14px; }
  .shopitem .btn { min-height: 44px; }
  .maphead .btn { min-height: 44px; }
  .legend { font-size: 13px; gap: 10px; }
  .row .btn { flex: 1; }
  .sumgrid { font-size: 14px; gap: 5px 10px; }
  #overlay.title { padding-top: 4vh; }
  .col .btn { min-height: 52px; }
}

/* landscape phones: actions become a right-hand rail, sheets a side drawer */
body.land #topbar { right: calc(78px + env(safe-area-inset-right)); display: flex; align-items: center; gap: 8px; padding-top: max(4px, env(safe-area-inset-top)); padding-bottom: 4px; }
body.land .srow { flex: 1; }
body.land .crow { margin-top: 0; }
body.land .st .val { font-size: 16px; }
body.land .ctl { min-width: 50px; padding: 6px 8px; }
body.land .autobtn { min-width: 84px; }
body.land #actbar { top: 0; bottom: 0; right: 0; width: calc(78px + env(safe-area-inset-right)); flex-direction: column; gap: 3px; padding: max(4px, env(safe-area-inset-top)) max(4px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) 4px; border-top: 0; border-left: 1px solid var(--line); }
body.land .act { min-height: 44px; flex-direction: column; font-size: 11px; gap: 1px; letter-spacing: 0; }
body.land .act .ico { width: 20px; height: 20px; }
body.land.sheetopen #sheet { bottom: 0; width: min(360px, 46vw); border-radius: 14px 0 0 0; border-right: 0; padding: 0 10px 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); animation: sheetin 0.18s ease-out; }
@keyframes sheetin { from { transform: translateX(30px); opacity: 0.5; } to { transform: none; opacity: 1; } }
body.land #crew { left: 0; padding-left: max(8px, env(safe-area-inset-left)); }
body.land .crewcard { width: 146px; min-height: 48px; padding: 4px 8px 6px; }
body.land .crewcard .swatch { height: 28px; }
body.land .sb-power .syscols, body.land .crewgrid { grid-template-columns: 1fr; }
body.land .tube { min-height: 0; padding: 8px; }
body.land .ttype { font-size: 13px; margin: 4px 0; }
body.land .roomgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.land #log { left: 96px; }

/* desktop fit */
body.desk #topbar { flex-wrap: nowrap; gap: 12px; }
body.desk #topbar .sector { flex: 0 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
body.desk .hullbar i { width: 4px; }
body.desk #coach { bottom: auto; top: 172px; }
body.desk #bottom { flex-wrap: wrap; overflow-x: hidden; justify-content: center; }
body.desk .p-hatches .tacinfo { max-width: 150px; }
body.desk .p-hatches .tacbtns { flex-direction: column; }
body.desk .p-depth .tacinfo { max-width: 250px; }
body.desk .p-sonar .tacinfo { max-width: 250px; }
body.desk .tube { width: 124px; }
.crewauto { display: flex; align-items: center; gap: 6px; }

/* ---------- v0.3 ---------- */
/* title logo */
.logowrap { margin: 0 auto 4px; max-width: 560px; }
.logo-svg { width: 100%; height: auto; display: block; overflow: visible; }
.lg-ping { transform-origin: 320px 150px; animation: lgping 4.5s ease-out infinite; opacity: 0; }
.lg-ping2 { animation-delay: 2.25s; }
@keyframes lgping { 0% { transform: scale(0.2); opacity: 0.9; } 100% { transform: scale(2.1); opacity: 0; } }
.lg-wave { animation: lgwave 3s ease-in-out infinite alternate; }
@keyframes lgwave { from { transform: translateX(-6px); } to { transform: translateX(6px); } }
.lg-sub { animation: lgsub 7s ease-in-out infinite alternate; }
@keyframes lgsub { from { transform: translate(176px, 248px); } to { transform: translate(204px, 244px); } }
.lg-b1, .lg-b2, .lg-b3 { animation: lgbub 2s linear infinite; }
.lg-b2 { animation-delay: 0.6s; } .lg-b3 { animation-delay: 1.2s; }
@keyframes lgbub { from { transform: translate(0, 0); opacity: 1; } to { transform: translate(-14px, -20px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .lg-ping, .lg-wave, .lg-sub, .lg-b1, .lg-b2, .lg-b3 { animation: none; } .lg-ping { opacity: 0.4; } }
.dialog.title .tag { margin-top: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* new-run setup */
.dialog.setup { max-width: 860px; }
.hullgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 6px 0 12px; }
.hullcard { text-align: left; font: inherit; color: var(--ink); background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-height: 44px; }
.hullcard.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 16px rgba(127, 255, 212, 0.18); background: rgba(45, 139, 120, 0.14); }
.hullcard.locked { opacity: 0.55; }
.hullcard.locked .hcsvg { filter: grayscale(1) brightness(0.6); }
.hcname { font-weight: 800; font-size: 15px; }
.hcmark { font: 700 12px var(--mono); color: var(--brass); }
.hccls { font: 600 11px var(--mono); color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.hcstats { font: 600 11px var(--mono); color: #b9ffe6; }
.hcblurb { font-size: 13px; color: #c7dcd8; line-height: 1.4; }
.hclock { font: 700 12px var(--mono); color: #ffcf9a; }
.setrow { margin: 10px 0; }
.setlbl { font: 700 11px var(--mono); letter-spacing: 0.16em; color: var(--brass); text-transform: uppercase; margin-bottom: 6px; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 4px; }
.segb.on, .perk.on { background: linear-gradient(180deg, #2d8b78, #1b5e52); border-color: var(--accent); color: #fff; }
.perkgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.perk { text-align: left; font-family: system-ui, sans-serif; letter-spacing: 0; padding: 8px 10px; }
.perk b { display: block; font-size: 13px; }
.perk .pdesc { display: block; font-size: 12px; font-weight: 400; color: #b8d0cc; margin-top: 2px; }
.perk.locked { opacity: 0.5; }
/* records */
.dialog.records { max-width: 640px; }
.achlist { display: grid; gap: 6px; margin: 8px 0 14px; }
.ach { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: rgba(255, 255, 255, 0.02); opacity: 0.7; }
.ach.got { opacity: 1; border-color: rgba(217, 167, 90, 0.6); background: rgba(217, 167, 90, 0.08); }
.achn { font-weight: 700; }
.ach.got .achn { color: #ffd98a; }
.achd { font-size: 13px; color: #b8d0cc; }
.toastmsg.ach { border-left-color: #ffd27a; background: rgba(40, 32, 10, 0.95); }
/* contacts, mine deck, divers */
.contacts, .divers { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 0 6px; }
.divers { margin-top: 6px; }
.clbl { font: 700 10px var(--mono); letter-spacing: 0.12em; color: var(--muted); margin-right: 2px; }
.cbtn { font-size: 11px; padding: 4px 8px; }
.cbtn.on { border-color: #ffd27a; color: #ffe2a8; background: rgba(217, 167, 90, 0.22); }
.cbtn b { color: #ffd27a; }
.dvbtn { font-size: 11px; padding: 4px 8px; border-color: rgba(127, 214, 255, 0.5); }
.dvinfo { font: 600 10px var(--mono); color: var(--muted); flex-basis: 100%; }
.tube.mine { border-color: rgba(239, 154, 90, 0.35); }
.tube.mine .tfill { background: linear-gradient(90deg, #8a4a20, #ef9a5a); }
body.desk .p-tubes { max-width: 420px; }
body.desk .tubes { flex-wrap: wrap; }
body.phone .cbtn, body.phone .dvbtn { min-height: 44px; font-size: 13px; flex: 1 1 0; }
body.phone .contacts .clbl, body.phone .divers .clbl { flex-basis: 100%; font-size: 11px; }
body.phone .dvinfo { font-size: 12px; }
@media (max-width: 760px), (max-height: 500px) {
  .hullgrid { grid-template-columns: 1fr; }
  .perkgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hcblurb { font-size: 13px; }
  .segb { min-height: 48px; }
  .perk { min-height: 52px; }
  .row2 .btn { min-height: 52px; }
}
@media (max-height: 500px) { .hullgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .hcsvg { display: none; } .logowrap { max-width: 360px; } }
body.desk .crewauto.hatchd { padding-left: 8px; border-left: 1px solid var(--line); }
body.desk .hatchmini { font: 600 10px var(--mono); color: var(--muted); max-width: 150px; display: none; }
body.desk #crew { max-width: calc(100vw - 70px); }
body.desk .crewcard { max-width: 205px; min-width: 0; }
body.desk .crewcard .cinfo { min-width: 0; overflow: hidden; }
body.desk .crewcard .crole { overflow: hidden; text-overflow: ellipsis; }
/* v0.3 phone polish: shorter sheets, compact tube cards, a quieter log while a sheet is open */
body.port.sheetopen #sheet { max-height: 46vh; max-height: 46dvh; }
body.phone .tube { min-height: 0; padding: 8px; }
body.phone .ttype { font-size: 14px; padding: 4px 8px; margin: 4px 0; }
body.phone .tswap { min-height: 44px; margin-top: 6px; }
body.port.sheetopen #log .cl ~ .cl { display: none; }
body.land.sheetopen #sheet { width: min(330px, 42vw); }
body.land #toast { align-items: flex-start; }
body.land .toastmsg { font-size: 13px; padding: 6px 10px; }
/* setup: keep BACK / CAST OFF in reach while the boat list scrolls */
.dialog.setup .row { position: sticky; bottom: -20px; margin: 12px -22px -20px; padding: 10px 22px 14px; background: linear-gradient(180deg, rgba(5, 16, 22, 0.85), rgba(5, 16, 22, 0.99)); border-top: 1px solid var(--line); z-index: 2; }
@media (max-width: 760px), (max-height: 500px) { .dialog.setup .row { bottom: -16px; margin: 10px -16px -16px; padding: 8px 16px 12px; } }
body.desk .brand { white-space: nowrap; }

/* Keyboard, controller focus and player options. */
:focus-visible { outline: 3px solid var(--brass); outline-offset: 3px; }
.chart .node:focus-visible .dot { stroke: #fff; stroke-width: 4px; }
.dialog.options { width: min(480px, 94vw); display: flex; flex-direction: column; gap: 12px; }
.optionrow, .volume { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.optionrow .on { border-color: var(--brass); background: #40534b; }
#volume { width: 100%; min-height: 44px; accent-color: var(--brass); cursor: pointer; }
.sysguide { width: 100%; margin-top: 6px; }
body.phone .sysguide { min-height: 44px; }
#perf { position: fixed; right: 8px; top: 132px; z-index: 50; pointer-events: none; white-space: pre; font: 11px/1.5 var(--mono); padding: 5px 8px; background: #021018df; color: #afffca; border-radius: 6px; }
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (min-width: 1700px) and (min-height: 900px) {
  body.desk #bottom { justify-content: center; gap: 16px; padding: 12px; }
  body.desk .panel { padding: 10px 14px; }
  body.desk .btn { font-size: 14px; }
  body.desk .syscol { width: 46px; }
  body.desk #crew { max-width: 1200px; }
}

/* Demo patrol: readable objectives and controls that stay within narrow dialogs. */
.objective { color: var(--accent); font-size: 15px; line-height: 1.4; margin: 6px 0; }
.dialog.options > * { flex-shrink: 0; min-width: 0; }
#volume { margin: 0; }
.crow2 { flex-wrap: wrap; }
.crow2 .btn { white-space: normal; }
#wishlist { width: 100%; white-space: normal; }
@media (min-width: 760px) and (min-height: 500px) and (max-width: 1350px) {
  body.desk #topbar { flex-wrap: wrap; gap: 8px; }
}

/* Reading size and redundant status cues work alongside the numeric readouts. */
body.colour-safe { --accent: #74cfff; --safe: #74cfff; --warn: #ff9854; }
body.colour-safe .hullbar i.on { box-shadow: none; }
body.colour-safe .mfill.ours { background: var(--safe); }
body.colour-safe .mfill.theirs { background: var(--warn); }
body.colour-safe .bar.on { background: var(--safe); border-color: var(--safe); box-shadow: none; }
.bar.dmg { background: repeating-linear-gradient(135deg, var(--warn) 0 3px, #18232a 3px 6px); border-color: var(--warn); }
body.colour-safe .bar.dmg { background: repeating-linear-gradient(135deg, var(--warn) 0 3px, #18232a 3px 6px); border-color: var(--warn); }
body.colour-safe .chip.good { border-color: var(--safe); color: #bdeaff; }
body.colour-safe .chip.bad, body.colour-safe .btn.warn { border-color: var(--warn); color: #ffc599; }
body.phone .st.warn .lbl::before { content: '! '; }
.num.warn::before { content: '! '; }
.key-options summary { min-height: 44px; padding: 10px 0; cursor: pointer; font-weight: 700; }
.keygrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.keygrid .btn { min-height: 48px; white-space: normal; overflow-wrap: anywhere; font-size: 12px; }
.keygrid [aria-pressed=true] { border-color: var(--brass); }
body.large-text .etext, body.large-text .ctext { font-size: 18px; }
body.large-text .choice, body.large-text .btn, body.large-text .tacinfo, body.large-text .mapsub,
body.large-text .dialog .muted, body.large-text .sumgrid { font-size: 16px; }
body.large-text .slbl, body.large-text .ptitle, body.large-text .tname, body.large-text .tstate,
body.large-text .crole, body.large-text .small, body.large-text .sumgrid .sk { font-size: 13px; }
body.large-text .cname { font-size: 16px; }
body.large-text .crewcard { width: 190px; }
body.large-text .ccard .crole { white-space: normal; }
body.large-text .autosw { font-size: 12px; }
body.large-text .keygrid .btn { font-size: 14px; }
body.large-text .act { font-size: 12px; }
body.large-text .optionrow { flex-wrap: wrap; }
body.large-text #bottom { flex-wrap: wrap; overflow-y: auto; overflow-x: hidden; justify-content: center; max-height: 45vh; }
body.large-text .panel { max-width: 380px; }
body.large-text #coach { max-height: 45vh; overflow-y: auto; }

.detailrow { flex-wrap: wrap; }
.detailrow .btn { min-width: 54px; }
