.mobile-sheet-eye, .mobile-sheet-handle, .mobile-sheet-dock, .mobile-sheet-home,
.mobile-sheet-export:not([open]) { display: none; }

@media (max-width: 800px) {
  body.mobile-sheet-active {
    --sheet-glass: rgba(24, 24, 40, .76);
    --dock-glass: rgba(22, 22, 36, .88);
    --sheet-edge: rgba(208, 206, 236, .27);
    --tab-active: rgba(161, 148, 229, .32);
    --sheet-ink: #f7f6fd;
    --sheet-motion: 250ms cubic-bezier(.22, .72, .28, 1);
  }
  html[data-site-theme=light] body.mobile-sheet-active {
    --sheet-glass: rgba(247, 246, 255, .82);
    --dock-glass: rgba(250, 249, 255, .9);
    --sheet-edge: rgba(66, 54, 104, .23);
    --tab-active: rgba(123, 102, 197, .23);
    --sheet-ink: #222035;
  }

  body.mobile-sheet-active .topbar,
  body.mobile-sheet-active #drawerScrim,
  body.mobile-sheet-active .preview-col > :not(.phone-wrap),
  body.mobile-sheet-active .mobile-editor-step,
  body.mobile-sheet-active #sheetResizeToggle,
  body.mobile-sheet-active #sheetToggle,
  body.mobile-sheet-active #sheetGestureTip { display: none !important; }

  body.mobile-sheet-active .preview-col {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100dvh !important;
    max-height: none !important;
    padding: 0 !important;
    display: grid !important;
    place-items: center;
    overflow: hidden;
  }
  body.mobile-sheet-active .preview-col .phone-wrap {
    margin: 0 !important;
    padding: 0 !important;
    width: max-content;
    height: max-content;
    min-height: 0 !important;
    transform: var(--mobile-preview-transform, none) !important;
    transition: transform var(--sheet-motion) !important;
  }
  body.mobile-sheet-active .preview-col .phone[data-device] {
    height: min(calc(100dvh - 24px - env(safe-area-inset-top)), 198vw) !important;
    max-height: none !important;
    max-width: calc(100vw - 18px) !important;
    margin: 0 !important;
    transform: none !important;
  }

  body.mobile-sheet-active #settingsDrawer {
    position: fixed !important;
    inset: auto 0 0 !important;
    width: 100% !important;
    height: var(--mobile-sheet-height, 50dvh) !important;
    max-height: none !important;
    box-sizing: border-box;
    display: block !important;
    background: var(--sheet-glass) !important;
    -webkit-backdrop-filter: blur(22px) saturate(135%);
    backdrop-filter: blur(22px) saturate(135%);
    border: 1px solid var(--sheet-edge) !important;
    border-bottom: 0 !important;
    border-radius: 26px 26px 0 0 !important;
    box-shadow: 0 -12px 40px #08081838;
    transform: translateY(0) !important;
    transition: height var(--sheet-motion), transform var(--sheet-motion) !important;
    z-index: 45;
  }
  body.mobile-sheet-hidden #settingsDrawer { transform: translateY(105%) !important; }
  body.mobile-sheet-dragging #settingsDrawer,
  body.mobile-sheet-dragging .preview-col .phone-wrap { transition: none !important; }

  body.mobile-sheet-active #sheetDragHandle {
    height: 60px !important;
    min-height: 60px !important;
    padding: 20px 16px 0 !important;
    border: 0;
    background: transparent !important;
    z-index: 5;
  }
  body.mobile-sheet-active #sheetDragHandle::before { display: none; }
  body.mobile-sheet-active #sheetDragHandle > strong {
    max-width: none;
    margin: 0;
    color: var(--sheet-ink);
  }
  body.mobile-sheet-active #sheetDragHandle .sheet-actions { display: flex !important; }
  body.mobile-sheet-active #sheetDragHandle .mobile-sheet-handle {
    position: absolute;
    inset: 0 auto auto 50%;
    transform: translateX(-50%);
    display: grid;
    place-items: start center;
    width: 76px;
    height: 24px;
    padding: 8px 0 0;
    border: 0;
    background: transparent;
    color: var(--sheet-ink);
    cursor: ns-resize;
    touch-action: none;
  }
  .mobile-sheet-handle span {
    width: 41px;
    height: 4px;
    border-radius: 99px;
    background: currentColor;
    opacity: .48;
  }
  body.mobile-sheet-active .mobile-sheet-collapsed #sheetDragHandle > :not(.mobile-sheet-handle),
  body.mobile-sheet-active .mobile-sheet-collapsed .controls-scroll { visibility: hidden; }
  body.mobile-sheet-active #settingsDrawer .controls-scroll {
    position: absolute !important;
    inset: 60px 0 var(--mobile-dock-height, 80px) !important;
    height: auto !important;
    min-height: 0;
    padding: 10px 16px 20px !important;
    overflow: auto;
    overscroll-behavior: contain;
  }

  body.mobile-sheet-active .mobile-sheet-eye,
  body.mobile-sheet-active .mobile-sheet-plus {
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    touch-action: manipulation;
  }
  body.mobile-sheet-active .mobile-sheet-eye {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 9px);
    right: calc(env(safe-area-inset-right) + 9px);
    width: 44px;
    height: 44px;
    z-index: 51;
    color: var(--sheet-ink);
    background: var(--dock-glass);
    border: 1px solid var(--sheet-edge);
  }
  .mobile-sheet-eye svg, .mobile-sheet-plus svg, .mobile-sheet-export-close svg { width: 23px; height: 23px; }
  .mobile-sheet-eye[aria-expanded=true] .mobile-eye-slash { display: none; }

  body.mobile-sheet-active .mobile-sheet-dock {
    position: fixed;
    inset: auto 0 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: clamp(7px, 2.1vw, 14px);
    padding: 8px max(10px, env(safe-area-inset-right)) calc(9px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    pointer-events: none;
  }
  body.mobile-sheet-active .mobile-sheet-dock .studio-settings-nav {
    position: static !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    flex: 1 1 auto;
    min-width: 0;
    gap: 0;
    margin: 0;
    padding: 4px;
    border: 1px solid var(--sheet-edge);
    border-radius: 999px;
    background: var(--dock-glass) !important;
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    pointer-events: auto;
    transition: transform var(--sheet-motion), visibility var(--sheet-motion);
  }
  body.mobile-sheet-hidden .mobile-sheet-dock .studio-settings-nav {
    transform: translateY(calc(110% + env(safe-area-inset-bottom)));
    visibility: hidden;
    pointer-events: none;
  }
  body.mobile-sheet-active .mobile-sheet-dock .studio-settings-nav button {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    min-height: 49px;
    padding: 3px 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--sheet-ink) !important;
    font-size: clamp(9px, 2.65vw, 12px);
    line-height: 1.15;
    font-weight: 500;
    touch-action: manipulation;
  }
  body.mobile-sheet-active .mobile-sheet-dock .studio-settings-nav button[data-studio-section=appearance] { display: none !important; }
  body.mobile-sheet-active .mobile-sheet-dock .studio-settings-nav button[aria-current=true] { background: var(--tab-active); }
  body.mobile-sheet-active .mobile-sheet-dock .studio-settings-nav svg { display: block; width: 22px; height: 22px; }
  body.mobile-sheet-active .mobile-sheet-plus {
    flex: 0 0 57px;
    width: 57px;
    height: 57px;
    background: #d6fb60;
    color: #192008;
    border: 1px solid #d6fb60;
    box-shadow: 0 4px 20px #0003;
    pointer-events: auto;
  }
  body.mobile-sheet-active .mobile-sheet-home {
    display: flex;
    align-items: center;
    min-height: 44px;
    color: var(--ui-text);
  }
  body.mobile-sheet-active .mobile-editor-menu {
    max-height: max(80px, calc(var(--mobile-sheet-height) - var(--mobile-dock-height) - 68px)) !important;
  }

  .mobile-sheet-export[open] {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    max-width: 540px;
    max-height: 90dvh;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    border: 1px solid var(--sheet-edge);
    border-radius: 24px 24px 0 0;
    background: var(--ui-surface);
    color: var(--ui-text);
    overflow: auto;
  }
  .mobile-sheet-export::backdrop { background: #10101a80; }
  .mobile-sheet-export > h2 { margin: 0 48px 16px 0; font-size: 19px; }
  .mobile-sheet-export .mobile-sheet-export-close {
    position: absolute;
    top: 8px;
    right: 8px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--ui-raised);
    color: var(--ui-text);
  }
  body.mobile-sheet-active .mobile-sheet-export .export-dock {
    position: static !important;
    height: auto !important;
    width: auto !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }
  .mobile-sheet-export .share-panel:not(.hidden) { margin-bottom: 16px; }
  .mobile-sheet-export .toast {
    position: absolute;
    inset: auto auto 10px 50%;
    width: max-content;
    max-width: calc(100% - 24px);
  }
  .mobile-sheet-export .export-dock > div:first-child { display: none; }
  .mobile-sheet-export .export-dock .action-pair { margin: 0; }
  .mobile-sheet-export .export-dock button[hidden] { display: none !important; }

  @media (prefers-reduced-motion: reduce) {
    body.mobile-sheet-active { --sheet-motion: 0ms; }
  }
}

