/* Phone and touch layouts. Loaded last so the desktop theme stays intact. */
:root {--taskbar-height:calc(3.5rem + env(safe-area-inset-bottom,0px))}
.desktop-window,.small-window,.page-content,.hero-copy,.about-copy,.social-label,.mod-card,.art-card,.mod-dialog-meta>div {min-width:0}
.button {max-width:100%;overflow-wrap:anywhere}
.taskbar {padding-bottom:calc(.375rem + env(safe-area-inset-bottom,0px));padding-left:max(.5rem,env(safe-area-inset-left,0px));padding-right:max(.5rem,env(safe-area-inset-right,0px))}
.cookie-joke,.decal-ad,.side-promo,.retro-dialog {overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
.cookie-joke>.title-bar,.decal-ad>.title-bar,.side-promo>.title-bar,.retro-dialog>.title-bar {position:sticky;top:0;z-index:2}
html:has(dialog[open]) {overflow:hidden}
.decal-ad.dvd-docked {width:22rem}
.decal-ad.dvd-docked .promo-image {width:100%;height:clamp(72px,20dvh,140px);max-height:none;object-fit:contain}
.decal-ad.dvd-docked h2 {font-size:1.25rem;letter-spacing:0;line-height:1.25;overflow-wrap:anywhere}
.compact-popup {scroll-padding-top:4rem}
.decal-ad.dvd-docked .ad-actions {align-items:center}
@media(max-height:360px) {
  .decal-ad.dvd-docked .youtube-promo-player,.decal-ad.dvd-docked .youtube-embed-fallback {min-height:88px}
}
@media(pointer:coarse) {
  button,a.button,.menu-bar a,.top-social-link,.stream-popout,.photo-tab {min-height:44px;touch-action:manipulation}
  .stream-popout {padding:.5rem}
  .turn-off-ads,.tiny-no {min-height:44px;min-width:44px}
}
@media(max-width:760px) {
  body,body.main-window-maximized {padding:max(.625rem,env(safe-area-inset-top,0px)) max(.375rem,env(safe-area-inset-right,0px)) calc(var(--taskbar-height) + 1rem) max(.375rem,env(safe-area-inset-left,0px))}
  .desktop-label {align-items:center;margin-bottom:.5rem}
  .desktop-label>span {display:none}
  .desktop-window>.title-bar>span:first-child,.welcome-window>.title-bar>span:first-child {display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .title-bar {min-height:3rem}
  .window-control,.close-dialog {width:44px;min-width:44px;height:44px;min-height:44px}
  .menu-bar {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.25rem;padding:.375rem}
  .menu-bar a,.menu-bar .motion-toggle,.menu-bar .nonsense-toggle {min-width:0;min-height:44px;margin:0;padding:.5rem .25rem;font-size:.8125rem;text-align:center;white-space:normal;overflow-wrap:anywhere}
  .social-toolbar {display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:.25rem;padding:.375rem}
  .top-social-link {min-width:0;min-height:44px;justify-content:center;padding:.5rem}
  .top-social-link>span {display:none}
  .top-social-link .brand-icon {width:24px;height:24px}
  .address-bar {display:none}
  .page-content {padding:1rem .75rem 0;margin:0 .1875rem}
  .hero {display:flex;flex-direction:column;gap:1.25rem;padding:1rem 0}
  .hero h1 {font-size:clamp(2rem,8vw,3rem);overflow-wrap:anywhere;letter-spacing:-.06rem}
  .hero-actions {padding-inline:1rem;gap:1rem}
  .hero-actions .button {width:100%;min-height:44px}
  .hero-aside {width:100%;padding:0}
  .welcome-window {width:100%;max-width:360px;margin:auto;padding:4px}
  .welcome-body {display:grid;grid-template-columns:80px minmax(0,1fr);gap:.25rem .75rem;align-items:center;text-align:left;padding:.75rem}
  .welcome-body .pixel-monitor {display:block;grid-row:1/5;width:72px;margin:0}
  .welcome-body .monitor-screen {height:56px;border-width:6px}
  .welcome-body h2,.welcome-body p {margin:0}
  .homepage-shortcuts {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.75rem}
  .homepage-shortcuts .button {min-width:0;min-height:44px;flex:none;padding:.625rem .5rem}
  .homepage-shortcuts .button:last-child {grid-column:1/-1}
  .lower-grid,.community-layout,.about-body.about-profile,.link-decal-body {grid-template-columns:minmax(0,1fr)}
  .about-portrait {width:min(100%,260px);margin:auto}
  .steamy-stats {grid-template-columns:minmax(0,1fr)}
  .about-copy p,.steamy-stats dd,.extra-heading p,.link-decal-body p,.mod-promo-body p {overflow-wrap:anywhere}
  .extra-heading h1,.mods-heading h1 {font-size:clamp(1.75rem,7vw,2.75rem);overflow-wrap:anywhere}
  .extra-heading>.art-sticker,.extra-heading>.trophy-sticker,.extra-heading>.notepad-sticker,.folder-sticker {display:none}
  .gallery-toolbar,.search-label {width:100%;min-width:0}
  .search-label input {width:100%;min-width:0;max-width:100%;font-size:16px;min-height:44px}
  .filter-buttons {width:100%;gap:.5rem}
  .filter-buttons .button,.photo-tab,.card-photo-tabs .photo-tab {min-height:44px}
  .mod-card h3,.art-credit,.card-file-name,.rank-member strong {overflow-wrap:anywhere}
  .mod-dialog-meta {display:block}
  .mod-dialog-meta .button {width:100%;margin-top:.75rem}
  .retro-dialog {width:calc(100% - 1rem);max-width:calc(100% - 1rem);max-height:calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 1rem);margin:auto;padding:4px}
  .large-preview img {height:auto;min-height:0;max-height:48dvh;object-fit:contain}
  .preview-navigation {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.5rem}
  .preview-navigation>span {grid-column:1/-1;grid-row:1;text-align:center}
  .preview-navigation .button {min-width:0;min-height:44px}
  .twitch-compact {min-height:180px;padding:1rem;gap:.75rem}
  .stream-heading>p {font-size:.8125rem}
  .stream-popout {min-height:44px;max-width:40%;padding:.5rem .25rem}
  .cookie-joke {max-height:56dvh}
  .cookie-joke-body {padding:.875rem}
  .cookie-actions {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem;padding-inline:.25rem}
  .cookie-actions .button {min-width:0;min-height:44px;padding:.625rem .375rem}
  .cookie-actions .tiny-no {grid-column:1/-1;justify-self:center;margin:0}
  .taskbar,.taskbar-controls {gap:.25rem}
  .taskbar-toggle {width:4rem;min-width:44px;min-height:44px;padding:.25rem;font-size:.75rem}
  .taskbar-toggle .toggle-label {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
  .taskbar-toggle::after {content:attr(data-compact-label)}
  .task-button {max-width:none;min-width:0;flex:1;width:auto;font-size:.75rem;padding:.375rem}
  .task-label {overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .start-button {min-width:44px;min-height:44px;padding:.375rem .5rem}
  .clock {font-size:.75rem;padding:.375rem;flex-shrink:0}
  .page-footer {overflow-wrap:anywhere;gap:.75rem}
  .page-footer .button {min-height:44px}
}
@media(max-width:480px) {
  .start-button b,.task-button .task-label {display:none}
  .task-button {flex:0 0 44px;width:44px;justify-content:center}
  .task-button .ui-icon {display:inline-block}
  .mod-grid,.art-gallery,.social-grid {grid-template-columns:minmax(0,1fr)}
  .ranking-content {padding:.75rem;margin:3px}
  .ranking-table th:first-child {width:15%}
  .ranking-table th:nth-child(2) {width:44%}
  .ranking-table td,.ranking-table th {padding-inline:.25rem}
  .rank-number {font-size:1rem}
}
@media(max-width:360px) {
  .start-button b {display:none}
}
@media(min-width:540px) and (max-width:1000px) and (max-height:500px) {
  .menu-bar {display:grid;grid-template-columns:repeat(5,minmax(0,1fr))}
}
