.mobile-profile,.hw-jump,.mero-mobile-label,.season-table .mero-person .mero-inline-id { display:none; }
.topbar .mobile-profile { display:none; }
.mero-sheet-tools .mero-filter-toggle { display:none; }
.portal-more .more-group {
  display:grid;
  gap:5px;
  padding:8px;
  border:1px solid #dce7f4;
  border-radius:18px;
  background:#fffefa;
}
.portal-more .more-group h2 { margin:5px 10px 2px; color:#435f80; font-size:.85rem; }
.portal-more .more-group a { border-color:transparent; background:#f4f8fd; }
.portal-more .more-group a:hover { background:#eaf3ff; border-color:#c2d9f3; }
.more-account-actions { display:flex; flex-wrap:wrap; gap:8px; margin-block:13px 0; }
.more-account-actions:empty { display:none; }
.portal-start .portal-app-icon { border-radius:20px; }

.lesson-media-card,.lecture-lower {
  min-width:0;
  align-self:start;
  border:1px solid #e7edf7;
  border-radius:26px;
  box-shadow:var(--lift);
  background:#fff;
  overflow:hidden;
}
.lecture-lower { margin-top:0; }
@media (min-width:961px) {
  .lesson-layout { grid-template-areas:"player side" "reading side"; row-gap:0; grid-template-rows:auto 1fr; }
  .lesson-media-card { grid-area:player; border-radius:26px 26px 0 0; border-bottom:0; box-shadow:none; }
  .lesson-side { grid-area:side; align-self:start; }
  .lecture-lower { grid-area:reading; padding-top:52px; border-radius:0 0 26px 26px; border-top:0; box-shadow:0 14px 21px -16px #183b6326; }
}

.install-banner {
  display:flex;
  align-items:center;
  gap:4px;
  max-width:620px;
  margin:12px 0 16px;
  padding:5px 6px;
  border:1px solid #cfdef1;
  border-radius:17px;
  background:#f6faff;
  color:#174174;
}
.hw-login-card .install-banner { margin:20px auto 0; text-align:left; }
.install-banner-open {
  display:flex;
  flex:1;
  min-width:0;
  gap:10px;
  align-items:center;
  padding:5px;
  text-align:start;
  border-radius:11px;
  line-height:1.2;
}
.install-banner-open span { display:grid; gap:4px; }
.install-banner-open b { font-size:.9rem; }
.install-banner-open small { color:#4a6886; font-size:.78rem; }
.install-banner-open img,.hw-login-card .install-banner-open img { width:44px; height:44px; flex:none; margin:0; border-radius:11px; }
.install-dismiss { flex:0 0 44px; height:44px; font-size:1.45rem; border-radius:12px; color:#456688; }
.install-banner button:hover { background:#eaf3ff; }
.install-guide {
  width:min(420px,calc(100% - 28px));
  max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
  padding:0;
  border:1px solid #d8e6f5;
  border-radius:22px;
  background:#fffefa;
  color:#193c64;
  box-shadow:0 18px 60px #102a5059;
}
.install-guide::backdrop { background:#122946a6; }
.install-guide form { padding:18px; }
.install-guide header { display:flex; align-items:center; gap:12px; }
.install-guide header img { border-radius:15px; }
.install-guide h2 { margin:0; font-size:1.25rem; }
.install-guide p,.install-guide li { font-size:.94rem; line-height:1.45; }
.install-guide ol { padding-inline-start:22px; display:grid; gap:12px; margin:17px 0; }
.install-guide .btn { width:100%; min-height:44px; }
.more-account-actions .btn { min-height:44px; white-space:normal; }
body:has(.install-guide[open]) { overflow:hidden; }

@media (max-width:700px) {
  :root {
    --shpv-mobile-header:calc(56px + env(safe-area-inset-top));
    --shpv-mobile-nav:calc(58px + env(safe-area-inset-bottom));
    scroll-padding-block:calc(var(--shpv-mobile-header) + 10px) calc(var(--shpv-mobile-nav) + 10px);
  }
  .topbar {
    height:var(--shpv-mobile-header);
    min-height:var(--shpv-mobile-header);
    padding-inline:max(12px,env(safe-area-inset-left)) max(12px,env(safe-area-inset-right));
    background:#fffefa;
    backdrop-filter:none;
  }
  .expedition-theme .topbar { background:#fbf8ef; }
  .topbar .top-actions .icon-btn,.topbar .mobile-profile {
    display:grid;
    place-items:center;
    flex:none;
    width:44px;
    min-width:44px;
    height:44px;
    border-radius:13px;
  }
  .topbar .mobile-profile { border:1px solid #dce7f3; background:#fff; }
  .topbar .mobile-profile .role-avatar { width:32px; height:32px; flex-basis:32px; font-size:.78rem; }
  .topbar .mobile-profile[aria-current] { border-color:#80afe4; background:#eaf4ff; }
  .topbar .site-logout { display:none; }
  .topbar .role-select,.topbar .choice-trigger { min-height:44px; }
  .mobile-bottom.mobile-primary {
    padding-inline:max(5px,env(safe-area-inset-left)) max(5px,env(safe-area-inset-right));
    padding-block:5px calc(6px + env(safe-area-inset-bottom));
    box-shadow:0 -3px 14px #24547a12;
  }
  .mobile-bottom.mobile-primary .side-link { min-height:46px; }
  .main-content { padding-bottom:calc(var(--shpv-mobile-nav) + 24px); }
  #main:has(> .expedition-page) { padding-bottom:calc(var(--shpv-mobile-nav) + 24px); }
  .shpv-keyboard .mobile-bottom { visibility:hidden; }
  .shpv-keyboard .player-shell.is-float { visibility:hidden; }
  .hw-login {
    padding:calc(14px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
  }
  .hw-login::before { display:none; }
  .hw-login-card { padding:24px 15px; }
  .hw-login-card h1 { font-size:clamp(1.35rem,5.8vw,1.8rem); }
  .hw-login-card > .btn { min-height:44px; }

  :is(#main,.dialog,.search-dialog,.disk-dialog,.ex-modal,.quiz-overlay) :is(
    input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=hidden]),
    textarea,select,[contenteditable=true]
  ) { font-size:16px; }
  :is(#main,.dialog,.quiz-overlay,.disk-dialog,.ex-modal) :is(.btn,.choice-trigger) {
    min-height:44px;
    white-space:normal;
    line-height:1.25;
  }
  .portal-filter-tools > label { min-width:0; }
  .local-search { min-height:44px; }
  :is(.disk-filters,.disk-file-row,.lesson-selection-head,.learning-card-actions) button,
  .expedition-page .ex-button,.expedition-page .ex-secondary { min-height:44px; }
  .disk-file-row .disk-pick-btn { min-width:44px; flex-basis:44px; }
  .modal-close,.ex-modal .ex-dialog-x,.searchbox .icon-only-btn {
    width:44px;
    height:44px;
    min-width:44px;
    min-height:44px;
  }
  .dialog,.disk-dialog,.search-results { overscroll-behavior:contain; }
  .dialog { border-radius:18px 18px 0 0; }
  .modal-backdrop { align-items:flex-end; }
  .modal-backdrop .dialog {
    height:auto;
    max-height:calc(100dvh - env(safe-area-inset-top) - 8px);
    padding-bottom:calc(16px + env(safe-area-inset-bottom));
  }
  .search-dialog {
    margin-top:calc(8px + env(safe-area-inset-top));
    max-height:calc(var(--shpv-visible-height,100dvh) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px);
  }
  .searchbox { padding:9px 12px; gap:9px; }
  .searchbox input { min-height:44px; }
  .search-results :is(.result,.search-helpers > a) { min-height:46px; }
  .search-results .result b { overflow-wrap:anywhere; }
  .shpv-keyboard :is(.search-backdrop,.modal-backdrop) {
    inset:var(--shpv-visible-top,0px) 0 auto;
    height:var(--shpv-visible-height,100dvh);
  }
  .shpv-keyboard .modal-backdrop .dialog { max-height:100%; }
  .quiz-overlay { padding-top:calc(10px + env(safe-area-inset-top)); padding-bottom:calc(15px + env(safe-area-inset-bottom)); }
  .quiz-overlay .choice-list label { min-height:48px; font-size:.91rem; line-height:1.45; }

  .lesson-action-strip .head-actions { gap:6px; }
  .lesson-side { padding:10px; }
  .lesson-side .side-tabs { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .lesson-side .side-tabs button { min-width:0; min-height:44px; padding:6px 4px; white-space:normal; font-size:.8rem; line-height:1.18; }
  .lesson-side .side-tabs button:only-child { grid-column:1/-1; }
  .lesson-side .side-tab-content { padding:11px 2px; min-height:unset; }
  .lesson-side .small-section-top { gap:6px; }
  .lesson-side .small-section-top button { min-height:44px; text-align:start; line-height:1.2; }
  .chapter-row .chapter-edit,.attached .detach-btn { min-width:44px; min-height:44px; }
  .lecture-lower { padding:12px; }
  .video-footer .video-actions > :is(.btn,.choice-trigger) { flex:1 1 auto; }
  .reader-top { flex-wrap:wrap; }
  .hw-jump.btn { display:inline-flex; }
  .hw-head { justify-content:flex-start; }
  .hw-head a,.hw-tabs button,.hw-actions .btn { min-height:44px; }
  .hw-head a { display:inline-flex; align-items:center; }
  .hw-jump { margin-inline-start:auto; }
  .hw-list .hw-row { min-height:56px; }
  .hw-composer .hw-actions .btn { flex:1 1 130px; }
  .hw-dialog h2 { scroll-margin-top:6px; }
  .hw-history { max-height:min(52dvh,32rem); }

  .mobile-admin-navigation {
    padding:9px 11px 11px;
    border:1px solid #dce7f3;
    border-radius:14px;
    background:#f6faff;
    font-size:.84rem;
  }
  .mobile-admin-navigation .choice-trigger { background:#fff; }
  .admin-list-row .admin-actions button,.admin-list-row .admin-actions summary { height:44px; min-width:44px; }
  .admin-list-row .admin-actions { gap:4px; }
  .people-filters { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
  .management-form .btn { max-width:100%; }
  .mero-sheet-tools { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .mero-sheet-tools > label:first-child,.mero-sheet-tools > [data-save] { grid-column:1/-1; }
  .mero-sheet-tools .mero-filter-toggle { display:inline-flex; justify-content:center; align-self:end; }
  .mero-sheet-tools:not([data-filters-open]) > [data-more-filter] { display:none; }
  .mero-sheet-tools > label,.mero-sheet-tools .choice-trigger,.mero-sheet-tools select { min-width:0; max-width:100%; width:100%; }
  .mero-sheet-tools label { align-self:end; }
  .mero-mobile-label,.season-table .mero-person .mero-inline-id { display:block; }
  .mero-desktop-label,.season-table :is(.mero-code,.mero-code-column,[data-period-off]) { display:none; }
  .season-table {
    --mero-person-width:clamp(104px,38vw,165px);
    --mero-cell-width:64px;
    max-height:min(58dvh,39rem);
    scroll-padding-inline-start:var(--mero-person-width);
  }
  .season-table .mero-person { left:0; }
  .season-table th,.season-table td { min-height:44px; }
  .management-content .season-table input[type="text"] { min-height:44px; }

  .ex-modal {
    max-height:calc(var(--shpv-visible-height,100dvh) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px);
  }
  .ex-modal .ex-dialog-x { margin:7px 9px -51px auto; }
  .ex-modal :is(.ex-dialog-tabs button,.ex-tab,.ex-admin-option,.ex-title-button),
  .expedition-page :is(.ex-title-button,.ex-text-button) { min-height:44px; }
  .ex-map-scroll-hint { font-size:.78rem; line-height:1.3; }
  .expedition-page .ex-map-scroll-hint { gap:4px; margin-inline:1px; }
  .ex-map-scroll-hint span { flex:1; }
  .ex-map-scroll-hint button {
    flex:0 0 44px;
    height:44px;
    border:1px solid #d5c39d;
    border-radius:11px;
    background:#fcf6e7;
    color:#204b39;
    font-size:1.4rem;
  }
  .ex-map-scroll-hint button:disabled { opacity:.48; }
}

@media (max-width:360px) {
  .topbar .top-actions { gap:5px; }
  .topbar .mobile-brand { gap:4px; }
  .mobile-bottom.mobile-primary .side-link { font-size:10px; }
  .hw-head .hw-jump { margin-inline-start:0; }
  .portal-more .more-group a { gap:9px; padding-inline:9px; }
}