@media (max-width: 800px) {
  .mobile-sheet-active {
    --settings-card: rgba(135, 134, 185, .10);
    --settings-rule: rgba(165, 167, 200, .20);
  }
  html[data-site-theme=light] .mobile-sheet-active {
    --settings-card: rgba(99, 90, 154, .06);
    --settings-rule: rgba(81, 71, 124, .16);
  }

  .mobile-sheet-active #settingsDrawer .studio-current-section {
    padding: 0 !important;
    border: 0 !important;
  }
  .mobile-sheet-active #settingsDrawer :is(
    .mobile-settings-group, .settings-order-group, .palette-row, #photoControls,
    #personalEventsEditor, .season-settings, .settings-order-details, .event-import
  ) {
    box-sizing: border-box;
    margin: 0 0 12px !important;
    padding: 13px !important;
    background: var(--settings-card);
    border: 1px solid var(--settings-rule) !important;
    border-radius: 16px;
  }
  .mobile-sheet-active #settingsDrawer :is(.mobile-settings-group, .settings-order-group, #personalEventsEditor, .season-settings) > h4,
  .mobile-sheet-active #settingsDrawer .palette-row > span {
    color: var(--sheet-ink);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 10px;
  }
  .mobile-sheet-active #settingsDrawer .settings-order-group > h4 { margin-bottom: 0; }
  .mobile-sheet-active #settingsDrawer :is(.settings-order-group, .mobile-settings-group) { gap: 9px; }
  .mobile-sheet-active #settingsDrawer .mobile-settings-group { display: grid; }
  .mobile-sheet-active #settingsDrawer .mobile-settings-group[data-group=background-color-grid]:not(:has(label:not([hidden]))) { display: none; }
  .mobile-sheet-active #settingsDrawer .mobile-settings-group .form-grid,
  .mobile-sheet-active #settingsDrawer .mobile-settings-group .background-color-grid {
    margin: 0;
  }
  .mobile-sheet-active #settingsDrawer .mobile-settings-group .segmented { margin: 0; }
  .mobile-sheet-active #settingsDrawer .settings-order-group:has(#progress) > h4 { display: none; }
  .mobile-sheet-active #settingsDrawer :is(.mobile-settings-group, .settings-order-group, #personalEventsEditor) .toggle-row {
    margin: 0;
    min-height: 50px;
    padding: 8px 0;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    background: transparent !important;
  }
  .mobile-sheet-active #settingsDrawer .toggle-row + .toggle-row:not([hidden]) {
    border-top: 1px solid var(--settings-rule);
  }
  .mobile-sheet-active #settingsDrawer details:is(.settings-order-details, .event-import) {
    padding-block: 0 !important;
  }
  .mobile-sheet-active #settingsDrawer details:is(.settings-order-details, .event-import) > summary {
    align-content: center;
    min-height: 46px;
  }
  .mobile-sheet-active #settingsDrawer details:is(.settings-order-details, .event-import)[open] {
    padding-bottom: 12px !important;
  }
  .mobile-sheet-active #settingsDrawer .mobile-settings-group > .settings-order-details {
    margin: 0 !important;
  }
  .mobile-sheet-active #settingsDrawer .mobile-settings-group > .hint { margin: 0; }
  .mobile-sheet-active #settingsDrawer #settings-appearance.mobile-appearance-inline {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }
  .mobile-sheet-active #settingsDrawer .palette-row { display: grid; }
  .mobile-sheet-active #settingsDrawer [hidden]:is(.settings-order-group, #photoControls, .mobile-settings-group) { display: none !important; }
}

