/* StudyWire — phone layout refinements (0.102.0). Loaded after the inline
   stylesheet so it wins; everything here is scoped to narrow screens and to
   the native shell (html.native), so the desktop look is untouched. Same
   navy / gold / ivory palette; no new colours. */

@media (max-width: 760px) {
  /* ---- Home dashboard: tighter rhythm, same information ---------------- */
  .home { gap: 10px; padding: 4px 0 28px; }
  .hcontinue { gap: 8px; padding: 12px 14px 12px 16px; }
  .hcontinue .eyebrow { font-size: 10.5px; }
  .hcontinue h2 { font-size: 19px; margin-top: 2px; }
  .hcontinue .hline { display: none; }            /* the explanatory sentence; the stats and button say it */
  .hcontinue .hstats { flex-direction: row; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 12.5px; }
  .hcontinue .hstats span { padding-right: 0; border-right: 0; }
  .hcontinue .hside { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
  .hcontinue .hpill { align-self: center; padding: 5px 10px; font-size: 12px; }
  .hcontinue .btn.p { flex: 1 1 180px; width: auto; min-height: 44px; justify-content: center; }

  .hhead { margin-top: 2px; }
  .hgrid { gap: 8px; }
  .hcard { padding: 10px 12px; gap: 8px 10px; }
  .hcard .htile { width: 48px; height: 48px; }
  .hcard .hcode { font-size: 17px; }
  .hcard .hmeta { font-size: 12px; }
  .hcard .hcardActs .btn { min-height: 44px; }
  .hacts .btn { min-height: 44px; }
  .jstep { min-height: 56px; }

  /* ---- Review card: one heading, names, one supporting line, one action -- */
  .hrefresh { padding: 12px 14px; gap: 10px; }
  .hrefresh .rico { width: 34px; height: 34px; }
  .hrefresh .rico svg { width: 19px; height: 19px; }
  .hrefresh b { font-size: 15.5px; line-height: 1.25; display: block; }
  .hrefresh .rsub { font-size: 12.5px; margin-top: 3px; }
  .hrefresh .rsub.names { color: var(--ink); }
  .hrefresh > .btn { min-height: 44px; }
  .hrefresh .r2 { font-size: 12.5px; margin-top: 6px; }

  /* ---- Composer: shorter, New chat recedes, safe area respected ---------- */
  form#f { padding: 6px 10px calc(6px + env(safe-area-inset-bottom)); gap: 6px; }
  .askbox input[type=text] { min-height: 44px; }
  .askbox #send { min-height: 44px; padding: 0 16px; }
  form#f > .btn.p { background: transparent; border: 1px solid var(--line); color: var(--accent);
    font-size: 12.5px; padding: 0 10px; min-height: 44px; box-shadow: none; }
  form#f > .btn.p:hover { background: var(--accent-soft); }
  #log { padding: 12px 12px 10px; gap: 14px; }

  /* ---- Reminders & challenge: a full-height sheet, not a desktop modal ---- */
  dialog#dRem { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  #dRem .remHd { padding: calc(12px + env(safe-area-inset-top)) 16px 8px; }
  #dRem .remBody { padding: 4px 14px 14px; }
  #dRem section { padding: 10px 12px; margin-top: 10px; }
  #dRem .g2 { grid-template-columns: 1fr; gap: 6px; }
  #dRem .ftr { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  #dRem .ftr .hint { display: none; }
  #dRem .ftr .btn { min-height: 44px; flex: 1; justify-content: center; }
  #dRem .acts .btn { min-height: 40px; }
  #dRem .chips label { min-height: 36px; }
}

/* ---- Native shell only: settings sheet always full height, selects native size */
html.native dialog#dRem { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
html.native #dRem .remHd { padding-top: calc(12px + env(safe-area-inset-top)); }
html.native #dRem .ftr { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }

/* ---- Shared: toggles that read as switches, collapsible advanced rows ---- */
#dRem .sw input.tog, #dRem .kv input.tog, #dRem input.tog { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: 13px;
  background: #c7cdd8; position: relative; cursor: pointer; transition: background .15s; margin: 0; flex: none; }
#dRem input.tog::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s; }
#dRem input.tog:checked { background: var(--accent); }
#dRem input.tog:checked::after { left: 21px; }
#dRem input.tog:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
#dRem details { margin-top: 8px; }
#dRem details > summary { cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--accent); list-style: none;
  display: flex; align-items: center; gap: 6px; min-height: 36px; }
