/* Shared phone/tablet presentation. app-core owns all layout classes.
   Existing components, media and data remain mounted across layout changes.
   This replaces styles-tablet.css; desktop and authored HTML are not restyled. */
.mobile-play-actions, .mobile-creator-toggle, .library-touch-menu { display: none; }

html.is-mobile-layout, html body.is-mobile-layout {
  width: 100%; min-width: 0 !important; max-width: 100%; overflow-x: clip;
}
html body.is-mobile-layout {
  --tryva-sidebar-width: 220px;
  --mobile-gutter: clamp(16px, 3vw, 28px);
  --tryva-page-gutter: var(--mobile-gutter);
  --mobile-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  --mobile-top: max(12px, env(safe-area-inset-top, 0px));
  --mobile-composer-height: 116px;
  --mobile-composer-bottom: calc(var(--mobile-bottom) + 54px);
  --mobile-actions-width: 160px;
  --mobile-play-edge: max(16px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  --mobile-surface: #111018ed;
  --mobile-hairline: #ffffff1f;
  --tryva-card-collection-gap: 12px;
  --tryva-character-card-width: clamp(150px, 23vw, 218px);
  --tryva-card-w: var(--tryva-character-card-width);
  --tryva-card-hover-w: var(--tryva-character-card-width);
  -webkit-text-size-adjust: 100%;
}
html body.is-mobile-layout .hidden { display: none !important; }
html body.is-mobile-layout :is(button, input, textarea, select) { touch-action: manipulation; }
html body.is-mobile-layout :is(button, input:not([type=checkbox]):not([type=radio]):not([type=range]), select) {
  min-height: 44px;
}
html body.is-mobile-layout :is(input, textarea, select) { font-size: 16px; }
html body.is-mobile-layout :is(button, a, input, textarea, select):focus-visible {
  outline: 2px solid #d5b9ff; outline-offset: 3px;
}
html body.is-mobile-layout .app-shell {
  display: grid !important; grid-template-columns: 220px minmax(0, 1fr) !important;
  width: 100% !important; min-width: 0 !important; max-width: none !important;
  height: var(--tryva-app-height, 100dvh) !important; overflow: hidden;
}
html body.is-mobile-layout .workspace {
  width: 100% !important; min-width: 0 !important; max-width: none !important;
  height: 100% !important; overflow-x: hidden; overflow-y: auto;
}
html body.is-mobile-layout:not(.has-compact-navigation) .nav-shell {
  position: relative !important; inset: auto !important; width: 220px !important;
  min-width: 0 !important; height: 100% !important; transform: none !important;
  visibility: visible !important; pointer-events: auto !important;
}
html body.is-mobile-layout:not(.has-compact-navigation) :is(.mobile-nav-toggle, .mobile-nav-backdrop) { display: none !important; }
html body.has-compact-navigation .app-shell { display: block !important; }
html body.has-compact-navigation .nav-shell {
  display: flex !important; position: fixed !important; inset: 0 auto 0 0 !important;
  width: min(320px, 86vw) !important; min-width: 0 !important; max-width: 86vw !important;
  height: var(--tryva-app-height, 100dvh) !important; padding-top: var(--mobile-top);
  z-index: 1400 !important; overflow-y: auto; visibility: hidden;
  transform: translateX(-105%) !important; pointer-events: none !important;
}
html body.has-compact-navigation.mobile-nav-open .nav-shell {
  transform: none !important; visibility: visible !important; pointer-events: auto !important;
}
html body.has-compact-navigation .mobile-nav-toggle {
  display: grid !important; position: fixed; top: var(--mobile-top); left: 16px;
  width: 44px; height: 44px; z-index: 1402;
}
html body.has-compact-navigation .mobile-nav-backdrop {
  display: none !important; position: fixed; inset: 0; z-index: 1399;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
}
html body.has-compact-navigation.mobile-nav-open .mobile-nav-backdrop { display: block !important; }
html body.is-mobile-layout:not(.chat-active) .workspace > .view {
  min-width: 0 !important; max-width: 100% !important; box-sizing: border-box;
}
html body.has-compact-navigation:not(.chat-active) :is(.home-topbar, .explore-topbar, .library-header, .recent-page-head, .story-asset-create-head) {
  padding-top: calc(var(--mobile-top) + 52px) !important;
}

/* Play: the stage occupies the window, controls remain CSS-pixel sized. */
html body.is-mobile-layout.chat-active .app-shell { display: block !important; height: var(--mobile-stage-height, 100dvh) !important; }
html body.is-mobile-layout.chat-active :is(.nav-shell, .mobile-nav-toggle, .mobile-nav-backdrop, .fullscreen-header-reveal-zone) { display: none !important; }
html body.is-mobile-layout.chat-active .workspace { padding: 0 !important; overflow: hidden !important; }
html body.is-mobile-layout.chat-active #chatView {
  position: fixed !important; inset: var(--tryva-mobile-top, 0px) 0 auto !important;
  display: grid; grid-template-columns: minmax(0,1fr) 296px !important; gap: 0 !important;
  grid-template-rows: minmax(0, 1fr) !important;
  width: 100% !important; height: var(--mobile-stage-height, 100dvh) !important;
  min-height: 0 !important; max-height: none !important; padding: 0 !important; overflow: hidden !important;
}
html body.is-mobile-layout.has-compact-insight.chat-active #chatView { grid-template-columns: minmax(0,1fr) !important; }
html body.is-mobile-layout.chat-active #chatView .chat-panel {
  position: relative !important; display: block !important; min-width: 0 !important;
  width: 100% !important; height: 100% !important; min-height: 0 !important;
  padding: 0 !important; border: 0 !important; border-radius: 0 !important; overflow: hidden !important;
}
html body.is-mobile-layout.chat-active #chatView .chat-header {
  position: absolute !important; inset: 0 0 auto !important; z-index: 1010 !important;
  display: flex !important; align-items: center; gap: 8px; width: 100% !important;
  min-height: 64px !important; height: auto !important;
  padding: var(--mobile-top) max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left)) !important;
  opacity: 1 !important; transform: none !important; visibility: visible !important; pointer-events: auto !important;
  border: 0 !important; background: linear-gradient(#090910c9, #09091000) !important;
}
html body.is-mobile-layout.chat-active #chatView .chat-title-block { flex: 1; min-width: 0; }
html body.is-mobile-layout.chat-active #chatRoomTitle { font-size: clamp(15px, 2vw, 19px) !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html body.is-mobile-layout.chat-active #statusText { font-size: 11px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
html body.is-mobile-layout.chat-active #chatView .chat-header .controls { display: flex !important; flex-wrap: nowrap !important; gap: 6px; width: auto !important; }
html body.is-mobile-layout.chat-active #chatView .chat-header :is(button, .tool-button) { flex: 0 0 auto; min-width: 44px; min-height: 44px; padding: 8px 10px !important; font-size: 12px !important; }
/* Keep translated text as the accessible name; compact icons only on mobile. */
html body.is-mobile-layout.chat-active #chatView .chat-header :is(#fullscreenBtn, #mobileInsightBtn) {
  position: relative; width: 44px !important; height: 44px !important;
  font-size: 0 !important; color: #fff !important;
  border: 0 !important; border-radius: 12px !important;
  background: transparent !important; box-shadow: none !important;
}
html body.is-mobile-layout.chat-active #chatView .chat-header :is(#fullscreenBtn, #mobileInsightBtn) span { font-size: 0 !important; }
html body.is-mobile-layout.chat-active #chatView .chat-header :is(#fullscreenBtn, #mobileInsightBtn)::before {
  content: ""; position: absolute; inset: 11px; background: currentColor;
  mask: var(--mobile-control-icon) center / contain no-repeat;
  -webkit-mask: var(--mobile-control-icon) center / contain no-repeat;
}
html body.is-mobile-layout #fullscreenBtn {
  --mobile-control-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3H3v5m13-5h5v5M3 16v5h5m13-5v5h-5'/%3E%3C/svg%3E");
}
html body.is-mobile-layout #fullscreenBtn[aria-pressed=true] {
  --mobile-control-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8h5V3m8 0v5h5M8 21v-5H3m18 0h-5v5'/%3E%3C/svg%3E");
}
html body.is-mobile-layout #mobileInsightBtn {
  --mobile-control-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M5 6h14M5 12h14M5 18h14'/%3E%3C/svg%3E");
}
html body.is-mobile-layout.chat-active #chatView .chat-header #newRoomBtn {
  font-size: 30px !important; line-height: 1; background: transparent !important;
  border: 0 !important; box-shadow: none !important;
}
html body.is-mobile-portrait.chat-active #chatView #fullscreenBtn,
html body.is-mobile-layout.chat-active #chatView :is(#fullscreenBtn, #autoBtn)[hidden] { display: none !important; }
html body.is-mobile-landscape.chat-active #chatView #fullscreenBtn:not([hidden]) { display: inline-flex !important; }
html body.is-mobile-layout.chat-active #chatView .chat-title-row { min-width: 0; }
html body.is-mobile-layout.chat-active #chatRoomTitle { min-width: 0; margin: 0 !important; }
html body.is-mobile-layout.chat-active #chatView .vn-stage-shell {
  position: absolute !important; inset: 0 0 auto !important; width: 100% !important;
  height: var(--mobile-stage-height, 100%) !important; min-height: 0 !important; z-index: 0 !important;
}
html body.is-mobile-layout.chat-active #vnStageRuntimeCanvas {
  position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important;
  transform: none !important; min-height: 0 !important;
}
html body.is-mobile-layout.chat-active #vnStage {
  height: 100% !important; min-height: 0 !important; width: 100% !important;
  overflow: hidden !important; border-radius: 0 !important; background-position: center !important; background-size: cover !important;
}
html body.is-mobile-layout.chat-active #vnStage .vn-presentation-layer {
  position: absolute; display: flex !important; flex-direction: column; justify-content: flex-end;
  left: var(--mobile-play-edge); right: var(--mobile-play-edge);
  bottom: calc(var(--mobile-composer-height) + var(--mobile-bottom) + 66px);
  max-height: calc(var(--mobile-stage-height, 100dvh) - var(--mobile-composer-height) - 170px);
  z-index: 100; pointer-events: none;
}
html body.is-mobile-layout.chat-active #vnStage :is(.vn-dialogue-box, .vn-scene-card) {
  position: relative !important; inset: auto !important; transform: none !important;
  width: min(100%, 760px) !important; max-width: 100% !important; min-width: 0 !important;
  min-height: 0 !important; max-height: 100% !important; margin: 0 auto !important;
  padding: 18px 20px 24px !important; border: 1px solid #ffffff1a !important;
  border-radius: 18px !important; background: #0d0d16dc !important;
  box-shadow: 0 12px 48px #0004 !important; pointer-events: auto;
  overflow-y: auto !important; overscroll-behavior: contain; touch-action: pan-y;
}
html body.is-mobile-layout.chat-active #vnStage .vn-dialogue-name {
  position: static !important; display: block; width: auto !important; min-width: 0 !important;
  padding: 0 !important; margin-bottom: 10px; background: none !important;
  border: none !important; box-shadow: none !important; font-size: 16px !important; color: #d5b9ff;
}
html body.is-mobile-layout.chat-active #vnStage .vn-presentation-text {
  font-size: clamp(17px, 2vw, 21px) !important; line-height: 1.65 !important;
  color: #fff !important; overflow-wrap: anywhere; text-shadow: 0 2px 6px #0008;
  max-height: none !important;
}
html body.is-mobile-layout.chat-active #vnStage .vn-advance-indicator { position: static !important; display: block; text-align: right; font-size: 12px !important; margin-top: 8px; }
html body.is-mobile-portrait.chat-active #vnStage .vn-presentation-layer::before {
  content: ""; position: absolute; inset: -110px -28px -100px; z-index: -1;
  background: linear-gradient(transparent, #07070bc9 38%, #07070be6); pointer-events: none;
}
html body.is-mobile-portrait.chat-active #vnStage :is(.vn-dialogue-box, .vn-scene-card) {
  padding: 16px 12px 8px !important; border: 0 !important; border-radius: 0 !important;
  background: transparent !important; box-shadow: none !important; backdrop-filter: none !important;
}
html body.is-mobile-portrait.chat-active #vnStage .vn-character {
  width: 100% !important; max-width: none !important;
  height: 120% !important; top: -16% !important; bottom: auto !important;
}
html body.is-mobile-layout.chat-active #vnStage .vn-standing { max-width: none !important; max-height: none !important; }
html body.is-mobile-layout.chat-active #userForm {
  position: absolute !important; inset: auto var(--mobile-play-edge) var(--mobile-composer-bottom) var(--mobile-play-edge) !important;
  display: grid !important; grid-template-columns: 44px minmax(0,1fr) 44px !important;
  gap: 8px !important; width: auto !important; min-width: 0 !important; max-width: 760px !important;
  margin: 0 auto !important; padding: 12px !important; height: auto !important;
  min-height: 0 !important; border: 1px solid var(--mobile-hairline) !important; border-radius: 18px !important;
  z-index: 1011 !important; background: var(--mobile-surface) !important; box-shadow: 0 8px 28px #0003;
}
html body.is-mobile-layout.chat-active #userInput {
  grid-column: 1 / -1; grid-row: 1; width: 100% !important; min-width: 0 !important;
  max-height: min(140px, 22dvh) !important; padding: 6px 4px !important;
  border: 0 !important; font-size: 16px !important; background: transparent !important;
}
html body.is-mobile-layout.chat-active #userForm #starInsertBtn { grid-column: 1; grid-row: 2; }
html body.is-mobile-layout.chat-active #userForm #contactBtn { grid-column: 2; grid-row: 2; justify-self: start; }
html body.is-mobile-layout.chat-active #userForm button[type=submit] { grid-column: 3; grid-row: 2; }
html body.is-mobile-layout.chat-active #userForm > button { position: static !important; width: auto !important; min-width: 44px; height: 44px !important; min-height: 44px !important; margin: 0 !important; border-radius: 12px !important; }
html body.is-mobile-layout.chat-active #userForm :is(#starInsertBtn, #contactBtn) {
  background: transparent !important; border-color: transparent !important; box-shadow: none !important;
}
html body.is-mobile-layout.chat-active #userInput { box-shadow: none !important; resize: none; line-height: 1.5; }
html body.is-mobile-layout.chat-active #userInput::placeholder { color: #a5a0af; opacity: 1; }
html body.is-mobile-layout.chat-active .mobile-play-actions {
  position: absolute; inset: auto var(--mobile-play-edge) var(--mobile-bottom) var(--mobile-play-edge);
  display: flex; justify-content: space-between; gap: 12px; max-width: 760px; margin: auto; z-index: 1011;
}
html body.is-mobile-layout.chat-active .mobile-play-actions button {
  min-height: 44px; padding: 10px 16px; border-radius: 24px; color: #f2edf9;
  border: 1px solid var(--mobile-hairline); background: var(--mobile-surface); font-size: 14px;
  box-shadow: none; white-space: nowrap;
}
html body.is-mobile-layout.chat-active .mobile-play-actions button:last-child { background: #292132ed; border-color: #c5a3ee33; }
html body.is-mobile-layout.chat-active #storyPresentationRuntime { z-index: 1100 !important; background: #090910c9; height: var(--mobile-stage-height, 100dvh) !important; }
html body.is-mobile-layout.chat-active #chatView.has-authored-presentation .vn-stage-shell { z-index: 1020 !important; }
html body.is-mobile-layout.chat-active #storyPresentationRuntimeFrame {
  position: absolute; left: 50%; top: 50%; width: 1667px !important; height: 900px !important;
  max-width: none !important; max-height: none !important; transform-origin: center;
  transform: translate(-50%, -50%) scale(var(--tryva-stage-logical-scale, 1));
}
html body.is-mobile-layout.chat-active .story-presentation-runtime-actions { position: absolute; bottom: var(--mobile-bottom); left: 16px; right: 16px; z-index: 2; }
html body.is-mobile-layout.chat-active .story-presentation-runtime-actions button { min-height: 44px; font-size: 16px; }

