/* Loaded last on active pages and the same-origin map document. */
html[data-theme=day]{color-scheme:light;--bg:#f6f5ef;--panel:#fffefb;--border:#cdd5c7;--muted:#505f55;--text:#223a2e;--accent:#42643c}
html[data-theme=night]{color-scheme:dark;--bg:#101819;--panel:#172122;--border:#2b3737;--muted:#a2afab;--text:#ecf0e7;--accent:#d8e9a2}
html[data-theme] body{background:var(--bg);color:var(--text)}
.theme-control{display:inline-flex;align-items:center;gap:5px;flex:none;color:var(--muted);font:12px 'Noto Sans JP',sans-serif}.theme-control svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.5}.theme-control select{font:inherit;color:var(--text);background:var(--panel);border:1px solid var(--border);border-radius:4px;padding:5px;min-height:40px;cursor:pointer;max-width:90px}.theme-control option{background:var(--panel);color:var(--text)}
html[data-theme] .site-header-inner{column-gap:clamp(6px,1.2vw,20px)}
html[data-theme] :focus-visible{outline:2px solid var(--accent);outline-offset:3px}
@media(max-width:700px){.theme-control>span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}.theme-control{gap:2px;font-size:11px}.theme-control select{max-width:69px;min-height:44px;padding:3px}.theme-control svg{width:14px}html[data-theme] .site-header-inner{column-gap:5px}html[data-theme] .header-share+.theme-control{margin-left:0}html[data-theme] .header-share{margin-left:auto}html[data-theme] .language-control{margin-left:0;gap:2px}html[data-theme] .language-control select{max-width:78px}.theme-game .error-tools{gap:5px}}
@media(max-width:370px){.theme-control svg{display:none}html[data-theme] .site-header-inner{column-gap:3px}}
/* Surfaces and controls: deliberately exclude video pixels, posters and game canvas. */
html[data-theme=day] :is(.library,.place-card,.related-card,.daily-pick-card,.surprise-invitation,.time-invitation,.watch-resume,.scenic-card,.destination-sign,dialog,.leaflet-popup-content-wrapper,.leaflet-popup-tip){background:var(--panel);color:var(--text);border-color:var(--border)}
html[data-theme=day] :is(.search,.filters select,.drive-time-filter select,.places button,.mood-chip,.time-invitation button,.region-choice,.region-tab,.surprise-another,.watch-tools button,.watch-resume button,.leaflet-control-zoom a,.map-error){background:#eef2e7;color:var(--text);border-color:#becbb6}
html[data-theme=day] :is(.video-card:hover,.daily-pick-card:hover,.related-card:hover,.scenic-card:hover,.share-menu>a:hover,.share-menu>button:hover){background:#e8efdf;color:var(--text)}
html[data-theme=day] :is(.mood-chip[aria-pressed=true],.places button[aria-pressed=true],.time-invitation button[aria-pressed=true],.region-choice[aria-pressed=true],.region-tab[aria-selected=true],.video-card[aria-current=true]){background:#dbe7cb;color:#203e26;border-color:#738a61}
html[data-theme=day] :is(.list-tools option,.language-control option){background:var(--panel);color:var(--text)}
html[data-theme=day] :is(.brand-word,.brand,.guide-main h2,.guide-main h3){color:var(--text)}
html[data-theme=day] :is(.brand svg){stroke:var(--accent)}
html[data-theme=day] :is(dialog p:not(.eyebrow),#info .quiet-note p,#info .quiet-note small,.place-card p,.place-card-links a,.place-photo-credit,.daily-pick-place,.daily-pick-meta,.related-copy>span,.surprise-copy>p:last-child,.surprise-detail>p,.surprise-status,.surprise-invitation>p,.home-drive-options .guide-description,.region-route-note,.map-note,.popup-meta,.copy span,#watch-bookmarks .watch-privacy,#watch-bookmarks .watch-empty){color:var(--muted)}
html[data-theme=day] :is(.surprise-close,.daily-pick-arrow,.home-drive-options .guide-cta,.popup-link,.popup-all){color:var(--accent)}
html[data-theme=day] :is(.home-page .home-drive-options>.daily-pick,.home-page .home-drive-options>.surprise-section,.home-page .home-drive-options>.drive-time,.watch-bookmark-card){border-color:var(--border)}
html[data-theme=day] .watch-resume .resume-play{background:#e4ecd9;color:#29472b;border-color:#8da17c}
html[data-theme=day] .duration{background:#102019de;color:#fff}
html[data-theme=day] .avatar{background:#dfe9d2;color:#29472b;border-color:#80966d}
html[data-theme=day] .destination-found .destination-sign{background:#edf3e5;color:#2f532c;border-color:#80966d}
html[data-theme=day] #home-map-frame{background:var(--bg);color-scheme:light}
html[data-theme=day] :is(.map-wrap,#map,.leaflet-container){background:#e8eddf}
html[data-theme=day] :is(.drive-pin,.drive-cluster){background:#e0eacb;color:#203e26;border-color:#456f35;box-shadow:0 1px 5px #223a2e30}
html[data-theme=day] :is(.drive-pin>span,.drive-cluster>span){background:#e0eacb;color:#203e26}
/* Player surround stays dark in both themes; no filter, opacity or blending on media. */
html:not(.theme-game)[data-theme] .screen{background:#030707;color:#ecf0e7}html:not(.theme-game)[data-theme] .screen .primary{background:#d8e9a2;color:#172222}html:not(.theme-game)[data-theme] .screen :focus-visible{outline-color:#d8e9a2}
/* The guide uses the same palette, including its night variant. */
html[data-theme] :is(.site-header,.guide-card){background:var(--panel);color:var(--text);border-color:var(--border)}
html[data-theme] :is(.guide-main p,#info p:not(.eyebrow),#info .quiet-note p,#info .quiet-note small){color:var(--muted)}
html[data-theme] :is(.guide-main .eyebrow,.guide-link){color:var(--accent);border-color:var(--accent)}
html[data-theme=night] :is(.guide-note,.guide-art){background:#26362d;color:var(--text)}html[data-theme=night] .guide-card{box-shadow:none}html[data-theme=night] .guide-art svg{background:#edf1e5;border-radius:6px}html[data-theme=night] :is(.brand,.brand-word){color:var(--text)}html[data-theme=night] .brand svg{stroke:var(--accent)}
/* Optional UI loads its CSS later; specificity keeps all dialogs in sync. */
html[data-theme] :is(#info,#watch-bookmarks,#notification-settings,#pwa-help,.analytics-panel){background:var(--panel);color:var(--text);border-color:var(--border)}
html[data-theme] :is(#notification-settings p,#pwa-help p,.analytics-status,.analytics-panel a){color:var(--muted)}
html[data-theme] :is(#pwa-install,#pwa-help button,#notification-settings button,#notification-settings input,.analytics-panel button){background:var(--panel);color:var(--text);border-color:var(--border);color-scheme:inherit}
html[data-theme] :is(#pwa-help .pwa-help,#notification-settings .notification-next){background:var(--bg);color:var(--text);border-color:var(--accent)}
html[data-theme] #notification-enable,html[data-theme] .analytics-panel .analytics-allow{background:var(--accent)!important;color:var(--bg)!important}
html[data-theme] :is(#watch-bookmarks .watch-dialog-feedback,#watch-bookmarks time){color:var(--accent)}
html[data-theme] :is(#pwa-install:focus-visible,#pwa-help button:focus-visible,#notification-settings :focus-visible,.analytics-panel :focus-visible,.analytics-settings:focus-visible){outline-color:var(--accent)}
html[data-theme=day] :is(.analytics-panel,.share-panel){box-shadow:0 10px 32px #233b2d26}
/* Game page chrome only: mono/color drawing and its HUD remain unchanged. */
html.theme-game[data-theme=day] :is(.intro .description,.error-home,footer,.characters,.journey-return){color:#223a2e;border-color:#aebca2}html.theme-game[data-theme=day] .characters{background:#fffefb}
html[data-theme=day] .leaflet-tile-pane{filter:saturate(.55)}html[data-theme=day] .leaflet-control-zoom a{background:var(--panel)!important;color:var(--text)!important}html[data-theme=day] .leaflet-control-attribution{background:#fffefbe6;color:#334d36}
html[data-theme] .site-header-inner>.language-control{margin-left:0}
html[data-theme=day] .map-note{background:#fffefbeF;border-color:var(--border)}
html[data-theme=night] .guide-link:hover{color:var(--text)}
html[data-theme=night] :is(.share-menu>a:hover,.share-menu>button:hover){background:#2a3937}
@media(max-width:370px){html[data-theme] .site-header-inner{column-gap:2px}html[data-theme] .site-header-inner .brand{font-size:20px;gap:5px}html[data-theme] .site-header-inner .brand svg{width:24px}html[data-theme] .language-control svg{display:none}html[data-theme] .language-control select{width:65px;padding-inline:1px}.theme-control select{width:50px;padding-inline:1px}}

html[data-theme=day] #watch-bookmarks button{background:#eef2e7;color:var(--text);border-color:#becbb6}
/* Match the surprise action to the saved-drive resume action. */
html[data-theme=day] #surprise-launch{background:#e4ecd9;color:#29472b;border:1px solid #8da17c}
html[data-theme=night] #surprise-launch{background:#1e2c27;color:var(--accent);border:1px solid #526447}
html[data-theme] #surprise-launch:hover{color:var(--accent);border-color:var(--accent)}
html[data-theme=day] #area-clear{background:#eef2e7;color:var(--text);border-color:#becbb6}
html[data-theme=day] #area-clear:hover{background:#e4ecd9;color:#29472b;border-color:#8da17c}
html[data-theme=day] :is(.popup-all,.clear){background:#eef2e7;color:var(--text);border-color:#becbb6}
html[data-theme=day] :is(.popup-all,.clear):hover{background:#e4ecd9;color:#29472b;border-color:#8da17c}
/* Day palette audit: interactive states and secondary surfaces share one scale. */
html[data-theme=day]{--day-control:#eef2e7;--day-hover:#e4ecd9;--day-selected:#dbe7cb;--day-control-border:#a5b596}
html[data-theme=day] .home-drive-options .daily-pick-card:hover,
html[data-theme=day] .daily-pick-card:focus-visible,
html[data-theme=day] .related-card:hover,
html[data-theme=day] .scenic-card:hover{background:var(--day-hover);color:var(--text);border-color:#8da17c}
html[data-theme=day] .time-invitation button:hover{background:var(--day-hover);color:#29472b;border-color:#8da17c}
html[data-theme=day] .time-invitation button[aria-pressed=true]{background:var(--day-selected);color:#203e26;border-color:#738a61}
html[data-theme=day] :is(.clear,.popup-all,#area-clear,.surprise-close,#surprise-retry){background:var(--day-control);color:var(--text);border-color:var(--day-control-border)}
html[data-theme=day] :is(.clear,.popup-all,#area-clear,.surprise-close,#surprise-retry):hover{background:var(--day-hover);color:#29472b;border-color:#8da17c}
html[data-theme=day] :is(.place-photo,.place-card img,.scenic-card-image){background-color:#e7ecdf}
html[data-theme=day] :is(input,select){color-scheme:light}
html[data-theme=day] input::placeholder{color:#59675d;opacity:1}
html[data-theme=day] .video-list{scrollbar-color:#83947c #eef2e7}
html[data-theme=day] :is(#pwa-install:hover,#pwa-help button:hover,#notification-settings button:not(:disabled):hover,.analytics-panel button:hover){background:var(--day-hover);color:#29472b;border-color:#8da17c}
html[data-theme=day] #notification-settings .notification-privacy{border-color:var(--border)}
html[data-theme=day] .leaflet-popup-close-button{color:#505f55!important}
html[data-theme=day] .leaflet-popup-close-button:hover{color:#223a2e!important}
html[data-theme=day] :is(.map-error,.notice,.watch-feedback){color:#505f55}
/* Shared footer: introduction left, ordered settings right. */
html[data-theme] .site-footer.has-footer-settings{grid-template-columns:minmax(0,1fr) auto;gap:16px 28px;align-items:center}
html[data-theme] .site-footer.has-footer-settings>.brand-word{grid-column:1/-1;grid-row:1}
html[data-theme] .site-footer.has-footer-settings>.footer-introduction{grid-column:1;grid-row:2;margin:0;max-width:none}
html[data-theme] .footer-settings{grid-column:2;grid-row:2;display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:8px 20px;min-width:0}
html[data-theme] .footer-settings :is(.theme-control,#daily-notifications,.analytics-settings,.footer-about){margin:0;grid-column:auto;grid-row:auto;font-size:12px;line-height:1.6;color:var(--muted);opacity:1;min-height:44px}
html[data-theme] .footer-settings :is(#daily-notifications,.analytics-settings,.footer-about){padding:6px 0;width:auto;text-align:left;white-space:normal}
html[data-theme] .footer-settings .theme-control{display:inline-flex;gap:6px;white-space:nowrap}
html[data-theme] .footer-settings .theme-control>span{position:static;width:auto;height:auto;overflow:visible;clip-path:none}
html[data-theme] .footer-settings .theme-control svg{display:block;width:16px;height:16px}
html[data-theme] .footer-settings .theme-control select{width:auto;max-width:none;min-height:40px;padding:5px;font-size:12px}
html[data-theme] .footer-settings :is(button:hover,a:hover){color:var(--accent)}
@media(max-width:1200px){html[data-theme] .site-footer.has-footer-settings{grid-template-columns:1fr}html[data-theme] .site-footer.has-footer-settings>.footer-introduction{grid-column:1;grid-row:2}html[data-theme] .footer-settings{grid-column:1;grid-row:3;justify-content:flex-start}}
@media(max-width:600px){html[data-theme] .site-footer.has-footer-settings{gap:12px}html[data-theme] .footer-settings{gap:6px 18px;align-items:center}html[data-theme] .footer-settings #daily-notifications{max-width:100%}}
/* Keep footer actions above the floating install button. */
html[data-theme] .site-footer.has-footer-settings{padding-bottom:calc(88px + env(safe-area-inset-bottom))}
/* The floating install shortcut must not cover footer settings while they are on screen. */
html.footer-settings-visible #pwa-install{visibility:hidden;pointer-events:none}
html[data-theme] .site-footer.has-footer-settings{padding-bottom:calc(32px + env(safe-area-inset-bottom))}
html[data-theme] .footer-settings :is(#daily-notifications,.analytics-settings,.footer-about){flex:0 1 auto}
@media(max-width:600px){html[data-theme] .footer-settings{column-gap:12px}}

/* Route 404 theme belongs below the game, outside its controls. */
html[data-theme] .game-footer{display:flex;justify-content:flex-end;align-items:center;gap:16px;flex-wrap:wrap;padding-bottom:24px}
html[data-theme] .game-footer .theme-control{margin:0;display:inline-flex;gap:8px}
html[data-theme] .game-footer .theme-control>span{position:static;width:auto;height:auto;overflow:visible;clip-path:none;font-size:12px}

/* Align Route 404 footer actions with the site's theme-first order. */
html[data-theme] .game-footer{font-family:inherit;font-size:12px;line-height:1.6;letter-spacing:0;gap:8px 20px}
html[data-theme] .game-footer :is(.theme-control,.analytics-settings){margin:0;min-height:44px;font-size:12px;line-height:1.6;letter-spacing:0;color:var(--muted);opacity:1;flex:0 1 auto}
html[data-theme] .game-footer .theme-control{align-items:center;order:0;gap:6px}
html[data-theme] .game-footer .theme-control>span{font-size:12px;line-height:1.6}
html[data-theme] .game-footer .theme-control select{font-family:inherit;font-size:12px;line-height:1.6;min-height:40px;padding:5px;width:auto;max-width:none}
html[data-theme] .game-footer .analytics-settings{display:inline-flex;align-items:center;justify-content:center;padding:6px 0;order:1}
@media(max-width:600px){html[data-theme] .game-footer{justify-content:flex-start;column-gap:16px}}

/* Control rhythm: 13px filters, 12px utility actions; retain distinctive player/game CTAs. */
html[data-theme] :is(.filters select,.drive-time-filter select,.list-tools select,.list-tools button,.mood-chip,.search input){font-size:13px;line-height:1.5;min-height:40px}
html[data-theme] :is(#clear-moods,#home-map-reset,.load-more,.related-more,.region-tab,.region-choice,.watch-tools button,#watch-bookmarks button,.resume-play){font-size:12px;line-height:1.5;min-height:40px}
html[data-theme] :is(#clear-moods,#home-map-reset,.load-more,.related-more,.region-tab,.region-choice,.watch-tools button,#watch-bookmarks button,.resume-play){display:inline-flex;align-items:center;justify-content:center;gap:6px;box-sizing:border-box}
html[data-theme] #clear-moods{padding:6px 8px;flex:none}
html[data-theme] .region-tab{padding:8px 12px;white-space:normal;text-align:center}
html[data-theme] .watch-tools{align-items:center}
html[data-theme] .footer-settings>button{display:inline-flex;align-items:center;justify-content:center;gap:6px}
html[data-theme] .footer-settings :is(.theme-control,#display-theme){min-height:44px}
html[data-theme] .header-guide{font-size:12px}
/* Embedded map shares the same control scale, without changing map markers. */
html[data-theme] :is(#area-clear,.clear,.popup-all){font-size:12px;line-height:1.5;min-height:40px}
html[data-theme] .game-footer #display-theme{min-height:44px}
html.theme-game[data-theme] .error-home{display:inline-flex;align-items:center;justify-content:center;font-size:11px;line-height:1.5;min-height:44px;padding:6px 8px;letter-spacing:0}
html.theme-game[data-theme] .error-language-control{font-size:12px;line-height:1.5}
html.theme-game[data-theme] .error-language-control select{font:inherit;min-height:44px}
html.theme-game[data-theme] .machine-top .error-mode-switch{height:40px;min-height:40px;align-items:center}
html.theme-game[data-theme] .machine-top .error-mode-switch button{height:32px;min-height:32px;font-size:11px;line-height:1;padding-inline:8px}
html.theme-game[data-theme] .machine-top #game-fullscreen{height:40px;min-height:40px;font-size:11px;line-height:1;display:inline-flex;align-items:center;justify-content:center}
html.theme-game[data-theme] .machine-bottom{align-items:center;gap:8px;flex-wrap:wrap}
html.theme-game[data-theme] .machine-bottom :is(#pause,#route-sound){display:inline-flex;align-items:center;justify-content:center;font-size:11px;line-height:1.4;min-height:36px;padding:6px 8px;box-sizing:border-box;margin:0;letter-spacing:0}
@media(max-width:700px){
html[data-theme] :is(.filters select,.drive-time-filter select,.list-tools select,.list-tools button,.mood-chip,#clear-moods,#home-map-reset,.load-more,.related-more,.region-tab,.region-choice,.watch-tools button,#watch-bookmarks button,.resume-play,#area-clear,.clear,.popup-all){min-height:44px}
html.theme-game[data-theme] .machine-top .error-mode-switch{height:52px;min-height:52px}
html.theme-game[data-theme] .machine-top .error-mode-switch button{height:44px;min-height:44px}
html.theme-game[data-theme] .machine-top #game-fullscreen{height:52px;min-height:52px}
html.theme-game[data-theme] .machine-bottom :is(#pause,#route-sound){min-height:44px}
}

@media(max-width:700px){
html[data-theme] #region-tabs{display:flex;flex-wrap:wrap;overflow:visible;gap:8px}
html[data-theme] #region-tabs .region-tab{flex:1 1 calc(50% - 4px);min-width:0;margin:0}
/* Audio's existing inline size is overridden only within the game toolbar. */
html.theme-game[data-theme] .machine-bottom #route-sound{min-height:44px!important}
}

html[data-theme] #watch-bookmarks .watch-close{display:flex;width:fit-content;margin-left:auto}
