:root{color-scheme:dark;--bg:#111a3b;--line:#495580;--muted:#a8b3d5;--white:#f4f3ff;--mint:#c8f58d}*{box-sizing:border-box}body{margin:0;color:var(--white);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC',sans-serif}.app{max-width:1320px;padding:0 48px;margin:auto}button,a{-webkit-tap-highlight-color:transparent}button{font:inherit;cursor:pointer;color:inherit}button:focus-visible,a:focus-visible,canvas:focus-visible{outline:3px solid #c8f58d;outline-offset:4px}header{height:100px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between}.brand{display:flex;align-items:center;gap:12px;color:inherit;text-decoration:none;font-size:19px;font-weight:800;letter-spacing:3px}.brand-icon{background:linear-gradient(135deg,#d5f896,#ad91f3,#ff9dbe);color:#141723;border-radius:12px;font-size:32px;line-height:40px;text-align:center;width:42px;letter-spacing:0}.brand-sub{font-size:10px;color:var(--muted);font-weight:500;letter-spacing:2px;margin-left:7px}.small{border:1px solid var(--line);border-radius:30px;background:transparent;padding:9px 15px;font-size:12px;color:#bfc3d6}.small:disabled{opacity:.4;cursor:default}.intro{display:flex;justify-content:space-between;align-items:center;padding:38px 0 30px}.eyebrow{font-size:10px;letter-spacing:2px;color:var(--mint);font-weight:700;margin:0 0 12px}h1{font-size:36px;letter-spacing:-1px;margin:0;line-height:1.4}h1 span{font-size:15px;letter-spacing:0;font-weight:400;margin-left:18px;color:#a6a5c2}.subtitle{font-size:13px;color:var(--muted);margin:12px 0 0}.best{display:flex;flex-direction:column;text-align:right;gap:6px}.best span:first-child{font-size:12px;color:#babbd0}.best strong{font-size:34px;font-variant-numeric:tabular-nums;letter-spacing:2px}.best span:last-child{font-size:9px;color:var(--muted);letter-spacing:1.5px}.game-layout{display:grid;grid-template-columns:minmax(0,1fr) 260px;gap:24px}.game-card{border:1px solid #37354e;border-radius:20px;background:#171a2b;overflow:hidden;align-self:start;box-shadow:0 20px 65px #0002}.game-top{height:64px;padding:0 22px;display:flex;align-items:center;justify-content:space-between}.game-top>div{display:flex;align-items:center;gap:10px;font-size:13px}.live-dot{height:6px;width:6px;background:var(--mint);border-radius:50%;box-shadow:0 0 10px #c8f58455}.level{font-size:9px;color:#9e94bb;letter-spacing:1px;background:#29253e;border-radius:4px;padding:5px 7px}.board-wrap{position:relative;margin:0 12px;border:1px solid #292f43;border-radius:12px;overflow:hidden;aspect-ratio:1.5}canvas{display:block;width:100%;height:100%;touch-action:none}.overlay{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;background:#141e44a6;text-align:center;padding:20px;backdrop-filter:blur(1px)}.overlay.hidden{display:none}.rainbow-mark{font-size:100px;line-height:100px;font-weight:bold;background:linear-gradient(100deg,#b6f39b,#7acaf4,#bc8df0,#fc8bab,#ffca72);color:transparent;background-clip:text;transform:rotate(-12deg);margin-bottom:20px}h2{font-size:25px;margin:3px 0 12px;letter-spacing:-.5px}.overlay>p:not(.eyebrow){font-size:12px;color:#a6adc4;margin:0 0 26px}.primary{background:var(--mint);border:0;border-radius:12px;padding:15px 30px;color:#253223;font-size:14px;font-weight:700;min-width:200px;box-shadow:0 4px 28px #b4ef7920}.primary span{margin-left:35px}.hint{color:#737c94;font-size:10px;margin-top:18px}.game-bottom{display:flex;justify-content:center;gap:24px;padding:20px 12px;font-size:10px;color:#9fa6bc}.game-bottom span{display:flex;align-items:center;gap:6px}.dot{width:6px;height:6px;border-radius:50%;display:inline-block}.pink{background:#ef91ba}.gold{background:#f5cf6b}.cyan{background:#81e0e1}aside{display:flex;flex-direction:column;gap:20px}.score-card{background:linear-gradient(120deg,#26253c,#202237);border:1px solid #3c3b53;border-radius:18px;padding:22px}.score-label{font-size:12px;color:#c5c6d8;display:flex;justify-content:space-between}.score-label span{color:#d3b0ff}.score-card>strong{font-size:50px;line-height:1.5;font-weight:600;letter-spacing:2px;font-variant-numeric:tabular-nums}.progress-label{display:flex;justify-content:space-between;font-size:10px;color:#a8abc1;margin:9px 0}.progress{height:4px;background:#3b3d53;border-radius:5px;overflow:hidden}.progress>div{height:100%;width:0;background:linear-gradient(90deg,#bd9ef0,#cbf694);transition:width .2s}.shield-status{margin-top:16px;padding-top:14px;border-top:1px solid #3a3b50;font-size:10px;color:#9299b2}.shield-status.on{color:#81e0e1}.journey{padding:0 5px}.journey .eyebrow{font-size:9px;color:#858da8}.journey h3{font-size:13px;font-weight:500;margin:0 0 13px}ol{padding:0;list-style:none;margin:0}li{display:flex;align-items:center;gap:13px;padding:9px 10px;color:#737c97;font-size:11px;border-radius:7px}li span{font-size:10px;min-width:22px;font-variant-numeric:tabular-nums}li i{font-style:normal;margin-left:auto;opacity:.6}.active{background:#252d2c;color:#ceeaa9}.controls{margin-top:auto;text-align:center}.dpad{display:grid;grid-template-columns:repeat(3,42px);grid-template-rows:repeat(2,36px);gap:5px;justify-content:center}.dpad button{background:#212638;border:1px solid #353b52;border-radius:8px;touch-action:manipulation}.dpad button:first-child{grid-column:2}.dpad button:nth-child(2){grid-column:1}.controls p{font-size:10px;line-height:1.9;color:#8e96ad}.controls p span{color:#646f8a}.restart{background:none;border:none;color:#a7afc8;font-size:11px;padding:8px}footer{display:flex;justify-content:space-between;padding:29px 0;color:#636b84;font-size:9px;letter-spacing:1.5px}.footer-star{color:#bba1e6;margin-left:12px;font-size:18px}#toast{position:absolute;top:18px;left:50%;transform:translateX(-50%);background:#c8f58d;color:#263421;border-radius:25px;padding:10px 20px;font-size:12px;opacity:0;pointer-events:none;transition:opacity .25s;white-space:nowrap}#toast.show{opacity:1}@media(min-width:1400px){.app{padding-top:15px}}@media(max-width:950px){.app{padding:0 24px}.game-layout{grid-template-columns:minmax(0,1fr) 210px;gap:16px}.game-top{padding:0 13px}.level{display:none}h1{font-size:30px}h1 span{display:block;margin:2px 0;font-size:12px}.game-bottom{gap:12px;font-size:9px}.score-card{padding:17px}h2{font-size:21px}.rainbow-mark{margin-bottom:5px;font-size:80px;line-height:80px}.journey li{padding:6px 8px}}@media(max-width:650px){.app{padding:0 16px}header{height:72px}.brand-sub{display:none}.intro{padding:24px 0}.eyebrow{font-size:8px}h1{font-size:27px}.subtitle{font-size:11px}.best strong{font-size:28px}.best span:first-child{font-size:10px}.game-layout{grid-template-columns:1fr}.game-top{height:54px}.game-bottom{padding:16px 8px}.overlay h2{font-size:20px}.overlay>p:not(.eyebrow){font-size:10px;margin-bottom:16px}.rainbow-mark{font-size:65px;line-height:55px}.overlay .eyebrow{margin-bottom:7px}.primary{padding:12px 22px}.hint{margin-top:12px}aside{display:grid;grid-template-columns:1fr 1fr;gap:16px}.journey{display:none}.score-card>strong{font-size:36px}.controls{align-self:center}.controls p{margin:8px 0}.score-card{padding:15px}footer{font-size:7px;letter-spacing:.5px}.best span:last-child{font-size:7px}.board-wrap{margin:0 8px}}

/* Compact, touch-friendly audio controls on H5 screens. */
header{gap:8px}header .small{white-space:nowrap;min-height:40px}#music{margin-left:auto}header .brand{flex-shrink:0}@media(max-width:650px){header{flex-wrap:wrap;height:auto;min-height:88px;padding:12px 0;gap:6px}header .brand{font-size:14px;letter-spacing:1px}header .brand-icon{width:30px;line-height:30px;font-size:24px}header .small{font-size:10px;padding:8px 9px}.brand-sub{display:none}}

/* 星空实验室 */
body {
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 19px 31px, #d8e8ff80 0 1px, transparent 1.6px),
    radial-gradient(circle at 89px 63px, #c0b9ff75 0 1.3px, transparent 2px),
    radial-gradient(circle at 52px 103px, #9acaff65 0 1px, transparent 1.7px),
    radial-gradient(ellipse at 12% 10%, #344c91 0, transparent 54%),
    radial-gradient(ellipse at 94% 28%, #523b81 0, transparent 54%),
    linear-gradient(155deg, #202951, #111a3b 80%);
  background-size: 157px 173px, 213px 191px, 119px 151px, 100% 100%, 100% 100%, 100% 100%;
}
.game-card {
  background: linear-gradient(150deg, #26325c, #20264a);
  border-color: #566294;
}
.board-wrap {
  border-color: #788dcc;
  background-color: #141e40;
  background-image:
    linear-gradient(90deg, #849bd21a 1px, transparent 1px),
    linear-gradient(#849bd21a 1px, transparent 1px),
    radial-gradient(circle at 26px 41px, #9dbafa55 0 1px, transparent 1.6px),
    radial-gradient(circle at 103px 61px, #c5b7ff50 0 1px, transparent 1.6px),
    linear-gradient(145deg, #20335d, #1d244a 60%, #2c2856);
  background-size: calc(100% / 30) 100%, 100% 5%, 139px 127px, 167px 113px, 100% 100%;
}

.release-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 12px 16px;
  margin-top: 16px;
  border: 1px solid #8c78b6;
  border-radius: 12px;
  background: #322951;
  color: #f4edff;
  font-size: 13px;
}
.release-notice[hidden],
.release-notice button[hidden] {
  display: none;
}

.game-top .level {
  display: inline-block;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .game-card .rainbow-mark { display: none; }
  .game-card .overlay > p:not(.eyebrow) { margin-bottom: 8px; }
}

.game-top .screen-actions {
  gap: 6px;
  justify-content: flex-end;
}
.screen-actions .small {
  white-space: nowrap;
}
.screen-score {
  display: none;
}
body.game-screen-open {
  overflow: hidden;
  overscroll-behavior: none;
}
.game-card.is-expanded {
  position: fixed;
  z-index: 10;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  border: 0;
  border-radius: 0;
}
.is-expanded .game-top {
  min-height: 48px;
  height: auto;
  padding: 4px clamp(8px, 2vw, 24px);
  gap: 4px;
}
.is-expanded .screen-actions .small {
  min-height: 40px;
  padding: 6px 10px;
}
.is-expanded .game-stage {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 4px;
  container-type: size;
}
.is-expanded .board-wrap {
  width: min(100%, max(0px, (100vh - 110px) * 1.5));
  width: min(100%, 150cqh);
  margin: 0;
}
.is-expanded .game-bottom {
  display: none;
}
.is-expanded .game-top .level {
  display: none;
}
.is-expanded .screen-score {
  display: block;
  min-height: 26px;
  padding: 4px 8px;
  color: var(--white);
  font-size: clamp(12px, 3.5vw, 16px);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
@media (max-width: 380px) {
  .is-expanded .game-top > div { gap: 4px; }
  .is-expanded .screen-actions .small { padding-inline: 6px; font-size: 11px; }
  .is-expanded .connection { display: none; }
}

.solo-game.is-expanded {
  grid-template-rows: auto minmax(0, 1fr);
}
.solo-game.is-expanded .game-top {
  flex-wrap: wrap;
}
.solo-game.is-expanded .game-top .screen-score {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-inline: auto;
  padding: 3px 0;
}
.shield-counter {
  white-space: nowrap;
  color: #a5f3f6;
}
@media (max-width: 640px) {
  .solo-game.is-expanded .screen-score {
    order: 1;
    flex-basis: 100%;
  }
}

.battle-items {
  position: absolute;
  z-index: 2;
  right: 8px;
  bottom: 8px;
  display: flex;
  gap: clamp(14px, 4vw, 22px);
}
.battle-slot {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: #14203be8;
  color: #8891a8;
  font-size: 22px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.battle-slot.stocked { cursor: grab; }
.battle-slot.stocked:active { cursor: grabbing; }
.freeze-slot.stocked { color: #a5e7ff; }
.slow-slot.stocked { color: #dab8ff; }
.shield-slot.stocked { color: #9eefd1; }
.battle-slot .item-count {
  position: absolute;
  right: -2px;
  bottom: -2px;
  min-width: 17px;
  padding: 1px 3px;
  border: 1px solid currentColor;
  border-radius: 12px;
  background: #14203b;
  font-size: 11px;
  line-height: 13px;
  text-align: center;
}
.battle-drag-icon {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -115%);
  border: 1px solid currentColor;
  border-radius: 50%;
  background: #14203b;
  font-size: 22px;
}
.battle-drag-icon[hidden] { display: none; }
.item-status {
  position: absolute;
  z-index: 2;
  top: 4px;
  left: 50%;
  width: max-content;
  max-width: 90%;
  transform: translateX(-50%);
  margin: 0;
  padding: 4px 8px;
  border-radius: 8px;
  background: #141e44e8;
  color: #edf4ff;
  font-size: 12px;
  pointer-events: none;
}
.item-status:empty { display: none; }

.multiplayer-game .game-top {
  height: auto;
  min-height: 54px;
  gap: 6px;
  flex-wrap: wrap;
  padding-block: 4px;
}
.game-top .battle-avatars {
  gap: 5px;
  justify-content: center;
}
.battle-avatars:empty {
  display: none;
}
.player-avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  overflow: hidden;
  flex: none;
  border: 2px solid #8ba3d5;
  border-radius: 50%;
  background: #263457;
  color: #f4f3ff;
  font-weight: 700;
}
.player-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.player-avatar.avatar-inactive {
  opacity: .5;
}
@media (max-width: 540px) {
  .game-top .battle-avatars {
    order: 1;
    flex-basis: 100%;
  }
}

.desktop-mode-link {
  text-decoration: none;
}
@media (max-width: 680px) {
  .game-page.has-game-navigation > .app {
    padding: 0 max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  .game-page > .app > header {
    min-height: 60px;
    padding: 8px 0;
  }
  .has-game-navigation .desktop-mode-link,
  .game-page .intro .eyebrow,
  .game-page .intro h1 span,
  .game-page footer {
    display: none;
  }
  .game-page .intro {
    padding: 14px 0;
  }
  .game-page .intro h1 {
    font-size: 23px;
  }
  .game-page .intro .subtitle {
    margin-top: 4px;
  }
  .game-page .game-layout,
  .game-page .arena-layout {
    gap: 12px;
  }
  .game-page .game-card {
    min-width: 0;
  }
  .game-page .game-card:not(.is-expanded) .board-wrap {
    margin-inline: 4px;
  }
  .settings-main :is(button, input) {
    min-height: 44px;
  }
  .room-card input,
  .account-card input,
  .settings-main input {
    font-size: 16px;
  }

}

.game-top .screen-score {
  display: none;
}
.profile-audio {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}
.profile-audio #music {
  margin: 0;
}

@media (max-width: 680px) {
  .solo-page {
    background: linear-gradient(155deg, #252e5a, #101734 65%);
  }
  .solo-page > .app > header {
    min-height: 54px;
    border-bottom-color: #3d4b76;
  }
  .solo-page .intro {
    padding: 20px 0 12px;
  }
  .solo-page .intro h1 {
    font-size: 27px;
    letter-spacing: 0;
  }
  .solo-page .game-layout > aside {
    display: block;
  }
  .solo-page .game-layout > aside .score-card,
  .solo-page .game-layout > aside .controls,
  .solo-page .solo-game .game-bottom,
  .solo-page .solo-game:not(.is-expanded):not([data-phase=running]) .game-top {
    display: none;
  }
  .solo-page .solo-game:not(.is-expanded) .board-wrap {
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .solo-page .solo-game:not(.is-expanded) .overlay {
    padding: 14px;
    background: linear-gradient(155deg, #14204ba6, #111938e8);
  }
  .solo-page .solo-game:not(.is-expanded) .overlay .rainbow-mark {
    display: block;
    margin: 0 0 6px;
    font-size: 50px;
    line-height: 1;
  }
  .solo-page .solo-game .overlay .eyebrow {
    display: none;
  }
  .solo-page .solo-game .overlay h2 {
    font-size: clamp(19px, 5vw, 23px);
  }
  .solo-page .solo-game .overlay .primary {
    min-height: 46px;
    min-width: min(200px, 100%);
  }
  .solo-page .solo-game .overlay .hint {
    font-size: 11px;
    color: #b3bfdf;
  }
  .solo-page .solo-game[data-phase=running]:not(.is-expanded) .game-top {
    min-height: 46px;
    height: auto;
    padding: 3px 8px;
    flex-wrap: wrap;
  }
  .solo-page .solo-game[data-phase=running]:not(.is-expanded) .game-top .screen-score {
    display: flex;
    order: 1;
    flex-basis: 100%;
    justify-content: center;
    gap: 6px;
    padding: 4px 0;
  }
  .solo-page .solo-game[data-phase=running]:not(.is-expanded) .game-top .level {
    display: none;
  }
}

#pause-restart {
  min-height: 44px;
}
.solo-game[data-phase=paused] .overlay .hint {
  display: none;
}

.has-game-navigation header #music,
.has-game-navigation header #sound {
  display: none;
}
.game-page header .profile-link {
  width: 44px;
  height: 44px;
  margin-left: auto;
  text-decoration: none;
}
.launch-page header .profile-link {
  font-size: 24px;
  line-height: 1;
}
.launch-page.project-open header .profile-link {
  display: none;
}
.launch-page .app,
.settings-page .app,
.admin-page .app {
  max-width: 1000px;
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
}
.launch-main,
.settings-main {
  padding: clamp(20px, 6vh, 60px) 0 max(24px, env(safe-area-inset-bottom));
}
.launch-page .app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
}
.launch-main {
  display: grid;
  flex: 1;
  align-content: center;
  width: min(100%, 892px);
  margin-inline: auto;
  text-align: center;
  container-type: inline-size;
}
.launch-page.project-draft-open .app {
  height: 100dvh;
}
.launch-page.project-draft-open .launch-main {
  padding-block: 0;
}
.launch-page.project-draft-open #project-draft p {
  margin: 0;
}
.launch-section h2 {
  margin: 0 0 clamp(10px, 3vh, 18px);
  font-size: clamp(18px, 3.5vw, 24px);
}
.launch-section + .launch-section {
  margin-top: 96px;
}
#finish-layout[hidden],
#project-back[hidden],
#home-tiles[hidden],
#layout-status[hidden] {
  display: none;
}
#finish-layout,
#project-back {
  order: 1;
}
#home-tiles .mode-card {
  user-select: none;
  -webkit-touch-callout: none;
}
#home-tiles.is-reordering .mode-card {
  touch-action: none;
  cursor: grab;
  animation: tile-wiggle 240ms ease-in-out infinite alternate;
}
#home-tiles .mode-card.is-dragging {
  position: relative;
  z-index: 1;
  pointer-events: none;
  translate: var(--drag-x, 0px) var(--drag-y, 0px);
  animation: none;
  cursor: grabbing;
}
@keyframes tile-wiggle {
  from { rotate: -1deg; }
  to { rotate: 1deg; }
}
@media (prefers-reduced-motion: reduce) {
  #home-tiles.is-reordering .mode-card {
    animation: none;
    border-color: var(--mint);
  }
}
.launch-page header h1 {
  font-size: clamp(22px, 4vw, 32px);
  letter-spacing: 0;
}
.brand .rainbow-logo {
  position: relative;
  flex: none;
  height: 42px;
  background: #222e56;
}
.rainbow-logo::before {
  position: absolute;
  inset: 20% 12%;
  content: '';
  background: radial-gradient(circle at 50% 100%,
    transparent 0 28%, #a98cff 29% 37%, #75c6ff 38% 46%,
    #93e8ab 47% 55%, #ffe283 56% 64%, #ff98b5 65% 73%, transparent 74%) top / 100% 75% no-repeat;
}
.mode-grid {
  --original-gap: clamp(10px, 3vw, 24px);
  --mode-card-width: calc((min(100cqw, 820px) - var(--original-gap)) / 2);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: calc(4 * var(--original-gap));
}
#home-tiles {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--mode-card-width));
}
.mode-grid > .mode-card {
  flex: 0 0 var(--mode-card-width);
  min-width: 0;
}
.mode-grid-single {
  grid-template-columns: minmax(0, 1fr);
  width: min(100%, 400px);
  margin-inline: auto;
}
.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: clamp(150px, 34vh, 240px);
  gap: 12px;
  padding: clamp(14px, 4vw, 34px);
  border: 1px solid #596aa2;
  border-radius: 20px;
  color: var(--white);
  text-decoration: none;
}
[data-project] .mode-grid > .mode-card {
  flex-basis: calc(var(--mode-card-width) * 0.8);
  min-height: clamp(120px, 27.2vh, 192px);
}
[data-project="plants"] {
  --plants-card-gap: clamp(12px, 2vw, 24px);
}
[data-project="plants"] .mode-grid {
  gap: var(--plants-card-gap);
}
[data-project="plants"] .mode-grid > .mode-card {
  flex-basis: min(320px, calc((100% - 2 * var(--plants-card-gap)) / 3));
  min-height: clamp(104px, 24dvh, 192px);
  padding: clamp(12px, 2vh, 24px);
}
.plants-extra-entries {
  margin-top: var(--plants-card-gap);
}
.launch-page header #plants-records { display: none; }
.launch-page:has([data-project="plants"]:not([hidden])) header #plants-records {
  display: inline-grid;
  margin-inline-start: auto;
}
.launch-page:has([data-project="plants"]:not([hidden])) #project-back {
  margin-inline-start: clamp(12px, 2vw, 18px);
}
@container (max-width: 500px) {
  [data-project="plants"] .mode-grid > .mode-card {
    flex-basis: min(100%, 320px);
    min-height: 112px;
  }
}
.mode-solo {
  background: linear-gradient(150deg, #364878, #212c56);
}
.mode-battle {
  background: linear-gradient(150deg, #483968, #29264c);
}
.project-icon {
  position: relative;
  flex: none;
  width: 52px;
  height: 46px;
  zoom: 1.5;
}
.project-icon-plants {
  object-fit: contain;
  transform: scale(1.44);
}
.project-icon-snake::before {
  position: absolute;
  inset: 1px 4px;
  border-radius: 50%;
  background: radial-gradient(circle at 48.65% 10.25%, #ff9dbb 4px, transparent 4.8px),
    conic-gradient(from 48deg, #c5f592, #71e4cf, #82afff, #c899ff, #ff9dbb 310deg, transparent 310deg);
  mask-image: radial-gradient(circle, transparent 12px, #000 13px);
  content: '';
}
.project-icon-snake::after {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 16px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 43% 35%, #263457 1px, transparent 1.5px),
    radial-gradient(circle at 73% 43%, #263457 1px, transparent 1.5px), #c5f592;
  transform: rotate(-28deg);
  content: '';
}
.project-icon-draft::before {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 13px 18px, #e9d9ff 1.5px, transparent 2px),
    radial-gradient(circle at 22px 12px, #e9d9ff 1.5px, transparent 2px),
    radial-gradient(circle at 27px 22px, #c5f592 1.5px, transparent 2px),
    linear-gradient(146deg, transparent 46%, #e9d9ffad 47% 53%, transparent 54%) 13px 12px / 9px 6px no-repeat,
    linear-gradient(63deg, transparent 44%, #e9d9ffad 45% 55%, transparent 56%) 22px 12px / 5px 10px no-repeat,
    linear-gradient(145deg, #bea4ed, #7663b5);
  clip-path: path("M 16 41 L 16 37 C 16 32 7 30 7 20 C 7 10 14 4 23 4 C 31 4 37 10 37 18 L 37 21 Q 38 24 40 26 Q 42 29 38 29 L 37 29 L 37 34 Q 37 38 32 38 L 29 38 L 28 41 Z");
  content: '';
}
.project-icon-draft::after {
  position: absolute;
  top: 1px;
  right: 1px;
  color: #c5f592;
  font-size: 14px;
  line-height: 1;
  content: '✦';
}
.mode-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  color: #c5f592;
}
.mode-team {
  color: #d5b7ff;
  gap: 4px;
}
.subject-mark {
  font-size: 29px;
  font-weight: 700;
  line-height: 1;
}
.mode-person {
  position: relative;
  display: block;
  width: 32px;
  height: 37px;
}
.mode-person::before,
.mode-person::after {
  position: absolute;
  content: '';
  background: currentColor;
}
.mode-person::before {
  top: 0;
  left: 25%;
  width: 50%;
  aspect-ratio: 1;
  border-radius: 50%;
}
.mode-person::after {
  inset: 52% 0 0;
  border-radius: 18px 18px 6px 6px;
}
.mode-team .mode-person:not(:nth-child(2)) {
  width: 23px;
  height: 27px;
  opacity: .7;
  align-self: end;
  margin-bottom: 5px;
}
@media (max-width: 650px) {
  .brand .rainbow-logo { height: 30px; }
}
.mode-card strong,
.mode-card small {
  display: block;
}
.mode-card strong {
  font-size: clamp(17px, 3.5vw, 28px);
}
.mode-card small {
  margin-top: 4px;
  color: #ccd5f1;
  font-size: 12px;
}
.settings-main,
.admin-page main {
  max-width: 560px;
  margin: auto;
}
.settings-card {
  margin: 12px 0;
  padding: 16px;
  border: 1px solid #4c5d92;
  border-radius: 14px;
  background: #202b50;
}
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.settings-page #profile-admin {
  text-decoration: none;
}
.settings-actions #profile-logout {
  width: 100%;
  min-height: 44px;
}
.rotate-game {
  display: none;
}
@media (orientation: portrait) and (max-width: 1024px) {
  .is-expanded .rotate-game {
    display: inline-block;
    flex: none;
    padding: 4px 7px;
    color: #d7e3ff;
  }
  .is-expanded .game-top {
    flex-wrap: wrap;
  }
}
@media (orientation: landscape) and (max-height: 520px) {
  .launch-page .app > header,
  .settings-page .app > header {
    height: auto;
    min-height: 56px;
  }
  .launch-main {
    padding-top: 16px;
  }
}

.direct-game > .app > header,
.direct-game main > .intro,
.direct-game main > footer,
.direct-game .game-layout > aside {
  display: none;
}
.direct-game .release-notice {
  position: fixed;
  z-index: 12;
  inset: auto max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  width: fit-content;
  margin: auto;
}
.direct-game .solo-game .overlay .rainbow-mark {
  display: none;
}
.direct-game .solo-game .overlay {
  overflow-y: auto;
  justify-content: safe center;
}
.arena-overlay {
  justify-content: flex-start;
  overflow: auto;
  padding: 8px;
  background: #141e44a6;
  pointer-events: none;
}
.arena-overlay.room-overlay {
  pointer-events: auto;
}
.arena-dialog {
  width: min(100%, 400px);
  margin: auto;
}
.arena-dialog h2 {
  margin: 0 0 5px;
  font-size: clamp(17px, 3vw, 24px);
}
#arena-description {
  margin: 0 0 8px;
  color: #cad6f4;
  font-size: 12px;
}
.arena-overlay:not(.room-overlay) .room-card {
  display: none;
}
.room-card {
  padding: 9px;
  border: 1px solid #3d4b76;
  border-radius: 14px;
  background: #1b2548;
}
.room-card :is(button, input) {
  min-height: 42px;
}
.room-card .primary {
  min-width: 0;
  padding: 8px 12px;
}
.room-actions {
  display: flex;
  gap: 6px;
}
.room-actions {
  justify-content: center;
  flex-wrap: wrap;
}
.room-actions .small {
  padding-inline: 10px;
}
.room-occupancy {
  margin: 0 0 4px;
  font-size: 12px;
}
#room-code {
  color: var(--mint);
  letter-spacing: 2px;
}
#players {
  max-height: 62px;
  overflow: auto;
  margin-bottom: 6px;
}
.player-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 4px;
  font-size: 12px;
}
.player-row span:first-child {
  overflow-wrap: anywhere;
}
#message {
  margin: 5px 0 0;
  color: #ffc3d3;
  font-size: 12px;
}
#message:empty {
  display: none;
}
.connection {
  color: var(--mint);
  font-size: 11px;
  text-align: right;
}
.multiplayer-game:has(.arena-overlay:not(.hidden)) .battle-items {
  visibility: hidden;
}

.direct-game .game-card.is-expanded {
  display: block;
}
.direct-game .is-expanded .game-stage {
  width: 100%;
  height: 100%;
  padding: 0;
}
.direct-game .is-expanded .board-wrap {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
}
.direct-game .is-expanded .game-top {
  position: absolute;
  z-index: 4;
  inset: 0 0 auto;
  min-height: 0;
  padding: 5px clamp(8px, 2vw, 20px);
  background: linear-gradient(#121a38d9, #121a3800);
  pointer-events: none;
}
.direct-game .is-expanded .game-top :is(button, a) {
  pointer-events: auto;
}
.direct-game .is-expanded .game-top .screen-score {
  display: flex;
  justify-content: center;
  padding: 3px 0;
}
.direct-game .is-expanded .overlay {
  padding-top: 58px;
}
.direct-game .lab-preplay,
.direct-game .lab-preplay .board-wrap,
.direct-game .lab-preplay .game-top,
.direct-game .lab-preplay .overlay {
  background: transparent;
  box-shadow: none;
}
.direct-game .lab-preplay .overlay {
  backdrop-filter: none;
}
.direct-game .lab-preplay canvas {
  visibility: hidden;
}
.direct-game .lab-preplay .rotate-game {
  display: none;
}
.direct-game .is-expanded #toast,
.direct-game .is-expanded .item-status {
  top: 58px;
}
@media (orientation: portrait) {
  .direct-game .is-expanded canvas {
    width: min(100%, 150cqh);
    height: auto;
    outline: 1px solid #6074ac;
  }
  .direct-game .is-expanded .overlay {
    padding-top: 88px;
  }
  .direct-game .is-expanded #toast,
  .direct-game .is-expanded .item-status {
    top: 88px;
  }
}
@media (orientation: landscape) {
  .direct-game .is-expanded canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }
}

.solo-game .game-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: clamp(4px, 2vw, 16px);
}
.solo-game .game-top .solo-status {
  flex-wrap: wrap;
  gap: 2px 10px;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.solo-status strong {
  white-space: nowrap;
}
.solo-status #screen-score {
  color: #d1dcf6;
}
.solo-game .game-top .solo-items {
  justify-content: center;
  font-size: clamp(13px, 2vw, 17px);
  font-variant-numeric: tabular-nums;
}
.solo-game .game-top .screen-actions {
  justify-self: end;
}
.solo-game .game-top .rotate-game {
  grid-column: 1 / -1;
  justify-self: center;
}
@media (max-width: 480px) {
  .solo-game .solo-status #screen-score {
    font-size: 11px;
  }
}

.page-return {
  text-decoration: none;
}
header .page-return {
  margin-left: auto;
}

.direct-game .is-expanded .game-top .screen-actions {
  gap: clamp(12px, 4vw, 18px);
}
.direct-game .is-expanded .screen-actions :is(#pause, #game-screen-toggle),
.page-return.small {
  display: inline-grid;
  place-items: center;
  width: clamp(48px, 15vw, 68px);
  height: 44px;
  min-height: 44px;
  padding: 0;
}
.page-return.small {
  flex: none;
  font-size: 12px;
  white-space: nowrap;
}
@media (max-width: 380px) {
  .page-return.small {
    font-size: 11px;
  }
}

.settings-password form {
  display: grid;
  gap: 8px;
}
.settings-password label {
  margin-top: 4px;
  font-size: 13px;
  color: #d1dbf7;
}
.settings-password input {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #54628c;
  border-radius: 8px;
  background: #182343;
  color: var(--white);
  font: inherit;
}
.settings-password .profile-edit-actions {
  margin-top: 6px;
}
#profile-password-status {
  margin: 0;
  color: #ffc3d3;
  font-size: 13px;
}

.room-settings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 7px;
  text-align: left;
}
.room-settings label {
  display: grid;
  gap: 3px;
  min-width: 0;
  color: #d1dcf6;
  font-size: 12px;
}
.room-settings input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 8px;
  background: #111a39;
  color: var(--white);
  font-size: 16px;
}
#room-lobby > .primary {
  width: 100%;
  margin-top: 7px;
}
.create-room-actions .primary {
  flex: 1;
}
#arena-description:empty {
  display: none;
}

