:root {
  color-scheme: dark;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #202348;
  color: #fff9e8;
  --toolbar-height: 52px;
  --navy: #202348;
  --yellow: #ffdf58;
  --aqua: #81dfd2;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { min-width: 280px; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--aqua); outline-offset: 3px; }
.portal { display: grid; grid-template-rows: var(--toolbar-height) minmax(0, 1fr); height: 100%; height: 100dvh; width: 100%; background: var(--navy); }
.portal:fullscreen { height: 100%; }
.toolbar { display: flex; align-items: center; gap: 18px; height: var(--toolbar-height); padding: 0 max(12px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); border-bottom: 1px solid #ffffff20; background: var(--navy); }
.brand { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 850; letter-spacing: -.5px; }
.brand img { display: block; border-radius: 5px; }
.stage-picker { display: flex; flex: 0 0 auto; gap: 3px; padding: 3px; border: 1px solid #ffffff26; border-radius: 8px; background: #161a36; }
.stage-link { display: inline-flex; align-items: center; justify-content: center; min-height: 30px; padding: 0 13px; border-radius: 5px; font-size: 13px; font-weight: 750; white-space: nowrap; color: #fff9e8c7; }
.stage-link[aria-current="page"] { color: #202348; background: var(--yellow); box-shadow: 0 1px 0 #0003; }
.stage-link:hover:not([aria-current]) { background: #ffffff12; color: #fff9e8; }
.actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #fff9e8d9; }
.icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-button:hover { border-color: #ffffff30; background: #ffffff12; color: var(--aqua); }
.icon-button[aria-pressed="true"] { background: #ffffff18; color: var(--aqua); }
.player { position: relative; min-height: 0; overflow: hidden; background: #11152e; }
iframe { display: block; width: 100%; height: 100%; border: 0; background: #202348; }
.notice { position: absolute; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); left: 12px; display: flex; align-items: center; justify-content: center; gap: 12px; width: fit-content; max-width: calc(100% - 24px); margin: 0 auto; padding: 10px 13px; border: 1px solid #ffffff30; border-radius: 8px; background: #202348f5; color: #fff9e8; box-shadow: 0 3px 16px #0003; font-size: 12px; line-height: 1.5; }
.notice a { color: var(--aqua); font-weight: 700; white-space: nowrap; text-decoration: underline; text-underline-offset: 3px; }
.notice button { flex: 0 0 28px; height: 28px; padding: 0; border: 0; border-radius: 4px; background: #ffffff12; font-size: 21px; line-height: 1; }
.noscript-message { position: absolute; right: 12px; bottom: 12px; left: 12px; padding: 12px; margin: 0; border-radius: 6px; background: var(--navy); font-size: 13px; }
.noscript-message a { text-decoration: underline; }

@media (max-width: 600px) {
  :root { --toolbar-height: 48px; }
  .toolbar { gap: 8px; padding-right: max(6px, env(safe-area-inset-right)); padding-left: max(8px, env(safe-area-inset-left)); }
  .brand { gap: 5px; font-size: 15px; }
  .brand img { width: 23px; height: 23px; }
  .stage-picker { padding: 2px; gap: 2px; }
  .stage-link { min-height: 30px; padding: 0 9px; font-size: 12px; }
  .actions { gap: 1px; }
  .icon-button { width: 32px; height: 34px; padding: 7px; }
  .notice { gap: 8px; padding: 8px 10px; }
}

@media (max-width: 380px) {
  .brand span { display: none; }
  .toolbar { gap: 7px; }
  .stage-link { padding: 0 8px; }
  .notice { flex-wrap: wrap; justify-content: flex-start; }
  .notice button { margin-left: auto; }
}

@media (prefers-reduced-motion: no-preference) {
  .stage-link, .icon-button { transition: background-color 120ms ease, color 120ms ease; }
}
