/* DJYTL Capital - phone layer v1 (mobile-ready D1, 2026-11-14). Loaded after djytl-ui.css on every page.
 * Tokens + safe areas + 16px fields (no iOS zoom) + 44px header controls + bottom tab bar. Desktop (>1080px, fine pointer) unchanged.
 * Brand: green-black vault surfaces, gold primary, Inter body; tab bar active = gold top rule. */
:root{
  --tap:44px; --input-fs:16px; --tabbar-h:56px;
  --safe-t:env(safe-area-inset-top,0px); --safe-b:env(safe-area-inset-bottom,0px);
  --safe-l:env(safe-area-inset-left,0px); --safe-r:env(safe-area-inset-right,0px);
  --vh-full:100vh;
}
@supports (height:100dvh){:root{--vh-full:100dvh}}

/* ---------- safe areas (viewport-fit=cover: content must not run under the notch / home indicator) ---------- */
.hdr{padding-top:var(--safe-t)}
.hdr-in{padding-left:max(24px,var(--safe-l));padding-right:max(24px,var(--safe-r))}
.wrap,.container{padding-left:max(24px,var(--safe-l));padding-right:max(24px,var(--safe-r))}
.ftr-grid,.ftr-legal{padding-left:max(24px,var(--safe-l));padding-right:max(24px,var(--safe-r))}
.ftr{padding-bottom:var(--safe-b)}

/* ---------- no zoom on focus: every field 16px on phones and touch screens ---------- */
@media (max-width:760px),(pointer:coarse){
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=button]):not([type=submit]):not([type=reset]):not([type=file]),
  select,textarea{font-size:16px!important}
  .input,.field input,.field select,.field textarea{min-height:44px}
}

/* ---------- header on phones / tablets: 44px controls, room for the notch ---------- */
@media (max-width:1080px){
  .hdr .logo{min-height:44px}
  .hdr .hydra-connect,.hdr .hdr-actions .btn{min-height:44px}
  .hdr .hydra-connect{min-width:44px;justify-content:center}
  .menu-toggle{width:44px;height:44px}
  .drawer{top:calc(var(--hdr-h) + var(--safe-t));height:calc(var(--vh-full) - var(--hdr-h) - var(--safe-t));
    padding-left:max(16px,var(--safe-l));padding-right:max(16px,var(--safe-r));padding-bottom:calc(32px + var(--safe-b))}
  .drawer a{min-height:48px}
}
@media (max-width:620px){
  .hdr-in{padding-left:max(16px,var(--safe-l));padding-right:max(16px,var(--safe-r));gap:8px}
  .wrap,.container{padding-left:max(16px,var(--safe-l));padding-right:max(16px,var(--safe-r))}
  .ftr-grid,.ftr-legal{padding-left:max(16px,var(--safe-l));padding-right:max(16px,var(--safe-r))}
  .hdr-actions{gap:6px}
  .hdr .hdr-actions .btn{padding:0 12px}
  /* the moving price strip costs a whole row on a phone; prices live one tap away on Markets */
  .ticker{display:none}
  .ftr li{margin:0}
  .ftr ul a{display:inline-flex;align-items:center;min-height:44px}
}
@media (max-width:360px){.logo b{font-size:13px}.hdr .hdr-actions .btn{padding:0 10px}}

