/* Arwval mobile layout layer. Desktop presentation remains owned by styles.css. */
@media (max-width:700px){
  html,body{width:100%;max-width:100%;overflow-x:clip!important}body{min-width:0!important}
  img,svg,video,canvas{max-width:100%}input,textarea,select,button{max-width:100%;min-width:0}
  .container{width:100%;max-width:none;padding:.65rem!important;margin:0!important}.section-body{min-width:0}
  .appbar{position:sticky!important;top:0!important;z-index:1300!important;width:100%;max-width:100%;display:flex!important;align-items:center!important;gap:.3rem!important;padding:calc(env(safe-area-inset-top,0px) + .38rem) .5rem .38rem!important;height:auto!important;min-height:48px!important;overflow:visible!important}
  .mobile-nav-toggle{display:grid!important;place-items:center;width:34px!important;min-width:34px!important;height:32px!important;min-height:32px!important;padding:0!important;font-size:1rem!important}
  .appbar>.nav-main{display:flex!important;flex:0 1 auto!important;min-width:0!important;width:auto!important}.appbar>.nav-main>.nav-link,.appbar>.nav-right>.nav-link{display:none!important}
  .appbar .theme-menu-wrap{display:inline-flex!important;min-width:0!important}.appbar #themeButton{width:58px!important;min-width:58px!important;height:32px!important;padding:0 .35rem!important;font-size:0!important;justify-content:center!important}.appbar #themeButton::after{content:'THEME';font-size:.62rem;letter-spacing:.04em}
  .appbar>.nav-utils{display:flex!important;flex:0 0 auto!important;margin-left:auto!important;gap:.2rem!important}.appbar>.nav-right{display:flex!important;flex:0 0 auto!important;min-width:0!important}.appbar .connection-status{font-size:.62rem!important;max-width:4.4rem;overflow:hidden;text-overflow:ellipsis}
  .mobile-nav-menu{position:absolute!important;top:calc(100% + .2rem)!important;left:.5rem!important;right:.5rem!important;width:auto!important;max-height:calc(100dvh - 4.5rem);overflow-y:auto}
  .theme-menu{position:fixed!important;top:calc(env(safe-area-inset-top,0px) + 3.4rem)!important;left:.5rem!important;right:.5rem!important;width:auto!important;max-width:none!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;z-index:1100!important}.theme-menu button{font-size:.66rem!important;min-height:35px!important;white-space:normal!important}
  .dice-tray-panel{position:fixed!important;top:calc(env(safe-area-inset-top,0px) + 3.4rem)!important;left:.5rem!important;right:.5rem!important;width:auto!important;max-width:none!important;transform:none!important;z-index:1100!important}.dice-tray-panel .dice-row{display:grid!important;grid-template-columns:repeat(4,1fr)!important;justify-items:center!important}
  .stage-volume-panel.open{position:fixed!important;top:calc(env(safe-area-inset-top,0px) + 48px)!important;left:0!important;right:0!important;width:100%!important;max-width:none!important;min-height:44px!important;padding:.55rem .8rem!important;display:grid!important;grid-template-columns:auto minmax(0,1fr)!important;align-items:center!important;gap:.8rem!important;transform:none!important;border-left:0!important;border-right:0!important;border-radius:0!important;z-index:1400!important}.stage-volume-panel.open label{margin:0!important;white-space:nowrap!important;writing-mode:horizontal-tb!important;transform:none!important}.stage-volume-panel.open .stage-volume-slider-wrap{display:block!important;position:static!important;width:100%!important;height:1.2rem!important;min-width:0!important;overflow:visible!important}.appbar .stage-volume-panel.open .stage-volume-slider-wrap #stageVolumeSlider,.appbar .stage-volume-panel.open .stage-volume-slider-wrap #greenRoomVolumeSlider,.appbar .stage-volume-panel.open .stage-volume-slider-wrap #backstageVolumeSlider,.appbar .stage-volume-panel.open .stage-volume-slider-wrap #scriptVolumeSlider{display:block!important;width:100%!important;min-width:0!important;max-width:none!important;height:1.2rem!important;min-height:1.2rem!important;margin:0!important;padding:0!important;transform:none!important;writing-mode:horizontal-tb!important;direction:ltr!important;appearance:auto!important;-webkit-appearance:slider-horizontal!important}
  .stage-grid{display:grid!important;grid-template-columns:1fr!important;min-height:0!important}.stage-grid>.stage-pane{width:100%;min-width:0;padding:.55rem!important;border-left:0!important;border-top:1px solid var(--line)}.stage-grid>.stage-pane:first-child{border-top:0!important}
  .deck-card{height:190px!important;min-height:190px!important}.prop-stage-grid{display:grid!important;grid-template-columns:1fr!important;gap:.4rem!important}.prop-card{min-height:0!important;display:grid!important;grid-template-columns:auto minmax(0,1fr)!important;justify-items:start!important;text-align:left!important;column-gap:.7rem!important;padding:.65rem!important}.prop-card .icon,.prop-card .image-icon{grid-row:1 / span 3;font-size:1.7rem!important;width:2rem!important;height:2rem!important;align-self:center}.prop-card h3,.prop-card p{margin:.08rem 0!important;min-width:0;overflow-wrap:anywhere}
  .stage-grid>.stage-pane:nth-child(3),.stage-grid>.stage-pane:nth-child(3)>.section-body,#conditions{height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important;background:transparent!important}.condition{padding:.5rem 0!important}.location-bar{padding:.65rem!important;align-items:flex-start!important}.cast-grid{grid-template-columns:1fr!important}.cast-card{border-right:0!important;padding:.7rem!important}.score-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}.broadcast-message{width:calc(100vw - 1.3rem)!important;max-width:none!important}
  .backstage-grid{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:.65rem!important}.backstage-grid,.backstage-grid>* ,.backstage-grid .stack,.backstage-grid .panel{width:100%!important;max-width:100%!important;min-width:0!important}.stack{gap:.65rem!important}.broadcast-controls{grid-template-columns:auto minmax(0,1fr)!important;width:100%!important}.broadcast-controls>.broadcast-actions{grid-column:1 / -1;justify-content:flex-end!important;white-space:normal!important}
  .script-launch-panel .section-body>.toolbar{grid-template-columns:1fr 1fr!important;gap:.35rem!important}.script-launch-panel .script-launch{grid-column:1 / -1!important}.script-launch-panel .libraries-button,.script-launch-panel .game-open-button{width:100%!important}.props-head{align-items:flex-start!important;flex-direction:column!important}
  .props-head>.toolbar{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;width:100%!important}.props-head>.toolbar>*{width:100%!important;min-height:34px!important;padding:.35rem!important;font-size:.61rem!important;white-space:normal!important}
  .toolbar{min-width:0}.toolbar>input,.toolbar>select{flex:1 1 11rem}.prop-row,.deck-row,.saved-deck-row,.music-track-row{min-width:0!important}.cast-control-head{align-items:flex-start!important;flex-direction:column!important}.cast-search-result-row{grid-template-columns:1fr!important}.cast-search-result-row .toolbar{justify-content:flex-start!important}.score-mini{grid-template-columns:repeat(2,minmax(0,1fr))!important}.game-group-list{grid-template-columns:1fr!important}
  .modal-backdrop{padding:calc(env(safe-area-inset-top,0px) + .5rem) .5rem max(.5rem,env(safe-area-inset-bottom,0px))!important}.modal,.fixed-library-modal{width:100%!important;max-width:100%!important;max-height:calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 1rem)!important}.fixed-library-modal,.fixed-library-dialog{height:min(520px,calc(100dvh - 1rem))!important}dialog.cm-dialog,.fixed-library-dialog{width:calc(100vw - 1rem)!important;max-width:calc(100vw - 1rem)!important}.form-grid{grid-template-columns:1fr!important}.form-grid .full{grid-column:auto!important}
  .guide-view-controls,.greenroom-identity-row{display:flex!important;flex-wrap:wrap!important;align-items:flex-start!important;gap:.55rem!important}.guide-view-controls select,#playerCharacterIdentity{width:100%!important;max-width:100%!important}.greenroom-identity-row #logoutGreenRoom{margin-left:0!important}
  .character-map-panel{padding:.55rem!important;width:100%!important;overflow:hidden!important}.cm-workspace{display:grid!important;grid-template-columns:1fr!important;gap:.65rem!important}.cm-character-panel,.cm-journal-panel{width:100%!important;min-width:0!important;min-height:0!important}.cm-character-tabs{grid-template-columns:repeat(2,minmax(0,1fr))!important}.cm-tab-content,.cm-information-content,.cm-stats-content,.cm-carrying-content,.cm-wellbeing-content{grid-template-columns:1fr!important;width:100%!important;min-width:0!important}.cm-info-wide,.cm-carrying-content .cm-dropped-inline{grid-column:auto!important}
  .cm-top-first-row>.cm-top-character-fields,.cm-top-character-fields,.cm-description-fields-with-links,.cm-description-fields-six,.cm-traits-fields{grid-template-columns:1fr!important;grid-template-rows:auto!important}.cm-information-content .cm-description-restored,.cm-information-content .cm-traits-restored{height:auto!important;min-height:0!important}.cm-traits-restored .cm-description-fields{height:auto!important;grid-template-rows:auto!important}.cm-score-list{grid-template-columns:repeat(2,minmax(0,1fr))!important;padding:.45rem!important}.cm-score-line{min-height:112px!important}.cm-item-list,.cm-manager-list,.cm-dropped-list{max-width:100%!important;overflow-x:hidden!important}.cm-item-actions,.cm-inventory-actions{max-width:100%!important;overflow-x:visible!important;flex-wrap:wrap!important}.cm-dialog .section-body{overflow-y:auto}
  .script-page{padding:.65rem!important}.script-titlebar{display:flex!important;align-items:stretch!important;flex-direction:column!important;gap:.55rem!important;margin-bottom:.65rem!important}.script-titlebar .button-link{text-align:center}.script-layout{display:grid!important;grid-template-columns:1fr!important;gap:.65rem!important;min-height:0!important}.node-manager,.story-web-panel{width:100%!important;min-width:0!important}.node-tools{grid-template-columns:1fr!important}.story-controls-head{align-items:stretch!important;flex-direction:column!important}.story-control,.story-filter{width:100%!important;min-width:0!important}.story-filter{display:grid!important;grid-template-columns:1fr auto!important}.story-filter .control-label{grid-column:1 / -1}.graph-wrap{width:100%!important;height:60vh!important;min-height:360px!important}.graph-help{left:.45rem!important;right:.45rem!important;transform:none!important;text-align:center}.join-panel{width:100%!important;max-width:none!important;margin:.5rem 0!important}
  .library-theme-toggle{display:none!important}.library-mobile-theme-option{display:block!important}.account{padding:4.5rem 1rem 2rem!important}.account.visible{grid-template-columns:1fr!important;gap:2rem!important}.column{gap:2rem!important}.profile-panel,.diary-panel{height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important}.diary-panel .split,.characters-panel .split,.split{grid-template-columns:1fr!important;gap:1rem!important}.diary-panel .split>div:last-child,.character-manager-column{border-left:0!important;border-right:0!important;border-top:1px solid #eee;padding:1rem 0 0!important}body.library-dark .diary-panel .split>div:last-child,body.library-dark .character-manager-column{border-color:#444!important}.plain-list#dates,.plain-list#characters,.diary{height:9rem!important;min-height:9rem!important;max-height:9rem!important}
  .library-modal{align-items:start!important;padding:calc(env(safe-area-inset-top,0px) + .5rem) .5rem max(.5rem,env(safe-area-inset-bottom,0px))!important}.library-modal>.library-modal-box,.library-modal>.character-editor-box{width:100%!important;max-width:100%!important;max-height:calc(100dvh - 1rem)!important;padding-left:.45rem!important;padding-right:.45rem!important}.tools-tabs,.character-editor-tabs{overflow-x:auto!important;flex-wrap:nowrap!important;scrollbar-width:thin}.tools-tabs button,.character-editor-tabs button{flex:0 0 auto!important;white-space:nowrap!important}.admin-account,.tools-row,.library-section-row{min-width:0!important}
  .tools-inline{display:grid!important;grid-template-columns:1fr!important;align-items:stretch!important}.tools-inline label,.group-search{width:100%!important;min-width:0!important}.mechanics-value{grid-template-columns:1fr!important;gap:.45rem!important}.mechanics-value input{width:100%!important}.edit-game-groups{grid-template-columns:1fr!important}.tools-calendar{width:100%;grid-template-columns:repeat(7,minmax(0,1fr))!important}.tools-day{min-width:0!important;min-height:2.6rem!important;font-size:.65rem!important;overflow:hidden}.tools-game-link{font-size:.58rem!important;overflow:hidden;text-overflow:ellipsis}
  .ce-manager-grid,.ce-create,.ce-details-points,.ce-description,.ce-traits,.ce-carrying{grid-template-columns:1fr!important}.ce-create button,.ce-wide{grid-column:auto!important}.ce-score-grid,.ce-dice-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}.ce-ability-row{grid-template-columns:minmax(0,1fr) auto!important}.ce-ability-row .ce-dice{grid-column:1 / -1}.ce-training-form-row,.ce-training-edit{grid-template-columns:1fr!important}.ce-training-form-row>*,.ce-training-edit>*{grid-column:auto!important}.ce-row{align-items:flex-start!important;flex-wrap:wrap!important}.ce-actions{flex-wrap:wrap!important}.ce-actions .ce-creation-guide{flex-basis:100%!important}.basic-score-grid{grid-template-columns:1fr 1fr!important;gap:.65rem!important}.basic-score-controls{grid-column:1 / -1!important;display:flex!important;justify-content:center!important}.basic-score-actions{display:grid!important;grid-template-columns:1fr!important}.retire-character-field{margin-left:0!important}
  .library-book-page{padding:4.5rem .65rem 1rem!important}.library-book-top{gap:.7rem!important}.library-book-window{width:100%!important;height:calc(100dvh - 7rem)!important;min-height:0!important;margin-top:.7rem!important}.library-book-row{grid-template-columns:1.8rem minmax(0,1fr) 1.8rem!important}.book-arrow{width:1.8rem!important;min-width:1.8rem!important}.library-book-tabs{min-width:0!important}.library-book-tabs button{padding:.55rem .45rem!important;font-size:.78rem!important}.library-book-paper{padding:1rem .65rem!important}.library-book-save{margin:-1.6rem 0 0 .65rem!important}.library-lore-controls{right:.5rem!important;top:.45rem!important}.library-blog-image{max-width:min(400px,calc(100vw - 2.5rem))!important}.library-book-dialog{width:calc(100vw - 1rem)!important;max-width:calc(100vw - 1rem)!important;max-height:calc(100dvh - 1rem)!important}.lore-visibility-grid,.library-image-grid{grid-template-columns:1fr!important}
  .ce-mobile-tabs-toggle,.tools-mobile-tabs-toggle{display:block!important;border:0!important;background:transparent!important;font-size:1.15rem!important;padding:.3rem .45rem!important;cursor:pointer}.character-editor-tabs,.tools-tabs{display:none!important;position:absolute!important;z-index:20!important;right:.5rem!important;top:3.25rem!important;width:min(13rem,70vw)!important;margin:0!important;padding:.35rem!important;border:1px solid #ddd!important;background:#fff!important;box-shadow:0 .45rem 1.2rem #0002!important;flex-direction:column!important}.character-editor-tabs.mobile-open,.tools-tabs.mobile-open{display:flex!important}.character-editor-tabs button,.tools-tabs button{width:100%!important;text-align:left!important;white-space:nowrap!important}.character-editor-head,.tools-head{position:relative!important}.tools-head>div{display:flex!important;align-items:center!important;gap:.35rem!important}body.library-dark .character-editor-tabs,body.library-dark .tools-tabs{background:#202020!important;border-color:#555!important}
  .ce-actions{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;align-items:center!important}.ce-actions .ce-creation-guide{grid-column:1 / -1!important;grid-row:1!important;margin:.35rem 0!important}.ce-actions [data-ce-save],.ce-actions [data-ce-close]{font-size:.76rem!important;white-space:nowrap!important;padding:.5rem .35rem!important}.ce-actions .ce-saved{grid-column:1 / -1!important}
  .library-mobile-theme-option{border-top:1px solid #ddd!important;margin-top:.25rem!important;padding-top:.7rem!important}body.library-dark .library-mobile-theme-option{border-top-color:#444!important}
  .cm-mobile-view-toggle{display:grid!important;grid-template-columns:1fr 1fr!important;margin-bottom:.55rem!important}.cm-mobile-view-toggle button{border:1px solid var(--border,#aaa)!important;background:var(--panel,#fff)!important}.cm-mobile-view-toggle button.active{font-weight:700!important}.cm-workspace[data-mobile-view="map"] .cm-journal-stack{display:none!important}.cm-workspace[data-mobile-view="journal"] .cm-character-panel{display:none!important}
  .cm-workspace[data-mobile-view="journal"] .cm-journal-panel{min-height:62vh!important}.cm-workspace[data-mobile-view="journal"] .cm-journal-panel>.section-body{min-height:calc(62vh - 4rem)!important}
  .secret-card-row{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:.55rem!important;overflow-x:hidden!important;width:100%!important}.secret-card-row .secret-card{position:relative!important;width:100%!important;min-width:0!important;max-width:100%!important}
  .cm-story-points{grid-template-columns:repeat(2,minmax(0,1fr))!important}.cm-point-control{display:flex!important;flex-direction:column!important;align-items:center!important}.cm-point-control>strong{font-size:.76rem!important;line-height:1.15!important;text-align:center!important;min-height:2.3em!important}.cm-point-buttons{margin-top:.25rem!important}.cm-top-character-fields .cm-description-wide-field{display:grid!important;grid-template-columns:1fr!important}.cm-top-character-fields .cm-field-heading{width:100%!important}.cm-top-character-fields .cm-info-value{width:100%!important;margin-top:.3rem!important}.cm-traits-fields .cm-trait-field{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;align-items:center!important;gap:.4rem!important}.cm-traits-fields .cm-trait-field .cm-info-value{min-width:0!important;width:100%!important}.cm-traits-fields .cm-trait-field>.small{margin:0!important}
  .library-book-cover .library-book-search-wrap{margin-left:auto!important;margin-right:auto!important}.library-book-sun{font-family:Georgia,"Times New Roman",serif!important;font-variant-emoji:text!important}.library-image-option-row{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;align-items:center!important;gap:.45rem!important}.library-image-option-row .library-image-option{width:100%!important}.library-image-manage{font-size:.7rem!important;padding:.35rem .5rem!important}
  .mobile-nav-toggle{position:relative!important}.mobile-nav-notice{display:inline-block;width:8px;height:8px;border-radius:50%;background:#c40000;margin-left:.5rem;vertical-align:middle}.mobile-nav-toggle.has-notification::after{content:"";position:absolute;right:2px;top:2px;width:8px;height:8px;border-radius:50%;background:#c40000}
}
@media (min-width:701px){.library-mobile-theme-option,.ce-mobile-tabs-toggle,.tools-mobile-tabs-toggle,.cm-mobile-view-toggle{display:none!important}}
/* iPad Safari can use a desktop-width layout while retaining a touch viewport.
   Keep the real page header attached to that viewport without changing the
   desktop layout or relying on a delayed scroll correction. */
@media (hover:none) and (pointer:coarse){
  /* A two-row application shell avoids WebKit's unstable sticky/fixed document
     offsets. The header never overlaps the independently scrolling view. */
  html,body{height:100%!important;height:100dvh!important;min-height:0!important;overflow:hidden!important}
  body.app-shell{display:grid!important;grid-template-rows:auto minmax(0,1fr)!important}
  #persistentAppbar{position:relative!important;top:auto!important;left:auto!important;right:auto!important;width:100%!important;z-index:1300!important;grid-row:1!important}
  #appView{grid-row:2!important;min-height:0!important;height:auto!important;overflow-x:hidden!important;overflow-y:auto!important;overscroll-behavior-y:contain!important;-webkit-overflow-scrolling:touch;padding-top:0!important}
  .stage-volume-panel.open input[type="range"]{writing-mode:horizontal-tb!important;direction:ltr!important;transform:none!important}
}
.groups.groups-overflow-test{max-height:3.2em!important;overflow:hidden!important}.view-groups-button{margin-top:.15rem!important}.account-group-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.55rem;max-height:16rem;overflow-y:auto}.account-group-list button{text-align:left}
@media (max-width:420px){.appbar #themeButton{width:50px!important;min-width:50px!important}.appbar .connection-status{max-width:3.2rem;font-size:.58rem!important}.cm-score-list{grid-template-columns:1fr!important}.score-grid,.score-mini{grid-template-columns:repeat(2,minmax(0,1fr))!important}.library-book-top h1{font-size:.78rem!important}}
@media (max-width:700px){.edit-game-groups{grid-template-columns:repeat(2,minmax(0,1fr))!important;column-gap:1rem!important}}

/* Compact Backstage deck management without changing the desktop layout. */
@media (max-width:700px){
  .saved-decks{padding:.55rem!important}
  .saved-decks .deck-subhead{margin-bottom:.55rem!important}
  .saved-decks .saved-deck-row{
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    align-items:start!important;
    gap:.2rem!important;
    padding:.55rem 0!important;
  }
  .saved-decks .saved-deck-row>strong,
  .saved-decks .saved-deck-row>.muted{display:block!important;min-width:0!important;overflow-wrap:anywhere}
  .saved-decks .saved-deck-row>.toolbar{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:.3rem!important;
    width:100%!important;
    margin-top:.35rem!important;
  }
  .saved-decks .saved-deck-row>.toolbar button,
  .deck-toolbar button,
  .deck-actions button{
    min-width:0!important;
    padding:.32rem .2rem!important;
    font-size:.61rem!important;
    line-height:1.15!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
  }
  .deck-toolbar{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;align-items:center!important;gap:.4rem!important}
  .deck-toolbar>strong{margin:0!important;min-width:0!important;overflow-wrap:anywhere}
  .deck-toolbar>.toolbar{grid-column:1 / -1;display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;width:100%!important;gap:.3rem!important}
  .deck-row{grid-template-columns:54px minmax(0,1fr) auto!important;gap:.35rem!important}
  .deck-row .deck-actions{grid-column:2 / -1!important;display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;width:100%!important}
  #scriptModalBackdrop.node-editor-open{align-items:flex-start!important}
  #scriptModalBackdrop.node-editor-open .modal{width:100%!important;max-height:calc(100dvh - 1rem)!important}
}
