.site-language{display:inline-flex;align-items:center;justify-content:flex-end;gap:6px;margin:0;flex-shrink:0;font-family:system-ui,-apple-system,"Noto Sans TC","Noto Sans JP",sans-serif;font-size:.875rem;line-height:1.4;color:inherit}
/* Stabilize Safari's automatic text inflation while preserving user zoom. */
html { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
.site-language:has(select[aria-busy=true]) { opacity:.65; cursor:progress; }
@media(max-width:760px) {
  body :is(select,textarea,input:not([type=radio],[type=checkbox],[type=range],[type=color],[type=button],[type=submit],[type=hidden])) { font-size:max(16px,1rem); }
}
.site-language select{min-height:40px;max-width:132px;width:auto;margin:0;padding:6px 25px 6px 10px;border:1px solid currentColor;border-radius:10px;background:transparent;color:inherit;font:inherit;cursor:pointer}
.site-language select option{background:#fffdf7;color:#172c31}
.site-language select:focus-visible{outline:3px solid #e6aa43;outline-offset:3px}
.site-language .language-label{font-size:.75rem;opacity:.8}
.site-header,.photos-header,.fantasy-site-header,.tarot-nav,.support-header,.topbar,.topline{flex-wrap:wrap}
html:lang(en) :is(h1,h2,h3,h4,strong,button,summary),html:lang(ja) :is(h1,h2,h3,h4,strong,button,summary){overflow-wrap:anywhere;word-break:normal}
html:lang(en) .amao-home .hero-copy h1{font-size:clamp(2.25rem,4.3vw,4.8rem);line-height:1.12}
html:lang(en) .amao-home :is(h1,h2){letter-spacing:-.025em;text-wrap:balance}
html:lang(en) .amao-home .big-clap strong,html:lang(ja) .amao-home .big-clap strong{overflow-wrap:normal;white-space:nowrap}
@media(max-width:760px){html:lang(en) .amao-home nav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 16px}html:lang(en) .amao-home nav a{min-width:0;line-height:1.4}html:lang(en) .amao-home .hero-copy h1{font-size:clamp(2.1rem,7vw,3rem)}html:lang(en) .amao-home .fanclub h2 span,html:lang(ja) .amao-home .fanclub h2 span{display:block}}
html:lang(en) .amao-home .greeting-message{font-size:1.4rem}
html:lang(en) .amao-home .greeting-message span{font-size:.8rem}
html:lang(en) .photos-lightbox-nav,html:lang(en) .fantasy-lightbox-nav{grid-template-columns:minmax(0,1fr) auto minmax(0,1fr)}
@media(max-width:760px){.site-language .language-label{display:none}.site-language select{max-width:112px;min-height:40px;font-size:.8125rem}.site-header .site-language{margin-left:auto;order:1}.site-header nav{order:2;width:100%}.photos-header .site-language,.fantasy-site-header .site-language,.tarot-nav .site-language,.support-header .site-language{margin-left:auto}.topbar,.topline{gap:8px}.topbar .site-language,.topline .site-language{margin-left:auto}.escape-shell .topline>span,#amao-mischief .topline>span{display:none}.photos-lightbox-close,.fantasy-lightbox-close{background:#fff9ec;box-shadow:0 2px 10px #0002}}
@media(prefers-reduced-motion:reduce){.site-language select{scroll-behavior:auto}}

/* Keep translated labels within the same controls and image boundaries. */
html:lang(en) .photo-choice[aria-pressed=true]:after{content:"Selected"}
html:lang(ja) .photo-choice[aria-pressed=true]:after{content:"選択中"}
.preview-caption>span{min-width:0;overflow-wrap:anywhere}
.preview-caption>span:last-child{white-space:nowrap}
.escape-shell .jump-button :is(b,span){min-width:0}
.escape-shell .jump-button b{flex-shrink:0}
.escape-shell .jump-button span{overflow-wrap:anywhere;line-height:1.5}
.escape-shell .result-actions button{white-space:normal}
@media(max-width:600px){html:lang(en) .escape-shell .jump-button{gap:12px;padding:12px}html:lang(en) .escape-shell .jump-button b{font-size:22px}html:lang(en) .escape-shell .jump-button span{max-width:65%;line-height:1.5}.fantasy-brand>span{flex-shrink:0}.fantasy-site-header{gap:8px}}
@media(orientation:landscape) and (max-height:540px){.escape-shell>.topline{display:flex;grid-column:1;grid-row:1;margin:0;gap:6px}.escape-shell .topline .language-label,.escape-shell .topline>span{display:none}.escape-shell #sound{position:static;grid-column:2;grid-row:1;min-width:0;padding:8px}.escape-shell .topline .site-language select{max-width:112px}.escape-shell .stage{width:min(100%,calc((100dvh - 166px)*2))}.escape-shell .playing-controls{grid-row:2/6}.escape-shell .topline .site-language{margin-left:auto}}

body:has(.export-bar){padding-bottom:calc(var(--studio-export-height,100px) + 16px)}
@media(max-width:760px){
  /* Route styles can arrive last; page scope keeps this grid above their header defaults. */
  :is(.photos-page,.fantasy-page,.support-page,.tarot-page) :is(.photos-header,.fantasy-site-header,.support-header,.tarot-nav){display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px 12px}
  :is(.photos-header,.fantasy-site-header,.support-header,.tarot-nav)>.site-language{grid-column:2;grid-row:1;justify-self:end;margin:0}
  :is(.photos-header,.fantasy-site-header,.support-header,.tarot-nav)>a:first-child{grid-column:1;grid-row:1;min-width:0}
  :is(.photos-header,.fantasy-site-header,.support-header)>a:nth-child(2){grid-column:1/-1;grid-row:2;justify-self:end}
  .tarot-nav>div{grid-column:1/-1;grid-row:2;justify-self:end;display:flex;flex-wrap:wrap;gap:8px}
}

/* Catalan uses the same Latin-text layouts; labels remain locale-specific. */
html:lang(ca) :is(h1,h2,h3,h4,strong,button,summary){overflow-wrap:anywhere;word-break:normal}
html:lang(ca) .amao-home .hero-copy h1{font-size:clamp(2.25rem,4.3vw,4.8rem);line-height:1.12}
html:lang(ca) .amao-home :is(h1,h2){letter-spacing:-.025em;text-wrap:balance}
html:lang(ca) .amao-home .big-clap strong{overflow-wrap:normal;white-space:nowrap}
@media(max-width:760px){html:lang(ca) .amao-home nav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 16px}html:lang(ca) .amao-home nav a{min-width:0;line-height:1.4}html:lang(ca) .amao-home .hero-copy h1{font-size:clamp(2.1rem,7vw,3rem)}html:lang(ca) .amao-home .fanclub h2 span{display:block}}
html:lang(ca) .amao-home .greeting-message{font-size:1.4rem}
html:lang(ca) .amao-home .greeting-message span{font-size:.8rem}
html:lang(ca) .photos-lightbox-nav,html:lang(ca) .fantasy-lightbox-nav{grid-template-columns:minmax(0,1fr) auto minmax(0,1fr)}
@media(max-width:600px){html:lang(ca) .escape-shell .jump-button{gap:12px;padding:12px}html:lang(ca) .escape-shell .jump-button b{font-size:22px}html:lang(ca) .escape-shell .jump-button span{max-width:65%;line-height:1.5}.fantasy-brand>span{flex-shrink:0}.fantasy-site-header{gap:8px}}
html:lang(ca) .photo-choice[aria-pressed=true]:after{content:"Seleccionada"}

/* Japanese headings and controls use strict punctuation and balanced lines. */
html:lang(ja) body { line-break:strict; }
html:lang(ja) body :is(h1,h2,h3,h4,button,summary,.photo-choice>span,.artwork-label,.swatch>span,.pick>span,.decoration-pick>span) { text-wrap:balance; }
html:lang(ja) body :is(p,.hint) { text-wrap:pretty; }
@supports (word-break:auto-phrase) {
  html:lang(ja) body :is(h1,h2,h3,h4,button,summary,.photo-choice>span,.swatch>span,.pick>span,.decoration-pick>span) { word-break:auto-phrase; }
}