.mobile-mode-capsule { display: none; }

@media (max-width: 800px) {
  body.mobile-sheet-active .mobile-mode-capsule {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 9px);
    left: calc(env(safe-area-inset-left) + 9px);
    z-index: 51;
    display: block;
    transition: opacity var(--sheet-motion), visibility var(--sheet-motion);
  }
  body.mobile-sheet-hidden .mobile-mode-capsule {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
  body.mobile-sheet-active .mobile-mode-capsule .editor-mode-switch {
    display: flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--sheet-edge);
    border-radius: 999px;
    background: var(--dock-glass);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }
  body.mobile-sheet-active .mobile-mode-capsule .editor-mode-switch button {
    min-width: 56px;
    min-height: 36px;
    padding: 0 10px !important;
    border: 1px solid transparent !important;
    border-radius: 999px !important;
    color: var(--sheet-ink) !important;
    font-size: 13px !important;
    touch-action: manipulation;
  }
  body.mobile-sheet-active .mobile-mode-capsule .editor-mode-switch button[aria-pressed=true] {
    background: var(--tab-active) !important;
  }
}

@media (max-width: 800px) {
  html[data-site-theme=dark] body.mobile-sheet-active {
    --sheet-glass: rgba(18, 18, 18, .88);
    --dock-glass: rgba(25, 25, 25, .93);
    --sheet-edge: transparent;
    --tab-active: #3b3b3b;
    --sheet-ink: #f5f5f5;
    --settings-card: #202020;
    --settings-rule: #343434;
    --ui-text: #f5f5f5;
    --ui-secondary: #b5b5b5;
    --ui-tertiary: #949494;
    --ui-surface: #171717;
    --ui-raised: #292929;
    --ui-border: #343434;
    --ui-accent: #dedede;
  }
  html[data-site-theme=dark] body.mobile-sheet-active .preview-col {
    background: #080808 !important;
  }
  html[data-site-theme=dark] body.mobile-sheet-active #settingsDrawer {
    border: 0 !important;
    box-shadow: none;
  }
  html[data-site-theme=dark] body.mobile-sheet-active #settingsDrawer :is(
    .mobile-settings-group, .settings-order-group, .palette-row, #photoControls,
    #personalEventsEditor, .season-settings, .settings-order-details, .event-import
  ) {
    border: 0 !important;
  }
  html[data-site-theme=dark] body.mobile-sheet-active #settingsDrawer :is(
    .option, .segmented > button, .subtle, .photo-picker-trigger, .mobile-editor-more > summary,
    select, :where(input:not([type=range]):not([type=checkbox]):not([type=color])), textarea
  ) {
    color: var(--sheet-ink) !important;
    background: #2b2b2b !important;
    border-color: transparent !important;
    box-shadow: none !important;
  }
  html[data-site-theme=dark] body.mobile-sheet-active #settingsDrawer :is(
    .option, .segmented > button
  ):is(.selected, [aria-pressed=true]) {
    color: #fff !important;
    background: #4a4a4a !important;
  }
  html[data-site-theme=dark] body.mobile-sheet-active #settingsDrawer :is(
    .option, .segmented > button, .subtle, .photo-picker-trigger, .mobile-editor-more > summary,
    select, input, textarea
  ):focus-visible {
    outline: 2px solid #e2e2e2;
    outline-offset: 2px;
  }
  html[data-site-theme=dark] body.mobile-sheet-active #settingsDrawer .toggle-row input:checked + .switch {
    background: #d6d6d6 !important;
    border-color: transparent !important;
  }
  html[data-site-theme=dark] body.mobile-sheet-active #settingsDrawer .toggle-row input:checked + .switch::after {
    background: #191919;
  }
  html[data-site-theme=dark] body.mobile-sheet-active #settingsDrawer .calendar-fonts {
    border-color: var(--settings-rule) !important;
  }
  html[data-site-theme=dark] body.mobile-sheet-active #settingsDrawer input[type=range] {
    accent-color: #d6d6d6;
  }
  html[data-site-theme=dark] body.mobile-sheet-active .mobile-sheet-export[open] {
    border: 0;
    background: #171717;
  }
}

