/* Keep the application in one viewport; long content belongs to its own panel. */
:root { --viewport-gutter: clamp(12px, 2.4vw, 40px); }
html, body { height: 100%; min-height: 0; min-width: 0; overflow: hidden; overscroll-behavior: none; }
body { height: 100dvh; padding: 0; grid-template-rows: auto minmax(0, 1fr) auto auto; }
body > .header { min-width: 0; padding: clamp(10px, 2.4dvh, 26px) var(--viewport-gutter) 0; }
body > .main, html[data-tool] body > .main {
  height: 100%; min-height: 0; min-width: 0; padding: 12px var(--viewport-gutter);
  align-items: center; justify-content: center; overflow: hidden;
  container: workspace / size;
}
.clock-scene { min-height: 0; max-height: 100%; }
.mode-switch { flex-shrink: 0; margin-bottom: clamp(8px, 3cqh, 22px); }
.clock-scene > [role="region"] {
  flex: 0 1 auto; min-height: 0; max-height: 100%; padding: 3px;
  overflow: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--control-border) transparent;
}
.clock-scene > [role="region"]:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }
.clock-panel > *, .timer-panel > *, .stopwatch-panel > * { flex-shrink: 0; }
.clock-heading-row { max-width: 100%; margin-bottom: clamp(8px, 2cqh, 22px); }
.clock-heading-row h1 { text-align: center; overflow-wrap: anywhere; }
.clock-pill { min-height: clamp(104px, 27cqh, 222px); }
.clock { padding: clamp(10px, 2.8cqh, 24px) clamp(12px, 3vw, 38px); }
.clock .digits { font-size: clamp(38px, min(10vw, 15cqh), 120px); }
.clock .colon { font-size: clamp(33px, min(8.5vw, 12.5cqh), 100px); }
.clock[data-precision="milliseconds"] .digits { font-size: clamp(32px, min(8.5vw, 14cqh), 108px); }
.clock[data-precision="milliseconds"] .colon { font-size: clamp(28px, min(7.2vw, 11.8cqh), 90px); }
.stopwatch-fraction-digits { font-size: clamp(16px, min(2.6vw, 5cqh), 40px); }
.clock-details { margin-top: clamp(8px, 2cqh, 24px); }
.timezone { margin-top: 8px; }
.explore-button { min-height: 36px; margin-top: 8px; padding-block: 6px; }
.guest-note { margin-top: 8px; }
.timer-pill { min-height: 0; }
.timer-pill .clock { padding: 8px clamp(12px, 3vw, 38px); }
.timer-display .timer-input { font-size: clamp(34px, min(10vw, 14cqh), 100px); }
.timer-step-button { min-height: 24px; height: 24px; padding-block: 2px; }
.timer-status { margin-top: 8px; }
.timer-presets { margin-top: 6px; }
.timer-actions, .stopwatch-actions { margin-top: 8px; }
.timer-audio-support { margin-top: 3px; }
.stopwatch-note { margin-top: 5px; }
.stopwatch-precision { margin-top: 3px; }
.market-panel, .market-panel[data-visible="false"] { margin-top: clamp(8px, 2cqh, 20px); }
.market-panel { padding: 7px 12px; }
.market-toggle { min-height: 32px; }
.market-exchange { margin-block: 3px; }
.market-bottom { margin-top: 2px; }

