/* The logo's cream rim, navy edge and pastel candy faces on non-game panels. */
dialog::backdrop {
  background: #233b566b;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

:is(#settings-dialog, #profile-dialog, #records-dialog, #help-dialog,
    #guide-dialog, #welcome-consent, #welcome-news-choice, #support-dialog,
    #cloud-dialog, #reset-dialog, #ost-dialog, #flower-account, #other-games-dialog) {
  box-sizing: border-box;
  width: min(410px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  max-height: calc(100dvh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  margin: auto;
  padding: 22px 20px 20px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 2px solid var(--shell-line, #52637a);
  border-radius: 24px;
  background: linear-gradient(155deg, #fffdf4, var(--shell-paper, #fff9ed) 64%, #f6efe0);
  color: var(--shell-ink, #253b56);
  box-shadow: inset 0 0 0 3px var(--shell-cream, #fff6dd),
    inset 0 6px 0 #ffffffc9, 0 5px 0 #42546f, 0 15px 35px var(--shell-shadow, #263c5c40);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  scrollbar-color: #9bb6af transparent;
}

:is(#settings-dialog, #profile-dialog, #records-dialog, #help-dialog,
    #guide-dialog, #welcome-consent, #welcome-news-choice, #support-dialog,
    #cloud-dialog, #reset-dialog, #ost-dialog, #flower-account, #other-games-dialog)::backdrop {
  background: #233b566b;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

:is(#settings-dialog, #profile-dialog, #records-dialog, #help-dialog,
    #guide-dialog, #welcome-consent, #welcome-news-choice, #support-dialog,
    #cloud-dialog, #reset-dialog, #ost-dialog, #flower-account, #other-games-dialog) :is(h2, h3) {
  color: var(--shell-ink, #253b56);
  font-style: normal;
  font-weight: 850;
  text-shadow: none;
  letter-spacing: -.025em;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

:is(#settings-dialog, #profile-dialog, #records-dialog, #help-dialog,
    #guide-dialog, #welcome-consent, #welcome-news-choice, #support-dialog,
    #cloud-dialog, #reset-dialog, #ost-dialog, #flower-account, #other-games-dialog) p {
  color: var(--shell-muted, #617083);
  text-shadow: none;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

:is(#settings-dialog, #profile-dialog, #records-dialog, #help-dialog,
    #guide-dialog, #welcome-consent, #welcome-news-choice, #support-dialog,
    #cloud-dialog, #reset-dialog, #ost-dialog, #flower-account, #other-games-dialog) :is(button, select, input, textarea, summary, a) {
  -webkit-tap-highlight-color: transparent;
}

:is(#settings-dialog, #profile-dialog, #records-dialog, #help-dialog,
    #guide-dialog, #welcome-consent, #welcome-news-choice, #support-dialog,
    #cloud-dialog, #reset-dialog, #ost-dialog, #flower-account, #other-games-dialog) button {
  box-sizing: border-box;
  min-height: 44px;
  min-width: 0;
  border: 1.5px solid #65768b;
  border-radius: 14px;
  background: linear-gradient(#e6fff1, var(--shell-mint, #b8eed8));
  color: var(--shell-ink, #253b56);
  box-shadow: inset 0 2px 0 #fffc, 0 3px 0 #708d89;
  font-weight: 800;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}

:is(#settings-dialog, #profile-dialog, #records-dialog, #help-dialog,
    #guide-dialog, #welcome-consent, #welcome-news-choice, #support-dialog,
    #cloud-dialog, #reset-dialog, #ost-dialog, #flower-account, #other-games-dialog) :is(button, select, input, textarea, summary, a, iframe):focus-visible {
  outline: 3px solid #087c72;
  outline-offset: 3px;
}

:is(#settings-dialog, #profile-dialog, #records-dialog, #help-dialog,
    #guide-dialog, #welcome-consent, #welcome-news-choice, #support-dialog,
    #cloud-dialog, #reset-dialog, #ost-dialog, #flower-account, #other-games-dialog) button:disabled {
  opacity: .55;
}

:is(#settings-dialog, #profile-dialog, #records-dialog, #help-dialog) .map-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 0 0 14px;
  border-bottom: 1px solid #d2d8ce;
  background: transparent;
  box-shadow: none;
}

:is(#settings-dialog, #profile-dialog, #records-dialog, #help-dialog) .map-header h2 {
  min-width: 0;
  font-size: 24px;
  margin: 0;
}

:is(#settings-dialog, #profile-dialog, #records-dialog, #help-dialog) button[data-dismiss],
#support-dialog .support-close, #cloud-dialog .cloud-close,
#ost-dialog .ost-header button, #flower-account header button,
#other-games-dialog .other-close {
  box-sizing: border-box !important;
  display: grid !important;
  place-items: center !important;
  flex: 0 0 44px !important;
  width: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 1.5px solid #7c8294 !important;
  border-radius: 14px !important;
  background: linear-gradient(#fff5f9, #f4cedb) !important;
  color: var(--shell-ink, #253b56) !important;
  box-shadow: inset 0 2px 0 #fffd, 0 2px 0 #a08b9d !important;
  font-size: 25px;
  line-height: 1;
}

:is(#settings-dialog, #profile-dialog, #records-dialog, #help-dialog) .version,
#settings-dialog .font-credit {
  color: var(--shell-muted, #617083);
  opacity: 1;
  line-height: 1.5;
}

/* Settings keep the full language label and a generous range-input hit area. */
#settings-dialog { text-align: left; }
#settings-dialog .setting-row {
  box-sizing: border-box;
  min-height: 62px;
  gap: 12px;
  margin: 0 0 9px;
  padding: 9px 12px;
  border: 1px solid #d4d9d0;
  border-radius: 16px;
  background: #fffdf6;
  color: var(--shell-ink, #253b56);
}
#settings-dialog .setting-row :is(label, span) { min-width: 0; line-height: 1.45; }
#settings-dialog .setting-row button {
  min-height: 44px;
  width: 70px;
  min-width: 70px;
  flex: 0 0 70px;
  border: 1px solid #9aa4af;
  background: #e7eaf0;
  color: #4d5b70;
  box-shadow: inset 0 2px 0 #fff, 0 2px 0 #a8afb9;
}
#settings-dialog .setting-row button.on {
  border-color: #64988a;
  background: linear-gradient(#ddffea, #a4e3c7);
  color: #254e47;
  box-shadow: inset 0 2px 0 #fff, 0 2px 0 #709c8f;
}
#settings-dialog :is(#language-select, .performance-setting select) {
  box-sizing: border-box;
  max-width: 65%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 8px;
  border: 1px solid #9eaaa9;
  border-radius: 11px;
  background: #edf9f0;
  color: var(--shell-ink, #253b56);
  font: inherit;
  font-size: 13px;
}
#settings-dialog .audio-setting { padding: 9px 12px 5px; }
#settings-dialog .audio-volume { min-height: 44px; gap: 10px; }
#settings-dialog .audio-volume input { height: 44px; accent-color: #278e7d; }
#settings-dialog .audio-volume output { color: #476278; font-weight: 700; }
#settings-dialog .performance-setting > small { color: var(--shell-muted, #617083); }
#settings-dialog #new { background: linear-gradient(#fff3bc, var(--shell-gold, #ffe49a)); box-shadow: inset 0 2px 0 #fff, 0 3px 0 #a58c58; }
#settings-dialog #intro-home { background: linear-gradient(#e8fff1, #b8eed8); color: var(--shell-ink, #253b56); }
#settings-dialog .settings-secondary { gap: 8px; border-top-color: #d5dbd0; padding-top: 14px; }
#settings-dialog .settings-secondary button {
  min-height: 46px;
  padding: 10px 7px;
  border: 1px solid #c8cfc8;
  border-radius: 12px;
  background: #fffdf6;
  color: #526278;
  box-shadow: inset 0 1px #fff, 0 2px 0 #d8d7cd;
  font-size: 12px;
  font-weight: 650;
}
#settings-dialog .settings-secondary :is(.reset-open, .reset-undo) { color: #775b64; }
#settings-dialog .settings-secondary .reset-undo { color: #326c5c; }

/* Profile cards use the same soft collectible-block palette as the wordmark. */
#profile-dialog.player-profile { padding: 22px 20px 20px; }
#profile-dialog .profile-identity {
  padding: 14px;
  border: 1px solid #c9d5c8;
  border-radius: 17px;
  background: #f0f8ed;
  box-shadow: inset 0 2px #fff;
}
#profile-dialog :is(.profile-identity label, .profile-country label, .profile-bests h3) { color: #3a5268; }
#profile-dialog :is(#profile-nickname, #profile-country) {
  min-height: 44px;
  border: 1px solid #9daeb2;
  background: #fffdf6;
  color: var(--shell-ink, #253b56);
  box-shadow: inset 0 2px 2px #39596f0d;
}
#profile-dialog .nickname-row { grid-template-columns: minmax(0, 1fr) minmax(66px, auto); }
#profile-dialog .nickname-row button { height: auto; min-height: 44px; padding: 9px 12px; }
#profile-dialog :is(#nickname-note, .profile-country small) { color: #637082; }
#profile-dialog #nickname-status { color: #276958; }
#profile-dialog .profile-country { border-top-color: #cdd8ca; }
#profile-dialog .profile-affinity {
  border: 1px solid #c8d2ba;
  background: #f1f5dc;
  color: #476354 !important;
}
#profile-dialog .profile-score-card {
  border: 1px solid #bac8d7;
  background: linear-gradient(#f4f4ff, #e2e4f5);
  box-shadow: inset 0 2px 0 #fff, 0 3px 0 #c4c9d6;
}
#profile-dialog .profile-score-card[data-mode="endless"] { border-color: #a8cabb; background: linear-gradient(#edfff0, #d6efdf); }
#profile-dialog .profile-score-card[data-mode="items"] { background: linear-gradient(#fff0f8, #f3dce9); }
#profile-dialog .profile-score-card[data-mode="timed"] { background: linear-gradient(#fff7d9, #f6e6b3); }
#profile-dialog .profile-score-card :is(span, small) { color: #56667c; }
#profile-dialog .profile-score-card strong { color: var(--shell-ink, #253b56); text-shadow: 0 2px #fff9; }
#profile-dialog .profile-vs { border-color: #cbc6da; background: #f0e9f6; }
#profile-dialog .profile-vs :is(span, strong, small) { color: #685b78; }
#profile-dialog #profile-share { min-height: 46px; border-color: #b5a5b8; background: #fae5ee; color: #6e4e67; box-shadow: inset 0 2px #fff, 0 2px #d5becd; }
#profile-dialog.player-profile #emblem-profile button {
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid #b2c7b8;
  border-radius: 12px;
  background: #e6f5de;
  color: #416c55;
  box-shadow: inset 0 2px #fff, 0 2px #bfd1b8;
  font-size: 12px;
}
#profile-dialog.player-profile #profile-share {
  min-height: 46px;
  border: 1px solid #b5a5b8;
  border-radius: 12px;
  background: #fae5ee;
  color: #6e4e67;
  box-shadow: inset 0 2px #fff, 0 2px #d5becd;
}
#profile-dialog .profile-network { border-top-color: #d5d8cf; }
#profile-dialog .profile-network summary { display: list-item; min-height: 44px; line-height: 1.5; padding: 10px 0; color: #526a7c; }
#profile-dialog .games-settings { color: #506378; }
#profile-dialog .games-settings :is(small, #games-status) { color: #617083; opacity: 1; }
#profile-dialog #games-disconnect { color: #70647c !important; }
:is(#profile-dialog, #settings-dialog, #help-dialog) .support-open,
:is(#profile-dialog, #settings-dialog, #support-dialog) .cloud-open {
  min-height: 44px;
  color: #476275;
  background: #edf4ef;
  border-color: #b4c6bf;
  box-shadow: inset 0 2px #fff, 0 2px #c3d0c7;
}

/* Rankings: warm medal podiums, mint selected tabs and readable navy figures. */
#records-dialog { width: min(430px, calc(100vw - 28px)); }
#records-dialog .rank-eyebrow { color: #687e79; letter-spacing: 1.6px; }
#records-dialog :is(.rank-tabs, .rank-periods) { gap: 6px; }
#records-dialog :is(.rank-tabs, .rank-periods) button {
  min-height: 44px;
  padding: 10px 5px;
  border: 1px solid #c0cbd0;
  background: #f4f3ec;
  color: #5b6c80;
  box-shadow: inset 0 1px #fff, 0 2px #cbd2cc;
}
#records-dialog button[aria-pressed="true"] { border-color: #648f81; background: linear-gradient(#dffff0, #b8ead0); color: #254e46; }
#records-dialog #rank-mine { margin: 15px 0; border: 1px solid #c8d2c3; border-radius: 20px; background: linear-gradient(#f1fae7, #e5f4e9); box-shadow: inset 0 2px #fff; }
#records-dialog #rank-mine > small { color: #5b7469; }
#records-dialog .rank-number strong { color: #274c59; text-shadow: 0 3px #fff9; }
#records-dialog .rank-score { color: #506678; }
#records-dialog .rank-gap { color: #36775e !important; }
#records-dialog .podium-place { border-color: #b1c1d2; background: linear-gradient(#eef4fe, #d7e0ef); box-shadow: inset 0 2px #fff; }
#records-dialog .podium-place.place-1 { border-color: #c9ac68; background: linear-gradient(#fff6ce, #f4dda1); }
#records-dialog .podium-place.place-3 { border-color: #d1ad9e; background: linear-gradient(#fff0e2, #eecfbe); }
#records-dialog .podium-crown { color: #99773a; }
#records-dialog .podium-place :is(strong, b) { color: #3e5269; }
#records-dialog .podium-place small { color: #6f706c; }
#records-dialog :is(#rank-status, .rank-list h3, .rank-footer p, .ranking-note) { color: #617083; }
#records-dialog #rank-actions button { min-height: 46px; background: linear-gradient(#e6fff2, #b3e8d0); color: #2c514c; border-color: #82a398; box-shadow: inset 0 2px #fff, 0 3px #91b2a2; }
#records-dialog .rank-row { border-bottom-color: #d9ddd4; color: #3e5369; }
#records-dialog .rank-position { color: #99713b; }
#records-dialog .rank-self { border-color: #92bba7; background: #ddf1e2; color: #2f5a4e; }
#records-dialog .rank-footer { border-top-color: #d1d8cf; }
#records-dialog .rank-footer button { min-height: 44px; color: #54736d; }
#records-dialog #rank-demo-label { border-color: #b69c5b; background: #fff1ca; color: #7f6835; }
#records-dialog .ranking-hero { border-color: #bfcdba; background: linear-gradient(#f0fae8, #dff1e4); box-shadow: inset 0 2px #fff; }
#records-dialog .ranking-hero :is(small, span) { color: #617669; opacity: 1; }
#records-dialog .ranking-hero strong { color: #2c5b51; }

/* Help diagrams keep their original illustration and motion behaviour. */
:is(#help-dialog, #guide-dialog) .visual-guide { border: 1px solid #c2d1d4; background: radial-gradient(ellipse at top, #ffffffb0, transparent 70%), #e2eff0; box-shadow: inset 0 2px #fff; }
:is(#help-dialog, #guide-dialog) .guide-chip { border-color: #bccdcc; background: #f8fcf1; color: #4c6574; }
:is(#help-dialog, #guide-dialog) .guide-chip b { color: #826629; }
:is(#help-dialog, #guide-dialog) .guide-chip em { color: #476b70; }
:is(#help-dialog, #guide-dialog) :is(.demo-counter, .demo-complete, .demo-duel-rivals, .demo-pass, .demo-items i, .demo-burst, .demo-clock > strong, .demo-fever) { color: #4d6579; }
:is(#help-dialog, #guide-dialog) .demo-duel-rivals strong { color: #866b88; }
:is(#help-dialog, #guide-dialog) .demo-you { color: #397a93; }
:is(#help-dialog, #guide-dialog) .demo-rival { color: #a35e83; }
:is(#help-dialog, #guide-dialog) .demo-clock > em { color: #38866e; }
:is(#help-dialog, #guide-dialog) .demo-fever b { color: #a2578a; }
:is(#help-dialog, #guide-dialog) .practice-kicker { color: #557b6c; }
:is(#help-dialog, #guide-dialog) .practice-countdown { color: #866a32 !important; }
:is(#help-dialog, #guide-dialog) .first-boss-rules > div { border-color: #c3d0c7; background: #eaf3e6; }
:is(#help-dialog, #guide-dialog) .first-boss-rules span { color: #876d3d; }
#help-dialog .help-facts { color: #5b6f7c !important; padding: 12px; border: 1px solid #d8d8bd; border-radius: 14px; background: #f7f3db; }
#help-dialog > a { display: flex; align-items: center; justify-content: center; box-sizing: border-box; width: 100%; min-height: 44px; margin: 8px 0; padding: 10px; border: 1px solid #baccc3; border-radius: 13px; background: #ecf6ed; color: #376c60; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
#help-dialog > .support-link { background: #fff9e7; border-color: #ddd1b1; color: #677067; }
#guide-dialog #guide-body { color: #51697a; }
#guide-dialog #guide-ok { background: linear-gradient(#fff3bd, #ffe49a); box-shadow: inset 0 2px #fff, 0 3px #b49b63; }

/* First launch acknowledgement and the separate optional notification question. */
:is(#welcome-consent, #welcome-news-choice) { padding: 0; text-align: center; }
:is(#welcome-consent, #welcome-news-choice) .welcome-consent-card { padding: 25px 22px 22px; gap: 14px; }
:is(#welcome-consent, #welcome-news-choice) .welcome-consent-icon { border: 2px solid #fff6dd; box-shadow: 0 3px 0 #7b8194, 0 6px 14px #273f5626; }
:is(#welcome-consent, #welcome-news-choice) .welcome-consent-intro { color: #3b7964; }
:is(#welcome-consent, #welcome-news-choice) button { background: linear-gradient(#fff8e8, #f2e8d2); color: #526379; border-color: #b6b4a9; box-shadow: inset 0 2px #fff, 0 2px #c6bda8; }
:is(#welcome-consent, #welcome-news-choice) .welcome-consent-continue { border-color: #679687; background: linear-gradient(#ddffeb, #a9e5c8); color: #2c5548; box-shadow: inset 0 2px #fff, 0 3px #789f88; }
:is(#welcome-consent, #welcome-news-choice) #welcome-consent-optional { color: #637083; }
:is(#welcome-consent, #welcome-news-choice) .welcome-consent-reader { background: var(--shell-paper, #fff9ed); }
:is(#welcome-consent, #welcome-news-choice) .welcome-consent-reader header { border-bottom-color: #d1d9d0; background: #edf7ec; }
#welcome-news-choice .welcome-consent-bell { color: #388d7a; }
#welcome-news-choice .welcome-consent-later { background: #fffaf0; border-color: #d0cbbd; color: #647083; }

/* Support, backup and reset retain their existing controls and identity data. */
#support-dialog .support-intro, #support-dialog .support-save-note { color: #637083; }
#support-dialog .support-id-card { border-color: #a7c9b9; background: linear-gradient(#effbed, #dff0df); box-shadow: inset 0 2px #fff; }
#support-dialog .support-id-card label { color: #396a58; }
#support-dialog #support-id, #support-dialog textarea { border: 1px solid #bfcbc3; background: #fffef6; color: #395268; }
#support-dialog .support-id-card small, #support-dialog dt { color: #637083; }
#support-dialog dd { color: #455a6f; overflow-wrap: anywhere; }
#support-dialog .support-id-copy, #support-dialog .support-copy { background: linear-gradient(#dffff0, #b0e6ce); color: #2c554c; box-shadow: inset 0 2px #fff, 0 3px #809e92; }
#support-dialog details { border-top-color: #d2dacf; color: #617083; }
#support-dialog summary { min-height: 44px; padding: 7px 0; }
#support-dialog .support-status { color: #32765d; }
#cloud-dialog :is(.cloud-flow, .cloud-account, small, .cloud-notice) { color: #5f7482; }
#cloud-dialog .cloud-hero { color: #459b86; }
#cloud-dialog .cloud-hero b { color: #a48a40; }
#cloud-dialog .cloud-warning { border-color: #dac48a; background: #fff2cc; color: #81673a; }
#cloud-dialog .cloud-actions button + button, #cloud-dialog .cloud-secondary { background: #fff9ec; color: #647183; border-color: #c5c7bb; box-shadow: inset 0 2px #fff, 0 2px #d1cfbf; }
#cloud-dialog .cloud-backup-card { border-color: #bbd0bd; background: #ecf7e8; }
#cloud-dialog .cloud-summary { color: #38715d; border-top-color: #b9cfb8; }
#cloud-dialog .cloud-status { color: #8b743c; }
#reset-dialog .reset-kept { border-color: #b6ccb7; background: #eaf5e2; color: #456752; }
#reset-dialog small { color: #647083; }
#reset-dialog .reset-cancel { border-color: #bcc8bd; background: #eff8e9; color: #50705d; box-shadow: inset 0 2px #fff, 0 2px #bbccba; }
#reset-dialog .reset-error { color: #a65059; }
#flower-account { text-align: left; }
#flower-account header { gap: 12px; }
#flower-account header h2 { min-width: 0; font-size: 24px; }
#flower-account :is(label, small, [data-identity]) { color: #607083; }
#flower-account input { border-color: #a5b6b3; background: #fffef8; color: #253b56; }
#flower-account [data-status] { color: #34775f; }
#flower-account [data-conflict] { padding: 13px; border: 1px solid #dfbd91; border-radius: 15px; background: #fff1d9; }

/* Music-room controls remain recognisable as a player rather than game CTAs. */
#ost-dialog { text-align: left; }
#ost-dialog .ost-header small { color: #6f7b87; }
#ost-dialog .ost-record { border-color: #9ba9aa; background: repeating-radial-gradient(circle, #33465a 0 3px, #4b6074 4px 5px); box-shadow: 0 5px 0 #a6b0ad, 0 10px 17px #263c5c26, inset 0 0 0 7px #fff0c526; }
#ost-dialog .ost-record i { border-color: #efecd98c; }
#ost-dialog .ost-now small { color: #7a5e82; }
#ost-dialog .ost-now > span { color: #73818b; }
#ost-dialog .ost-timeline > div, #ost-dialog .ost-volume, #ost-dialog .ost-list-heading span, #ost-dialog .ost-count { color: #657784; }
#ost-dialog .ost-timeline input { min-height: 44px; accent-color: #318d7b; }
#ost-dialog .ost-volume input { height: 44px; accent-color: #609785; }
#ost-dialog .ost-controls { gap: 8px; }
#ost-dialog .ost-controls button { width: 44px; height: 44px; min-height: 44px; background: #edf3e9 !important; border: 1px solid #bdcbbf !important; color: #506679 !important; box-shadow: inset 0 2px #fff, 0 2px #c1cebf !important; }
#ost-dialog .ost-controls button[data-ost="play"] { width: 56px; height: 56px; background: linear-gradient(#fff4c6, #ffe49a) !important; color: #715d3e !important; border-color: #baa16b !important; box-shadow: inset 0 2px #fff, 0 3px #b89c61 !important; }
#ost-dialog .ost-controls button[aria-pressed="true"] { background: #bfe8d4 !important; color: #255d4d !important; }
#ost-dialog .ost-list { gap: 8px; }
#ost-dialog .ost-list button { border: 1px solid #d2d8ce !important; background: #fffdf5 !important; color: #3c5269 !important; box-shadow: inset 0 2px #fff, 0 2px #dddccf !important; }
#ost-dialog .ost-list button.selected { border-color: #a3c1ad !important; background: #e4f5de !important; }
#ost-dialog .ost-number, #ost-dialog .ost-track-copy small { color: #71808b; }
#ost-dialog .ost-indicator { color: #4f9179; }
#ost-dialog [data-ost="error"] { color: #a65059; }

/* The library's remote content keeps its own layout; its local shell matches. */
#other-games-dialog { text-align: left; }
#other-games-dialog .map-header { gap: 12px; }
#other-games-dialog .map-header small, #other-games-dialog .other-subtitle { color: #697789; }
#other-games-dialog .other-banner { border: 1.5px solid #a1b9b5; background: linear-gradient(135deg, #f5fff0, #d9eddf); color: #355767; box-shadow: inset 0 2px #fff, 0 4px #a6c1b3; }
#other-games-dialog .other-beat { background: linear-gradient(135deg, #faf1ff, #e7d9f5); border-color: #b8a8cb; }
#other-games-dialog .other-flow { background: linear-gradient(135deg, #efffff, #ccebf1); border-color: #9fc4cd; }
#other-games-dialog .other-banner small { color: #657485; }
#other-games-dialog .other-banner em { border-color: #bdc7b6; background: #fff9df; color: #7a7048; }

/* Tile-match lives in an iframe and uses these four explicit panel containers. */
:is(#settings, #clear, #over).overlay {
  background: #233b566b;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
:is(#settings, #clear, #over).overlay > .card,
#mission-guide {
  box-sizing: border-box;
  color: var(--shell-ink, #253b56);
  border: 2px solid var(--shell-line, #52637a);
  border-radius: 24px;
  background: linear-gradient(155deg, #fffdf4, var(--shell-paper, #fff9ed) 64%, #f6efe0);
  box-shadow: inset 0 0 0 3px var(--shell-cream, #fff6dd),
    inset 0 6px 0 #ffffffc9, 0 5px 0 #42546f, 0 15px 35px var(--shell-shadow, #263c5c40);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
#mission-guide {
  width: min(410px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  max-height: calc(100dvh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  padding: 22px 20px;
  overflow: auto;
}
#mission-guide::backdrop { background: #233b566b; }
:is(#settings, #clear, #over, #mission-guide) :is(h2, h3) { color: #253b56; font-style: normal; text-shadow: none; line-height: 1.35; }
:is(#settings, #clear, #over, #mission-guide) :is(p, .note, .stat small) { color: #617083; line-height: 1.6; }
:is(#settings, #clear, #over, #mission-guide) button:not(.x-btn) {
  min-height: 44px;
  min-width: 0;
  border: 1.5px solid #7f9d90;
  border-radius: 14px;
  background: linear-gradient(#e6fff1, #b8eed8);
  color: #253b56;
  box-shadow: inset 0 2px #fffc, 0 3px #8ca89a;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}
:is(#settings, #clear, #over, #mission-guide) button.ghost { border-color: #b9bec1; background: #f2f3ed; color: #5c6c7e; box-shadow: inset 0 2px #fff, 0 2px #ccd0c7; }
:is(#settings, #mission-guide) .x-btn { border: 1.5px solid #7c8294; border-radius: 14px; color: #253b56; background: linear-gradient(#fff5f9, #f4cedb); box-shadow: inset 0 2px #fffd, 0 2px #a08b9d; }
:is(#settings, #clear, #over, #mission-guide) :is(button, input, select):focus-visible { outline: 3px solid #087c72; outline-offset: 3px; }
#settings .row { color: #3f596c; border-bottom-color: #d4dbcf; }
#settings .row .toggle { min-height: 44px; width: 72px; flex: 0 0 72px; background: #e5e9eb; color: #5a697c; border-color: #9daab0; box-shadow: inset 0 2px #fff, 0 2px #b6c1c2; }
#settings .row .toggle.on { background: linear-gradient(#ddffea, #a4e3c7); border-color: #64988a; color: #254e47; box-shadow: inset 0 2px #fff, 0 2px #709c8f; }
#settings .audio-volume { min-height: 44px; }
#settings .audio-volume input { height: 44px; accent-color: #278e7d; }
#settings .audio-volume output { color: #476278; }
#settings .row select { min-height: 44px; color: #253b56; background: #edf9f0; border-color: #9eaaa9; }
#clear .stat b { color: #355b61; }
#clear .stars span { color: #c5d0c4; filter: drop-shadow(0 2px 0 #9da99e); }
#clear .stars span.on { color: #f7c954; filter: drop-shadow(0 2px 0 #a88948); }

/* The locked-mode explanation and unlocked-mode celebration share the shell. */
:is(#locked-mode-dialog, #unlock-dialog) {
  box-sizing: border-box;
  width: min(390px, calc(100vw - 28px)) !important;
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  max-height: calc(100dvh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  padding: 24px 22px 22px !important;
  overflow: auto;
  overscroll-behavior: contain;
  border: 2px solid var(--shell-line, #52637a) !important;
  border-radius: 24px;
  background: linear-gradient(155deg, #fffdf4, var(--shell-paper, #fff9ed) 64%, #f6efe0) !important;
  color: var(--shell-ink, #253b56) !important;
  box-shadow: inset 0 0 0 3px var(--shell-cream, #fff6dd),
    inset 0 6px 0 #ffffffc9, 0 5px 0 #42546f, 0 15px 35px var(--shell-shadow, #263c5c40);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
:is(#locked-mode-dialog, #unlock-dialog)::backdrop { background: #233b566b; }
:is(#locked-mode-dialog, #unlock-dialog) h2 {
  margin: 15px 0 12px !important;
  color: #253b56;
  font-size: 23px !important;
  font-style: normal;
  font-weight: 850;
  line-height: 1.4;
  letter-spacing: -.025em;
  text-shadow: none;
  overflow-wrap: anywhere;
}
:is(#locked-mode-dialog, #unlock-dialog) .unlock-icon {
  width: 76px;
  height: 76px;
  margin: 8px auto 17px;
  border: 2px solid #8aa48f;
  background: linear-gradient(#efffe9, #bee6c4);
  color: #467961;
  box-shadow: inset 0 3px #fff, 0 4px #89a692, 0 8px 15px #2c4a5e1a;
  font-size: 37px;
}
#locked-mode-dialog .unlock-icon svg {
  width: 37px;
  height: 37px;
  fill: #edfff0;
  stroke: #54816b;
  stroke-width: 1.7;
}
#locked-mode-dialog > small { color: #667a77; font-size: 12px; line-height: 1.5; }
#locked-mode-dialog .lock-condition {
  margin: 12px 0;
  padding: 14px 12px;
  border: 1px solid #d5c593;
  border-radius: 15px;
  background: #fff4d3;
  color: #78643a;
  font-size: 14px !important;
  line-height: 1.75;
  overflow-wrap: anywhere;
}
#locked-mode-dialog .lock-progress {
  align-items: center;
  gap: 10px;
  margin: 15px 0 18px;
  padding: 0 2px;
}
#locked-mode-dialog .lock-progress progress {
  min-width: 0;
  height: 10px;
  border: 1px solid #b6c6bb;
  border-radius: 999px;
  background: #e4e9dc;
  accent-color: #5aab8e;
}
#locked-mode-dialog .lock-progress progress::-webkit-progress-bar { background: #e4e9dc; }
#locked-mode-dialog .lock-progress progress::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, #7dccac, #c1e7a8); }
#locked-mode-dialog .lock-progress progress::-moz-progress-bar { border-radius: 999px; background: linear-gradient(90deg, #7dccac, #c1e7a8); }
#locked-mode-dialog .lock-progress b { flex: none; color: #5b746b; font-size: 12px; }
#locked-mode-dialog .lock-footnote { color: #647b78; font-size: 12px !important; line-height: 1.6; }
#unlock-dialog > p { margin: 12px 0 18px; color: #6c5d83; font-size: 18px !important; line-height: 1.5; }
:is(#locked-mode-dialog, #unlock-dialog) button {
  min-height: 48px;
  border: 1.5px solid #7d9b8a;
  border-radius: 14px;
  background: linear-gradient(#e6fff1, #b8eed8);
  color: #2c5149;
  box-shadow: inset 0 2px #fffc, 0 3px #8ca89a;
  font-weight: 800;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}
#unlock-dialog button:last-child { border: 1px solid #bfc5bd; background: #f5f5eb; color: #657568; box-shadow: inset 0 2px #fff, 0 2px #c8d0c1; }
#locked-mode-dialog .lock-dismiss {
  box-sizing: border-box;
  width: 44px !important;
  min-width: 44px;
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 !important;
  margin: 0 !important;
  display: grid;
  place-items: center;
  border: 1.5px solid #7c8294;
  border-radius: 14px;
  background: linear-gradient(#fff5f9, #f4cedb) !important;
  color: #253b56;
  box-shadow: inset 0 2px #fffd, 0 2px #a08b9d !important;
  font-size: 25px;
  line-height: 1;
}
:is(#locked-mode-dialog, #unlock-dialog) button:focus-visible { outline: 3px solid #087c72; outline-offset: 3px; }

html:lang(ko) :is(#settings-dialog, #profile-dialog, #records-dialog,
    #help-dialog, #guide-dialog, #support-dialog, #cloud-dialog, #reset-dialog,
    #ost-dialog, #flower-account, #other-games-dialog, #settings, #clear,
    #over, #mission-guide, #locked-mode-dialog, #unlock-dialog) :is(h2, h3, p, button, label, summary, small, a) {
  word-break: keep-all;
  overflow-wrap: break-word;
}

@media (max-width: 350px), (max-height: 560px) {
  :is(#settings-dialog, #profile-dialog, #records-dialog, #help-dialog,
      #guide-dialog, #support-dialog, #cloud-dialog, #reset-dialog,
      #ost-dialog, #flower-account, #other-games-dialog),
  #profile-dialog.player-profile {
    width: calc(100vw - 22px);
    max-width: calc(100vw - 22px);
    padding: 17px 14px 16px;
    border-radius: 21px;
  }
  :is(#settings-dialog, #profile-dialog, #records-dialog, #help-dialog) .map-header h2 { font-size: 22px; }
  #settings-dialog .setting-row { padding-inline: 10px; gap: 8px; }
  #settings-dialog :is(#language-select, .performance-setting select) { max-width: 65%; font-size: 12px; }
  #profile-dialog .profile-identity { padding: 11px; }
  :is(#welcome-consent, #welcome-news-choice) .welcome-consent-card { padding: 19px 16px; }
  #ost-dialog .ost-controls { gap: 5px; }
  :is(#settings, #clear, #over).overlay > .card, #mission-guide { padding: 18px 14px; border-radius: 21px; }
  :is(#locked-mode-dialog, #unlock-dialog) { padding: 21px 16px 19px !important; border-radius: 21px; }
  :is(#locked-mode-dialog, #unlock-dialog) h2 { font-size: 21px !important; }
}
