/* Shared by React routes and standalone studios/games. Scope beats late route CSS. */
:root body .amao-site-header {
  box-sizing:border-box; display:flex; flex-direction:row; flex-wrap:wrap; align-items:center;
  justify-content:space-between; gap:12px 16px; min-height:76px; height:auto;
  padding:16px clamp(16px,4vw,56px); margin:0;
  background:#fffdf7; color:#1f2922; border:0; border-bottom:1px solid #1f29222e;
  font-family:system-ui,-apple-system,"Noto Sans TC","Noto Sans JP",sans-serif;
}
:root body .amao-site-header * { box-sizing:border-box; }
:root body .site-brand {
  display:inline-flex; align-items:center; gap:11px;
  min-height:44px; padding:0; color:inherit; text-decoration:none;
  font-weight:800; font-size:.875rem; line-height:1.4; letter-spacing:.07em;
}
:root body .amao-site-header .site-brand { flex:1 1 auto; min-width:max-content; }
:root body .amao-site-header .site-brand::before { content:none; }
:root body .site-brand-mark {
  display:grid; place-items:center; flex:0 0 35px; width:35px; height:35px;
  border-radius:50%; background:#ba502d url("/ui/amao-mark.svg?v=118") center/contain no-repeat;
  color:transparent; font:0/0 sans-serif; letter-spacing:0;
}
:root body .site-brand-name {
  display:block; flex:none; width:108px; height:20px;
  color:inherit;
  background:currentColor;
  mask:url("/ui/amao-wordmark.svg") center/contain no-repeat;
  -webkit-mask:url("/ui/amao-wordmark.svg") center/contain no-repeat;
  font:0/0 sans-serif; letter-spacing:0;
  overflow-wrap:normal; word-break:normal; white-space:nowrap;
}
:root body .amao-site-header .site-language {
  display:inline-flex; flex:0 0 auto; align-items:center; gap:8px;
  margin:0 0 0 auto; color:inherit; font-size:.875rem; order:1;
}
:root body .amao-site-header .site-language-globe {
  display:block; flex:0 0 26px; width:26px; height:30px;
  background:url("/ui/language-cat-globe.svg") center/contain no-repeat;
  color:transparent; font:0/0 sans-serif; letter-spacing:0;
}
:root body .amao-site-header .language-label { display:none; }
:root body .amao-site-header :is(.site-language-short,.site-language-chevron) { display:none; }
:root body .amao-site-header .site-language select {
  min-height:44px; max-width:180px; padding:8px 28px 8px 12px;
  border:1.5px solid #1f2922; border-radius:12px;
  background:#fffdf7; color:#1f2922; font:inherit; line-height:1.4;
}
:root body .amao-site-header .site-header-links {
  display:flex; flex:1 0 100%; flex-wrap:wrap; align-items:center;
  justify-content:flex-end; gap:6px 20px; min-width:0; margin:0; padding:0; order:2;
  font-size:.875rem; font-weight:650; line-height:1.5;
}
:root body .amao-site-header .site-header-links :is(a,button) {
  display:inline-flex; align-items:center; min-height:44px; max-width:100%;
  padding:6px 0; color:inherit; font:inherit; line-height:1.5;
  text-decoration:none; white-space:normal; overflow-wrap:anywhere;
}
:root body .amao-site-header .site-header-links button {
  padding:6px 14px; border:1px solid #1f292255; border-radius:999px; background:transparent;
}
:root body .amao-site-header :is(a,button,select):focus-visible {
  outline:3px solid #df6b2f; outline-offset:3px;
}
:root body .amao-site-header .site-header-links a:hover { color:#ba502d; }
:root body .amao-site-header .site-header-links button[aria-pressed=false] { color:#626b63; }
:root body .amao-site-header .site-menu-toggle { display:none; }
@media(max-width:760px) {
  :root body .amao-site-header { padding:12px 16px; gap:8px 12px; }
  :root body .amao-site-header .site-brand { gap:11px; font-size:.75rem; }
  :root body .amao-site-header .site-brand-mark { flex-basis:35px; width:35px; height:35px; }
  :root body .amao-site-header .site-brand-name { width:108px; height:20px; }
  :root body .amao-site-header .site-language { gap:6px; font-size:.8125rem; }
  :root body .amao-site-header .site-language-globe { flex-basis:24px; width:24px; height:28px; }
  :root body .amao-site-header .site-header-links { gap:4px 16px; }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu {
    display:grid; grid-template-columns:minmax(0,1fr) auto 44px; align-items:center;
    padding:16px 12px; gap:8px 8px; border-bottom-color:#e6e3db;
  }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-brand {
    grid-column:1; grid-row:1; min-width:0;
  }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-language {
    position:relative; grid-column:2; grid-row:1; min-height:44px;
    gap:5px; margin:0; padding:0 3px; color:#455149;
    font-size:.875rem; font-weight:600; white-space:nowrap; cursor:pointer;
  }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-language-short {
    display:block; max-width:64px; overflow:hidden; text-overflow:ellipsis;
  }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-language-chevron {
    display:block; flex:0 0 7px; width:7px; height:7px; margin:0 2px 4px 0;
    border-right:1.5px solid currentColor; border-bottom:1.5px solid currentColor; transform:rotate(45deg);
  }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-language select {
    position:absolute; inset:0; z-index:1; width:100%; max-width:none; height:100%;
    min-height:0; margin:0; padding:0; border:0; opacity:0; cursor:pointer;
  }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-language:focus-within {
    outline:2px solid #bc6747; outline-offset:2px; border-radius:8px;
  }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-menu-toggle {
    display:grid; grid-column:3; grid-row:1; place-items:center; width:44px; height:44px;
    padding:0; border:0; border-radius:50%; background:transparent;
    color:#455149; cursor:pointer;
  }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-menu-toggle:hover,
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu.is-menu-open .site-menu-toggle {
    background:#f0eee6;
  }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-menu-icon {
    display:grid; gap:4px;
  }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-menu-icon span {
    display:block; width:20px; height:2px; border-radius:2px; background:currentColor;
  }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-header-links {
    display:none; grid-column:1/-1; grid-row:2; grid-template-columns:repeat(2,minmax(0,1fr));
    width:100%; padding:12px 0 0; border-top:1px solid #e6e3db; gap:4px 16px;
  }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu.is-menu-open .site-header-links {
    display:grid;
  }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-header-links a {
    display:flex; width:100%; min-height:44px; padding:6px 0; border-radius:10px;
  }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-header-links a:hover {
    background:#f2f1e9;
  }
}
@media(max-width:340px) {
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-brand { gap:5px; }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-brand-mark { flex-basis:30px; width:30px; height:30px; }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-brand-name { width:86px; height:16px; }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-language { gap:3px; }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-language-globe { flex-basis:20px; width:20px; height:24px; }
}
/* Full-width header against the oracle's inset page, with the same site background. */
:root body .tarot-page .amao-site-header {
  max-width:none; margin-inline:calc(-1 * max(22px,5vw));
}
/* Keep the standalone game frame separate from the shared header's margin reset. */
:root body #amao-mischief>.amao-site-header {
  margin-block-end:20px;
}
@media(max-width:380px) {
  :root body .tarot-page .amao-site-header { margin-inline:-16px; }
}
@media(max-width:360px) {
  :root body .amao-site-header { column-gap:8px; }
  :root body .amao-site-header .site-brand { flex-basis:130px; gap:10px; font-size:.6875rem; }
  :root body .amao-site-header .site-brand-mark { flex-basis:32px; width:32px; height:32px; }
  :root body .amao-site-header .site-brand-name { width:99px; height:18.33px; }
  :root body .amao-site-header .site-language { font-size:.75rem; }
  :root body .amao-site-header .site-language-globe { flex-basis:22px; width:22px; height:26px; }
  :root body .amao-site-header .site-language select { padding-inline:10px 20px; }
}
/* iOS magnifies a focused select below 16px, including the invisible home select. */
:root body .amao-site-header .site-language select { font-size:max(16px,1rem); }
@media(max-width:319px) {
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu { grid-template-columns:minmax(0,1fr) 44px; }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-brand { grid-column:1/-1; }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-language { grid-column:1; grid-row:2; justify-self:start; }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-menu-toggle { grid-column:2; grid-row:2; }
  :root body .amao-home .amao-site-header.amao-site-header--mobile-menu .site-header-links { grid-row:3; }
}
@media(max-width:600px) {
  :root body .escape-shell>.amao-site-header { margin-inline:-12px; }
  :root body #amao-mischief>.amao-site-header { margin-inline:-8px; }
}
@media(orientation:landscape) and (max-height:540px) {
  :root body .escape-shell>.amao-site-header {
    grid-column:1/-1; grid-row:1; min-height:52px; padding:4px 10px; gap:6px 12px;
  }
  :root body .escape-shell>.amao-site-header .site-brand { flex-basis:145px; font-size:.75rem; }
  :root body .escape-shell>.amao-site-header .site-brand-mark { flex-basis:35px; width:35px; height:35px; }
}