/* The player uses a bounded bottom row rather than extending the document. */
body > .utility-dock {
  min-height: 0; max-height: min(26dvh, 210px); width: 100%;
  justify-content: center; align-items: center; overflow: hidden; gap: 8px;
}
body > .utility-dock:has(> :not([hidden])) { padding: 0 12px 6px; }
.utility-dock > .spotify-dock {
  width: min(460px, 100%); margin: 0; max-height: min(calc(26dvh - 6px), 204px);
  padding: 8px 12px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
.spotify-native { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 6px; padding-top: 2px; }
.spotify-cover-link, #spotify-cover { width: 48px; height: 48px; }
.spotify-cover-link > span { width: 48px; height: 48px; }
.spotify-native .spotify-playback-controls { grid-column: auto; gap: 2px; }
.spotify-native .spotify-play { width: 36px; height: 36px; }
.spotify-native .spotify-skip { width: 32px; height: 36px; padding: 8px; }
.spotify-native-bottom { grid-column: 1 / -1; }
.utility-dock > .alarm-dock {
  position: fixed; z-index: 125; right: 0; bottom: calc(80px + env(safe-area-inset-bottom));
  width: auto; max-width: 100%; min-width: 0; padding: 0; flex: none;
}
.utility-dock > .alarm-dock:has(.alarm-popup:not([hidden])) { width: min(396px, 100%); }
.alarm-popup { max-height: calc(100dvh - 120px); overflow: auto; overscroll-behavior: contain; }
body > .footer {
  min-width: 0; min-height: calc(76px + env(safe-area-inset-bottom));
  padding: 6px var(--viewport-gutter) calc(12px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 240px) minmax(0, 1fr);
  align-items: end; gap: 12px;
}
.footer > .text-button:first-child { grid-column: 1; justify-self: start; }
.footer > .fullscreen-button { grid-column: 3; justify-self: end; }
.footer-note { display: none; }
.spotify-launcher { bottom: calc(14px + env(safe-area-inset-bottom)); }
.spotify-client-panel { max-height: calc(100dvh - 100px - env(safe-area-inset-bottom)); }

/* The globe keeps a fixed shell, with the city list scrolling independently. */
.world-dialog { padding: 0; overflow: hidden; }
.world-shell {
  display: flex; flex-direction: column; min-height: 0; height: 100%;
  padding: 16px var(--viewport-gutter) calc(78px + env(safe-area-inset-bottom));
}
.world-header, .world-intro { flex-shrink: 0; }
.world-intro { margin: 16px 0; }
.world-intro h2 { font-size: clamp(24px, 3vw, 34px); }
.world-layout { flex: 1; min-height: 0; align-items: stretch; gap: 24px; overflow: hidden; }
.globe-section { display: flex; flex-direction: column; min-height: 0; }
.globe-stage { flex: 1; min-height: 0; height: auto; }
.globe-instructions, .globe-current { flex-shrink: 0; }
.globe-current { margin-top: 10px; flex-wrap: wrap; }
.location-panel { display: flex; flex-direction: column; min-height: 0; padding-top: 0; overflow: auto; overscroll-behavior: contain; }
.location-panel > :not(.location-results) { flex-shrink: 0; }
.location-results { flex: 1; min-height: 0; max-height: none; }
.continent-filters { margin: 10px 0; }
.results-heading { margin-bottom: 8px; }
.world-bottom-note { display: none; }

@media (max-width: 720px) {
  .world-shell { padding-top: max(12px, env(safe-area-inset-top)); }
  .world-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(80px, .75fr) minmax(0, 1fr); gap: 12px; }
  .world-intro { margin: 10px 0; }
  .world-eyebrow { margin-bottom: 5px; }
  .globe-controls { flex-direction: row; gap: 5px; }
  .globe-controls button { width: 36px; height: 36px; }
  .globe-instructions { margin-top: 4px; font-size: 8px; }
  .globe-current { margin-top: 4px; font-size: 9px; }
  .continent-filters { flex-wrap: nowrap; overflow-x: auto; margin: 6px 0; padding-bottom: 4px; scrollbar-width: thin; }
  .continent-filters button { min-height: 32px; flex-shrink: 0; }
  .location-note { margin-top: 6px; }
}
@media (max-width: 600px) {
  body > .header { padding-top: max(10px, env(safe-area-inset-top)); }
  body > .main, html[data-tool] body > .main { padding-block: 8px; }
  .mode-switch { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; max-width: 440px; gap: 2px; padding: 2px; }
  .mode-button { min-height: 36px; padding: 6px 3px; font-size: 10px; justify-content: center; }
  .mode-button svg { display: none; }
  .clock .digits { letter-spacing: -2px; }
  .clock { gap: 5px; }
  .timer-actions > button { padding-inline: 10px; }
  body > .footer { grid-template-columns: minmax(0, 1fr) 180px minmax(0, 1fr); gap: 4px; }
  .footer > .text-button { width: 36px; min-height: 44px; padding: 8px; justify-content: center; }
  .footer > .text-button > span { display: none; }
  .spotify-launcher { gap: 9px; padding-inline: 16px; }
}
@container workspace (max-height: 360px) {
  .mode-switch { margin-bottom: 6px; }
  .mode-button { min-height: 32px; padding-block: 5px; }
  .clock-heading-row { margin-bottom: 6px; }
  .clock-pill { min-height: 76px; }
  .clock { padding-block: 8px; }
  .clock .digits { font-size: clamp(28px, min(8vw, 12cqh), 62px); }
  .clock .colon { font-size: clamp(24px, min(7vw, 10cqh), 52px); }
  .clock .unit-label { font-size: 6px; margin-top: 5px; letter-spacing: 1px; }
  .clock-details { margin-top: 6px; }
  .clock-details .date { font-size: 10px; }
  .clock-details .timezone { margin-top: 5px; font-size: 8px; letter-spacing: 1px; }
  .explore-button { min-height: 32px; margin-top: 5px; }
  .market-panel { margin-top: 8px; }
}
@media (max-height: 540px) {
  body > .header { padding-top: 8px; }
  body > .footer { min-height: calc(64px + env(safe-area-inset-bottom)); }
  .spotify-launcher { height: 40px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .spotify-client-panel { bottom: calc(64px + env(safe-area-inset-bottom)); max-height: calc(100dvh - 80px - env(safe-area-inset-bottom)); }
  .world-intro > p:last-child, .globe-instructions { display: none; }
  .world-intro { margin: 8px 0; }
  .world-eyebrow { margin-bottom: 4px; }
  .world-intro h2 { font-size: 23px; }
}
@media (max-width: 330px) { .spotify-launcher > span { display: none; } }
/* Native mobile fields remain readable without triggering focus zoom. */
@media (max-width: 650px) and (pointer: coarse) {
  .account-dialog input,.account-dialog select,.search-field input,.news-search input,.spotify-client-search-form input,.spotify-client-search-form select { font-size:16px; }
}
