/* Antologist iOS shim styles. Injected into the hub and every episode page by bundle.py. */
html.ant-app{-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}
html.ant-app img{-webkit-touch-callout:none}
html.ant-app body{overscroll-behavior:none}

/* Hub fixes (also reported to the hub session): side margins + safe areas, and [hidden] beating .menu button{display:flex}. */
html.ant-hub [hidden]{display:none!important}
html.ant-hub .wrap,html.ant-hub #title{padding-left:max(16px,env(safe-area-inset-left));padding-right:max(16px,env(safe-area-inset-right))}
@media (min-width:721px){html.ant-hub .wrap,html.ant-hub #title{padding-left:max(32px,env(safe-area-inset-left));padding-right:max(32px,env(safe-area-inset-right))}}
html.ant-hub .top{padding-top:env(safe-area-inset-top)}
html.ant-hub #title{padding-top:max(48px,env(safe-area-inset-top));padding-bottom:max(48px,env(safe-area-inset-bottom))}
html.ant-hub .sheet .in{padding-bottom:max(22px,calc(env(safe-area-inset-bottom) + 12px))}
html.ant-hub .toast{bottom:calc(24px + env(safe-area-inset-bottom))}

/* iOS zooms into any field under 16px on focus; keep fields at 16px so the layout stays put. */
html.ant-app input:not([type=checkbox]):not([type=radio]):not([type=range]),html.ant-app select,html.ant-app textarea{font-size:max(16px,1em)}
/* Hub text fields inherit the UA's black text on the dark sheet (reported to the hub session). */
html.ant-hub input:not([type=checkbox]):not([type=radio]):not([type=range]){color:var(--text);caret-color:var(--accent)}
html.ant-hub input::placeholder{color:var(--mute);opacity:.6}

/* Episode main menu on touch: no keyboard hints; landscape iPhone (short screens) gets a compact menu that fits. */
@media (pointer:coarse){html.ant-game .ev2-mfoot{display:none}}
html.ant-game .ev2-mcol{margin-left:env(safe-area-inset-left)}
@media (max-height:500px){
  html.ant-game .ev2-mcol{padding-top:max(20px,env(safe-area-inset-top));padding-bottom:max(20px,env(safe-area-inset-bottom))}
  html.ant-game .ev2-mtitle{font-size:40px!important;line-height:1.05}
  html.ant-game .ev2-mi{padding-top:5px;padding-bottom:5px}
}

/* Notebook: on landscape iPhone the floating window becomes a full-height side sheet (portrait already gets the
   engine's bottom sheet under 720px). Inline drag/resize sizes are overridden on purpose. */
@media (max-height:500px) and (min-width:721px){
  html.ant-game #ev2nb{top:0!important;bottom:0!important;right:0!important;left:auto!important;width:min(420px,48vw)!important;
    height:auto!important;max-height:none;border-radius:14px 0 0 14px;resize:none;padding-right:env(safe-area-inset-right)}
  html.ant-game #ev2nb.ev2-min{top:auto!important;height:auto!important}
}

/* Engine reveals the header buttons (music, notebook, settings, pause menu) on header:hover; touch never hovers. */
@media (hover:none){html.ant-game .ev2-hud .ev2-round{opacity:.85!important}}
html.ant-game header.top{padding-right:env(safe-area-inset-right)}

