/* ===================================================================
   MERGE ISLE — game stylesheet.

   Originally extracted verbatim from the `CSS` string array that
   merge.ui.js injected at boot (spec §8.4 / M19). This revision is the
   PHONE REDESIGN: a bright, high-contrast play surface (rail + board +
   tool row + tray + dock) between the arcade's dark chrome (top bar,
   nav, panels, sheets), and a height ledger that gives the board every
   pixel it can get on a phone.

   LAYOUT (portrait, top to bottom — all in normal flex flow):
     .mi-top        48   dark chrome, '‹ Arcade' is a real button
     .mi-rail      ~66   compact, content-sized order cards (never clip)
     .mi-strip     ~31   next-move suggestion — only when it has one
     .mi-bw       flex   the board; the coach hint is an OVERLAY inside it
     .mi-pill       50   tool row: [📦 storage][🎁 daily] … [↶][👁][🧹]
     .mi-dock       52   ONLY when at least one producer is docked
     .mi-tray       50   ONLY when the overflow tray holds something
     .mi-nav        56   dark chrome
   Nothing is ever positioned over the grid: the three action chips live
   in the tool row at every breakpoint, so they can never overlap a cell
   and never steal a side gutter from the board's width.

   HARD RULE for this file (spec §8.4): no `height:` on any card or rail
   without a matching `min-height` fallback, and no `overflow:hidden` on a
   box whose height is capped below its content. That combination is what
   shipped the clipping bug.

   Loaded by merge.html as <link rel="stylesheet" href="merge.css?v=…">
   BEFORE the deferred module scripts. The --vh / safe-area custom
   properties are also declared in merge.html's inline <style> with the
   same values, so link order cannot change the result.
   =================================================================== */

html,body{margin:0;padding:0;height:100%;width:100%;overflow:hidden;overscroll-behavior:none;
touch-action:none;background:#070b14;color:#e8f2ff;-webkit-user-select:none;user-select:none;
-webkit-tap-highlight-color:transparent;-webkit-text-size-adjust:100%;
font-family:system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif}

/* Dark chrome tokens (top bar, nav, panels, sheets) and, new, the LIGHT
   play-surface tokens (--s*). Every --s* text colour is >= 4.5:1 on both
   --surf and --surf2:
     --sink  #17263a on #f3ead7 = 13.9:1     --sdim  #465a73 on #f3ead7 = 5.9:1
     --sacc  #0b6fa8 on #fffdf7 = 5.5:1      --sgood #0f7a42 on #fffdf7 = 5.4:1
     --swarn #a85200 on #fffdf7 = 5.4:1      --sbad  #c41e3a on #fffdf7 = 5.8:1
     --sgold #8a5a00 on #fffdf7 = 5.9:1
   and --dim #8fa3bd on the dark chrome #0a1120 = 7.2:1. */
:root{--bg:#070b14;--bg2:#0d1524;--panel:#111c2e;--ink:#e8f2ff;--dim:#8fa3bd;--neon:#38e8ff;
--neon2:#ff79c6;--gold:#ffd166;--good:#5bff9c;--warn:#ffb454;--bad:#ff5c7a;--radius:14px;
--tap:44px;--vh:100vh;--sat:env(safe-area-inset-top,0px);--sab:env(safe-area-inset-bottom,0px);
--sal:env(safe-area-inset-left,0px);--sar:env(safe-area-inset-right,0px);
--cross:#b388ff;
--surf:#f3ead7;--surf2:#fffdf7;--sline:#c9d3de;--sline2:#a9b8c9;--sedge:#d9cfb9;
--sink:#17263a;--sdim:#465a73;--sacc:#0b6fa8;--sgood:#0f7a42;--swarn:#a85200;--sbad:#c41e3a;
--sgold:#8a5a00;--spurp:#6d3fd6}

.mi *{box-sizing:border-box}

#mi-root{position:fixed;left:0;top:0;right:0;height:var(--vh);display:flex;flex-direction:column;
z-index:2;background:var(--bg);color:var(--ink);padding-left:var(--sal);padding-right:var(--sar)}