#dRem details > summary::-webkit-details-marker { display: none; }
#dRem details > summary::before { content: '›'; display: inline-block; transition: transform .15s; font-size: 16px; line-height: 1; }
#dRem details[open] > summary::before { transform: rotate(90deg); }
#dRem .kv { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
#dRem .kv label, #dRem .kv .lbl { margin: 0; font-size: 13px; font-weight: 600; }
#dRem .kv select { width: auto; max-width: 60%; }

/* ---- Page reader for iOS / the app (0.102.2): the cited page as an image ---- */
.bookBody #bookPager { height: 100%; overflow: auto; -webkit-overflow-scrolling: touch; background: var(--bg); position: relative; }
#bookPager[hidden] { display: none; }
#bookPager img { display: block; width: 100%; height: auto; background: #fff; }
#bookPager .pgnav { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); font-size: 13px; }
#bookPager .pgnav .btn { min-height: 44px; min-width: 88px; justify-content: center; }
#bookPager .pgLoad { padding: 24px 16px; font-size: 14px; text-align: center; }
#bookFrame[hidden] { display: none; }

/* ---- Citation preview + Reader (0.103.0) ---------------------------------- */
#dRef .rfBadge { display: inline-block; background: var(--accent); color: #fff; border-radius: 6px; padding: 1px 7px; font-size: 11.5px; font-weight: 700; }
#dRef .rfPage { color: var(--accent); font-weight: 700; }
#dRef .rfText { font-size: 14px; line-height: 1.6; max-height: min(52vh, 420px); overflow-y: auto; background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-family: Georgia, "Times New Roman", serif; color: var(--ink); }
#dRef .rfText p { margin: 0 0 10px; } #dRef .rfText p:last-child { margin-bottom: 0; }
#dRef .rfText p.li { padding-left: 14px; text-indent: -14px; }
#dRef .rfText mark, #bookPager .rdText mark { background: #ffe79a; color: inherit; border-radius: 3px; padding: 0 2px; }
#dRef .rfActs { gap: 8px; flex-wrap: wrap; } #dRef .rfActs .btn { min-height: 44px; }
#dRef .rfActs .btn.p { flex: 1 1 100%; justify-content: center; }
@media (max-width: 760px) { dialog#dRef { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; flex-direction: column; }
  /* 0.113.2: only while open — an unconditional display:flex showed the blank sheet over every page on phones */
  #dRef:not([open]) { display: none; } #dRef[open] { display: flex; }
  .calhd { flex-wrap: wrap; } .calhd h2 { font-size: 19px; flex: 1; text-align: center; } .calhd .muted { flex-basis: 100%; margin-left: 0 !important; text-align: center; } #dRef .rfText { flex: 1; max-height: none; } #dRef h3 { padding-top: env(safe-area-inset-top); } }

#bookPager .rdTabs { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; }
#bookPager .rdTab { appearance: none; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 9px; min-height: 40px; cursor: pointer; }
#bookPager .rdTab.on { background: var(--accent); border-color: var(--accent); color: #fff; }
#bookPager .rdHl { margin-left: auto; font-size: 12px; color: var(--muted); }
#bookPager .rdBody { min-height: 40vh; }
#bookPager .rdBody img { max-width: 920px; margin: 0 auto; box-shadow: 0 1px 6px rgba(0,0,0,.12); }
#bookPager .rdText { max-width: 720px; margin: 0 auto; padding: 18px 20px 28px; font-family: Georgia, "Times New Roman", serif; font-size: 16.5px; line-height: 1.65; color: var(--ink); }
#bookPager .rdText p { margin: 0 0 12px; } #bookPager .rdText p.li { padding-left: 16px; text-indent: -16px; }
#bookPager .rdPg { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
#bookPager .rdPg input { width: 64px; padding: 6px 8px; font-size: 15px; text-align: center; border: 1px solid var(--line); border-radius: 8px; }

/* ---- Sign-up: account type (0.104.0) ---- */
#gate .gRoles { display: flex; gap: 8px; }
#gate .gRoles label { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; margin: 0;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 14px; font-weight: 600; cursor: pointer; }
#gate .gRoles input { width: auto; margin: 0; accent-color: var(--accent); }
#gate .gRoles label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* ---- Plan cards: Choose / Manage (0.105.0) ---- */
.planCard .pact { margin-top: 10px; }
.planCard .pact .btn { width: 100%; justify-content: center; min-height: 40px; font-size: 13px; }

/* ---- Teaching portal seats control (0.108.0) ---- */
.cpTools .seats { display: inline-flex; align-items: center; gap: 6px; }
.cpTools .seats .lbl { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cpTools .seats b { min-width: 56px; text-align: center; font-size: 13px; }
.cpTools .seats .btn { min-width: 32px; padding: 4px 8px; }