/* One insight panel: sidebar when it fits, modal drawer otherwise. */
html body.is-mobile-layout.chat-active #chatInsightPanel {
  min-width: 0 !important; height: 100% !important; max-height: none !important;
  overflow: hidden !important; border-radius: 0 !important;
}
html body.is-mobile-layout.chat-active #chatInsightPanel > :is(.insight-tabs, .insight-subtabs, .mobile-insight-close) { flex: 0 0 auto !important; }
html body.is-mobile-layout.chat-active #chatInsightPanel > .insight-pane {
  flex: 1 1 0 !important; min-height: 0 !important; overflow-y: auto !important;
}
html body.is-mobile-layout.chat-active #chatInsightPanel > #chatLogPanel {
  grid-template-rows: minmax(0, 1fr) !important; overflow: hidden !important;
}
html body.is-mobile-layout.chat-active #chatLogPanel > #messages {
  display: flex !important; flex-direction: column; min-height: 0 !important;
  height: 100% !important; max-height: none !important; box-sizing: border-box;
  overflow-x: hidden !important; overflow-y: auto !important; overscroll-behavior-y: contain;
}
html body.is-mobile-layout:not(.has-compact-insight).chat-active #chatInsightPanel {
  position: relative !important; inset: auto !important; display: flex !important;
  width: 296px !important; transform: none !important; visibility: visible !important;
}
html body.is-mobile-layout:not(.has-compact-insight) :is(#mobileInsightBtn, #mobileInsightCloseBtn, #mobileInsightBackdrop) { display: none !important; }
html body.has-compact-insight.chat-active #chatInsightPanel {
  position: fixed !important; inset: var(--tryva-mobile-top, 0px) 0 auto auto !important;
  display: flex !important; width: min(420px, 92vw) !important; max-width: 92vw !important;
  height: var(--mobile-stage-height, 100dvh) !important; z-index: 1501 !important;
  padding-top: var(--mobile-top); padding-bottom: var(--mobile-bottom);
  transform: translateX(105%) !important; visibility: hidden; pointer-events: none;
  background: #111019 !important; box-shadow: -20px 0 70px #0007;
}
html body.has-compact-insight.mobile-insight-open.chat-active #chatInsightPanel {
  transform: none !important; visibility: visible !important; pointer-events: auto !important;
}
html body.has-compact-insight.chat-active #mobileInsightBtn { display: inline-flex !important; }
html body.has-compact-insight.chat-active #mobileInsightCloseBtn { display: grid !important; align-self: flex-end; min-width: 44px; min-height: 44px; }
html body.has-compact-insight.chat-active #mobileInsightBackdrop { display: none !important; position: fixed; inset: 0; z-index: 1500; background: #0008; }
html body.has-compact-insight.mobile-insight-open.chat-active #mobileInsightBackdrop { display: block !important; }