#room-list {
  max-height: min(32vh, 220px);
  overflow-y: auto;
  color: #d1dcf6;
  font-size: 13px;
}
.room-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px;
}
.room-list-row + .room-list-row {
  border-top: 1px solid var(--line);
}
.room-list-row button {
  flex: none;
}
.room-pin-label {
  display: grid;
  gap: 4px;
  margin-bottom: 7px;
  text-align: left;
  color: #d1dcf6;
  font-size: 12px;
}
.room-pin-label input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #111a39;
  color: var(--white);
  font-size: 16px;
}

.settings-identity-heading {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.settings-page > .app > header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
}
.settings-page header h1 {
  grid-column: 1;
  font-size: clamp(20px, 4vw, 28px);
  letter-spacing: 0;
  white-space: nowrap;
}
.settings-page header #profile-admin {
  grid-column: 2;
  margin-inline-end: clamp(12px, 2vw, 20px);
}
.settings-page header .page-return {
  grid-column: 3;
}
#profile-avatar-button {
  width: 72px;
  height: 72px;
  padding: 0;
  font-size: 39px;
}
.settings-page [hidden] {
  display: none;
}
.profile-details-form,
.profile-details-form label {
  display: grid;
  gap: 6px;
}
.profile-details-form {
  gap: 12px;
}
.profile-details-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}
.profile-details-form label,
.profile-details-form small {
  color: #cad5f4;
  font-size: 13px;
}
.profile-details-form input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #182343;
  color: var(--white);
  font: inherit;
}
.profile-details-form input[readonly] {
  background: #202b50;
}
.profile-edit-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.profile-edit-actions :is(button, .primary) {
  min-width: 80px;
}
.profile-action-button {
  min-width: 80px;
  min-height: 44px;
}
.profile-edit-status {
  margin: 0;
  color: #d1dcf6;
  font-size: 13px;
}
.profile-edit-status:empty {
  display: none;
}
.avatar-dialog,
.admin-confirm-dialog {
  width: min(380px, calc(100% - 24px));
  max-height: 85dvh;
  padding: 18px;
  border: 1px solid #6276ad;
  border-radius: 16px;
  background: #202b50;
  color: var(--white);
}
.avatar-dialog::backdrop,
.admin-confirm-dialog::backdrop {
  background: #0b112bbd;
}
.avatar-dialog h2,
.admin-confirm-dialog h2 {
  margin: 0;
}
.cartoon-avatars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  justify-items: center;
  gap: 9px;
  margin: 16px 0;
}
.cartoon-avatars .player-avatar {
  width: 54px;
  height: 54px;
  padding: 0;
  font-size: 29px;
}
.cartoon-avatars [aria-pressed=true] {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}

.password-input {
  position: relative;
}
.settings-password .password-input input {
  padding-right: 90px;
}
#password-strength {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  color: #a8b3d5;
  font-size: 12px;
  pointer-events: none;
}
#password-strength[data-strength=weak] { color: #ffc3d3; }
#password-strength[data-strength=medium] { color: #ffe096; }
#password-strength[data-strength=strong] { color: #bff39d; }
