@import url("https://fonts.googleapis.com/css2?family=Fredoka:wght@600&display=swap");

:root {
  --display: "Fredoka", "Arial Rounded MT Bold", ui-rounded, "Comic Sans MS", "Trebuchet MS", sans-serif;
  color-scheme: light;
  --bg:#f5f2f6; --ink:#272532; --soft:#595668; --line:#d6d0dd; --card:#fffcff; --tint:#ede9f2;
  --pearl:linear-gradient(112deg,#bde4f1,#dcd2ed 55%,#f1cadf);
  font:16px/1.5 "Plus Jakarta Sans","Segoe UI",sans-serif;
}
:root.dark {color-scheme:dark;--bg:#15141e;--ink:#f4eff7;--soft:#b8b2c7;--line:#393543;--card:#22202c;--tint:#302c3b}
* {box-sizing:border-box}
body {margin:0;background:var(--bg);color:var(--ink);min-height:100svh}
h1,h2,p {margin:0} button,input {font:inherit}
button {display:inline-flex;align-items:center;justify-content:center;gap:.55rem;min-height:42px;padding:0 14px;border:1px solid var(--line);border-radius:12px;background:transparent;color:inherit;cursor:pointer;font-size:.87rem;font-weight:600}
button:hover {background:var(--tint)} :focus-visible {outline:3px solid #a9cfee;outline-offset:3px}
.mast {border-bottom:1px solid var(--line)}
.mast-inner,.studio,footer {width:94%;margin:auto}
.mast-inner {min-height:76px;display:flex;align-items:center;justify-content:space-between;gap:12px}
.brand {display:inline-flex;align-items:center;gap:13px;text-decoration:none;color:inherit;font-weight:650;letter-spacing:-.035em;font-size:1.5rem}
.brand img {width:45px;height:45px;object-fit:contain;filter:drop-shadow(0 1px 2px #51446266)}
nav,.dock,.dock>div,.section-head,.dialog-head {display:flex;align-items:center;gap:9px}
nav button:not(:last-child) {border-color:transparent;width:42px;padding:0}
.studio {padding:clamp(18px,3.4vh,42px) 0 12px}
.section-head,.dialog-head {justify-content:space-between;margin-bottom:14px}
h1,h2,.brand {font-family:var(--display);font-weight:600;letter-spacing:-.015em}
h1,h2 {line-height:1.12}
h1 {font-size:clamp(1.5rem,2.1vw,3rem)}
#header-status-badge {display:flex;align-items:center;gap:8px;font:600 .69rem/1.3 ui-monospace,monospace;text-transform:uppercase;letter-spacing:.09em;color:var(--soft)}
#header-pulse-dot {width:8px;height:8px;border-radius:50%;background:#d3b1d6}
#header-status-badge.on-air b {background:#85dcb2}
#player-container {position:relative;padding:2px;border-radius:24px;background:linear-gradient(125deg,#94bbc9,#c7b5d2 38%,#574f68 65%,#d5aabe);box-shadow:0 12px 38px #09091624}
.video-wrapper {position:relative;overflow:hidden;isolation:isolate;container-type:inline-size;width:100%;aspect-ratio:16/9;background:#090812;border-radius:22px;color:white}
video {width:100%;height:100%;display:block}.object-contain {object-fit:contain}.object-cover {object-fit:cover}
.scene {position:absolute;inset:0;z-index:4;overflow:hidden;background:radial-gradient(ellipse at 76% 45%,#4a4565 0,transparent 45%),linear-gradient(145deg,#151c33,#322c4b 57%,#322338);color:#fcf3ff;display:flex;align-items:center;transition:opacity .3s}
.sky {position:absolute;inset:0;background:radial-gradient(circle at 13% 16%,#b6ddeb 0 1px,transparent 2px),radial-gradient(circle at 32% 28%,#e1d5ec 0 1px,transparent 2px),radial-gradient(circle at 89% 16%,#e1d5ec 0 1px,transparent 2px),radial-gradient(circle at 53% 70%,#b7d5f2 0 1px,transparent 2px)}
.sky b {position:absolute;width:8px;aspect-ratio:1;background:#ded7ed;clip-path:polygon(50% 0,60% 40%,100% 50%,60% 60%,50% 100%,40% 60%,0 50%,40% 40%);left:9%;top:31%}
.sky b:nth-child(2){left:55%;top:25%;width:12px}.sky b:nth-child(3){left:89%;top:65%}
.horizon,.horizon:after {position:absolute;content:"";height:59%;width:145%;bottom:-36%;left:-22%;border-radius:50%;border-top:1px solid #f7dfef9e;transform:rotate(-9deg);background:linear-gradient(177deg,#c3a9cb75,#635d8430 15%,#3b3855 65%);box-shadow:0 -10px 56px #bdb7f026}
.horizon:after {bottom:0;left:12%;height:105%;transform:rotate(17deg);background:linear-gradient(180deg,#acdaeb63,#51465e 33%);border-color:#cae7f49c}
.emblem {position:absolute;width:36%;aspect-ratio:1;right:8%;top:48%;transform:translateY(-50%);display:grid;place-items:center}
.emblem:before,.emblem:after {position:absolute;content:"";inset:-3% -16%;border:1px solid #d8d9f244;border-radius:50%;transform:rotate(-26deg) scaleY(.75)}
.emblem:after {inset:-13% -1%;transform:rotate(25deg) scaleX(.76);opacity:.5}
.emblem img {width:84%;height:auto;z-index:1;filter:drop-shadow(0 12px 18px #12122185);animation:float 7s ease-in-out infinite alternate}
@keyframes float {to {transform:translateY(-2%)}}
.scene-copy {position:relative;z-index:2;margin-left:7%;width:43%}
.scene-copy h2,.login-card h1 {font:600 clamp(34px,5.8vw,110px)/1.06 var(--display);letter-spacing:-.025em}
.scene-copy h2 {font-size:clamp(27px,6.3cqw,13rem)}
.scene-copy em,.login-card em {font-style:normal;font-weight:inherit;color:#dfcce8}
.scene-copy span {display:block;margin-top:16px;font-size:clamp(.78rem,1.2vw,1rem);color:#d7d6ea}
.dock {justify-content:space-between;padding:17px 0;flex-wrap:wrap}
button.pearl,.login-card button {background:var(--pearl);border:0;color:#272338}
.controls-overlay {position:absolute;left:0;right:0;z-index:2;display:flex;align-items:center;gap:8px;padding:12px 16px;transition:opacity .22s}
.controls-overlay button,.sound,.exit-theater {background:#171520bf;border:1px solid #ffffff42;color:white}
.controls-overlay button:hover,.sound:hover {background:#413949}
.top {top:0;justify-content:space-between;background:linear-gradient(#090712ad,transparent)}
.bottom {bottom:0;background:linear-gradient(transparent,#090712de)}
#quality-indicator,#latency-indicator {font-size:.75rem;color:#eee9f3}
#volume-slider {width:clamp(42px,9vw,120px);accent-color:#d5c4eb}
#latency-indicator {margin-left:auto}
.controls-hidden:not(:focus-within),.opacity-0 {opacity:0;pointer-events:none}
.sound {position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);z-index:3;white-space:nowrap}
.sound.opacity-0 {visibility:hidden}
.exit-theater {display:none;position:absolute;z-index:7;top:10px;left:50%;transform:translateX(-50%)}
.theater-mode .exit-theater {display:flex}
.theater-mode .mast,.theater-mode .dock,.theater-mode footer,.theater-mode .section-head {display:none}
.theater-mode .studio {width:100%;padding:0}
.theater-mode .video-wrapper,#player-container:fullscreen .video-wrapper {height:100svh;max-height:none;border-radius:0}
#player-container:fullscreen,.theater-mode #player-container {padding:0;border-radius:0;background:#000}
footer {border-top:1px solid var(--line);padding:16px 0 28px;color:var(--soft);display:flex;align-items:center;justify-content:space-between;font-size:.75rem}
footer>span {font-weight:650}kbd {margin:0 2px 0 10px;border:1px solid var(--line);padding:2px 5px;border-radius:5px}
dialog {width:min(380px,92vw);padding:22px;background:var(--card);color:var(--ink);border:1px solid var(--line);border-radius:22px}
dialog::backdrop {background:#11101ab8}
.setting {display:flex;align-items:center;justify-content:space-between;width:100%;padding:12px 4px;border:0;border-bottom:1px solid var(--line);border-radius:0;font-size:.95rem;color:var(--ink)}
.setting strong {font-size:.86rem;color:var(--soft)}
#toast-container {position:fixed;z-index:10;bottom:18px;right:18px;pointer-events:none}
#toast-container>div {padding:10px 16px;background:var(--card);border:1px solid var(--line);border-radius:12px;font-size:.875rem}
.calm-mode *, .calm-mode *::before,.calm-mode *::after {animation:none!important;transition:none!important}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}
.gate {background:radial-gradient(ellipse at 20% 20%,#303451,#181722 56%);color:#f6f1fa;min-height:100svh;display:grid;place-items:center;padding:20px;color-scheme:dark}
.gate-shell {width:min(900px,100%);display:grid;grid-template-columns:1fr 1fr;border:1px solid #514b60;border-radius:30px;overflow:hidden;background:#22202c;box-shadow:0 30px 80px #08081150}
.gate-art {position:relative;min-height:405px;overflow:hidden}.gate-art .emblem {width:66%;right:17%}
.login-card {padding:clamp(26px,4vw,54px);align-self:center}.login-card h1 {font-size:clamp(40px,4vw,64px)}
.login-card p {color:#cec7d7}.login-card label {display:block;font-size:.84rem;margin:26px 0 7px}
.login-card input,.login-card button {width:100%;padding:12px 14px;border-radius:12px}
.login-card input {color:#fff;background:#171620;border:1px solid #746b81}.login-card button {margin-top:15px}
.login-card .error {font-size:.83rem;color:#ffbfd4;margin-top:8px}
@media(min-width:651px) and (min-height:500px){
  /* Derive the 16:9 player's width from the height left by the real toolbar
     and footer. Browser chrome, OS scaling and wrapped controls are accounted for. */
  body:has(.studio):not(.theater-mode) {
    display:grid;height:100svh;
    grid-template-rows:auto minmax(0,1fr) auto;
  }
  .mast-inner {min-height:3.6rem}
  .studio {display:grid;grid-template: auto minmax(0,1fr) auto / minmax(0,1fr);min-height:0;margin-block:0;padding:clamp(8px,1.2vh,22px) 0 0}
  .section-head {margin-bottom:.45rem}
  .dock {padding:.5rem 0}
  footer {padding:.4rem 0 .55rem}
  .stage {container-type:size;display:grid;place-items:center;min-height:0}
  #player-container {width:min(100cqw,177.77778cqh);aspect-ratio:16/9}
  .video-wrapper {height:100%;aspect-ratio:auto}
  .theater-mode .studio,.theater-mode .stage {display:block;container-type:normal}
  .theater-mode #player-container,#player-container:fullscreen {width:100%;aspect-ratio:auto}
  #player-container:fullscreen {height:100%}
}
@media(min-width:2000px) and (min-height:1000px){
  :root {font-size:clamp(16px,0.83vw,28px)}
  .mast-inner {min-height:4.5rem}
  .brand img {width:2.9rem;height:2.9rem}
  button {min-height:2.6rem;padding-inline:.9rem}
  nav button:not(:last-child) {width:2.6rem}
}
@media(min-width:651px) and (min-height:500px) and (max-height:800px){
  .mast-inner {min-height:48px}
  .brand img {width:37px;height:37px}
  .section-head h1 {font-size:1.5rem}
  .dock {padding:4px 0}
  footer {padding:2px 0}
}
@media(max-width:650px){
 .mast-inner,.studio,footer {width:94%}.mast-inner {min-height:64px}.brand {font-size:1.15rem;gap:7px}.brand img {width:35px;height:35px}nav {gap:0}nav button:last-child span {display:none}
 .section-head {margin-bottom:10px}.video-wrapper {border-radius:14px}#player-container {border-radius:16px}
 .scene-copy {margin-left:6%;width:45%}.scene-copy h2 {font-size:clamp(27px,7.4vw,46px)}.scene-copy span {margin-top:7px;font-size:.75rem}
 .controls-overlay {gap:3px;padding:5px}.controls-overlay button {padding:0 9px;min-height:36px}#latency-indicator {font-size:.64rem}#aspect-text {display:none}
 .dock {gap:8px}.dock>div {gap:5px;flex-wrap:wrap}.dock button {font-size:.78rem;padding:0 10px}.dock {align-items:flex-start}
 footer>div {display:none}.gate-shell {grid-template-columns:1fr;max-width:390px}.gate-art {min-height:165px}.gate-art .emblem {width:36%;right:32%}.login-card {padding:24px}
}
