@import url('/client/fonts.css');
select{font:inherit}select:focus-visible{outline:3px solid #df923a;outline-offset:4px}.setting select{display:block;width:100%;margin-top:11px;padding:10px 12px;border:1px solid #cfddd3;border-radius:8px;background:#f4f7ef;color:var(--ink);font-size:11px;cursor:pointer}.capture-hint{font-size:9px;line-height:1.7;text-align:center;color:#51796f;margin:-8px 0 18px;padding:9px 10px;background:#edf3e8;border:1px solid #dce7d8;border-radius:8px}
:root {
  --ink: #173b50;
  --muted: #4b6879;
  --teal: #205967;
  --cream: #fffdf5;
  --red: #da625a;
  --blue: #368cb1;
  --orange: #eb9f46;
  --shadow: 0 12px 45px #163d4917;
  --winter-trim: #9ab8c9;
  --winter-line: #c7dbe4;
  --winter-paper: #edf6f8;
  --winter-red: #993d43;
  --winter-blue: #285d83;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  color: var(--ink);
  font-synthesis: none;
}
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#dceff3}button,input{font:inherit}button{cursor:pointer;-webkit-tap-highlight-color:transparent}button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid #df923a;outline-offset:4px}button{border:0}button:disabled{cursor:wait;opacity:.6}.hidden{display:none!important}#world{position:fixed;inset:0;width:100%;height:100%;display:block}body.playing #world{cursor:none}body.playing{user-select:none}#damage-flash{pointer-events:none;position:fixed;inset:0;z-index:3;box-shadow:inset 0 0 130px 30px #d8504b;opacity:0;transition:opacity .35s}.topbar{position:fixed;inset:0 0 auto;z-index:12;display:flex;align-items:center;justify-content:space-between;gap:20px;height:78px;padding:0 36px;background:linear-gradient(#edf6f4e8,#edf6f400);pointer-events:none}.topbar>*{pointer-events:auto}.brand{display:flex;align-items:center;gap:10px;color:var(--ink);text-decoration:none;font-size:30px;font-weight:900;letter-spacing:-1.5px}.brand img{width:34px;height:34px}.brand-dot{color:var(--orange)}.place{display:flex;align-items:center;gap:11px;font-size:10px;font-weight:800;letter-spacing:1.8px}.live-dot{display:inline-block;width:7px;height:7px;border-radius:50%;background:#3d9884;box-shadow:0 0 0 4px #3d988412;flex-shrink:0}.place-divider{opacity:.35;margin:0 4px}.practice-label{color:#6c8b8e}.top-actions{display:flex;align-items:center;gap:8px}.icon-button,.menu-button{height:36px;background:#fffdf3dc;border:1px solid #c8ddde99;box-shadow:0 3px 10px #21465608;color:var(--ink);border-radius:10px;font-size:20px;transition:transform .15s,background .15s}.icon-button:hover,.menu-button:hover{background:white;transform:translateY(-1px)}.icon-button{width:36px}.icon-button[aria-pressed=true]{color:#aa7971}.menu-button{padding:0 12px;font-size:11px;font-weight:bold}.menu-button span{margin-left:8px;font-size:9px;color:#809397;border:1px solid #d4dfdd;border-radius:4px;padding:2px 3px}.hud{position:fixed;inset:0;pointer-events:none;z-index:4}.scoreboard{position:absolute;top:83px;left:50%;transform:translateX(-50%);display:flex;align-items:stretch;min-width:348px;height:80px;background:#fffef6ed;border:1px solid #fff;border-radius:17px;box-shadow:var(--shadow);overflow:hidden}.team-score{display:flex;align-items:center;justify-content:center;gap:12px;min-width:120px;padding:10px 18px}.team-score div{display:flex;flex-direction:column;gap:2px}.team-score small,.clock small{font-size:8px;font-weight:800;letter-spacing:1.5px}.team-score strong{font-size:30px;font-weight:900;letter-spacing:-1px;line-height:1.1}.team-score.blue{text-align:right}.red{color:var(--red)}.blue{color:var(--blue)}.team-icon{font-size:17px;text-shadow:0 2px white}.clock{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;min-width:105px;border-left:1px solid #e5ece8;border-right:1px solid #e5ece8;margin:13px 0}.clock small{color:#8b9d99;font-size:7px}.clock strong{font-size:22px;font-variant-numeric:tabular-nums}.clock.urgent{color:#c6534b}.practice-note{position:absolute;top:104px;left:36px;display:flex;align-items:center;gap:10px;font-size:8px;font-weight:bold;letter-spacing:1.5px;max-width:220px;line-height:1.8;color:#5c7b7d}.practice-note span{font-size:24px;font-weight:normal;border-right:1px solid #8ba8aa77;padding-right:10px;line-height:1.3}.controls-card{position:absolute;bottom:30px;left:36px;background:#fffdf3dd;border:1px solid #fff;border-radius:14px;padding:17px 18px;width:215px;box-shadow:var(--shadow);backdrop-filter:blur(7px)}.controls-title{font-size:8px;letter-spacing:1.7px;font-weight:bold;color:#77928f;margin-bottom:13px}.controls-card>div:not(:first-child){display:flex;justify-content:space-between;align-items:center;margin:7px 0;font-size:10px}.key{font-size:8px;font-weight:bold;padding:5px 6px;min-width:53px;text-align:center;border-radius:5px;background:#edf2eb;border:1px solid #d7e2db;box-shadow:0 1px #c6d4ce}.controls-card p{font-size:9px;margin:13px 0 0;color:#698181;border-top:1px solid #dae4dc;padding-top:10px}.bottom-status{position:absolute;bottom:30px;left:50%;transform:translateX(-50%);width:294px}.health-line{display:flex;align-items:center;justify-content:space-between;padding:0 5px 10px}.hearts{font-size:25px;letter-spacing:4px;color:#d85d55;filter:drop-shadow(0 2px 0 #fff7);white-space:nowrap}.heart-empty{color:#91a9af6b}.health-line>span{font-size:8px;font-weight:bold;letter-spacing:1px;color:#497172;background:#f4faf28c;padding:5px 6px;border-radius:5px}.round-note{position:absolute;right:36px;bottom:31px;font-size:7px;letter-spacing:1.5px;font-weight:bold;color:#456a70;background:#f4faf395;padding:10px 12px;border-radius:8px}.round-note span{margin:0 8px;color:#78998f}.knockout-banner{position:absolute;left:50%;top:26%;transform:translateX(-50%) rotate(-5deg);display:flex;align-items:center;gap:14px;animation:pop .22s ease-out;filter:drop-shadow(3px 4px 0 #163f48)}.knockout-banner strong{font-size:38px;color:#ffdf80;letter-spacing:-1px;-webkit-text-stroke:1px #214752;font-style:italic}.knockout-banner span{font-size:30px;font-weight:900;color:#fff}.respawn-banner{position:absolute;left:50%;top:35%;transform:translateX(-50%);text-align:center;background:#fffdf3ed;border:1px solid white;border-radius:15px;box-shadow:var(--shadow);padding:20px 30px;display:flex;flex-direction:column;gap:8px}.respawn-banner strong{font-size:27px}.respawn-banner span{font-size:11px;color:#73908c}.protection-banner{position:absolute;left:50%;top:175px;transform:translateX(-50%);background:#fffef6cc;color:#447d91;font-size:8px;font-weight:bold;letter-spacing:2px;padding:7px 12px;border-radius:8px}.overlay{position:fixed;inset:0;z-index:10;display:flex;align-items:center;justify-content:center;background:#dceff339;backdrop-filter:blur(3px);padding:86px 20px 24px}.welcome-overlay{justify-content:flex-start;padding-left:8vw;background:linear-gradient(90deg,#e5f2ed66,transparent 75%);backdrop-filter:none}.welcome-card{width:420px;background:#fffdf4ed;border:1px solid #fff;border-radius:25px;padding:34px 34px 0;box-shadow:0 25px 70px #1e546319;backdrop-filter:blur(12px);overflow:hidden;animation:arrive .5s ease-out}.eyebrow{display:flex;align-items:center;gap:8px;font-size:8px;font-weight:bold;letter-spacing:2px;color:#658b83}.tiny-flake{font-size:18px;color:var(--orange)}h1{font-size:63px;line-height:1.02;letter-spacing:-4px;margin:23px 0 18px;font-weight:900}h1 em{color:var(--teal);font-style:normal}.welcome-copy{font-size:12px;line-height:1.85;color:#759088;margin:0 0 22px}.welcome-facts{display:flex;gap:7px;flex-wrap:wrap;margin-bottom:24px}.welcome-facts span{border:1px solid #dce5db;border-radius:6px;padding:6px 8px;font-size:8px;font-weight:bold;color:#65847e;background:#f3f6ed}.primary-button{display:flex;align-items:center;justify-content:space-between;width:100%;padding:17px 20px;background:var(--teal);color:#fff9df;border:1px solid #144850;border-radius:11px;box-shadow:0 3px 0 #123e47;font-size:12px;font-weight:bold;transition:transform .15s,background .15s}.primary-button:hover{transform:translateY(-2px);background:#216d71}.primary-button:active{transform:translateY(1px);box-shadow:0 1px #123e47}.primary-button span{font-size:20px;line-height:1}.start-hint{font-size:8px;color:#8da094;text-align:center;margin:14px -5px 25px}.prototype-stamp{border-top:1px solid #e2e8db;display:flex;align-items:center;gap:8px;margin:0 -34px;padding:16px 23px;font-size:7px;letter-spacing:1px;font-weight:bold;color:#67877e;background:#f2f4e980}.prototype-stamp .live-dot{width:5px;height:5px}.prototype-stamp>span:last-child{margin-left:auto;font-size:7px;letter-spacing:0;color:#94a492;font-weight:normal}.welcome-corner{position:absolute;right:6vw;bottom:6vh;text-align:right;text-shadow:0 1px 3px #fff8}.welcome-corner>span{font-size:8px;font-weight:bold;letter-spacing:3px;color:#4f777a}.welcome-corner strong{display:block;font-size:25px;line-height:1.3;letter-spacing:-1px;margin-top:10px;color:#315f65}.panel{width:380px;max-height:calc(100dvh - 105px);overflow:auto;background:#fffdf5f5;border:1px solid white;border-radius:21px;padding:30px;box-shadow:0 20px 75px #13445229;backdrop-filter:blur(15px)}h2{font-size:32px;line-height:1.1;letter-spacing:-1.5px;margin:14px 0 10px}.panel-copy{font-size:11px;line-height:1.8;color:#789088;margin:0 0 22px}.setting{margin:18px 0 22px}.setting>label{display:flex;align-items:center;justify-content:space-between;font-size:11px;font-weight:bold}.setting>label strong{font-size:9px;color:#80978d;font-weight:normal}.setting input[type=range]{width:100%;margin:14px 0 0;accent-color:var(--teal);height:4px}.range-labels{display:flex;justify-content:space-between;font-size:7px;color:#8b9f94;margin-top:8px}.check-setting{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:14px 0;border-top:1px solid #e1e8de;border-bottom:1px solid #e1e8de}.check-setting span{display:flex;flex-direction:column;gap:5px;font-size:10px}.check-setting small{font-size:8px;color:#83988e}.check-setting input{accent-color:var(--teal);width:17px;height:17px}.small-controls{font-size:9px;line-height:1.9;color:#7d938b;margin:16px 0 20px}.text-button{background:none;color:#65887e;font-size:10px;text-decoration:underline;width:100%;padding:16px 0 4px}.panel-footnote{font-size:8px;line-height:1.7;color:#95a69c;text-align:center;margin:18px 0 0}.final-score{display:flex;align-items:center;justify-content:center;gap:26px;padding:14px 0 28px}.final-score>div{display:flex;flex-direction:column;align-items:center;gap:8px}.final-score small{font-size:9px;letter-spacing:2px;font-weight:bold}.final-score strong{font-size:48px;letter-spacing:-2px}.final-score>span{font-size:28px;color:#a7b4a9}.toast{position:fixed;z-index:30;bottom:22px;left:50%;transform:translateX(-50%);background:#184b54ed;color:#fffef2;padding:12px 18px;font-size:11px;line-height:1.6;border-radius:12px;text-align:center;max-width:90vw;box-shadow:var(--shadow)}@keyframes pop{from{opacity:0;scale:.6}to{opacity:1;scale:1}}@keyframes arrive{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:translateY(0)}}
@media(max-width:980px){.topbar{padding:0 22px}.practice-note{display:none}.controls-card{left:22px;width:183px;padding:14px}.controls-card div:not(:first-child){font-size:9px}.bottom-status{width:250px}.round-note{right:20px;font-size:6px}.welcome-overlay{padding-left:5vw}.welcome-corner{right:4vw}.place{font-size:8px;gap:9px}}
@media(max-width:720px){.topbar{height:67px;padding:0 16px;gap:8px}.brand{font-size:26px;gap:7px}.brand img{width:29px;height:29px}.place{display:none}.top-actions{gap:6px}.icon-button{height:33px;width:33px}.menu-button{height:33px;padding:0 10px}.menu-button span{display:none}.welcome-overlay{justify-content:center;padding:77px 16px 20px}.welcome-card{width:360px;padding:27px 26px 0}.welcome-card h1{font-size:56px;margin-top:18px}.welcome-copy{font-size:11px;margin-bottom:17px}.welcome-facts{margin-bottom:20px;gap:5px}.welcome-facts span{font-size:7px;padding:6px 7px}.prototype-stamp{margin:0 -26px;padding:14px 19px}.prototype-stamp>span:last-child{font-size:6px}.welcome-corner{display:none}.scoreboard{top:73px;min-width:290px;height:67px;border-radius:13px}.team-score{min-width:95px;padding:9px 12px;gap:8px}.team-score strong{font-size:26px}.team-score small{font-size:7px}.team-icon{font-size:13px}.clock{min-width:90px;margin:10px 0;gap:5px}.clock strong{font-size:20px}.clock small{font-size:6px}.controls-card{left:12px;bottom:18px;width:150px;padding:12px}.controls-title{font-size:7px;letter-spacing:1px;margin-bottom:8px}.controls-card>div:not(:first-child){font-size:8px;margin:5px 0}.controls-card .key{font-size:7px;min-width:45px;padding:4px}.controls-card p{font-size:7px;line-height:1.6;margin-top:9px;padding-top:8px}.round-note{right:12px;bottom:165px;font-size:6px;padding:8px}.bottom-status{bottom:20px;left:auto;right:12px;transform:none;width:190px}.hearts{font-size:23px}.health-line>span{font-size:6px}.knockout-banner{top:27%;gap:9px}.knockout-banner strong{font-size:30px}.knockout-banner span{font-size:25px}.protection-banner{top:151px;font-size:7px}.respawn-banner{top:35%}.respawn-banner strong{font-size:24px}.panel{width:350px;padding:25px}.overlay{padding-top:78px}}
@media(max-height:560px) and (min-width:600px){.topbar{height:56px}.scoreboard{top:59px;height:59px;min-width:288px}.team-score{min-width:92px}.team-score strong{font-size:24px}.clock{min-width:85px;margin:9px 0}.practice-note{display:none}.controls-card{left:16px;bottom:12px;width:175px;padding:11px}.controls-title{margin-bottom:7px}.controls-card>div:not(:first-child){font-size:8px;margin:4px 0}.controls-card p{font-size:7px;margin-top:8px;padding-top:7px}.bottom-status{bottom:12px;width:240px}.health-line{padding-bottom:5px}.round-note{right:16px;bottom:168px}.welcome-overlay{padding:64px 20px 15px;align-items:center}.welcome-card{width:370px;max-height:calc(100dvh - 75px);overflow:auto;padding:19px 26px 0}.welcome-card h1{font-size:42px;letter-spacing:-2.5px;margin:12px 0}.welcome-copy{font-size:10px;line-height:1.6;margin-bottom:12px}.welcome-facts{margin-bottom:14px}.welcome-facts span{padding:5px 6px;font-size:7px}.welcome-card .primary-button{padding:13px 16px}.start-hint{margin:10px 0 15px;font-size:7px}.prototype-stamp{padding:11px 18px;margin:0 -26px}.welcome-corner strong{font-size:20px}.overlay{padding-top:65px;padding-bottom:14px}.panel{max-height:calc(100dvh - 80px);padding:23px}.protection-banner{top:125px}.knockout-banner{top:28%}.knockout-banner strong{font-size:29px}.bottom-status{width:200px}}
@media(max-width:440px){.controls-card{width:140px}.bottom-status{width:174px}.health-line>span{font-size:6px}}
@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
.capture-hint{position:fixed;right:24px;top:180px;z-index:8;width:235px;background:#fffdf3ee;box-shadow:0 6px 25px #21465615;padding:13px 15px;margin:0;text-align:left}.capture-hint strong{display:block;font-size:10px;margin-bottom:7px}.capture-hint span{display:block;font-size:9px;line-height:1.7}

.sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.welcome-overlay{isolation:isolate;overflow:auto;align-items:safe center;background:#23445f}
.welcome-card{position:relative;z-index:1;flex-shrink:0;padding:26px 32px 20px;width:min(100%,414px);max-height:none;backdrop-filter:none}
.welcome-card h1{font-size:clamp(39px,6vw,58px);letter-spacing:-.065em;margin:0 0 8px;line-height:1}
.welcome-copy{color:#46666b;margin:0 0 19px}
.home-profile{display:grid;grid-template-columns:minmax(0,1fr) minmax(108px,.78fr);gap:10px}
.home-field,.character-picker{margin:0 0 15px}
.home-field label,.character-picker legend{display:block;margin-bottom:7px;font-size:11px;font-weight:700;color:#244e54}
.home-field input,.home-field select,.room-form input,.invite-code{min-width:0;width:100%;padding:9px 11px;border:1px solid #c0d3d3;border-radius:8px;background:#fff;color:#163f47;font:inherit;font-size:13px}
.character-picker{display:flex;gap:8px;border:0;padding:0}
.character-picker label{display:flex;align-items:center;gap:8px;flex:1;padding:6px 9px;border:1px solid #d3e1df;border-radius:9px;background:#edf5f1;color:#2b535a;font-size:12px;cursor:pointer}
.character-picker label:has(input:checked){border-color:#317984;background:#e0efed}
.character-picker input{accent-color:#28656d;margin:0}
.portrait{position:relative;width:23px;height:25px;flex:none;overflow:hidden;background:#407481;clip-path:polygon(12% 0,88% 0,100% 100%,0 100%)}
.portrait::before,.portrait::after{content:'';position:absolute;left:5px;top:6px;width:13px;height:12px;background:#efbd98;border-radius:40%}
.portrait::after{top:3px;height:7px;background:#c7735d;border-radius:5px 5px 0 0}
.portrait.girl::after{left:3px;width:17px;height:15px;background:#8e5946;clip-path:polygon(0 0,100% 0,100% 100%,77% 100%,77% 40%,23% 40%,23% 100%,0 100%)}
#welcome[data-quality="low"] .portrait{clip-path:none}
#welcome[data-quality="low"] .portrait::before,#welcome[data-quality="low"] .portrait::after{border-radius:0}
#welcome[data-quality="medium"] .portrait{background:linear-gradient(130deg,#5a8e97 0 48%,#3d6c7b 49%)}
#welcome[data-quality="medium"] .portrait::before{border-radius:0;clip-path:polygon(18% 0,82% 0,100% 45%,79% 100%,21% 100%,0 45%)}
#welcome[data-quality="medium"] .portrait.boy::after{border-radius:0;clip-path:polygon(0 38%,42% 0,80% 14%,100% 100%,0 100%)}
#welcome[data-quality="high"] .portrait{clip-path:none;border-radius:40% 40% 22% 22%;background:linear-gradient(130deg,#5e929a,#326372)}
.welcome-card .setting{margin:0 0 15px}
.room-form{display:flex;gap:6px;min-width:0;flex:1}
.room-form input{text-transform:uppercase}
.secondary-button{padding:8px 10px;border:1px solid #b4cccc;border-radius:8px;background:#e8f1ed;color:#214d54;font:inherit;font-weight:700;font-size:11px;white-space:nowrap;cursor:pointer}
.secondary-button:hover{background:#d7eae8}
.home-status{margin:8px 0 0;color:#315f65;font-size:11px}
.home-status:empty{display:none}
.invite-code{display:block;margin:0 0 18px;text-align:center;font-size:24px;font-weight:bold;letter-spacing:.18em}
@media(max-width:820px){.welcome-overlay{justify-content:center;padding-inline:16px}.welcome-card{padding:21px 22px 18px}}
.online-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 19px;
}

.online-options button {
  min-height: 42px;
  text-transform: uppercase;
  letter-spacing: .09em;
}

.practice-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  align-items: end;
  gap: 8px;
}

.practice-row .home-field {
  margin: 0;
}

.practice-row button {
  grid-column: 1 / -1;
  min-height: 37px;
  white-space: normal;
}

.multiplayer-panel {
  width: min(100%, 410px);
}

.multiplayer-panel h2, .lobby-dialog h2 {
  margin: 0 0 20px;
  overflow-wrap: anywhere;
}

.multiplayer-panel h2:focus, .welcome-card h1:focus, #result-title:focus {
  outline: none;
}

.lobby-form {
  display: grid;
  gap: 13px;
}

.lobby-form .home-field, .join-form .home-field {
  margin: 0;
}

.lobby-status {
  margin: 12px 0 0;
  color: #456b6a;
  font-size: 12px;
  line-height: 1.5;
}

.lobby-status:empty {
  display: none;
}

.multiplayer-panel .text-button, .lobby-dialog .text-button {
  color: #35645f;
  font-size: 12px;
}

.join-panel {
  width: min(100%, 560px);
}

.browser-heading, .room-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px 60px;
  gap: 8px;
  align-items: center;
  padding-inline: 10px;
}

.browser-heading {
  margin-bottom: 7px;
  font-size: 11px;
  color: #456b6a;
}

.browser-heading > :not(:first-child), .room-row > :not(:first-child) {
  text-align: right;
}

.room-list, .lobby-seats, .chat-messages {
  list-style: none;
  margin: 0;
  padding: 0;
}

.room-list {
  display: grid;
  gap: 7px;
}

.room-row, .empty-room-list {
  width: 100%;
  min-height: 46px;
  border: 1px solid #ccdddb;
  border-radius: 8px;
  background: #eff7f9;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
}

.empty-room-list {
  padding: 14px 10px;
  color: #456b6a;
}

.room-row:hover, .room-row[aria-pressed=true] {
  background: #e1f1ec;
  border-color: #559390;
}

.room-row[aria-pressed=true] {
  box-shadow: inset 3px 0 #43817f;
}

.room-name {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  padding-block: 9px;
  font-weight: 700;
}

.room-name small {
  display: inline-block;
  margin-left: 6px;
  color: #456b6a;
  font-weight: 400;
}

.room-ping {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.room-ping[data-rating=good] { color: #21643f; }
.room-ping[data-rating=fair] { color: #825800; }
.room-ping[data-rating=poor] { color: #9b342d; }

.join-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 9px;
  margin-top: 18px;
}

.join-form .primary-button {
  gap: 10px;
  padding: 8px 13px;
  min-height: 37px;
}

#room-code {
  text-transform: uppercase;
}

.lobby-panel {
  width: min(100%, 940px);
  container: lobby / inline-size;
}

.lobby-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-bottom: 20px;
}

.lobby-heading h2 {
  margin: 0;
  min-width: 0;
}

.lobby-invite {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
}

.lobby-invite .invite-code {
  width: 100px;
  margin: 0;
  padding: 6px;
  font-size: 14px;
}

.lobby-content {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(210px, 1fr);
  gap: 16px;
}

.lobby-teams {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.lobby-team, .room-chat {
  min-width: 0;
  border: 1px solid #ccdedd;
  border-radius: 12px;
  background: #eff7f9;
  padding: 10px;
}

.lobby-team h3, .room-chat h3 {
  margin: 0 0 9px;
  font-size: 13px;
}

.lobby-team.team-red {
  border-color: #e6c2ba;
  background: linear-gradient(140deg, #fbf0ef 0 77%, #f4e3e2 77%);
  color: var(--winter-red);
}

.lobby-team.team-blue {
  border-color: #bed3e4;
  background: linear-gradient(140deg, #eff6fb 0 77%, #e0edf6 77%);
  color: var(--winter-blue);
}

.lobby-seats {
  display: grid;
  gap: 6px;
}

.lobby-seat {
  width: 100%;
  min-height: 45px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  border: 1px dashed currentColor;
  border-radius: 8px;
  background: #ffffff76;
  padding: 6px 9px;
  color: inherit;
  text-align: left;
  font-size: 12px;
}

.lobby-seat:hover:enabled {
  background: #fff;
}

.lobby-seat:disabled {
  cursor: default;
  opacity: 1;
}

.lobby-seat.occupied {
  border-color: #ffffffa6;
  border-style: solid;
  background: #fffdf9;
}

.seat-name, .seat-detail {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.occupied .seat-name { font-weight: 700; }
.seat-detail { color: #53676b; font-size: 10px; }
.seat-detail:empty { display: none; }
.seat-ready .seat-detail { color: #21643f; }

.room-chat {
  display: flex;
  flex-direction: column;
  color: var(--ink);
}

.chat-messages {
  display: flex;
  flex: 1 0 160px;
  flex-direction: column;
  gap: 7px;
  height: 190px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #cfddda;
  border-radius: 8px;
  background: #fffdf9;
  padding: 9px;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px;
  margin-top: 8px;
}

.chat-form input {
  min-width: 0;
  border: 1px solid #c0d3d3;
  border-radius: 8px;
  padding: 7px 8px;
  color: #163f47;
  font-size: 12px;
}

.lobby-actions, .dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
}

.lobby-actions .text-button, .dialog-actions .text-button {
  width: auto;
  margin-right: auto;
  padding: 6px 0;
}

.lobby-actions .primary-button, .dialog-actions .primary-button {
  width: auto;
  gap: 9px;
  padding: 8px 12px;
  min-height: 38px;
}

.lobby-actions:has(#ready-check:not(.hidden)) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

#ready-check { justify-self: center; }

.lobby-match-actions {
  justify-self: end;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

#start-room:disabled {
  cursor: not-allowed;
  transform: none;
  background: var(--teal);
}

#start-room:disabled[aria-busy=true] { cursor: progress; }
#start-room-action { position: relative; }
#start-room-action.start-blocked { cursor: not-allowed; }
.start-blocked #start-room { pointer-events: none; }
#start-hint {
  display: none; position: absolute; right: 0; bottom: calc(100% + 5px);
  width: max-content; max-width: min(240px, 75vw); padding: 6px 10px; border-radius: 6px; z-index: 2;
  background: #403631; color: #fff8eb; font-size: 13px; pointer-events: none;
}
.start-blocked:is(:hover, :focus-visible) #start-hint { display: block; }

@container lobby (width < 520px) {
  .lobby-actions:has(#ready-check:not(.hidden)) { grid-template-columns: minmax(0, 1fr); }
  .lobby-actions:has(#ready-check:not(.hidden)) .lobby-match-actions {
    justify-self: center;
    justify-content: center;
  }
}

#room-ready[aria-pressed=true] {
  background: #e1f1e7;
  border-color: #52836b;
  color: #215b43;
}

.lobby-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(370px, calc(100% - 32px));
  color: var(--ink);
}

.lobby-dialog::backdrop {
  background: #193b4d80;
}

.player-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 660px) {
  .lobby-content { grid-template-columns: minmax(0, 1fr); }
  .chat-messages { height: 130px; flex-basis: 130px; }
}

@media (max-width: 420px) {
  .lobby-panel { padding: 16px; }
  .lobby-team, .room-chat { padding: 7px; }
  .lobby-seat { padding-inline: 5px; }
}
.top-actions .language-select {
  height: 36px;
  padding: 0 6px;
  border: 1px solid #c8ddde99;
  border-radius: 10px;
  background: #fffdf3dc;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.top-actions .language-select:focus-visible {
  outline: 3px solid #df923a;
  outline-offset: 3px;
}

@media (max-width: 720px) {
  .top-actions .language-select { height: 33px; }
}

@media (max-width: 380px) {
  .topbar .brand { font-size: 21px; }
  .topbar .brand img { width: 24px; height: 24px; }
  .topbar .top-actions { gap: 4px; }
}
.panel.result-card { width: min(690px, 100%); }
.result-card .panel-copy { margin-bottom: 12px; }
.result-card .panel-copy:empty { display: none; }
.result-card table { width: 100%; border-collapse: collapse; font-size: 12px; }
.result-card th, .result-card td { padding: 7px 6px; text-align: right; border-bottom: 1px solid #dce5db; }
.result-card th:first-child { text-align: left; overflow-wrap: anywhere; }
.result-card thead { color: var(--muted); }
.result-card tbody td { color: var(--ink); font-variant-numeric: tabular-nums; }
.player-score-scroll { overflow-x: auto; margin: 12px 0 16px; }
.player-score { min-width: 405px; }
.player-score caption { text-align: left; font-size: 12px; font-weight: bold; padding-bottom: 5px; }

body.playing.cursor-mode #world { cursor: default; }

.topbar .brand, .top-actions, .welcome-card, .panel, .controls-card,
.scoreboard, .bottom-status, .knockout-banner, .respawn-banner,
.protection-banner, .taunt-hint, .round-note, .capture-hint {
  zoom: var(--ui-scale, 1);
}

.master-volume {
  display: flex;
  align-items: center;
  width: clamp(44px, 8vw, 104px);
  height: 32px;
  padding-inline: 8px;
  border-radius: 8px;
  background: #fffdf3ed;
}

.master-volume input { width: 100%; min-width: 0; margin: 0; accent-color: var(--teal); }
.top-actions .language-select { max-width: 84px; }
.overlay { overflow-y: auto; align-items: safe center; }
.overlay .panel { max-height: calc((100dvh - 110px) / var(--ui-scale, 1)); }
.welcome-card { max-height: calc((100dvh - 110px) / var(--ui-scale, 1)); overflow-y: auto; }
.panel-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding: 9px;
  border: 1px solid #d5e0d8;
  border-radius: 11px;
  background: #edf3ec;
}
.panel-nav .primary-button { flex-basis: 100%; margin-bottom: 3px; }
.panel-nav .secondary-button { flex: 1; min-height: 34px; }
.lobby-actions #leave-room, .dialog-actions #cancel-password { margin-right: auto; }
.lobby-actions {
  padding: 8px;
  border: 1px solid #d5e0d8;
  border-radius: 10px;
  background: #edf3ec;
}

.controls-layout { gap: clamp(12px, 2vw, 32px); }
.controls-layout > .panel { flex: 0 1 auto; min-width: 0; }
.controls-slot { flex: 0 0 auto; z-index: 1; max-width: 100%; }
.welcome-overlay {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-auto-rows: max-content;
  align-content: safe center;
  align-items: start;
  justify-content: normal;
  gap: clamp(13px, 2vw, 32px);
}
.welcome-overlay .controls-slot { justify-self: end; margin-right: 7vw; }
.controls-card {
  position: static;
  width: 214px;
  padding: 15px;
}
.controls-card .controls-title { margin-bottom: 12px; }
.controls-card > div:not(:first-child) {
  justify-content: flex-start;
  gap: 9px;
  margin: 6px 0;
  font-size: 11px;
}
.controls-card .key { min-width: 58px; font-family: inherit; font-size: 9px; font-weight: bold; }
.controls-card .key { flex-shrink: 0; }
.controls-card p { font-size: 10px; color: #456b6a; }

.topbar { background: linear-gradient(#edf7fbe8, #dcecf5a6 62%, #dcecf500); }
.topbar .place { color: #234961; }
.topbar :is(.icon-button, .menu-button, .language-select, .master-volume) {
  border: 1px solid #a7c2d191;
  border-radius: 8px;
  background-color: #f3f9fbeb;
  box-shadow: 0 2px 0 #173b5013;
}
.topbar :is(.icon-button, .menu-button):hover { background-color: #fff; }

.welcome-card, .panel, .controls-card {
  border: 1px solid var(--winter-trim);
  border-radius: 15px;
  background:
    linear-gradient(225deg, #bad3dfb0 16px, transparent 17px) top right / 44px 44px no-repeat,
    linear-gradient(145deg, #f8fcfdf2, #e9f4f5df),
    var(--park-snow-texture, none) center / cover no-repeat var(--winter-paper);
  box-shadow: 0 3px 0 #688b9d63, 0 20px 43px #122c4752, inset 0 0 0 1px #fff9;
  backdrop-filter: none;
}
.welcome-card, .panel { scrollbar-width: thin; scrollbar-color: #8daebf #e4eff4; }
.cottage-overlay .panel, .cottage-overlay .controls-card {
  border-color: #ab8973;
  box-shadow: 0 4px 0 #4c3732ba, 0 18px 40px #191d31a6, inset 0 0 0 1px #fff9;
}
#pause-panel, #result-panel, #error-panel {
  background: linear-gradient(150deg, #183149a6, #28556d65);
  backdrop-filter: none;
}
.lobby-dialog::backdrop { background: #132c449c; }
.panel h2 { color: var(--ink); }
.panel-copy, .setting > label strong, .range-labels { color: var(--muted); }
.pause-card .panel-copy { margin-bottom: 14px; }
.pause-card .setting { margin: 12px 0 15px; }
.pause-card .panel-nav { margin-top: 10px; }
.controls-card .controls-title { color: #426778; }
.controls-card .key { background: #e6f1f5; border-color: #c2d8e3; box-shadow: 0 1px #aec6d2; }
.controls-card p { border-color: var(--winter-line); }
.panel-nav, .lobby-actions { border-color: var(--winter-line); background: #ddebf1a8; }
:is(.home-field, .chat-form, .room-form) :is(input, select), .invite-code, .setting select {
  border-color: #abc7d4;
  background-color: #f7fbfc;
}
.primary-button {
  border: 1px solid #1a4055;
  border-radius: 8px;
  background: linear-gradient(140deg, #2c6a75 0 71%, #225967 71%);
  box-shadow: 0 3px 0 #163c50;
  color: #f7fbff;
}
.primary-button:hover:enabled { background: linear-gradient(140deg, #2e7581 0 71%, #245c6c 71%); }
.primary-button span { color: #d6edf2; }
.secondary-button {
  border-color: #b2ccda;
  border-radius: 8px;
  background: #e6f1f5;
  color: #244b60;
}
.secondary-button:hover:enabled { background: #d4e8f1; }

.match-notices {
  position: absolute;
  top: calc(83px * var(--ui-scale, 1));
  left: 50%;
  transform: translateX(-50%);
  width: min(76vw, 560px);
  display: grid;
  justify-items: center;
  gap: 8px;
}
.match-notices > * { position: static; max-width: 100%; transform: none; }
.round-countdown {
  padding: .08em .48em;
  border-radius: .25em;
  background: #243c4eed;
  color: #ffedbd;
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.scoreboard {
  min-width: 0;
  height: 72px;
  border: 1px solid #6e96ac;
  border-radius: 13px;
  background:
    linear-gradient(147deg, #183f53e3 0 65%, #14384be8 65%),
    var(--park-ice-texture, none) center / cover no-repeat #163d53;
  color: #fff;
}
.team-score { min-width: 108px; text-align: center; }
.team-score.blue { text-align: center; color: #fff; background: linear-gradient(140deg, #2c678e 62%, var(--winter-blue) 62%); }
.team-score.red { color: #fff; background: linear-gradient(140deg, var(--winter-red) 63%, #874048 63%); }
.team-score .team-icon { display: none; }
.team-score strong, .clock strong { color: #fff; font-variant-numeric: tabular-nums; }
.team-score small, .clock small { font-size: 9px; color: #faf3df; letter-spacing: .06em; }
.clock { min-width: 100px; border: 0; margin: 0; }
.clock.urgent strong { color: #ffd88b; }
.right-hud {
  position: absolute;
  top: 84px;
  right: 24px;
  max-width: min(28vw, 360px);
  display: grid;
  gap: 6px;
}
.right-hud .round-note {
  position: static;
  justify-self: end;
  text-align: center;
}
.match-stats {
  zoom: calc(var(--ui-scale, 1) * 1.2);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 10px;
  padding: 9px 12px;
  color: #f4f6ef;
  background:
    linear-gradient(146deg, #1a4358e6 0 74%, #12374be8 74%),
    var(--park-ice-texture, none) center / cover no-repeat #163d53;
  border: 1px solid #6e96ac;
  border-radius: 11px;
  font-size: 11px;
}
.bottom-status { width: max-content; left: 50%; right: auto; transform: translateX(-50%); }
.bottom-status .health-line { padding: 0; }
.match-stats > div { display: flex; gap: 5px; align-items: baseline; justify-content: space-between; }
.match-stats strong { color: #fff5cf; font-size: 14px; font-variant-numeric: tabular-nums; }
.taunt-hint {
  text-align: center;
  background: #153c47f5;
  border: 1px solid #e6b768;
  border-radius: 9px;
  color: #fff1c1;
  padding: 9px 15px;
  font-size: 19px;
  font-weight: 700;
}
.taunt-hint { padding: 5px 10px; font-size: 12px; }
.capture-hint { top: auto; bottom: 60px; }

.panel.result-card { width: min(760px, 100%); }
.result-card .series-score { table-layout: fixed; border-collapse: separate; border-spacing: 0 5px; }
.result-card .series-score thead th { border: 0; color: #385c65; font-size: 11px; }
.result-card .series-score tbody tr { color: white; }
.result-card .series-score tbody tr.red { background: linear-gradient(141deg, var(--winter-red) 78%, #874048 78%); }
.result-card .series-score tbody tr.blue { background: linear-gradient(141deg, var(--winter-blue) 78%, #224f73 78%); }
.result-card .series-score tbody th { padding-left: 11px; border-radius: 8px 0 0 8px; }
.result-card .series-score tbody td { color: inherit; font-size: 16px; font-weight: 700; }
.result-card .series-score tbody td:nth-child(2) { font-size: 22px; }
.result-card .series-score tbody td:last-child { padding-right: 11px; border-radius: 0 8px 8px 0; }
.result-card .series-score tbody :is(th, td) { border: 0; padding-block: 10px; }
.score-scope { color: #44656d; margin: 15px 0 0; font-size: 11px; line-height: 1.45; }
.player-score { min-width: 460px; }
.player-score thead { background: #e0edf4; color: #34586b; }
.player-score tbody tr:nth-child(even) { background: #e8f2f5; }
.player-score tbody tr.red th { border-left: 3px solid #b94c45; }
.player-score tbody tr.blue th { border-left: 3px solid #387baa; }

@media (max-width: 850px) {
  .topbar .place { display: none; }
  .welcome-overlay .controls-slot { margin-right: 0; }
  .controls-layout { flex-wrap: wrap; }
  .controls-layout > .controls-slot { margin: 4px 0; }
  .right-hud { top: calc(160px * var(--ui-scale, 1)); right: 12px; max-width: 44vw; }
  .match-stats { grid-template-columns: 1fr; }
  .capture-hint { bottom: 58px; left: 12px; right: auto; max-width: 35vw; }
}
@media (max-width: 720px) {
  .match-notices { top: calc(73px * var(--ui-scale, 1)); }
  .welcome-overlay { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .welcome-overlay .controls-slot { justify-self: center; }
}
@media (max-height: 560px) and (min-width: 600px) {
  .match-notices { top: calc(59px * var(--ui-scale, 1)); }
}
@media (max-width: 660px) {
  .topbar .brand span { display: none; }
  .topbar .top-actions { gap: 4px; min-width: 0; }
  .topbar .top-actions { zoom: min(1.15, var(--ui-scale, 1)); }
  .top-actions .language-select { max-width: 73px; }
  .master-volume { padding-inline: 4px; }
}

.cabin-hub {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: #bdcfe3;
}
.cabin-hub > div {
  position: absolute;
  inset: 0;
  transition: transform 720ms cubic-bezier(.26,.68,.22,1), opacity 520ms ease;
}
.cabin-hub-exterior {
  transform-origin: 76% 59%;
  background:
    linear-gradient(90deg, #dceaf339, transparent 48%),
    var(--park-exterior-texture, none) 57% center / cover no-repeat;
}
.cabin-hub-lodge {
  opacity: 0;
  transform-origin: center 60%;
  transform: scale(.9);
  background: var(--park-lodge-texture, none) center / cover no-repeat #625249;
}
body[data-hub-view=lodge] .cabin-hub-exterior { opacity: 0; transform: scale(1.64); }
body[data-hub-view=lodge] .cabin-hub-lodge { opacity: 1; transform: scale(1); }
body[data-hub-view=arena] .cabin-hub { visibility: hidden; }
.welcome-overlay, .cottage-overlay { background: transparent; backdrop-filter: none; }
.cottage-overlay { background: linear-gradient(0deg, #29252a2b, transparent 64%); }
#pause-panel, #result-panel {
  background:
    linear-gradient(#332a3191, #332a3163),
    var(--park-lodge-texture, none) center / cover no-repeat #625249;
}

.welcome-card, .panel, .controls-card {
  border: 8px solid transparent;
  border-radius: 13px;
  background:
    linear-gradient(145deg, #fbf6ea, #e8ddce) padding-box,
    linear-gradient(160deg, #a88a7266, #3f2f2a8c) border-box,
    var(--park-wood-texture, none) center / 220px border-box #766354;
  box-shadow: 0 2px 0 #41372f, 0 16px 38px #251f2959, inset 0 0 0 1px #77665685;
}
.cottage-overlay .panel, .cottage-overlay .controls-card { border-color: transparent; }
.welcome-card h1, .welcome-card h1 em, .panel h2 { color: #433b37; }
.panel-copy, .welcome-copy, .controls-card p { color: #534e4b; }
.panel-nav, .lobby-actions { background: #d3c1ad57; border-color: #c3ae97; }
:is(.home-field, .chat-form, .room-form) :is(input, select), .invite-code, .setting select {
  background: #fffaf0;
  border-color: #bba998;
}
:is(.primary-button, .secondary-button), #start-room:disabled {
  border: 1px solid #4e3f35;
  box-shadow: 0 2px 0 #44362e7f, inset 0 1px 0 #eee6d263;
  background:
    linear-gradient(150deg, #836f5b66, #3329299c),
    var(--park-wood-texture, none) center / 172px #6f5949;
  color: #fff7e7;
}
.secondary-button {
  background: linear-gradient(145deg, #f0e1cbdb, #d8bea6e0),
    var(--park-wood-texture, none) center / 172px #c3a58d;
  color: #352b27;
}
.primary-button:not(:disabled):hover { filter: brightness(1.16); }
.secondary-button:not(:disabled):hover { background-color: #e8d6c1; }
.lobby-team h3 {
  margin: 0 0 4px;
  padding: 8px 9px;
  border-radius: 4px;
  color: #fff9ec;
  background: #865b5a;
}
.lobby-team.team-blue h3 { background: #496782; }
@media (min-width: 1100px) {
  #room-panel { padding-inline: 8.5vw; }
  .lobby-panel { width: min(835px, 100%); }
}
.scoreboard {
  border: 5px ridge #ae9076;
  border-radius: 8px;
  background: linear-gradient(150deg, #50423bcc, #302827dd),
    var(--park-wood-texture, none) center / 140px #604d41;
  box-shadow: 0 3px 0 #3a302e8c, 0 6px 16px #2d34475c;
}
.match-stats, .right-hud .round-note {
  border-color: #a58a73;
  background: linear-gradient(150deg, #574941eb, #372f2be9),
    var(--park-wood-texture, none) center / 140px #604d41;
  color: #fff4df;
}
.team-score.red { background: #895b59; }
.team-score.blue { background: #496782; }
.topbar { background: linear-gradient(#ece7deed, #ede7de99 60%, transparent); }
@media (max-width: 660px) {
  .cabin-hub-exterior { background-position: 65% center; }
}
.diagnostic-tools { margin-top: .6rem; font-size: .85rem; }
.diagnostic-tools summary { cursor: pointer; }
.diagnostic-tools label { display: inline-flex; align-items: center; gap: .4rem; }
.diagnostic-tools button { margin-top: .4rem; }

.multiplayer-panel.join-panel { width: min(850px, 100%); }
.room-browser-columns { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
.room-browser-columns section { min-width: 0; }
.room-browser-columns h3 { margin-bottom: .5rem; }
.seat-bot-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin: 1rem 0; }
.seat-bot-fields .home-field { margin: 0; }
.room-browser-columns section { padding: .75rem; border: 1px solid #bfa987; border-radius: 10px; background: #fffcf380; }
.room-browser-columns h3 { margin: 0 0 .65rem; }
.lobby-status:empty { display: none; }
@media (max-width: 640px) { .room-browser-columns { grid-template-columns: 1fr; } }

#touch-play, .controls-card .touch-guide { display: none; }
.touch-input .controls-card .touch-guide { display: block; line-height: 1.5; }
.touch-input .controls-card > div:not(.controls-title), .touch-input .controls-card p:not(.touch-guide),
.touch-input #menu-button span { display: none; }
body.playing #world, #touch-play { touch-action: none; }
button, select { touch-action: manipulation; }
#touch-look { position: absolute; inset: 0; pointer-events: auto; touch-action: none; }
.touch-input.playing #touch-play {
  display: block; position: fixed; inset: 0; z-index: 5; pointer-events: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
#touch-pad, .touch-actions button { pointer-events: auto; touch-action: none; }
#touch-pad { position: absolute; bottom: 0; left: 0; width: 47%; height: 47%; }
#touch-stick {
  position: absolute; left: max(76px, 12vw); top: calc(100% - 78px - env(safe-area-inset-bottom));
  width: 82px; height: 82px; transform: translate(-50%, -50%);
  border: 2px solid #ffffffad; border-radius: 50%; background: #18374969; pointer-events: none;
}
#touch-stick i {
  position: absolute; inset: 26%; border-radius: 50%; background: #fff9;
  transform: translate(var(--knob-x, 0px), var(--knob-y, 0px));
}
.touch-size-setting { display: none; }
.touch-input .touch-size-setting { display: block; }
#touch-play {
  --throw-size: calc(100px * var(--touch-scale, 1));
  --action-width: max(58px, calc(72px * var(--touch-scale, 1)));
  --action-height: max(44px, calc(48px * var(--touch-scale, 1)));
  --pad-right: max(16px, env(safe-area-inset-right));
  --pad-left: max(16px, env(safe-area-inset-left));
  --pad-bottom: max(18px, env(safe-area-inset-bottom));
}
#touch-stick { width: calc(82px * var(--touch-scale, 1)); height: calc(82px * var(--touch-scale, 1)); }
.touch-actions { position: absolute; inset: 0; pointer-events: none; }
.touch-actions button {
  position: absolute; right: var(--pad-right);
  width: var(--action-width); height: var(--action-height); padding: 0 3px;
  border-radius: 24px; border: 2px solid #fff9; background: #18374954;
  color: white; font-size: clamp(12px, calc(14px * var(--touch-scale, 1)), 19px);
  font-weight: bold; text-shadow: 0 1px 3px #10202a, 0 0 2px #10202a;
}
#touch-throw {
  bottom: var(--pad-bottom); width: var(--throw-size); height: var(--throw-size);
  border-radius: 50%; background: #175c7166;
}
#touch-jump, #touch-taunt { bottom: calc(var(--pad-bottom) + var(--throw-size) + 18px); }
#touch-taunt { right: calc(var(--pad-right) + var(--action-width) + 14px); }
@media (max-width: 400px) {
  #touch-taunt { right: var(--pad-right); bottom: calc(var(--pad-bottom) + var(--throw-size) + var(--action-height) + 32px); }
}
#touch-crouch {
  left: var(--pad-left); right: auto;
  bottom: calc(var(--pad-bottom) + 78px + 48px * var(--touch-scale, 1));
}
#touch-crouch[aria-pressed="true"] { background: #804c1c99; border-color: #ffda9d; }
#touch-throw[data-charging] { background: #175c7199; border-color: white; }
.player-health {
  position: absolute;
  top: max(84px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  pointer-events: none;
}
body:not(.playing) .player-health { display: none; }
.player-health .hearts {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px; border: 1px solid #ffffff85; border-radius: 10px;
  background: #213441f2; color: #ffa6a0; font-size: 32px; line-height: 1.1;
  letter-spacing: 1px; filter: none; zoom: var(--ui-scale, 1);
}
.hearts strong { color: white; font-size: .56em; letter-spacing: normal; font-variant-numeric: tabular-nums; }
@media (max-width: 850px) {
  .player-health { top: calc(164px * var(--ui-scale, 1)); left: max(8px, env(safe-area-inset-left)); }
  .player-health .hearts { font-size: 28px; }
}
@media (max-height: 550px), (max-width: 600px) {
  .touch-input.playing .right-hud .round-note { display: none; }
  .touch-input.playing .player-health { top: calc(53px + 46px * var(--ui-scale, 1)); }
  .touch-input.playing .right-hud { top: 100px; right: 6px; max-width: 40vw; }
  .touch-input.playing .match-stats { zoom: 1; grid-template-columns: 1fr 1fr; padding: 4px 6px; gap: 2px 6px; font-size: 9px; }
  .touch-input.playing .match-stats strong { font-size: 10px; }
  .touch-input .overlay { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .touch-input.playing .topbar { height: 44px; }
  .touch-input.playing .match-notices { top: 45px; gap: 4px; }
  .touch-input.playing .scoreboard { height: 46px; }
}

#welcome {
  --home-top: max(82px, calc(56px * var(--ui-scale, 1) + env(safe-area-inset-top)));
  --home-bottom: max(16px, env(safe-area-inset-bottom));
  grid-template-columns: minmax(0, calc(510px * var(--ui-scale, 1))) minmax(0, calc(390px * var(--ui-scale, 1)));
  justify-content:center; overflow:auto;
  padding:var(--home-top) max(16px, env(safe-area-inset-right)) var(--home-bottom) max(16px, env(safe-area-inset-left));
}
#welcome .welcome-card {
  width:100%; min-width:0; display:flex; flex-direction:column;
  max-height:calc((100vh - var(--home-top) - var(--home-bottom)) / var(--ui-scale, 1));
  max-height:calc((100dvh - var(--home-top) - var(--home-bottom)) / var(--ui-scale, 1));
  overflow:visible; padding:clamp(12px,1.4vw,22px);
}
.home-fields { min-height:0; overflow:auto; padding:2px 4px; }
#welcome .online-options { flex:none; margin:8px 0 0; }
#welcome .character-picker { min-width:0; flex-wrap:wrap; }
.overlay .panel { max-width:calc((100vw - 40px - env(safe-area-inset-left) - env(safe-area-inset-right)) / var(--ui-scale,1)); }
.preview-column { display:grid; gap:12px; width:100%; min-width:0; grid-template-columns:minmax(0,1fr); }
.preview-column #home-controls { justify-self:stretch; margin:0; }
.preview-column .controls-card { width:100%; }
.preview-card { min-width:0; background:#f1e7d9; border:3px solid #886b57; border-radius:15px; padding:12px; color:#403631; }
.preview-heading,.preview-card label { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.preview-heading h2 { font-size:20px; margin:0; }
#preview-stage { position:relative; aspect-ratio:4/3; background:#c6dcec; border-radius:9px; overflow:hidden; margin:9px 0; }
#preview-stage #world { position:absolute; width:100%; height:100%; }
#preview-stage[data-error]::after { content:attr(data-error); position:absolute; inset:0; display:grid; place-items:center; }
.preview-card button { padding:8px; width:auto; }
#preview-throw { touch-action:none; }
#preview-stage.inspectable { touch-action:none; cursor:grab; }
#preview-stage.inspectable:active { cursor:grabbing; }
#preview-throw-tools p { margin:6px 0; font-size:12px; }
#inspect-landing[aria-pressed=true] { background:#295f66; color:white; }
.player-options { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,142px),1fr)); gap:8px 12px; margin:12px 0; }
.player-options > *, .player-options select, .player-options input { min-width:0; }
.player-options select { width:100%; }
.preview-heading,.preview-card label { flex-wrap:wrap; }
.preview-card input { max-width:100%; min-width:0; }
.player-options > label,.player-options .hand-setting { display:grid; align-content:start; gap:4px; font-size:12px; margin:0; padding:0; }
.player-options select,.preview-card select { max-width:100%; padding:5px; border-radius:6px; }
.player-options input { width:100%; accent-color:var(--teal); }
.player-options label:has(:disabled) { opacity:.62; }
.player-options .hand-setting label { margin:0; }
.preview-card input[type=range] { accent-color:var(--teal); }
.preview-card button,.preview-heading select { min-height:36px; }
#hud .match-notices > .player-health { position:static; justify-self:center; }
@keyframes hud-pulse { 50% { color: var(--pulse-color, white); transform:scale(1.12); } }
.team-score { --pulse-color: #ffe197; }
@keyframes score-pulse { 50% { color: #ffe197; text-shadow: 0 0 6px #ffe19780; } }
@media (prefers-reduced-motion:no-preference) {
  .score-pulse, .lost-heart { display:inline-block; animation:hud-pulse .38s ease-out; }
}
@media (prefers-reduced-motion:reduce) {
  .score-pulse { animation: score-pulse .38s ease-out; }
}
@media(max-width:740px) {
  #welcome { display:flex; flex-direction:column; align-items:stretch; justify-content:flex-start; }
  .preview-column { display:contents; }
  #welcome .preview-card { margin:12px 0; }
  #welcome .welcome-card { max-height:none; }
  .home-fields { overflow:visible; }
  #preview-stage { aspect-ratio:auto; height:clamp(120px,24dvh,220px); }
}
.throw-charge {
  position:absolute; left:50%; bottom:max(14px,env(safe-area-inset-bottom)); transform:translateX(-50%);
  width:min(calc(156px * var(--ui-scale,1)),36vw); padding:6px 10px; pointer-events:none;
  color:#fff3d3; background:#443930ef; border:2px solid #bfa180; border-radius:9px;
  text-align:center; font-size:calc(11px * var(--ui-scale,1)); font-weight:bold;
}
.throw-charge progress { display:block; width:100%; height:8px; margin-top:4px; border:0; border-radius:4px; overflow:hidden; background:#292522; appearance:none; }
.throw-charge progress::-webkit-progress-bar { background:#292522; }
.throw-charge progress::-webkit-progress-value { background:#ffd07e; }
.throw-charge progress::-moz-progress-bar { background:#ffd07e; }
.host-rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin-top: 12px; }
.host-rules .home-field { margin: 0; }
#host-panel .multiplayer-panel { width: min(620px, 100%); }
#map-setup { grid-column: 1 / -1; margin-top: 12px; }
.map-picker { padding: 0; margin: 14px 0 0; border: 0; min-width: 0; }
.map-picker legend { margin-bottom: 6px; font-weight: 700; }
#map-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.map-card { position: relative; display: grid; align-content: start; gap: 3px; padding: 5px 7px 9px;
  border: 2px solid #b2c6bf; border-radius: 8px; background: #eaf0e9; color: #244743; cursor: pointer; }
.map-card:has(input:checked) { border-color: #236b61; background: #d9eee6; }
.map-card:focus-within { outline: 2px solid #255a8b; outline-offset: 2px; }
.map-card input { position: absolute; top: 6px; left: 6px; width: 15px; height: 15px; margin: 0; accent-color: #236b61; }
.map-card img { width: 100%; height: auto; aspect-ratio: 3 / 2; }
.map-card strong { font-size: 14px; line-height: 1.2; }
.map-card small { font-size: 12px; line-height: 1.35; }
.empty-map { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; cursor: pointer; }
.empty-map input { margin: 0; accent-color: #236b61; }
@media (max-width: 510px) {
  #map-cards { grid-template-columns: 1fr; }
  .map-card { grid-template-columns: 76px 1fr; column-gap: 8px; padding: 5px 8px; align-items: center; }
  .map-card img { grid-row: span 2; }
  .map-card strong { align-self: end; }
  .map-card small { align-self: start; }
}
.point-stepper, .builder-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.point-stepper input { width: 8ch; text-align: center; appearance: textfield; }
.point-stepper input::-webkit-inner-spin-button { appearance: none; }
.point-stepper button, .builder-row button, .builder-row select, #chat-audience {
  padding: 6px 9px; border: 1px solid #b3c9cf; border-radius: 7px; color: #284657; background: #fcfffe;
  font: inherit; font-size: 12px;
}
#layout-lock, #prop-apply { background: #28606c; color: white; }
#layout-canvas { display: block; width: 100%; height: clamp(150px, 21vh, 245px); border-radius: 8px; touch-action: manipulation; }
#layout-feedback, #layout-summary { margin: 2px 0 6px; font-size: 12px; }
#layout-feedback:empty { display: none; }
#prop-picker { position: relative; flex: 1 1 150px; min-width: 0; color: #284657; }
#prop-picker summary { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 2px 9px 2px 3px; background: #fcfffe; border: 1px solid #b3c9cf; border-radius: 7px; font-size: 12px; cursor: pointer; }
#prop-picker summary::after { content: '▾'; }
#prop-current, #prop-options button { display: flex; align-items: center; gap: 8px; text-align: left; }
#prop-picker img { width: 42px; height: 36px; object-fit: contain; background: #e0ebed; border-radius: 4px; }
#prop-options { position: absolute; z-index: 3; width: max-content; min-width: 100%; max-height: min(220px,32vh); overflow: auto; padding: 3px; border: 1px solid #abc0c4; background: #fff; border-radius: 6px; box-shadow: 0 5px 14px #21394e30; }
#prop-options button { width: 100%; border: 0; padding: 3px; }
#prop-options button:is(:hover,:focus-visible,[aria-pressed=true]) { background: #dbecee; }
#layout-panel .builder-row { margin: 6px 0; }
#layout-panel select { max-width: 100%; }
#layout-panel label { font-size: 12px; }
.room-workspace { display: grid; gap: 10px; min-width: 0; }
.room-workspace .chat-messages { height: 95px; flex: 0 0 95px; }
.room-workspace .chat-form { grid-template-columns: auto minmax(0,1fr) auto; }
.chat-messages strong { text-decoration: underline; }
.lobby-seats li[hidden] { display:none; }
@container lobby (min-width: 590px) {
  .lobby-content { grid-template-columns: minmax(220px, .95fr) minmax(300px, 1.35fr); align-items: start; }
}
@container lobby (max-width: 589px) {
  .lobby-content { grid-template-columns: minmax(0,1fr); }
}

/* The same guide opens from the home screen, room and pause menu. */
.controls-card.guide-launcher { padding: 0; }
#open-play-guide {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  min-height: 48px; width: 100%; padding: 12px 16px; border-radius: inherit;
  font-weight: bold; color: #42352d; background: transparent; text-align: left;
}
#open-play-guide:hover { background: #fff4dc; }
#play-guide {
  box-sizing: border-box; width: min(660px, calc(100vw - 24px)); max-height: 86dvh;
  overflow: auto; overscroll-behavior: contain; padding: clamp(18px, 4vw, 32px);
  color: #403631; background: #fff8eb; border: 2px solid #886b57;
  border-radius: 16px; box-shadow: 0 20px 64px #241c1440;
}
#play-guide::backdrop { background: #22202299; }
#play-guide header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#play-guide header button { width: auto; margin: 0; padding: 8px 14px; }
#play-guide h2 { margin: 0; font-size: clamp(22px, 3vw, 30px); }
#play-guide h3 { margin: 16px 0 4px; font-size: 16px; }
#play-guide p, .guide-list { font-size: 14px; line-height: 1.5; }
#play-guide p { margin: 0; }
.guide-rules { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid #cbb9a4; }
.guide-list { margin: 10px 0 0; }
.guide-list > div { display: grid; grid-template-columns: minmax(78px, 30%) 1fr; gap: 12px; align-items: baseline; padding: 6px 0; }
.guide-list dd { margin: 0; }
.guide-list kbd { display: inline-block; padding: 2px 5px; background: #ede3d1; border-radius: 4px; font-family: inherit; font-size: 12px; font-weight: bold; }
.guide-touch, .touch-input .guide-desktop { display: none; }
.touch-input .guide-touch { display: block; }

.cassette-choice { min-width: 0; margin: 0; padding: 0; border: 0; }
.cassette-choice legend { margin-bottom: 5px; padding: 0; font-size: 12px; font-weight: bold; }
.cassette-keys {
  display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 3px;
  padding: 3px; border-radius: 7px; background: #584a40;
}
.cassette-keys label { position: relative; display: grid; min-width: 0; cursor: pointer; }
.cassette-keys input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.cassette-key {
  display: grid; align-content: center; justify-items: center; gap: 2px; min-height: 44px;
  margin-bottom: 4px; padding: 4px 6px; border-radius: 4px; text-align: center;
  background: #f2e7d6; color: #40352d; box-shadow: inset 0 1px #fff8ed, 0 4px #b59a7d;
  transition: transform 100ms, box-shadow 100ms;
}
.cassette-key strong { font-size: 13px; }
.cassette-key small { font-size: 11px; }
.cassette-keys input:checked + .cassette-key {
  transform: translateY(4px); background: #d5e7e4; color: #184f50;
  box-shadow: inset 0 2px 3px #284a493d, inset 0 -3px #428484;
}
.cassette-keys input:focus-visible + .cassette-key { outline: 2px solid #126e84; outline-offset: -3px; }
@media (prefers-reduced-motion: reduce) { .cassette-key { transition: none; } }
@media (max-width: 600px) { .host-rules { grid-template-columns: 1fr; } }

/* Lodge arrival: the menu sits beside the view of the porch and team parking. */
body[data-hub-view=exterior] .cabin-hub-exterior {
  background: var(--park-exterior-texture) 58% 55% / cover no-repeat;
}
#welcome {
  display:flex; justify-content:flex-start; align-items:center;
  padding-inline:clamp(20px,4vw,76px); background:linear-gradient(90deg,#34484e45,transparent 48%);
}
#welcome .welcome-card {
  width:min(344px,100%); padding:0; border:1px solid #fff5df;
  border-top:5px solid #925133; border-radius:5px 5px 16px 16px;
  background:#fcf7ebf5; box-shadow:0 14px 48px #28323042;
}
#welcome .home-fields { padding:20px 22px 14px; }
#welcome-title { font-family:Georgia,serif; font-size:clamp(41px,4vw,58px); letter-spacing:-.055em; line-height:.98; margin:0 0 10px; }
#welcome-title em { font-family:inherit; color:#885033; font-weight:normal; font-style:italic; }
#welcome .welcome-copy { font-size:12px; line-height:1.5; margin:0 0 18px; }
#welcome .online-options { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin:14px 0; }
#welcome .online-options button { width:100%; margin:0; }
#welcome #join-button { background:#f2e8d8; border-color:#a0856c; color:#46382c; box-shadow:0 3px #aa9178; }
#welcome .lodge-drawer { border-top:1px solid #d7c8b3; }
#welcome .lodge-drawer summary { display:flex; align-items:center; justify-content:space-between; padding:12px 0; cursor:pointer; font-size:13px; font-weight:700; list-style:none; }
#welcome .lodge-drawer summary::after { content:'+'; color:#875536; font-size:17px; }
#welcome .lodge-drawer[open] summary::after { content:'−'; }
#welcome .lodge-drawer summary::-webkit-details-marker { display:none; }
#welcome .preview-card { border:0; padding:0 0 10px; background:transparent; }
#welcome #home-controls { margin:0; width:100%; }
#welcome .guide-launcher { width:100%; zoom:1; border:0; border-top:1px solid #d7c8b3; border-radius:0; background:none; box-shadow:none; }
#welcome #open-play-guide { padding:9px 0; min-height:40px; }
.lodge-postcard { display:none; }
@media(max-width:740px) {
  #welcome { display:block; padding:var(--home-top) 12px 20px; background:#e6dccd; }
  #welcome .lodge-postcard { display:block; width:calc(100% + 24px); height:clamp(170px,32vh,320px); margin:-8px -12px 0;
    background:var(--park-exterior-texture) 66% 62% / cover no-repeat; }
  #welcome .welcome-card { width:100%; max-width:560px; margin:-6px auto 0; position:relative; }
  #welcome .home-fields { padding:16px; }
}

.guide-steps { list-style:none; padding:0; margin:10px 0 20px; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; counter-reset:step; }
.guide-steps li { position:relative; counter-increment:step; padding:12px; border:1px solid #d2c3a9; border-radius:7px; background:#fffbf2; }
.guide-steps li::before { content:counter(step); position:absolute; top:10px; left:10px; color:#755e46; font-weight:bold; }
.guide-example { display:flex; gap:7px; align-items:center; justify-content:center; min-height:54px; padding:4px 0 8px 12px; color:#205e65; }
.guide-example b { font-size:23px; }
.guide-example span { padding:5px 7px; border:1px solid #93aaa5; border-bottom-width:3px; border-radius:5px; background:#e6f0eb; font-size:12px; font-weight:bold; }
@media(max-width:460px) { .guide-steps { grid-template-columns:1fr; } }

#region-picker { position:relative; pointer-events:auto; }
#region-picker summary { width:44px; height:38px; display:grid; place-items:center; cursor:pointer; list-style:none; background:#fffaf0ed; border:1px solid #ab987d; border-radius:8px; }
#region-picker summary::-webkit-details-marker { display:none; }
.region-flag { display:inline-block; position:relative; flex-shrink:0; width:30px; height:18px; background-image:var(--region-art); background-size:30px auto; background-position:0 calc(-18px * var(--flag-row)); border-radius:2px; box-shadow:0 0 0 1px #302b2338; }
.region-flag[data-script]:not([data-script=""])::after { content:attr(data-script); position:absolute; bottom:-4px; right:-3px; font: bold 12px/14px system-ui; padding:0 2px; color:white; background:#262d37; border-radius:3px; }
#region-options { position:absolute; right:0; top:calc(100% + 5px); width:min(244px,72vw); max-height:min(420px,62dvh); overflow:auto; overscroll-behavior:contain; padding:5px; background:#fff9eb; border:1px solid #a89170; border-radius:8px; box-shadow:0 8px 20px #30271944; }
#region-options button { display:flex; gap:12px; align-items:center; width:100%; padding:6px 9px; min-height:44px; text-align:left; background:none; color:#233a41; border-radius:4px; }
#region-options button:is(:hover,:focus-visible,[aria-pressed=true]) { background:#d9e9e6; }
@media(pointer:coarse) {
  input:not([type=range]):not([type=checkbox]):not([type=radio]), select, textarea { font-size:max(16px,1em) !important; }
}
.touch-input.playing :is(#world,#hud,#touch-play,.topbar) {
  inset:auto; left:var(--view-left,0px); top:var(--view-top,0px); width:var(--view-width,100vw);
}
.touch-input.playing :is(#world,#hud,#touch-play) { height:var(--view-height,100dvh); }
@media(max-height:550px),(max-width:600px) {
  .touch-input.playing .topbar { padding:env(safe-area-inset-top) max(8px,env(safe-area-inset-right)) 0 max(8px,env(safe-area-inset-left)); height:calc(44px + env(safe-area-inset-top)); gap:4px; }
  .touch-input.playing .topbar .place { display:none; }
  .touch-input.playing .topbar .brand, .touch-input.playing .top-actions { zoom:1; }
  .touch-input.playing .topbar .brand { font-size:20px; }
  .touch-input.playing .match-notices { width:calc(100% - 20px - env(safe-area-inset-left) - env(safe-area-inset-right)); top:calc(47px + env(safe-area-inset-top)); }
  .touch-input.playing .scoreboard { zoom:1; width:min(280px,100%); min-width:0; height:42px; }
  .touch-input.playing .scoreboard > * { flex:1; min-width:0; }
  .touch-input.playing .scoreboard :is(.team-score,.clock) { padding:1px 4px; margin:0; gap:0; }
  .touch-input.playing .scoreboard .team-score div { gap:0; }
  .touch-input.playing .scoreboard small { font-size:8px; line-height:10px; }
  .touch-input.playing .scoreboard strong { font-size:20px; line-height:21px; }
  .touch-input.playing .player-health .hearts { zoom:1; font-size:20px; padding:2px 6px; }
  .touch-input.playing .right-hud { top:calc(49px + env(safe-area-inset-top)); right:max(6px,env(safe-area-inset-right)); }
}
@media(max-width:600px) {
  #region-options { width:min(230px,calc(100vw - 130px)); }
  .touch-input.playing .right-hud { top:calc(121px + env(safe-area-inset-top)); left:8px; right:auto; max-width:none; }
  .touch-input.playing .match-stats { grid-template-columns:repeat(2,auto); }
}