@media (max-width: 800px) {
  .mobile-sheet-active #settingsDrawer .share-details:not(:has(.share-panel)) { display: none; }
  .mobile-sheet-active .mobile-editor-menu .editor-support-area {
    margin: 14px 0 0;
    padding: 0;
  }

  html[data-site-theme=dark] body.mobile-sheet-active {
    --sheet-glass: rgba(18, 18, 18, .96);
    --ui-focus: #dedede;
    --site-border: #343434;
    --studio-border: #343434;
  }
  html[data-site-theme=dark] body.mobile-sheet-active .controls-scroll {
    scrollbar-color: #555 transparent;
    scrollbar-width: thin;
  }
  html[data-site-theme=dark] body.mobile-sheet-active #settingsDrawer :is(.swatch, .theme-option) {
    border: 0 !important;
    background: #292929 !important;
    color: var(--sheet-ink) !important;
    box-shadow: none !important;
  }
  html[data-site-theme=dark] body.mobile-sheet-active #settingsDrawer :is(.swatch, .theme-option).selected {
    background: #4a4a4a !important;
  }
  html[data-site-theme=dark] body.mobile-sheet-active .studio-settings-nav button:focus-visible,
  html[data-site-theme=dark] body.mobile-sheet-active #settingsDrawer :is(.swatch, .theme-option):focus-visible {
    outline: 2px solid var(--ui-focus) !important;
    outline-offset: -3px;
  }

  .mobile-sheet-active #phoneMockup.mobile-preview-light :is(.lock-screen-time, .lock-screen-date, .status-icons, .status-time) {
    color: #292929;
    text-shadow: none;
  }
  .mobile-sheet-active #phoneMockup.mobile-preview-light .status-icons svg { filter: none; }
  .mobile-sheet-active #phoneMockup.mobile-preview-light[data-clock-finish=glass] .lock-screen-time {
    color: rgb(28 28 28 / .74);
    -webkit-text-stroke: .12cqw #29292955;
  }
}