/* Engine modals (settings, pause, persona, documents): keep clear of the notch / Dynamic Island and home bar. */
html.ant-game .ev2-modal{padding:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left))}
/* Engine rule `.ev2-round span{display:none}` also hides the HUD icon spans (notebook, settings, menu). Reported. */
html.ant-game .ev2-round .ev2-ico{display:inline-flex!important}
@media (max-height:500px){html.ant-hub #title{gap:14px}html.ant-hub #t-h img{height:44px!important}}

/* Cinematic player letterbox bars: clear the status bar / home indicator (iPad portrait and landscape). */
html.ant-game .cine-bar.top{padding-top:env(safe-area-inset-top);box-sizing:content-box}
html.ant-game .cine-bar.bot{padding-bottom:env(safe-area-inset-bottom);box-sizing:content-box}
/* The bottom bar grows by the home-bar inset above, so lift the subtitles by the same amount (second line was hidden on iPhone, 09/11/2026). */
html.ant-game .cine-subs{bottom:calc(var(--bar) + 3.2vh + env(safe-area-inset-bottom))!important}
/* Same for the speaker tag bottom-left: it sat half under the taller bottom bar ("THE NARRATOR" cut off, iPad, 12/11/2026).
   Landscape only: in portrait the tag is placed from the top, under the picture window. */
@media (orientation:landscape){
  html.ant-game .cine-tag{bottom:calc(var(--bar) + 2.6vh + env(safe-area-inset-bottom))}
  html.ant-game .cine.nv-inner .cine-tag{bottom:calc(var(--bar) + 3.2vh + clamp(52px,10vh,84px) + env(safe-area-inset-bottom))}
}

/* ===== Theme (Settings > Theme): html[data-ant-theme] recolours each case through its own palette variables.
   'Original' sets nothing. Dark-native cases get a paper light mode; The Third Pillar (paper-native) gets a dark one. ===== */
html[data-ant-theme=light]:is([data-game=kamcheng],[data-game=sireh],[data-game=lokap],[data-game=kurung]){
  --ink:#f3eee5;--ink2:#fbf8f1;--ink3:#e9e1d2;--line:#d3c8b4;--text:#231f1a;--fog:#675f53;--pink:#efe6d6;
  --ev-panel:#fffdf7;--ev-panel2:#f4eee3;--ev-ptext:#231f1a;--ev-pmute:#675f53;--ev-pline:#d3c8b4;--ev-bar:rgba(251,248,241,.97);--ev-btext:#231f1a;--ev-shadow:0 14px 40px rgba(60,45,20,.18)}
html[data-ant-theme=light][data-game=kamcheng]{--saffron:#a86f12;--jade:#2f7d63;--lantern:#a8382b;--ev-accent:#a86f12}
html[data-ant-theme=light][data-game=sireh]{--leaf:#4e7d33;--brass:#8c6a26;--kopi:#a8432e;--blue:#2f6f84;--ev-accent:#4e7d33;--ev-good:#4e7d33}
html[data-ant-theme=light][data-game=lokap]{--amber:#a8670f;--mint:#2f7d5c;--red:#b23f2b;--paper2:#e4ebdd;--ev-accent:#a8670f;--ev-good:#2f7d5c}
html[data-ant-theme=light][data-game=kerasukan]{
  --bg:#eef0ea;--bg2:#e4e8e0;--panel:#fafbf7;--line:#c9d2c8;--ink:#1b211d;--mute:#56645a;--dim:#7d897f;--amber:#9a6a12;--amber2:#7d550c;--nv:#1f8a48;--nv2:#1f8a48;
  --ev-accent:#9a6a12;--ev-good:#1f8a48;--ev-panel:#fafbf7;--ev-panel2:#eef0ea;--ev-ptext:#1b211d;--ev-pmute:#56645a;--ev-pline:#c9d2c8;--ev-bar:rgba(244,246,241,.97);--ev-btext:#1b211d}
html[data-ant-theme=dark][data-game=pillar]{
  --ink:#17141b;--ink2:#1f1b24;--ink3:#28232f;--line:#3b3446;--text:#ece4d6;--fog:#a99fae;--paper:#221e27;--paper2:#d9cfe0;--pink:#ece4d6;
  --saffron:#c9a35a;--jade:#7fb1c8;--lantern:#d97a92;
  --ev-accent:#c9a35a;--ev-good:#7fb1c8;--ev-panel:#1f1b24;--ev-panel2:#28232f;--ev-ptext:#ece4d6;--ev-pmute:#a99fae;--ev-pline:#3b3446;--ev-bar:rgba(23,20,27,.97);--ev-btext:#ece4d6}
html[data-ant-theme] body{transition:background-color .2s}
/* hard-coded colours inside the case pages */
html[data-ant-theme=light] header.top{background:rgba(251,248,241,.96)!important}
html[data-ant-theme=light][data-game=kerasukan] header.top{background:rgba(244,246,241,.96)!important}
html[data-ant-theme=light] .ch-head p{color:var(--fog,var(--mute))!important}
html[data-ant-theme=light][data-game=kerasukan] .ch-head p{color:var(--mute)!important}
html[data-ant-theme=dark][data-game=pillar] header.top{background:rgba(23,20,27,.96)!important}
/* "Dark islands": panels with a literal dark background (phone, CCTV, livestream, map pins, banners) keep their original light text */
html[data-ant-theme=light][data-game=kerasukan] :is(.ch-banner,.dm,.nvwrap,.seg,.conv,.boardbox,.mapbox,.mpin span,.evpick button[aria-pressed=true],.cnote,.t-meta span){
  --ink:#e2e7e1;--mute:#93a598;--dim:#5f7166;--nv:#5fd384;--nv2:#a9f5bf;--amber:#d9a441;--line:#24332b;color:var(--ink)}
html[data-ant-theme=light][data-game=sireh] :is(.tl .hd.a,.tl .hd.b,.mpin span,.evpick button[aria-pressed="true"]){--text:#e9e3d6;--fog:#9aa8a6;--line:#2c3d42;--leaf:#7fb054;color:var(--text)}
html[data-ant-theme=light][data-game=lokap] :is(.cctv,.mpin span){--text:#e6eadf;--fog:#93aba2;--line:#28463f;--amber:#e8a33c;--mint:#7fc6a4;color:var(--text)}
html[data-ant-theme=light][data-game=kamcheng] :is(.phone,.bub.in,.bub.out,.mpin span,#narr,.mus-btn,.stamp){--text:#ebe3d0;--fog:#9fb5af;--line:#2b4a50;--saffron:#e3a53d;--jade:#5fae92;color:var(--text)}
/* overlays (final accusation, document reader backdrop) */
html[data-ant-theme=light]:not([data-game=pillar]) #over{background:rgba(243,238,229,.96)!important}
html[data-ant-theme=light]:not([data-game=pillar]) #modal{background:rgba(60,50,35,.45)!important}
html[data-ant-theme=dark][data-game=pillar] #over{background:rgba(23,20,27,.96)!important}
html[data-ant-theme=light][data-game=kurung]{--gold:#8f6a17;--gold2:#6f5210;--teal:#22706a;--teal2:#1b5a55;--red:#a8432e;--ev-accent:#8f6a17;--ev-good:#22706a}
html[data-ant-theme=light][data-game=kurung] .mpin span{--text:#ece6d6;--fog:#a3a7c0;color:var(--text)}

/* HUD icon pills (music, notebook, settings, menu): always visible on touch, with a contrasting pill in every theme. */
html.ant-game{--ant-fg:var(--text,#ece6d6)}
html.ant-game[data-game=kerasukan]{--ant-fg:var(--ink)}
html.ant-game header.top .ev2-hud .ev2-round{opacity:1!important;color:var(--ant-fg)!important;
  background:color-mix(in srgb,var(--ant-fg) 12%,transparent)!important;border:1px solid color-mix(in srgb,var(--ant-fg) 35%,transparent)!important}
html.ant-game header.top .ev2-hud .ev2-round:active{background:color-mix(in srgb,var(--ant-fg) 24%,transparent)!important}
.ant-theme-row .ev2-seg{flex-wrap:nowrap;white-space:nowrap}.ant-theme-row .ev2-seg button{padding-left:10px;padding-right:10px}

/* Paper artefacts keep dark ink even when the surrounding case uses Dark mode.
   Scope the palette to the surface so inherited text, controls and evidence labels agree. */
html.ant-game[data-game=pillar] :is(.strip,.sheet,.paper,.screen,.nbk .e.hl,.evpick button[aria-pressed="true"],.lgrid td button.y){
  --text:#2c2433;--pink:#2c2433;--fog:#65596c;--paper:#fffdf6;--paper2:#3d3445;--line:#a99a83;
  --jade:#326478;--saffron:#785617;--lantern:#99374f;color:var(--text);color-scheme:light}
html.ant-game[data-game=pillar] .sheet{background:var(--paper)}
html.ant-game[data-game=pillar] .strip .mv button{color:#55485e;border-color:#8b7b96}

/* Evidence is printed paper in every case. Quirks-mode tables must have an
   explicit colour: WebKit can otherwise use the dark page's light body text. */
html.ant-game .sheet.ev2-obj{
  --text:#2c2433;--fog:#65596c;--pink:#2c2433;--pink-ink:#2c2433;
  --ptext:#2c2433;--pfog:#65596c;--paper:#fffdf6;--paper2:#3d3445;
  --ev-ptext:#2c2433;--ev-pmute:#65596c;color:#2c2433;color-scheme:light}
html.ant-game .sheet.ev2-obj :is(table,thead,tbody,tfoot,tr,th,td){color:#2c2433}
html.ant-game .sheet.ev2-obj :is(.s-kind,.rp-note,.tr-meta,.cap,.np-meta,.np-dek,.tr,.st,.small,.trans,.sig){color:#65596c}
html.ant-game .sheet.ev2-obj .close{background:#2c2433;color:#fffdf6}

/* Keep every pinprick and the final newspaper line in continuous readable flow. */
html.ant-game[data-game=pillar] .paper{columns:auto;column-count:1;column-width:auto;min-width:0;max-width:100%;padding:28px 22px;line-height:2.25;text-align:left;overflow-wrap:break-word;overflow:visible}
html.ant-game[data-game=pillar] .paper .pk{display:inline-block}
html.ant-game #modal.ev2-cmp #ev2cmp>.sheet{min-width:0;max-width:100%;overflow-wrap:break-word;zoom:1!important}
html.ant-game #modal{padding-bottom:calc(180px + env(safe-area-inset-bottom,0px))}
@media(max-width:1000px){html.ant-game #modal.ev2-cmp #ev2cmp{grid-template-columns:minmax(0,1fr)}}

/* iPhone portrait (09/11/2026): the sticky game header was 330px tall (title, chapter dots, HUD, tabs, objective),
   leaving ~60% of the screen for the case, and the tab row ran off the right edge (Board, Dialect, Notebook hidden).
   Phones: header scrolls away with the page, tabs wrap onto a second line. */
@media (max-width:600px){
  html.ant-game header.top{position:relative!important}
  html.ant-game #tabs{flex-wrap:wrap!important;overflow-x:visible!important;row-gap:2px}
  html.ant-game #tabs button{padding:8px 10px!important}
}

/* No sideways page scroll or zoom-out strip on phones (09/11/2026). Shelves scroll inside themselves. */
html.ant-app,html.ant-app body{overflow-x:clip}
/* The class above is added by app.js at the end of the page; clip from the very first layout too (13/11/2026). */
html,body{overflow-x:clip;max-width:100%}