/* ---------- bottom tab bar (phones + tablets; the top nav takes over above 1080px) ---------- */
.m-tabbar{display:none}
@media (max-width:1080px){
  html.m-has-tabbar body{padding-bottom:calc(var(--tabbar-h) + var(--safe-b))}
  .m-tabbar{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:50;height:calc(var(--tabbar-h) + var(--safe-b));
    padding:0 var(--safe-r) var(--safe-b) var(--safe-l);background:rgba(9,13,11,.96);border-top:1px solid var(--line,#1e2a24);
    -webkit-backdrop-filter:blur(14px) saturate(140%);backdrop-filter:blur(14px) saturate(140%)}
  .m-tabbar a{flex:1 1 0;min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
    height:var(--tabbar-h);color:var(--tx-3,#8b978f);font:500 11.5px/1 var(--sans,system-ui,sans-serif);letter-spacing:.01em;
    position:relative;-webkit-tap-highlight-color:transparent;text-decoration:none}
  .m-tabbar a svg{width:22px;height:22px;stroke:currentColor;fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
  .m-tabbar a[aria-current="page"]{color:var(--gold-hi,#ecca63)}
  .m-tabbar a[aria-current="page"]::before{content:"";position:absolute;top:0;left:22%;right:22%;height:2px;border-radius:0 0 2px 2px;background:var(--gold,#d6b24a)}
  .m-tabbar a:active{background:rgba(255,255,255,.03)}
  html.m-kb-open .m-tabbar{display:none}
  html.m-kb-open body{padding-bottom:0}
  .drawer{z-index:61}
}
@media print{.m-tabbar{display:none!important}}

/* ---------- shared phone primitives (used by the next batches) ---------- */
/* sticky action bar: the money action stays in reach, above the tab bar */
.m-actionbar{position:sticky;bottom:0;z-index:40}
@media (max-width:1080px){
  .m-actionbar{bottom:calc(var(--tabbar-h) + var(--safe-b));margin-inline:-16px;padding:10px 16px;
    background:linear-gradient(to top,var(--bg,#090d0b) 75%,rgba(9,13,11,0));}
  html.m-kb-open .m-actionbar{bottom:0}
  html:not(.m-has-tabbar) .m-actionbar{bottom:0;padding-bottom:calc(10px + var(--safe-b))}
}
/* bottom sheet */
.m-sheet-scrim{position:fixed;inset:0;z-index:69;background:rgba(0,0,0,.55);opacity:0;pointer-events:none;transition:opacity .18s}
.m-sheet-scrim.on{opacity:1;pointer-events:auto}
.m-sheet{position:fixed;left:0;right:0;bottom:0;z-index:70;max-height:calc(var(--vh-full) - 48px);overflow:auto;-webkit-overflow-scrolling:touch;
  background:var(--bg-1,#0d1310);border:1px solid var(--line-2,#29372f);border-bottom:0;border-radius:16px 16px 0 0;
  padding:8px max(16px,var(--safe-r)) calc(16px + var(--safe-b)) max(16px,var(--safe-l));transform:translateY(105%);transition:transform .22s ease}
.m-sheet.on{transform:none}
.m-sheet::before{content:"";display:block;width:40px;height:4px;border-radius:2px;background:var(--line-2,#29372f);margin:2px auto 10px}
/* segmented control */
.m-seg{display:flex;gap:4px;padding:4px;border:1px solid var(--line,#1e2a24);border-radius:12px;background:var(--bg-1,#0d1310);overflow-x:auto;scrollbar-width:none}
.m-seg::-webkit-scrollbar{display:none}
.m-seg button{flex:1 0 auto;min-height:44px;padding:0 14px;border:0;border-radius:9px;background:transparent;color:var(--tx-2,#b3bdb6);font-weight:600;font-size:14px;cursor:pointer}
.m-seg button[aria-selected="true"],.m-seg button.on{background:var(--gold-tint,rgba(214,178,74,.1));color:var(--gold-hi,#ecca63);box-shadow:inset 0 0 0 1px var(--line-gold,rgba(214,178,74,.38))}
@media (prefers-reduced-motion:reduce){.m-sheet,.m-sheet-scrim{transition:none}}

/* ---------- home markets panel as list-row cards (moved from D2 into D1: once the page no longer overflows, the panel's
   table would otherwise scroll sideways inside it). .m-list = each row one card: name left, price + last trade right. ---------- */
@media (max-width:620px){
  .m-list{overflow:visible}
  .m-list table,.m-list tbody{display:block;width:100%}
  .m-list thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
  .m-list tr{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:12px;row-gap:2px;align-items:center;min-height:64px;padding:12px 14px;border-bottom:1px solid var(--line-soft,#18221d)}
  .m-list tr:last-child{border-bottom:0}
  .m-list td{display:block;padding:0!important;border:0!important;white-space:normal;min-width:0}
  .m-list td:nth-child(1){grid-column:1;grid-row:1/span 2}
  .m-list .asset{min-height:44px}
  .m-list .asset small{white-space:normal}
  .m-list td[colspan]{grid-column:1/-1;grid-row:auto;text-align:center;padding:20px 0!important}
  .m-list tbody tr:hover td{background:transparent}
  /* Home: Asset | Reference | Last trade | Backing */
  .m-list-home td:nth-child(2){grid-column:2;grid-row:1;text-align:right}
  .m-list-home td:nth-child(3){display:none!important}
  .m-list-home td:nth-child(4){grid-column:2;grid-row:2;text-align:right}
}

/* ---------- home: the markets panel widened the whole page on phones (grid item min-width:auto) ---------- */
@media (max-width:1080px){.hero-grid{grid-template-columns:minmax(0,1fr)}.hero-grid>*{min-width:0}}

/* ---------- D2: wide tables become cards on phones (mobile-ready D2, 2026-11-14) ---------- */
/* .m-list = a market list: each row is one card - name on the left, price and change on the right, the action at the end;
   the whole row stays the tap target. .m-stack = any other table: each row becomes a small card of "label  value" lines. */
@media (max-width:620px){
  .m-stack{overflow:visible}
  .m-stack table,.m-stack tbody{display:block;width:100%}
  .m-stack thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
  .m-stack tr:last-child{border-bottom:0}
  /* Markets: Asset | Reference | Value per token | Last trade | 24h | Backing | Trade */
  .m-list-mk tr{grid-template-columns:minmax(0,1fr) auto auto}
  .m-list-mk td:nth-child(2){grid-column:2;grid-row:1;text-align:right}
  .m-list-mk td:nth-child(5){display:block!important;grid-column:2;grid-row:2;text-align:right;font-size:12.5px}
  .m-list-mk td:nth-child(3),.m-list-mk td:nth-child(4),.m-list-mk td:nth-child(6){display:none!important}
  .m-list-mk td:nth-child(7){grid-column:3;grid-row:1/span 2;text-align:right}
  .m-list-mk td:nth-child(7) .btn{min-height:44px;padding:0 14px}
  .m-list-mk td:nth-child(7) .tag{white-space:normal;max-width:84px;text-align:center}
  /* stacked */
  .m-stack tr{display:block;padding:12px 14px;border-bottom:1px solid var(--line-soft,#18221d)}
  .m-stack td{display:flex!important;justify-content:space-between;align-items:baseline;gap:14px;padding:3px 0!important;border:0!important;white-space:normal;text-align:right!important;overflow-wrap:anywhere}
  .m-stack td::before{content:attr(data-label);flex:0 0 auto;max-width:42%;text-align:left;color:var(--tx-3,#8b978f);font:500 12px/1.5 var(--sans,system-ui,sans-serif)}
  .m-stack td.m-long{flex-direction:column;align-items:stretch;text-align:left!important;gap:2px}
  .m-stack td:first-child{justify-content:flex-start;text-align:left!important;font-weight:600;color:var(--tx,#e9ede9);padding-bottom:6px!important}
  .m-stack td:first-child::before,.m-stack td[colspan]::before,.m-stack td:not([data-label])::before{display:none}
  .m-stack td[colspan]{display:block!important;text-align:center!important}
  .m-stack tbody tr:hover td{background:transparent}
}

/* ---------- D3: wallet + money pages (mobile-ready D3, 2026-11-14) ---------- */
/* Text that waits for the web font no longer jumps when it arrives: a local fallback sized like Inter (Arial / Liberation Sans). */
@font-face{font-family:"Inter Fallback";src:local("Arial"),local("ArialMT"),local("Liberation Sans"),local("Helvetica");size-adjust:107.1%;ascent-override:90.4%;descent-override:22.5%;line-gap-override:0%}
:root{--sans:"Inter","Inter Fallback",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
@media (max-width:1080px){
  /* pages that draw their content after load (bridge, P2P) pushed the footer down the screen; the page now starts a screen tall */
  body>main{min-height:calc(var(--vh-full) - var(--hdr-h))}
  /* the money action stays in reach: it rides at the bottom of the screen, above the tab bar, while its form is on screen */
  #cta.act,#bridgeBtn,#redeemBtn,.card.panel>.cta,div:has(>#sGo),div:has(>#bGo),div:has(>#tGo){position:sticky;bottom:calc(var(--tabbar-h) + var(--safe-b) + 10px);z-index:6}
  #cta.act,#bridgeBtn,#redeemBtn,.card.panel>.cta,#sGo,#bGo,#tGo{min-height:48px;box-shadow:0 -10px 24px -6px rgba(0,0,0,.65),0 0 0 1px rgba(0,0,0,.35)}
  html.m-kb-open #cta.act,html.m-kb-open #bridgeBtn,html.m-kb-open #redeemBtn,html.m-kb-open .card.panel>.cta,html.m-kb-open div:has(>#sGo),html.m-kb-open div:has(>#bGo),html.m-kb-open div:has(>#tGo){bottom:8px}
  html:not(.m-has-tabbar) #cta.act,html:not(.m-has-tabbar) #bridgeBtn{bottom:calc(var(--safe-b) + 10px)}
}
/* wallet page: the vault frame follows its content (min 320px, at most one screen), no empty box under "Set up your wallet" */
.walletframe-wrap.m-fit{min-height:0}
.walletframe-wrap.m-fit #wallet-frame{height:var(--vault-h,640px)}
@media (max-width:620px){
  .hw-head{flex-direction:column;align-items:flex-start;gap:10px}
  .hw-head img{width:40px;height:40px}
  .wallet-tabs .btn{min-height:44px}
}

/* ---------- D4: Terminal phone mode (mobile-ready D4, 2026-11-14) - html.m-term is set by djytl-terminal-m.js at <=760px ---------- */
.t-seg,.t-bar{display:none}
@media (max-width:760px){
  html.m-term .grid{min-height:0;display:block;background:var(--bg)}
  html.m-term .mktbar{gap:8px 18px;padding:10px max(16px,var(--safe-r)) 10px max(16px,var(--safe-l))}
  html.m-term .mktbar select.pair{min-height:44px}
  html.m-term .t-seg{display:flex;margin:10px max(16px,var(--safe-r)) 8px max(16px,var(--safe-l))}
  html.m-term[data-tp=chart] [data-tp-panel]:not([data-tp-panel=chart]),html.m-term[data-tp=book] [data-tp-panel]:not([data-tp-panel=book]),
  html.m-term[data-tp=trades] [data-tp-panel]:not([data-tp-panel=trades]),html.m-term[data-tp=orders] [data-tp-panel]:not([data-tp-panel=orders]){display:none}
  html.m-term #chart,html.m-term .chart-empty{height:min(52vh,420px)}
  html.m-term .book .r,html.m-term .trades .r{padding-block:5px;font-size:13px}
  html.m-term .oo .x{min-height:36px;min-width:44px}
  /* the order ticket lives in a sheet on phones */
  html.m-term #tradecol{display:none}
  html.m-term #tradecol.m-sheet.on{display:block}
  html.m-term #tradecol .form input{font-size:16px}
  html.m-term #tradecol .seg button,html.m-term #tradecol .tabs button{min-height:44px}
  html.m-term #tradecol .cta{min-height:48px}
  html.m-term main{padding-bottom:76px}
  html.m-term .t-bar{display:flex;gap:10px;position:fixed;left:0;right:0;bottom:calc(var(--tabbar-h) + var(--safe-b));z-index:49;
    padding:8px max(16px,var(--safe-r)) 8px max(16px,var(--safe-l));background:rgba(9,13,11,.96);border-top:1px solid var(--line);
    -webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px)}
  html.m-term:not(.m-has-tabbar) .t-bar{bottom:0;padding-bottom:calc(8px + var(--safe-b))}
  html.m-term .t-bar .btn{flex:1;min-height:48px;font-size:15px}
  html.m-term.m-kb-open .t-bar{display:none}
}

/* ---------- D5: polish (mobile-ready D5, 2026-11-14) - type floor and tap targets on phones ---------- */
/* tab bar labels at the 12px floor (they were 11.5px: 5 per page) */
html body .m-tabbar a{font-size:12px}
@media (max-width:620px){
  /* html body: page <style> blocks come after this file and would win a tie */
  html body :is(.tag,.asset small,.tbl th,.stats .k,.mstat .k,.kvs .k,.panel-h,.page-head .crumbs,.ftr-legal,.fine,.tk,.tk-empty){font-size:12px}
}
@media (max-width:760px),(pointer:coarse){
  html body .btn{min-height:44px}
  html body :is(.tabs-bar a,.tabs-bar button,.fchip){min-height:44px;display:inline-flex;align-items:center}
  html body :is(.section-h a,.panel-h a){display:inline-flex;align-items:center;min-height:44px}
  html body details>summary{min-height:44px;padding-block:10px}
  /* remaining small targets on the account pages (WebKit sweep): footer logo, checkbox labels, show-password, small links */
  html body .ftr .logo{display:inline-flex;align-items:center;min-height:44px}
  html body .ftr ul a{min-width:44px}
  html body label:has(>input[type=checkbox]),html body label:has(>input[type=radio]){display:flex;align-items:center;min-height:44px}
  html body .pw-toggle{min-height:44px;min-width:44px}
  html body a.link-a.small{display:inline-flex;align-items:center;min-height:44px}
}

/* ---------- D7: money actions stick only once their form is on screen (mobile-ready D7, 2026-11-14) ----------
   Found by the signed-in pass: a sticky action cannot leave its card, so while the card's top was still near the bottom of the screen the
   button sat pinned on the card's first lines (Bridge: over "Deposit to DJYTL Chain / From network") and 2px into the tab bar. The
   script in djytl-mobile.js marks the action .m-unstick until enough of its form is visible; then it rides above the tab bar as before. */
@media (max-width:1080px){
  html body .m-unstick{position:static!important}
  /* a disabled sticky action stays opaque (dimmed, not see-through), so the fields it passes over never show through it */
  #cta.act:disabled,#bridgeBtn:disabled,#redeemBtn:disabled,.card.panel>.cta:disabled,#sGo:disabled,#bGo:disabled,#tGo:disabled{opacity:1!important;filter:saturate(.35) brightness(.6)}
}
/* P2P offer rows (signed-in, 360px): the lists are CSS grids, whose items default to min-width:auto, so a row's content pushed it 18px
   past the screen. Rows may shrink; their text wraps. */
.p2p-offers>*,.p2p-list>*,.p2p-orders>*{min-width:0}
@media (max-width:620px){.p2p-offer>*{min-width:0}.p2p-offer{overflow-wrap:anywhere}}
/* [mobile-ready D8 2026-11-14] P2P order room: the order's main action rides above the tab bar on phones (djytl-mobile.js orderBar()).
   The page keeps room at its end for the bar, so the last field (the chat box) can always be scrolled clear of it. */
.m-orderbar{display:none}
@media (max-width:1080px){
  .m-orderbar:not([hidden]){display:flex;position:fixed;left:0;right:0;z-index:45;bottom:calc(var(--tabbar-h) + var(--safe-b));
    padding:10px max(16px,var(--safe-r)) 10px max(16px,var(--safe-l));background:rgba(9,13,11,.96);border-top:1px solid var(--line,#1e2a24);
    -webkit-backdrop-filter:blur(14px) saturate(140%);backdrop-filter:blur(14px) saturate(140%)}
  .m-orderbar .btn{flex:1 1 auto;width:100%;min-height:48px;white-space:normal;line-height:1.25}
  .m-orderbar .btn:disabled{opacity:1;filter:saturate(.35) brightness(.6)}
  html:not(.m-has-tabbar) .m-orderbar{bottom:0;padding-bottom:calc(10px + var(--safe-b))}
  html.m-has-orderbar body{padding-bottom:calc(var(--tabbar-h) + var(--safe-b) + 72px)}
  html.m-kb-open .m-orderbar{display:none}
  html.m-kb-open.m-has-orderbar body{padding-bottom:0}
}
@media print{.m-orderbar{display:none!important}}