/* ---- top bar (dark chrome) ---- */
.mi-top{flex:0 0 auto;height:48px;padding:0 6px;margin-top:var(--sat);display:flex;align-items:center;
gap:5px;background:linear-gradient(180deg,#0b1322,#070b14);border-bottom:1px solid #17233a}
/* '‹ Arcade' — a real button in the arcade's neon, not a grey label.
   The shell (merge.html) styles the same anchor as #back with an id
   selector, so these rules carry an id too and win on specificity. The
   link is flex:0 0 auto: it is never the thing that truncates — the level
   block absorbs the shortfall instead. */
#mi-root .mi-back,#back.mi-back{flex:0 0 auto;display:inline-flex;align-items:center;gap:1px;
height:44px;min-height:44px;min-width:44px;margin:0;padding:0 11px 0 8px;border-radius:12px;
border:2px solid #7ef0ff;background:rgba(126,240,255,.10);color:#7ef0ff;text-decoration:none;
font-size:15px;font-weight:800;letter-spacing:.02em;line-height:1;white-space:nowrap;
box-shadow:0 0 10px rgba(126,240,255,.28);cursor:pointer}
#mi-root .mi-back .chev{font-size:20px;line-height:1;margin-top:-2px}
#mi-root .mi-back:active{background:rgba(126,240,255,.26)}
.mi-lv{flex:1 1 auto;min-width:0;overflow:hidden;display:flex;flex-direction:column;
justify-content:center;gap:3px}
.mi-lvtxt{font-size:12.5px;font-weight:800;color:#c7d6ea;letter-spacing:.03em;white-space:nowrap;
overflow:hidden;text-overflow:ellipsis}
.mi-xpbar{height:6px;border-radius:4px;background:#16223a;overflow:hidden}
.mi-xpfill{height:100%;width:0;background:linear-gradient(90deg,#38e8ff,#5bff9c);transition:width .28s}
.mi-w{flex:0 0 auto;display:flex;align-items:center;gap:3px;font-size:13px;font-weight:800;
padding:5px 5px;border-radius:9px;background:#0e1728;border:1px solid #223353;
font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--ink)}
.mi-w.b{min-width:44px;min-height:34px;justify-content:center;cursor:pointer}
.mi-ib{width:44px;height:44px;flex:0 0 44px;border:0;background:none;color:var(--ink);font-size:20px;
border-radius:11px;cursor:pointer;line-height:1}
.mi-ib:active{background:#16223a}
/* the narrowest phones (320px) get the chevron alone; every wider phone
   keeps the word so the button reads as "Arcade" */
@media (max-width:359px){
  #mi-root .mi-back .lbl{display:none}
  #mi-root .mi-back{padding:0 8px 0 7px}
  .mi-w{font-size:12.5px;padding:5px 4px}
  .mi-top{gap:4px}
}

/* ---- order rail (light play surface) ----
   Content-sized cards (§4.12): the rail is a horizontal scroller with
   overflow-y:hidden and NO max-height, so nothing can ever clip a card.
   Compact form: one wrap-row of requirement chips, a 5px bar, and a foot
   row that carries the character, the reward and the tap estimate —
   62px for a one-row card, ~70px rail; a 3-requirement card that wraps
   is 88px and the ResizeObserver in merge.ui.js re-measures the board. */
.mi-rail{flex:0 0 auto;height:auto;min-height:64px;display:flex;align-items:stretch;gap:6px;
padding:4px 8px;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;
-webkit-overflow-scrolling:touch;touch-action:pan-x;scrollbar-width:none;background:var(--surf)}
.mi-rail::-webkit-scrollbar{height:0}

.mi-card{flex:0 0 auto;min-width:104px;max-width:188px;height:auto;min-height:56px;
scroll-snap-align:start;background:var(--surf2);border:2px solid var(--sline2);border-radius:12px;
padding:4px 6px 4px;display:flex;flex-direction:column;gap:3px;position:relative;overflow:visible;
cursor:pointer;color:var(--sink);box-shadow:0 1px 0 rgba(23,38,58,.08)}
.mi-card.rdy{border-color:var(--sgood);box-shadow:0 0 0 2px rgba(15,122,66,.22),0 0 12px rgba(15,122,66,.35)}
.mi-card.hot{border-color:var(--sacc)}
.mi-card.pin{border-color:var(--sgold);box-shadow:0 0 0 2px rgba(138,90,0,.28)}
/* locked slot: muted by a dashed border and a duller face, NOT by opacity —
   opacity .7 took the "🔒 Lv 4" text down to 3.4:1; --sdim on #f7f1e4 is 6.3:1 */
.mi-card.lock{border-style:dashed;background:#f7f1e4;align-items:center;justify-content:center;
color:var(--sdim);box-shadow:none}
/* -5px keeps the tag inside the rail's 4px top padding (the rail clips on y);
   -8px lost the top of the 📌 */
.mi-cpin{position:absolute;top:-5px;right:-5px;font-size:14px;line-height:1;pointer-events:none}
.mi-crow{flex:0 0 auto;display:flex;align-items:center;gap:3px;font-size:12px;color:var(--sdim);
font-weight:700}
.mi-creq{flex:0 0 auto;display:flex;flex-wrap:wrap;align-content:flex-start;gap:4px;row-gap:3px}
.mi-cq{flex:0 0 auto;white-space:nowrap;display:flex;align-items:center;gap:2px;font-size:16px;
line-height:1;background:#eaf1f7;border:1px solid var(--sline2);border-radius:8px;padding:3px 4px;
color:var(--sink)}
.mi-cq i{font-style:normal;font-size:12px;font-weight:800;color:var(--sdim);
font-variant-numeric:tabular-nums}
.mi-cq.ok{background:#dff4e7;border-color:var(--sgood)}
.mi-cq.ok i{color:var(--sgood)}
.mi-cq .mi-bdg{color:var(--sdim);font-size:10px}
/* margin-top:auto pins the bar and the foot to the bottom of the card
   however tall the requirement block grows. */
.mi-cbar{flex:0 0 auto;margin-top:auto;height:5px;border-radius:3px;background:#d8e1ea;overflow:hidden}
.mi-cbar>i{display:block;height:100%;width:0;background:var(--sacc)}
/* margin-top:auto so the foot still pins to the bottom on the AUTO order
   card, which has no .mi-cbar. When a bar IS present the two stay welded. */
.mi-cfoot{flex:0 0 auto;min-height:15px;margin-top:auto;display:flex;align-items:center;gap:4px;
font-size:12px;font-weight:800;color:var(--sgold);font-variant-numeric:tabular-nums;line-height:1}
.mi-cbar+.mi-cfoot{margin-top:0}
.mi-cfoot .who{flex:0 0 auto;font-size:15px}
.mi-cfoot .pay{flex:1 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mi-cfoot em{font-style:normal;color:var(--sdim);flex:0 0 auto}

/* Colourblind-safe chain badge (§5.4) wherever a chain is named in the DOM:
   order-card chips, storage cells, compendium cells, recipe rows. On canvas
   tiles the badge is baked into the cached tile instead. Dark-context
   colour here; the light-surface contexts override it above/below. */
.mi-bdg{display:inline-block;font-style:normal;font-size:10px;line-height:1;font-weight:700;
color:rgba(232,242,255,.72);vertical-align:middle}

/* ---- board column (light play surface) ----
   The next-move strip is a real flex item ABOVE the board (in flow, so
   the board measures itself against what is left). The coach hint is an
   OVERLAY inside .mi-bw: it reserves no height, is pointer-events:none,
   and during the tutorial (levels 1-5) it sits over row 0, which stays
   locked until level 9 — so it never covers a playable tile. */
.mi-boardcol{flex:1 1 auto;display:flex;flex-direction:column;min-height:0;min-width:0;
background:var(--surf)}
.mi-bw{flex:1 1 auto;position:relative;display:flex;align-items:center;justify-content:center;
min-height:0;padding:3px 0;overflow:hidden}
.mi-canvas{display:block;touch-action:none;border-radius:12px}
.mi-hint{position:absolute;left:10px;right:10px;top:5px;z-index:6;padding:7px 11px;
border-radius:11px;background:rgba(23,38,58,.95);border:1px solid rgba(126,240,255,.6);color:#fff;
font-size:13.5px;font-weight:700;line-height:1.3;pointer-events:none;text-align:center;
opacity:0;transform:translateY(-6px);transition:opacity .22s,transform .22s;
box-shadow:0 6px 18px rgba(0,0,0,.25)}
.mi-hint.on{opacity:1;transform:none}

/* ---- next-move strip (§4.8) — one slim line above the board ---- */
.mi-strip{flex:0 0 auto;display:none;align-items:center;gap:6px;min-height:28px;margin:3px 8px 0;
padding:3px 10px;border-radius:9px;background:var(--surf2);border:1px solid var(--sline2);
color:var(--sink);font-size:13px;font-weight:700;text-align:left;cursor:pointer;
width:auto;overflow:hidden}
.mi-strip.on{display:flex}
.mi-striptx{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* collapsed: an 8px bar, no text, still tappable to reopen */
.mi-strip.col{min-height:8px;height:8px;padding:0;border-radius:4px;background:#d3dbe4;
border-color:#d3dbe4}
.mi-strip.col .mi-striptx,.mi-strip.col .mi-bdg{display:none}

.mi-disc{position:absolute;left:10px;right:10px;top:8px;z-index:7;padding:9px 12px;
border-radius:12px;background:rgba(17,28,46,.96);border:1px solid var(--neon);color:var(--ink);
font-size:13.5px;font-weight:700;text-align:center;pointer-events:none;opacity:0;
transform:translateY(-8px);transition:opacity .22s,transform .22s;
box-shadow:0 0 22px rgba(56,232,255,.25)}
.mi-disc.on{opacity:1;transform:none}
.mi-dropbar{position:fixed;left:0;right:0;bottom:0;height:calc(58px + var(--sab));display:none;gap:10px;
padding:4px 12px calc(4px + var(--sab));z-index:880;align-items:center;justify-content:center;
background:linear-gradient(180deg,rgba(7,11,20,0),rgba(7,11,20,.92) 40%)}
.mi-dropbar.on{display:flex}
.mi-dz{flex:1 1 0;max-width:170px;height:52px;border-radius:13px;display:flex;align-items:center;
justify-content:center;gap:6px;font-size:13.5px;font-weight:800;background:rgba(13,21,36,.96);
border:2px dashed #3a4d6e;color:#c7d6ea}
.mi-dz.hot{border-style:solid;border-color:var(--neon);color:var(--ink);
box-shadow:0 0 16px rgba(56,232,255,.3)}
.mi-dz.trash.hot{border-color:var(--bad);box-shadow:0 0 16px rgba(255,92,122,.3)}
/* the Dock zone only exists while a producer is being dragged and the
   dock has room (the dock rail itself is hidden until something is docked) */
.mi-dz.dock{display:none}
.mi-dz.dock.show{display:flex}

/* ---- drag drop label (§4.9): combine / cross-feed are never colour-only,
       the ring style and this label both change. Body-level and fixed, so it
       is positioned from JS; transform anchors it above the finger. ---- */
.mi-droplbl{position:fixed;left:0;top:0;z-index:910;display:none;align-items:center;gap:5px;
max-width:76vw;padding:5px 10px;border-radius:11px;font-size:12.5px;font-weight:800;
white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:none;
background:rgba(11,19,34,.96);border:1px dashed #2a3b58;color:var(--ink);
box-shadow:0 6px 18px rgba(0,0,0,.5);transform:translate(-50%,-100%)}
.mi-droplbl.on{display:flex}
.mi-droplbl.combine{border-color:var(--warn);color:var(--warn)}
.mi-droplbl.cross{border-color:var(--cross);color:#cbb2ff}

/* ---- tool row (§5.6, redesigned) ----
   The three action chips used to float over the board (covering cells)
   and then stood in a 56px side gutter (costing ~7px per cell at 375px).
   They now live in a 50px row directly beneath the board, together with
   the 📦 storage button and the 🎁 daily chip that used to sit in the
   always-visible tray row — which lets the tray row disappear entirely
   while it is empty. The row is a plain flex child of #mi-root at every
   breakpoint (a grid row in landscape), so it can never overlap the grid.
   Right-handed (default): chips on the right, storage on the left;
   'Left-handed' (#mi-root.lefty) mirrors the order. */
.mi-pill{flex:0 0 auto;display:flex;align-items:center;gap:6px;height:50px;min-height:50px;
padding:0 8px;background:var(--surf);border-top:1px solid var(--sedge);min-width:0}
.mi-pill.on{display:flex}
.mi-pillsp{flex:1 1 auto;min-width:0;order:2}
.mi-pill .mi-pc{order:3}
.mi-pill .mi-store{order:1}
#mi-root.lefty .mi-pill .mi-pc{order:1}
#mi-root.lefty .mi-pill .mi-store{order:3}
.mi-pc{width:44px;height:44px;flex:0 0 44px;min-height:44px;padding:0;border-radius:12px;
border:2px solid var(--sline2);background:var(--surf2);color:var(--sacc);font-size:21px;line-height:1;
display:flex;align-items:center;justify-content:center;cursor:pointer;
box-shadow:0 1px 0 rgba(23,38,58,.10)}
.mi-pc:active{transform:translateY(1px)}
/* disabled chip: still legible for older eyes — #5f6f84 on #f1f3f5 = 4.6:1
   (the old #98a6b6 was 2.2:1); the flat face and grey border carry the state */
.mi-pc.off{color:#5f6f84;border-color:#d3dbe3;background:#f1f3f5;box-shadow:none}
/* while a tile is being dragged the chips fade and stop taking pointer
   events, so they can never swallow a drop; the 📦 storage button in the
   same row stays live because it IS a drop target */
.mi-pill.fade .mi-pc{opacity:.45;pointer-events:none}
/* flex:0 1 auto + min-width:0: on the narrowest phone, with the daily chip
   showing, the label gives before the action chips are pushed off-screen */
.mi-store{min-width:0;height:44px;min-height:44px;border-radius:12px;background:var(--surf2);
border:2px solid var(--sline2);color:var(--sink);font-size:14px;font-weight:800;cursor:pointer;
padding:0 10px;flex:0 1 auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
box-shadow:0 1px 0 rgba(23,38,58,.10)}
@media (max-width:359px){
  .mi-store{padding:0 7px;font-size:13px}
}
.mi-store.hot{border-color:var(--sacc);box-shadow:0 0 0 2px rgba(11,111,168,.25)}

/* ---- producer dock (§3.3) ----
   Same row model as the tray: fixed-size label, one flexible scroller with
   min-width:0 so its intrinsic width can never push the row wider than the
   phone, and overflow:hidden on the rail so nothing escapes it. 44px tiles
   in a 52px rail leaves 4px clearance top and bottom. The row is in flow
   ONLY while at least one producer is docked (merge.ui.js layoutRails). */
.mi-dock{flex:0 0 auto;height:52px;min-height:52px;display:flex;align-items:center;gap:6px;
padding:0 8px;background:var(--surf);border-top:1px solid var(--sedge);overflow:hidden;min-width:0}
.mi-dock.off{display:none}
.mi-docklbl{flex:0 0 auto;font-size:12px;font-weight:800;color:var(--sdim);letter-spacing:.05em;
white-space:nowrap}
.mi-dockin{flex:1 1 auto;min-width:0;display:flex;align-items:center;gap:6px;height:100%;
overflow-x:auto;overflow-y:hidden;touch-action:pan-x;-webkit-overflow-scrolling:touch;
scroll-snap-type:x proximity;scrollbar-width:none}
.mi-dockin::-webkit-scrollbar{height:0}
.mi-dt{flex:0 0 auto;position:relative;width:44px;height:44px;min-height:44px;padding:0;
scroll-snap-align:start;border-radius:11px;background:var(--surf2);border:2px solid var(--sline2);
display:flex;align-items:center;justify-content:center;font-size:22px;line-height:1;
cursor:pointer;color:var(--sink)}
.mi-dt.empty{background:transparent;border-style:dashed;opacity:.5;cursor:default}
.mi-dt.blocked{border-color:var(--swarn)}
.mi-dt.boost{border-color:var(--spurp);box-shadow:0 0 10px rgba(109,63,214,.4)}
.mi-dt.hot{border-color:var(--sacc);box-shadow:0 0 0 2px rgba(11,111,168,.25)}
.mi-dt b{position:absolute;right:2px;bottom:0;font-size:10.5px;font-weight:800;color:var(--sgold);
font-variant-numeric:tabular-nums;text-shadow:0 0 2px #fff,0 0 2px #fff}
.mi-dt i{position:absolute;left:2px;top:0;font-style:normal;font-size:10px;font-weight:700;
color:var(--sdim)}

/* ---- overflow tray ----
   Row model: [⚡/📥 toggle][📥 OVERFLOW n/cap label][slot strip][ⓘ] — the
   chips are fixed-size (flex:0 0 auto) and the strip is the ONLY flexible
   item. min-width:0 stops the strip's intrinsic width (up to 8 x 42px +
   gaps) forcing the row wider than the phone; the strip scrolls instead
   of overflowing, and .mi-tray clips so nothing can ever escape the row.
   The row is in flow ONLY while the tray holds something (layoutRails);
   the 📦 storage button that used to live here is in the tool row now. */
.mi-tray{flex:0 0 auto;height:50px;min-height:50px;display:flex;align-items:center;gap:6px;
padding:0 8px;background:var(--surf);border-top:1px solid var(--sedge);overflow:hidden;min-width:0}
.mi-tray.off{display:none}
/* scrollbar-width:none matches the ::-webkit-scrollbar rule below — on a
   non-WebKit desktop browser a classic scrollbar is laid out INSIDE these
   fixed-height strips and eats the clearance the chips need. */
.mi-trayin{flex:1 1 auto;min-width:0;display:flex;align-items:center;gap:5px;
overflow-x:auto;overflow-y:hidden;height:100%;touch-action:pan-x;
-webkit-overflow-scrolling:touch;scrollbar-width:none}
.mi-trayin::-webkit-scrollbar{height:0}
.mi-ti{flex:0 0 auto;width:42px;height:42px;border-radius:10px;background:var(--surf2);
border:2px solid var(--sline2);display:flex;align-items:center;justify-content:center;font-size:22px;
cursor:pointer;padding:0;color:var(--sink)}
.mi-ti.empty{background:transparent;border-style:dashed;opacity:.5}
/* the label carries the 📥 glyph and a live count, and the optional
   trailing hint sits in an <em> that ellipsises before it can shove the
   slot strip out of the row. */
.mi-traylbl{flex:0 1 auto;min-width:0;max-width:48%;font-size:12px;font-weight:800;
color:var(--sdim);letter-spacing:.05em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mi-traylbl em{font-style:normal;letter-spacing:normal;opacity:.9}
.mi-trayempty{flex:1 1 auto;min-width:0;display:flex;align-items:center;gap:6px;height:28px;
min-height:28px;padding:0 9px;border-radius:9px;background:var(--surf2);border:1px dashed var(--sline2);
color:var(--sdim);font-size:12px;font-weight:700;line-height:1;overflow:hidden;cursor:pointer;
text-align:left}
.mi-trayempty .tx{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mi-iq{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:26px;
height:26px;border-radius:50%;border:1.5px solid var(--sline2);background:var(--surf2);color:var(--sacc);
font-size:13px;font-weight:800;line-height:1;padding:0;cursor:pointer}

/* ---- combined dock/tray rail toggle (short phones, §5.7) ---- */
.mi-rsegs{flex:0 0 auto;display:none;border-radius:9px;overflow:hidden;border:1.5px solid var(--sline2)}
.mi-rseg{min-height:36px;padding:0 9px;border:0;background:var(--surf2);color:var(--sdim);font-size:14px;
font-weight:800;letter-spacing:.04em;white-space:nowrap;cursor:pointer}
.mi-rseg.on{background:var(--sacc);color:#fff}

/* ---- nav (dark chrome) ---- */
.mi-nav{flex:0 0 auto;height:56px;padding-bottom:var(--sab);display:flex;background:#0a1120;
border-top:1px solid #17233a}
.mi-nb{flex:1 1 0;min-height:56px;display:flex;flex-direction:column;align-items:center;
justify-content:center;gap:1px;background:none;border:0;color:var(--dim);font-size:12px;
font-weight:800;letter-spacing:.02em;cursor:pointer;padding:0}
.mi-nb i{font-style:normal;font-size:21px;line-height:1}
.mi-nb.on{color:var(--neon)}
.mi-nb .dot{position:absolute;margin:-18px 0 0 20px;width:7px;height:7px;border-radius:50%;
background:var(--neon2)}

/* ---- panels (dark chrome) ---- */
.mi-panel{position:fixed;left:0;top:0;right:0;height:var(--vh);z-index:400;background:var(--bg);
display:flex;flex-direction:column;transform:translateY(101%);transition:transform .26s ease;
padding-left:var(--sal);padding-right:var(--sar)}
.mi-panel.on{transform:none}
.mi-ph{flex:0 0 auto;height:52px;margin-top:var(--sat);display:flex;align-items:center;gap:8px;
padding:0 8px;border-bottom:1px solid #17233a;background:#0b1322}
.mi-ph h2{flex:1 1 auto;margin:0;font-size:17px;font-weight:800;letter-spacing:.03em}
.mi-pb{flex:1 1 auto;overflow-y:auto;-webkit-overflow-scrolling:touch;touch-action:pan-y;
padding:10px 10px calc(24px + var(--sab))}
/* The tab strip is a fixed-size band, never a shrinkable one: as a flex
   child of .mi-panel with the default flex-shrink:1 it used to be squeezed
   by the tall scrolling body and clip its own chips in half. flex:0 0 auto
   + symmetric padding + overflow-y:hidden keeps every chip whole, and
   overflow-x:auto lets the strip scroll when the tabs do not fit. */
.mi-tabs{flex:0 0 auto;display:flex;align-items:center;gap:6px;overflow-x:auto;
overflow-y:hidden;padding:8px;touch-action:pan-x;-webkit-overflow-scrolling:touch;
scrollbar-width:none}
.mi-tabs:empty{display:none}
.mi-tabs::-webkit-scrollbar{height:0}
.mi-tab{flex:0 0 auto;min-height:40px;height:40px;padding:0 12px;border-radius:10px;
background:#101a2c;border:1px solid #243452;color:#c7d6ea;font-size:13px;font-weight:800;
cursor:pointer;white-space:nowrap;line-height:38px}
.mi-tab.on{color:#04121a;background:var(--neon);border-color:var(--neon)}

/* ---- generic blocks ---- */
.mi-sec{margin:0 0 14px}
.mi-h3{margin:0 0 7px;font-size:12px;font-weight:800;letter-spacing:.1em;color:var(--dim);
text-transform:uppercase}
.mi-row{background:var(--panel);border:1px solid #1e2c46;border-radius:var(--radius);padding:10px;
margin-bottom:8px}
.mi-row.dim{opacity:.72}   /* .6 put "Unlocks at level N" at 3.9:1; .72 = 5.1:1 */
/* island map (merge.island.js) at the top of Island ▸ Island. The host is a
   persistent div merge.ui.js re-inserts on every render; it is empty (and
   therefore hidden) when the renderer is missing, so nothing reserves
   height for a map that is not there. The canvas sizes itself to the
   host's width (height = width x 0.66) and sets its own style width/height. */
.mi-islandwrap{margin:0 0 12px;border-radius:12px;overflow:hidden;background:#0c1424;
border:1px solid #1e2c46;line-height:0}
.mi-islandwrap:empty{display:none}
.mi-islandwrap canvas{display:block;max-width:100%}
/* a map tap pulses that area's card */
.mi-row.flash{border-color:var(--neon);box-shadow:0 0 0 2px rgba(56,232,255,.35),0 0 18px rgba(56,232,255,.35);
transition:box-shadow .3s,border-color .3s}
.mi-rt{display:flex;align-items:center;gap:8px}
.mi-rt .em{font-size:26px;line-height:1;flex:0 0 auto}
.mi-rt .tx{flex:1 1 auto;min-width:0}
.mi-nm{font-size:14.5px;font-weight:800;color:var(--ink)}
.mi-sub{font-size:12.5px;color:#a9bbd3;margin-top:2px;line-height:1.38}
.mi-btn{min-height:44px;padding:0 14px;border-radius:11px;border:1px solid #2a3b58;
background:#16233a;color:var(--ink);font-size:14px;font-weight:800;cursor:pointer;
display:inline-flex;align-items:center;justify-content:center;gap:6px;text-decoration:none}
.mi-btn.pri{background:var(--neon);border-color:var(--neon);color:#04121a}
.mi-btn.good{background:var(--good);border-color:var(--good);color:#04121a}
.mi-btn.bad{background:#2a1420;border-color:var(--bad);color:var(--bad)}
.mi-btn[disabled]{opacity:.45}
/* the second exit: '🏠 Back to Arcade' at the top of Log ▸ Settings */
.mi-btn.home{border:2px solid #7ef0ff;background:rgba(126,240,255,.10);color:#7ef0ff;
font-size:15px;min-height:48px;padding:0 18px;box-shadow:0 0 10px rgba(126,240,255,.22)}
.mi-btnrow{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
.mi-bar{height:8px;border-radius:5px;background:#16223a;overflow:hidden;margin-top:7px}
.mi-bar>i{display:block;height:100%;width:0;background:var(--neon)}
.mi-cost{display:inline-flex;align-items:center;gap:3px;font-size:13px;font-weight:800;
color:var(--gold);margin-right:9px;font-variant-numeric:tabular-nums}
.mi-cost.no{color:var(--bad)}
.mi-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(76px,1fr));gap:7px}
.mi-cellitem{aspect-ratio:1/1;border-radius:11px;background:#101a2c;border:1px solid #243452;
display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font-size:25px;
cursor:pointer;color:var(--ink);padding:2px;min-height:58px}
.mi-cellitem small{font-size:10.5px;color:var(--dim);font-weight:700;text-align:center;line-height:1.1}
.mi-cellitem.un{opacity:.32}
.mi-tblwrap{overflow-x:auto;touch-action:pan-x;border-radius:11px;border:1px solid #1e2c46}
.mi-tbl{width:100%;border-collapse:collapse;font-size:12.5px}
.mi-tbl th,.mi-tbl td{padding:6px 8px;text-align:left;border-bottom:1px solid #17233a;
white-space:nowrap}
.mi-tbl th{color:var(--dim);font-size:11.5px;letter-spacing:.06em;text-transform:uppercase}
.mi-chainline{display:flex;align-items:center;gap:4px;flex-wrap:wrap;font-size:21px;margin-top:6px}
.mi-chainline b{font-size:11.5px;color:var(--dim);font-weight:800}
.mi-chainline .cur{filter:drop-shadow(0 0 6px var(--neon))}
.mi-slider{width:100%;height:44px;-webkit-appearance:none;appearance:none;background:none;font-size:16px}
.mi-slider::-webkit-slider-runnable-track{height:6px;border-radius:4px;background:#22314c}
.mi-slider::-webkit-slider-thumb{-webkit-appearance:none;width:26px;height:26px;border-radius:50%;
background:var(--neon);margin-top:-10px}
.mi-slider::-moz-range-track{height:6px;border-radius:4px;background:#22314c}
.mi-slider::-moz-range-thumb{width:26px;height:26px;border:0;border-radius:50%;background:var(--neon)}
.mi-ta{width:100%;min-height:96px;font-size:16px;border-radius:10px;border:1px solid #2a3b58;
background:#0c1424;color:var(--ink);padding:8px;font-family:ui-monospace,Menlo,Consolas,monospace}

/* ---- commit preview (§4.3 / §4.4) ---- */
.mi-plan{border:1px solid #1e2c46;border-radius:12px;background:#0c1424;padding:6px 10px;
margin:2px 0 8px}
.mi-planrow{display:flex;align-items:center;gap:8px;padding:5px 0;font-size:13.5px;font-weight:700;
border-bottom:1px solid #16223a}
.mi-planrow:last-child{border-bottom:0}
.mi-planrow .em{flex:0 0 auto;font-size:21px;line-height:1}
.mi-planrow .tx{flex:1 1 auto;min-width:0}
.mi-planrow b{flex:0 0 auto;color:var(--dim);font-weight:800;font-variant-numeric:tabular-nums}
.mi-planrow.tot{margin-top:3px;padding-top:7px;border-top:1px solid #24354f;border-bottom:0;
color:var(--gold)}
.mi-planwarn{display:flex;align-items:flex-start;gap:6px;margin-top:6px;padding:6px 8px;
border-radius:9px;background:rgba(255,180,84,.1);border:1px solid rgba(255,180,84,.45);
color:var(--warn);font-size:12.5px;font-weight:700;line-height:1.35}

/* ---- recipes tab (§4.9) ---- */
.mi-recipe{width:100%;min-height:52px;display:flex;align-items:center;gap:8px;text-align:left;
background:var(--panel);border:1px solid #1e2c46;border-radius:12px;padding:8px 10px;
margin-bottom:8px;font-size:13.5px;font-weight:700;color:var(--ink);cursor:pointer}
.mi-recipe .em{flex:0 0 auto;font-size:21px;line-height:1}
.mi-recipe .tx{flex:1 1 auto;min-width:0}
.mi-recipe b{flex:0 0 auto;font-size:12px;font-weight:800;color:var(--dim);
font-variant-numeric:tabular-nums}
.mi-recipe.lock{opacity:.5;border-style:dashed;cursor:default}

/* ---- mastery tab (§7.2) ---- */
.mi-medal{display:flex;align-items:center;gap:8px;min-height:48px;background:var(--panel);
border:1px solid #1e2c46;border-left-width:4px;border-radius:12px;padding:8px 10px;margin-bottom:8px}
.mi-medal .em{flex:0 0 auto;font-size:21px;line-height:1}
.mi-medal .tx{flex:1 1 auto;min-width:0}
.mi-medal.b{border-left-color:#c08457}
.mi-medal.s{border-left-color:#c9d4e4}
.mi-medal.g{border-left-color:var(--gold)}
.mi-parcell{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
min-height:46px;padding:4px;border-radius:10px;background:#101a2c;border:1px solid #1e2c46;
font-size:13.5px;font-weight:800;color:var(--ink);font-variant-numeric:tabular-nums}
.mi-parcell small{font-size:10.5px;font-weight:700;color:var(--dim);letter-spacing:.04em;
text-transform:uppercase}
.mi-parcell.best{border-color:var(--gold);color:var(--gold)}
.mi-parcell.under{border-color:var(--good);color:var(--good)}

/* ---- storage filter / sort (§4.7) ---- */
.mi-fbar{display:flex;align-items:center;gap:6px;padding:2px 0 6px;overflow-x:auto;
overflow-y:hidden;touch-action:pan-x;-webkit-overflow-scrolling:touch;scrollbar-width:none}
.mi-fbar::-webkit-scrollbar{height:0}
/* 44px: spec 9.3 requires every NEW control to be at least 44px. */
.mi-fchip{flex:0 0 auto;min-height:44px;height:44px;padding:0 12px;border-radius:11px;
background:#101a2c;border:1px solid #243452;color:#c7d6ea;font-size:13px;font-weight:800;
white-space:nowrap;cursor:pointer;display:inline-flex;align-items:center;gap:4px;line-height:1}
.mi-fchip.on{color:#04121a;background:var(--neon);border-color:var(--neon)}
.mi-fchip i{font-style:normal;font-size:11px;opacity:.85;font-variant-numeric:tabular-nums}
.mi-range{display:flex;align-items:center;gap:8px;margin:2px 0 8px}
.mi-range .mi-slider{flex:1 1 0;min-width:0;width:auto}
.mi-range b{flex:0 0 auto;min-width:58px;text-align:right;font-size:12.5px;font-weight:800;
color:var(--dim);font-variant-numeric:tabular-nums}

/* ---- sheets / modals ---- */
.mi-scrim{position:fixed;inset:0;z-index:480;background:rgba(3,6,12,.66);opacity:0;
transition:opacity .2s;pointer-events:none}
.mi-scrim.on{opacity:1;pointer-events:auto}
.mi-sheet{position:fixed;left:0;right:0;bottom:0;z-index:500;max-height:82%;display:flex;
flex-direction:column;background:var(--panel);border-top:1px solid #24354f;
border-radius:18px 18px 0 0;transform:translateY(102%);transition:transform .24s ease;
padding-bottom:var(--sab);box-shadow:0 -12px 40px rgba(0,0,0,.6)}
.mi-sheet.on{transform:none}
.mi-sh{flex:0 0 auto;display:flex;align-items:center;gap:8px;padding:10px 10px 6px}
.mi-sh h3{flex:1 1 auto;margin:0;font-size:16px;font-weight:800}
.mi-sb{flex:1 1 auto;overflow-y:auto;touch-action:pan-y;padding:0 12px 14px}
.mi-modal{position:fixed;inset:0;z-index:600;display:none;align-items:center;justify-content:center;
padding:18px}
.mi-modal.on{display:flex}
.mi-mbox{width:min(340px,100%);background:var(--panel);border:1px solid var(--neon);
border-radius:18px;padding:18px;text-align:center;box-shadow:0 0 42px rgba(56,232,255,.3)}

/* ---- toasts / banner ---- */
.mi-toasts{position:fixed;left:0;right:0;bottom:calc(70px + var(--sab));z-index:800;display:flex;
flex-direction:column;align-items:center;gap:6px;pointer-events:none;padding:0 12px}
.mi-toast{max-width:340px;padding:9px 13px;border-radius:12px;background:rgba(17,28,46,.97);
border:1px solid #2a3b58;color:var(--ink);font-size:13.5px;font-weight:700;text-align:center;
opacity:0;transform:translateY(10px);transition:opacity .18s,transform .18s;
box-shadow:0 6px 22px rgba(0,0,0,.5)}
.mi-toast.on{opacity:1;transform:none}
.mi-toast.good{border-color:var(--good)}
.mi-toast.warn{border-color:var(--warn)}
.mi-toast.bad{border-color:var(--bad)}

/* ---- anti-addiction card ----
   Deliberately impossible to miss and deliberately impossible to hit:
   the scrim AND the card are pointer-events:none, so every tap, drag and
   merge goes straight through to the board underneath. Only the optional
   dismiss button of the 25-minute nudge takes pointer events back. */
.mi-warn{position:fixed;left:0;top:0;right:0;bottom:0;z-index:9000;display:flex;
align-items:center;justify-content:center;padding:0 14px;
background:rgba(4,8,16,.58);pointer-events:none;opacity:0;transition:opacity .3s ease;
visibility:hidden}
.mi-warn.on,.mi-warn.out{visibility:visible}
.mi-warn.on{opacity:1}
.mi-warn.out{opacity:0;transition:opacity 1.2s ease}
.mi-warnbox{width:100%;max-width:560px;padding:22px 18px;border-radius:22px;text-align:center;
pointer-events:none;background:rgba(11,19,34,.9);border:2px solid var(--neon2);color:#fff;
font-size:clamp(21px,7.6vw,34px);line-height:1.16;font-weight:900;letter-spacing:.005em;
text-shadow:0 0 12px rgba(255,121,198,.8),0 0 30px rgba(255,121,198,.45);
box-shadow:0 0 32px rgba(255,121,198,.5),0 0 84px rgba(255,121,198,.26),
inset 0 0 26px rgba(255,121,198,.12);animation:mi-warnpulse 1.5s ease-in-out infinite}
@keyframes mi-warnpulse{0%,100%{transform:scale(1);
box-shadow:0 0 32px rgba(255,121,198,.5),0 0 84px rgba(255,121,198,.26),
inset 0 0 26px rgba(255,121,198,.12)}
50%{transform:scale(1.035);
box-shadow:0 0 46px rgba(255,121,198,.78),0 0 130px rgba(255,121,198,.42),
inset 0 0 34px rgba(255,121,198,.2)}}
.mi-warn button{pointer-events:auto;display:block;margin:16px auto 0;min-height:44px;
padding:0 22px;border-radius:11px;border:1px solid var(--neon2);background:#1a1226;
color:var(--ink);font-size:15px;font-weight:800;text-shadow:none}
/* the card is still in the DOM for the 1.2s fade-out; the dismiss button
   is the one thing on it that takes pointer events, so hand them back
   immediately or it spends that second as an invisible tap-blocker
   sitting in the middle of the board */
.mi-warn.out button{pointer-events:none}
/* reduced motion: keep the fade (it is not motion), drop the pulse. The
   shell stylesheet clamps every transition to .001ms under this query, so
   the durations here have to be !important to survive it. */
@media (prefers-reduced-motion:reduce){
.mi-warnbox{animation:none !important;transform:none !important}
.mi-warn{transition-duration:.3s !important}
.mi-warn.out{transition-duration:1.2s !important}
}

.mi-ghost{position:fixed;left:0;top:0;z-index:900;pointer-events:none;display:none;
align-items:center;justify-content:center;border-radius:12px;
box-shadow:0 0 0 1.5px rgba(23,38,58,.55),0 10px 26px rgba(0,0,0,.4);will-change:transform}
.mi-ghost.on{display:flex}
.mi-fly{position:fixed;z-index:950;pointer-events:none;font-size:20px;
transition:transform .62s cubic-bezier(.4,.1,.5,1),opacity .62s}
.mi-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* ---- arcade wordmark ---- */
.pa-brand{background:linear-gradient(100deg,#ff6b00 0%,#ff9f1c 26%,#ffd166 50%,#7ef0ff 80%,
#00e5ff 100%) !important;background-size:100% 100% !important;-webkit-background-clip:text !important;
background-clip:text !important;-webkit-text-fill-color:transparent !important;color:transparent !important;
filter:drop-shadow(0 0 9px rgba(255,140,30,.32)) drop-shadow(0 0 13px rgba(0,229,255,.18))}
@supports not ((-webkit-background-clip:text) or (background-clip:text)){
.pa-brand{background:none !important;color:#ffb347 !important;-webkit-text-fill-color:#ffb347 !important}
}
.mi-brand{margin:18px 0 4px;text-align:center;font-size:11px;font-weight:800;letter-spacing:.18em}

/* ---- short phones (iPhone SE class, and every phone landscape) ----
   Every height here keeps its min-height twin, and no capped box clips its
   own content: .mi-rail stays height:auto so a three-requirement card is
   still whole at 320x568. The three action chips stay 44px — they are the
   controls the redesign exists for. */
@media (max-height:700px){
.mi-rail{height:auto;min-height:60px;padding:3px 8px}
.mi-card{min-height:52px;padding:3px 5px 3px}
.mi-cq{font-size:15px}
.mi-strip{min-height:26px;margin:2px 8px 0;padding:2px 9px;font-size:12.5px}
.mi-pill{height:48px;min-height:48px}
.mi-tray{height:46px;min-height:46px}
.mi-ti{width:38px;height:38px;font-size:20px}
.mi-trayempty{height:26px;min-height:26px;font-size:11.5px}
.mi-iq{width:24px;height:24px;font-size:12px}
/* §5.7: the dock and the tray share one rail with a segmented toggle,
   so only one of them is in flow at a time (when both have content). */
.mi-dock{height:48px;min-height:48px}
.mi-dt{width:40px;height:40px;min-height:40px;flex:0 0 40px;font-size:20px}
.mi-dock.off,.mi-tray.off{display:none}
.mi-rsegs{display:flex}
}

/* ---- landscape ----
   Grid: nav column | board column | side panel (top bar + vertical rail).
   The board column stacks board / tool row / dock / tray as grid rows, so
   the action chips sit under the board here too and never overlap it.
   .mi-dock / .mi-tray collapse to 0px rows when they are display:none.

   INTEGRATOR NOTE: every phone landscape viewport is also inside
   @media (max-height:700px), so .mi-rsegs (the ⚡/📥 toggle) is displayed
   there whenever BOTH rails have content; layoutRails keeps exactly one of
   them in flow. */
#mi-root.land{display:grid;grid-template-columns:56px 1fr 248px;
grid-template-rows:1fr auto auto auto;
grid-template-areas:"nav board side" "nav tools side" "nav dock side" "nav tray side";
padding-bottom:var(--sab)}
#mi-root.land .mi-side{grid-area:side;display:flex;flex-direction:column;min-height:0;
border-left:1px solid #17233a}
#mi-root.land .mi-top{margin-top:var(--sat);flex-wrap:wrap;height:auto;padding:5px 6px;
row-gap:4px}
#mi-root.land .mi-rail{height:auto;flex:1 1 auto;flex-direction:column;overflow-x:hidden;
overflow-y:auto;scroll-snap-type:none;touch-action:pan-y}
/* landscape cards are full-width rows in a vertical scroller: they must size
   to content exactly like the portrait ones. */
#mi-root.land .mi-card{flex:0 0 auto;width:100%;max-width:none;height:auto;min-height:56px}
#mi-root.land .mi-boardcol{grid-area:board}
#mi-root.land .mi-pill{grid-area:tools}
#mi-root.land .mi-dock{grid-area:dock}
#mi-root.land .mi-tray{grid-area:tray}
#mi-root.land .mi-nav{grid-area:nav;height:auto;flex-direction:column;justify-content:flex-start;
padding-top:var(--sat);padding-bottom:0;border-top:0;border-right:1px solid #17233a}
#mi-root.land .mi-nb{flex:0 0 auto;min-height:52px;font-size:10.5px}
@media (min-width:900px){
#mi-root{left:50%;transform:translateX(-50%);width:min(1040px,100%)}
#mi-root.land{grid-template-columns:56px 1fr 320px}
}

/* .mi-warn is deliberately absent here — it keeps its plain fade under
   reduced motion (see the rule next to the card above); only its pulse is
   switched off. */
@media (prefers-reduced-motion:reduce){
.mi-panel,.mi-sheet,.mi-toast,.mi-disc,.mi-fly,.mi-xpfill,.mi-hint{transition:none !important}
}

/* ================================================================
   Large text (Log ▸ Settings ▸ "Large text", localStorage
   'arcade.merge.bigtext'). ~15% on every HUD, rail, card, tool-row and
   panel font. Cards and the strip are content-sized, so they grow and
   the board re-measures itself; the canvas glyphs are already 63% of
   the cell and are not touched.
   ================================================================ */
body.mi-big .mi-lvtxt{font-size:14px}
body.mi-big .mi-w{font-size:15px}
body.mi-big .mi-cq{font-size:18px}
body.mi-big .mi-cq i{font-size:13.5px}
body.mi-big .mi-cq .mi-bdg{font-size:11px}
body.mi-big .mi-cfoot{font-size:13.5px;min-height:17px}
body.mi-big .mi-cfoot .who{font-size:17px}
body.mi-big .mi-card.lock{font-size:12.5px}
body.mi-big .mi-strip{font-size:15px;min-height:32px}
body.mi-big .mi-hint{font-size:15.5px}
body.mi-big .mi-disc{font-size:15.5px}
body.mi-big .mi-store{font-size:16px}
body.mi-big .mi-traylbl,body.mi-big .mi-docklbl{font-size:13.5px}
body.mi-big .mi-trayempty{font-size:13.5px}
body.mi-big .mi-nb{font-size:13.5px}
body.mi-big .mi-toast{font-size:15px}
body.mi-big .mi-droplbl{font-size:14px}
body.mi-big .mi-dz{font-size:15px}
body.mi-big .mi-ph h2{font-size:19px}
body.mi-big .mi-sh h3{font-size:18px}
body.mi-big .mi-tab{font-size:15px}
body.mi-big .mi-h3{font-size:13.5px}
body.mi-big .mi-nm{font-size:16.5px}
body.mi-big .mi-sub{font-size:14.5px}
body.mi-big .mi-btn{font-size:16px}
body.mi-big .mi-cost{font-size:15px}
body.mi-big .mi-tbl{font-size:14.5px}
body.mi-big .mi-tbl th{font-size:13px}
body.mi-big .mi-cellitem{font-size:28px}
body.mi-big .mi-cellitem small{font-size:12px}
body.mi-big .mi-recipe{font-size:15.5px}
body.mi-big .mi-recipe b{font-size:13.5px}
body.mi-big .mi-planrow{font-size:15.5px}
body.mi-big .mi-planwarn{font-size:14.5px}
body.mi-big .mi-parcell{font-size:15.5px}
body.mi-big .mi-parcell small{font-size:12px}
body.mi-big .mi-fchip{font-size:15px}
body.mi-big .mi-chainline b{font-size:13px}
body.mi-big .mi-range b{font-size:14.5px}
body.mi-big .mi-rseg{font-size:16px}
body.mi-big .mi-mbox{font-size:17px}