/* Short landscape windows keep the PC-style horizontal stage and compact input. */
html body.is-mobile-landscape { --mobile-composer-bottom: var(--mobile-bottom); }
html body.is-mobile-landscape.chat-active #userForm { grid-template-columns: 44px minmax(0,1fr) 44px 44px !important; padding: 8px !important; left: calc(var(--mobile-play-edge) + var(--mobile-actions-width) + 12px) !important; }
html body.is-mobile-landscape.chat-active #userInput { grid-column: 2; grid-row: 1; }
html body.is-mobile-landscape.chat-active #userForm #starInsertBtn { grid-column: 1; grid-row: 1; }
html body.is-mobile-landscape.chat-active #userForm #contactBtn { grid-column: 3; grid-row: 1; }
html body.is-mobile-landscape.chat-active #userForm button[type=submit] { grid-column: 4; grid-row: 1; }
html body.is-mobile-landscape.chat-active .mobile-play-actions { right: auto; gap: 6px; max-width: 30%; }
html body.is-mobile-landscape.chat-active .mobile-play-actions button { min-width: 44px; padding-inline: 10px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
/* Don't reserve an empty contact column when no separated character exists. */
html body.is-mobile-landscape.chat-active #userForm:has(#contactBtn.hidden) { grid-template-columns: 44px minmax(0,1fr) 44px !important; }
html body.is-mobile-landscape.chat-active #userForm:has(#contactBtn.hidden) button[type=submit] { grid-column: 3; }
html body.is-mobile-landscape.chat-active #vnStage .vn-presentation-layer { bottom: calc(var(--mobile-composer-height) + var(--mobile-bottom) + 12px); max-height: calc(var(--mobile-stage-height, 100dvh) - var(--mobile-composer-height) - 100px); }
html body.is-mobile-landscape.chat-active #vnStage .vn-presentation-text { font-size: 17px !important; line-height: 1.5 !important; }
/* Keyboard overlays the unchanged play screen. Only the existing textarea
   leaves its grid cell; keep its value, focus, selection and IME composition. */
html body.is-mobile-layout.mobile-composer-overlay.chat-active #userForm {
  height: var(--mobile-composer-height) !important; box-sizing: border-box;
  grid-template-rows: minmax(0, 1fr) 44px !important;
  overflow: visible !important;
}
html body.is-mobile-landscape.mobile-composer-overlay.chat-active #userForm { grid-template-rows: minmax(0, 1fr) !important; }
html body.is-mobile-layout.mobile-composer-overlay.chat-active #userForm #userInput {
  position: absolute !important; top: auto !important; left: 0 !important; right: 0 !important;
  bottom: calc(var(--mobile-stage-occlusion, 0px) - var(--mobile-composer-bottom) + 8px) !important;
  width: 100% !important; height: 44px !important; min-height: 44px !important; max-height: 44px !important;
  box-sizing: border-box; margin: 0 !important; padding: 10px 12px !important;
  border: 1px solid var(--mobile-hairline) !important; border-radius: 12px !important;
  background: var(--mobile-surface) !important; color: #fff !important;
  line-height: 22px !important; overflow-y: auto !important; overscroll-behavior: contain;
  transform: none !important; transition: none !important; z-index: 2;
}

