/* Final responsive polish, loaded after the room-specific themes. */
/* Give the desktop dock real button targets while preserving the title and
   transport. At laptop widths, move the seek bar below the controls instead
   of squeezing its buttons back down. */
@media (min-width:761px){
  .music-player .icon-button,
  .music-player .play-button,
  .music-player .music-emblem{
    width:44px;
    min-width:44px;
    height:44px;
    min-height:44px;
    flex:0 0 44px;
  }
  .music-player .music-emblem{padding:0}
  .music-player .track-meta{min-height:44px;justify-content:center}
  .music-player.compact .music-emblem{display:none!important}
  .music-player button:focus-visible{outline-color:var(--score-gold);outline-offset:-3px}
}
@media (min-width:761px) and (max-width:960px){
  .music-player:not(.compact),#reader>.music-player:not(.compact){
    width:calc(100% - 24px);
    height:104px;
    padding:8px 12px 43px;
    gap:8px;
  }
  .music-player:not(.compact) .music-emblem,
  .music-player:not(.compact) .music-spectrum{display:none!important}
  .music-player:not(.compact) .track-meta{min-width:0;max-width:none;flex:1}
  .music-player:not(.compact)>.seek{
    position:absolute;
    left:58px;
    right:58px;
    bottom:4px;
    width:auto;
    height:34px;
    flex:none;
  }
  .music-player:not(.compact)>.time-label{position:absolute;bottom:13px}
  .music-player:not(.compact) #current-time{left:12px}
  .music-player:not(.compact) #total-time{right:12px}
}
@media (max-width:420px){
  .reader-toolbar .wordmark{
    flex:0 0 34px;
    width:34px;
    min-width:34px;
    gap:0;
    font-size:0;
    overflow:visible;
    justify-content:center;
  }
  .reader-toolbar .wordmark::after{
    content:"☾";
    display:block;
    font:400 29px/1 Editorial,Symbols,Georgia,serif;
    letter-spacing:0;
    color:inherit;
  }
  #reader-breadcrumb{max-width:76px;flex:0 1 auto}
  #reader-breadcrumb::after{font-size:13px}
  #reader[data-page=profile] .profile-identity{display:block;position:relative}
  #reader[data-page=profile] .profile-identity>div{min-width:0;width:100%}
  #reader[data-page=profile] .profile-identity h1{
    font-size:clamp(38px,10vw,48px);
    overflow-wrap:break-word;
    word-break:normal;
    max-width:100%;
  }
  #reader[data-page=profile] .identity-seal{position:absolute;top:0;right:0}
}

/* The player remains fixed while the reader scrolls. Full bleed chapters have
   their own zero-padding reader shell, so they need room inside the chapter. */