/* Shared collection, detail and editor geometry; authored content is untouched. */
html body.is-mobile-layout :is(#allCharacterGrid, #exploreStoryGrid, #libraryGrid, #creatorProfileCharacterGrid).tryva-card-collection {
  display: grid !important; grid-template-columns: repeat(auto-fill, minmax(min(100%, 174px), 1fr)) !important; gap: 12px !important;
}
html body.is-mobile-layout :is(#allCharacterGrid, #exploreStoryGrid, #libraryGrid, #creatorProfileCharacterGrid).tryva-card-collection > :is(.tryva-card, .catalog-card, .library-folder-tile) { width: 100% !important; min-width: 0 !important; max-width: none !important; }
html body.is-mobile-layout .tryva-card-corner-actions > button { min-width: 44px !important; min-height: 44px !important; }
html body.is-mobile-layout :is(.tryva-unified-detail-dialog, .account-modal, .site-dialog) { max-width: calc(100vw - 24px) !important; max-height: calc(var(--tryva-app-height, 100dvh) - 24px) !important; overflow-y: auto; }
html body.is-mobile-portrait .tryva-detail-hero { grid-template-columns: minmax(0,1fr) !important; }
html body.is-mobile-portrait .tryva-detail-media { min-height: 260px !important; max-height: 45dvh; }
html body.is-mobile-layout :is(#createView, #storyAssetCreateView) { height: auto !important; min-height: 100%; overflow: visible !important; }
html body.is-mobile-layout :is(#createView, #storyAssetCreateView) .story-asset-create-main {
  display: grid !important; grid-template-columns: 160px minmax(0,1fr) 258px !important;
  height: auto !important; min-height: 0 !important; overflow: visible !important;
}
html body.is-mobile-layout :is(#createView, #storyAssetCreateView) .story-asset-create-form { min-width: 0; overflow: visible !important; padding: 24px var(--mobile-gutter) 100px !important; }
html body.is-mobile-layout :is(#createView, #storyAssetCreateView) .story-asset-create-actions { position: sticky !important; bottom: 0; z-index: 20; padding-bottom: var(--mobile-bottom); background: #121019f5; }
html body.is-mobile-layout .library-touch-menu { display: grid; position: absolute; top: 8px; right: 8px; z-index: 40; min-width: 44px; min-height: 44px; border-radius: 12px; background: #171320e8; color: white; border: 1px solid #ffffff2b; }
html body.is-mobile-layout .library-context-menu { max-width: calc(100vw - 24px); z-index: 1600; }
html body.is-mobile-layout .library-context-menu button { min-height: 44px; }
.library-move-dialog { color: #f1ebfa; background: #15121e; border: 1px solid #ffffff26; border-radius: 20px; padding: 20px; width: min(440px, calc(100vw - 32px)); max-height: 80dvh; }
.library-move-dialog::backdrop { background: #0009; }
.library-move-dialog form { display: grid; gap: 16px; }
.library-move-dialog select { width: 100%; min-height: 44px; }
.library-move-dialog footer { display: flex; justify-content: flex-end; gap: 12px; }
.library-move-dialog button { min-height: 44px; }

@media (max-width: 1199px) {
  html body.is-mobile-layout :is(#createView, #storyAssetCreateView) .story-asset-create-main { grid-template-columns: minmax(0,1fr) !important; }
  html body.is-mobile-layout .story-asset-create-steps { position: static !important; width: 100% !important; max-height: none !important; overflow: auto !important; }
  html body.is-mobile-layout :is(.story-asset-create-step-list, #storyAssetStepList) { display: flex !important; gap: 8px; overflow-x: auto; padding: 12px 16px; }
  html body.is-mobile-layout :is(.story-asset-create-step-list, #storyAssetStepList) > button { flex: 0 0 auto; width: auto !important; min-width: 96px; }
  html body.is-mobile-layout .story-asset-create-steps small { display: none; }
  html body.is-mobile-layout .story-asset-create-preview { display: none !important; }
  html body.is-mobile-layout .creator-progress-open .story-asset-create-preview { display: block !important; grid-row: 2; width: 100%; max-height: 50dvh; overflow-y: auto; padding: 16px; }
  html body.is-mobile-layout .mobile-creator-toggle { display: inline-flex; align-items: center; min-height: 44px; margin-top: 12px; }
}
@media (max-width: 599px) {
  html body.is-mobile-layout :is(#allCharacterGrid, #exploreStoryGrid, #libraryGrid, #creatorProfileCharacterGrid).tryva-card-collection { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
  html body.is-mobile-layout :is(.story-field-grid.two, .cw-two-column-settings, .cw-field-row, .character-world-position-grid) { grid-template-columns: minmax(0,1fr) !important; }
  html body.is-mobile-layout .story-asset-create-head { padding-inline: 16px !important; }
  html body.is-mobile-layout.chat-active #fullscreenBtn { max-width: 70px; }
}
@media (prefers-reduced-motion: reduce) {
  html body.is-mobile-layout :is(.nav-shell, #chatInsightPanel) { transition: none !important; }
}