@media (max-width:760px){
  :root{--mobile-player-clearance:calc(230px + env(safe-area-inset-bottom,0px))}
  body:has(.music-player.compact){--mobile-player-clearance:calc(112px + env(safe-area-inset-bottom,0px))}
  #reader-content{padding-bottom:var(--mobile-player-clearance)}
  #reader[data-page=prologue] .opening-invitation{
    box-sizing:border-box;
    min-height:calc(100svh - 60px);
    padding:28px 20px var(--mobile-player-clearance);
  }
  #reader[data-page=prologue] .opening-invitation::before{inset:11px 8px calc(var(--mobile-player-clearance) - 42px)}
  #reader[data-page=prologue] .opening-invitation::after{inset:17px 14px calc(var(--mobile-player-clearance) - 36px)}
  #reader[data-page=faction] .faction-next,
  #reader[data-page=shadows] .hollow-next{padding-bottom:var(--mobile-player-clearance)}
  .site-footer{padding-bottom:var(--mobile-player-clearance)}

  /* Controls have actual finger-sized hit areas. The expanded transport uses
     three rows, retaining a readable track title at 320 px. */
  .music-player.compact,#reader>.music-player.compact{
    height:62px;
    padding:7px 8px;
    gap:5px;
  }
  .music-player.compact .queue-button,
  .music-player.compact #compact-player,
  .music-player.compact #mute-toggle,
  .music-player.compact .play-button{
    width:44px;
    min-width:44px;
    height:44px;
    min-height:44px;
    flex-basis:44px;
  }
  .music-player:not(.compact),#reader>.music-player:not(.compact){
    height:184px;
    padding:8px 10px 122px;
    gap:5px;
  }
  .music-player:not(.compact) .queue-button,
  .music-player:not(.compact) #compact-player,
  .music-player:not(.compact) .play-button{
    display:grid;
    place-items:center;
    width:44px;
    min-width:44px;
    height:44px;
    min-height:44px;
    flex:0 0 44px;
  }
  .music-player:not(.compact) .previous-track,
  .music-player:not(.compact) .next-track,
  .music-player:not(.compact) #repeat-toggle,
  .music-player:not(.compact) #mute-toggle{
    position:absolute;
    bottom:6px;
    display:grid;
    place-items:center;
    width:44px;
    min-width:44px;
    height:44px;
    min-height:44px;
    flex:0 0 44px;
    font-size:22px;
  }
  .music-player:not(.compact) #repeat-toggle{left:8px;right:auto}
  .music-player:not(.compact) .previous-track{left:56px}
  .music-player:not(.compact) .next-track{left:104px}
  .music-player:not(.compact) #mute-toggle{left:152px;right:auto}
  .music-player:not(.compact)>.volume{
    left:201px;
    right:14px;
    bottom:10px;
    width:calc(100% - 215px);
    min-width:60px;
    height:36px;
  }
  .music-player:not(.compact)>.seek{
    left:58px;
    width:calc(100% - 116px);
    bottom:57px;
    height:38px;
  }
  .music-player:not(.compact) .time-label{bottom:96px;font-size:12px}
  .music-player:not(.compact) #current-time{left:12px}
  .music-player:not(.compact) #total-time{right:12px}
  .music-player .track-meta strong{color:#fff7ea}
  .music-player .track-meta .small-caps{color:#e3d4b7}
  .music-player .music-spectrum{flex:0 0 18px;width:18px}
}

@media (max-width:340px){
  .music-player:not(.compact) .music-spectrum{display:none}
  .music-player:not(.compact) .track-meta strong{font-size:16px}
}

/* The three doors remain visible together on a phone, with words large enough
   to read over their artwork. The short visual cue fits even a 320px screen. */
@media (max-width:760px){
  .portal{min-width:0;min-height:330px;padding-inline:6px}
  .portal-index{font-size:clamp(12px,3vw,13px);line-height:1.25;letter-spacing:0;min-height:40px;overflow-wrap:anywhere}
  .portal h2{overflow-wrap:break-word;text-wrap:balance}
  .portal p{font-size:15px;line-height:1.4;overflow-wrap:break-word}
  .portal-action{display:flex;align-items:center;justify-content:center;gap:4px;min-height:32px;color:inherit}
  .portal-action::before{content:"Enter";font:700 12px/1.2 Body,Symbols,sans-serif;letter-spacing:.02em}
  .portal-action span{font-size:20px}
  .location-copy small{font-size:12px;line-height:1.35;letter-spacing:.08em}
  .welcome-top .small-caps,.welcome-bottom .small-caps{font-size:12px;line-height:1.4}
  .sound-choice small{font-size:12px}
  .cinematic-controls{font-size:12px}
  .cinematic-controls button{min-height:44px;font-size:14px;padding-inline:10px}
  .site-header .wordmark{min-width:0}
  .site-header .theme-toggle,.site-header .mobile-menu,
  .header-actions>.icon-button[data-route=search]{display:grid;place-items:center;min-width:44px;min-height:44px;width:44px;flex:0 0 44px}
  .site-header .theme-toggle{padding:0}
}
@media (min-width:761px) and (max-width:960px){
  .site-header .theme-toggle,.site-header .mobile-menu{min-width:44px;min-height:44px;justify-content:center}
  .site-header .wordmark{min-width:0}
}
@media (max-width:360px){
  .site-header .wordmark{font-size:14px;letter-spacing:0;gap:2px}
  .site-header .brand-symbol{font-size:21px}
  .header-actions{gap:0}
}
/* At extreme text zoom, preserve the route and close controls rather than
   clipping the toolbar. Search remains available through the navigation. */
@media (max-width:280px){
  .site-header .wordmark{font-size:0}
  .header-actions>.icon-button[data-route=search],
  #reader-breadcrumb,#reader-focus{display:none}
  .reader-toolbar{padding-inline:6px}
  .portal-index{font-size:10px}
  .portal h2{font-size:19px}
  .portal p{font-size:13px}
}

/* A stopped marquee should leave a legible title, not a clipped first phrase. */
@media (prefers-reduced-motion:reduce){
  .music-player .track-meta.title-scroll strong{width:100%;max-width:100%;white-space:normal;overflow-wrap:anywhere;padding-right:0;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
}
body.reduced-motion .music-player .track-meta.title-scroll strong{width:100%;max-width:100%;white-space:normal;overflow-wrap:anywhere;padding-right:0;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;animation:none}

/* Semantic welcome heading must keep the original cinematic geometry. */
.welcome-title{margin:0}
