.play-utility {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  margin-bottom: .45rem;
}
.play-utility a, .play-utility button {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid #566176;
  border-radius: .65rem;
  padding-inline: .8rem;
  color: #ebf0fa;
  background: #1c2433;
  font-weight: 700;
}
.play-utility button { font-size: 1.2rem; }
.play-storage { padding: .65rem; border: 1px solid #be9271; border-radius: .5rem; color: #ffddb4; }
.play-modal {
  color: #f5f7fa;
  color-scheme: dark;
  border: 1px solid #5f6a81;
  border-radius: 1rem;
  background: #151b28;
  width: min(94vw, 32rem);
  max-height: 89dvh;
  padding: clamp(.8rem, 3vw, 1.35rem);
}
.play-modal::backdrop { background: #070a11d9; }
.play-modal h2 { margin: .25rem 0 .7rem; }
.play-modal :is(input,button,select) { color: inherit; font: inherit; min-height: 44px; min-width: 44px; }
.play-modal button { padding-inline: .8rem; }
.play-modal .play-setting, .play-page .play-setting { display: flex; align-items: center; gap: .65rem; min-height: 44px; }
.play-setting input[type="checkbox"] { width: 21px; height: 21px; min-width: 21px; min-height: 21px; accent-color: #ffb078; }
.play-level-dialog {
  position: fixed;
  z-index: 35;
  inset: 4rem .75rem auto auto;
  width: min(calc(100vw - 1.5rem),22rem);
  margin: 0;
  box-shadow: 0 18px 55px #080b15ab;
}
.play-level-dialog .play-atom { margin-block: .55rem; min-height: 104px; }
.play-level-dialog .play-atom :is(img,canvas) { height: 104px; }
.play-progress-toast {
  position: fixed;
  z-index: 30;
  inset: auto 1rem 1rem auto;
  max-width: calc(100vw - 2rem);
  border: 1px solid #ffb078;
  border-radius: .7rem;
  background: #2a2331;
  color: #fff0e3;
  padding: .85rem 1.1rem;
  font-weight: 750;
  animation: play-arrival .25s ease-out;
}
.play-scoreband {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(10rem,.55fr);
  align-items: stretch;
  gap: .7rem;
}
.play-level, .play-streak {
  padding: .8rem;
  border-radius: .75rem;
  border: 1px solid #4d5870;
  background: #20283a;
  min-width: 0;
}
.play-level { display: grid; grid-template-columns: 2.75rem minmax(0,1fr); align-items: center; gap: .25rem .6rem; }
.play-level progress { grid-column: 1 / -1; }
.play-level-symbol {
  display: grid; place-items: center;
  width: 2.75rem; height: 2.75rem;
  color: var(--family, #ffb078);
  border: 1px solid currentColor;
  background: #101727;
  border-radius: .55rem;
  font-size: 1.25rem; font-weight: 820;
}
.play-level div, .play-streak { display: grid; gap: .18rem; align-content: center; }
.play-level :is(div span), .play-streak span { color: #cbd5e6; font-size: .89rem; }
.play-level progress, .play-badge progress { width: 100%; accent-color: #ffb078; }
.play-daily-grid, .play-badge-grid, .codex-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,15rem),1fr)); gap: .7rem; }
.play-daily-tile {
  display: grid;
  justify-items: start;
  align-content: start;
  gap: .45rem;
  min-width: 0;
  padding: .8rem .9rem;
  border: 1px solid #47536a;
  border-radius: .75rem;
  background: linear-gradient(150deg,#25293c,#191e2b);
}
.play-daily-tile h3, .play-daily-tile p { margin: 0; }
.play-daily-tile h3 { font-size: 1rem; }
.play-daily-state { color: #eed3b9; font-size: .84rem; font-weight: 750; }
.play-daily-state[data-done="true"] { color: #a0efd0; }
.play-daily-link { display: inline-grid; min-width: 44px; min-height: 44px; align-items: center; color: #ffb078; font-weight: 700; }
.home-play { margin: 0 0 1.15rem; }
.home-play > div:first-child { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .3rem 1rem; margin-bottom: .35rem; }
.home-play h2 { margin: 0; font-size: 1.13rem; }
.home-play .play-daily-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: .35rem; }
.home-play .play-daily-tile { gap: .2rem; padding: .55rem .45rem; }
.home-play .play-daily-tile h3 { font-size: clamp(.8rem,2.4vw,1rem); }
.home-play .play-daily-link { text-decoration: underline; text-underline-offset: .2em; }
.home-play time { font-variant-numeric: tabular-nums; color: #ffe1ca; }
.play-guide { line-height: 1.6; }
.play-guide p { max-width: 75ch; }
.play-guide summary { min-height: 44px; cursor: pointer; color: #ffcb9c; }
.profile-facts { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,13rem),1fr)); gap: .6rem; }
.profile-facts div { border-top: 1px solid #3c475b; padding-top: .5rem; }
.profile-facts dt { color: #c3cde0; }
.profile-facts dd { margin: .25rem 0 0; font-weight: 750; }
.play-badge-section { margin-block: 1.1rem; }
.play-badge-section h2 { margin-bottom: .55rem; }
.play-badge { border: 1px solid #4b5870; background: #171e2c; border-radius: .65rem; padding: .7rem; }
.play-badge[data-earned="true"] { border-color: #e19862; background: #302638; }
.play-badge-icon { color: #ffb078; font-size: 1.3rem; }
.play-badge h3 { margin: .13rem 0; font-size: 1rem; }
.play-badge p { margin: .25rem 0; color: #cbd4e4; font-size: .92rem; }
.play-badge small { color: #deccba; }
#profile-transfer .play-actions { margin-top: .6rem; }
.game-switch [aria-pressed="true"] { color: #ffcbab; border-color: #e99561; background: #422c38; }
.lab-bench h2, .lab-reaction h2 { margin: 0; }
.lab-bench .lab-quick { margin-block: .65rem; }
.lab-bench .lab-quick button { padding-inline: .48rem; }
.lab-tray { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,140px),1fr)); gap: .38rem; margin-block: .65rem; }
.lab-stepper {
  display: grid; align-items: center; grid-template-columns: 1fr auto auto auto; gap: .3rem;
  min-width: 0; padding: .35rem;
  background: #111926; border: 1px solid #49546a; border-radius: .6rem;
}
.lab-stepper-symbol { font-weight: 820; color: var(--family,#ffb078); }
.lab-stepper button { padding-inline: .4rem; }
.lab-stepper output { font-weight: 750; min-width: 1.15rem; text-align: center; }
.lab-actions .play-primary { flex: 1 1 7rem; }
.lab-bench .lab-actions { margin-top: .65rem; }
.lab-floor { margin-block: .65rem; border-radius: .7rem; height: clamp(160px,29vw,265px); --orbit:clamp(50px,11vw,108px); }
.lab-shape { min-height: 1.35em; margin: .25rem 0 .45rem; font-size: .87rem; }
.lab-pop {
  z-index: 2; position: absolute; inset: 8% 4% auto;
  display: grid; justify-items: center; gap: .12rem;
  pointer-events: none; color: #fff0dc; text-shadow: 0 1px 6px #080a12, 0 1px 12px #080a12;
  animation: lab-rise .62s cubic-bezier(.19,.77,.3,1) both;
}
.lab-pop strong { font-size: clamp(1rem,3vw,1.45rem); }
.lab-pop span { font-weight: 780; color: #ffd09d; }
.lab-pop small { color: #aaf3d5; font-weight: 810; }
.lab-floor[data-flash="discovery"]::after {
  position: absolute; inset: 0; content: ""; pointer-events: none;
  background: radial-gradient(ellipse at center,#fff6d3c7 0%,#ffb37b60 34%,transparent 70%);
  animation: lab-burst .62s ease-out both;
}
.lab-floor[data-flash="repeat"] .lab-pop { animation-duration: .35s; }
@keyframes lab-rise { from { transform: translateY(24px) scale(.94); opacity: 0; } }
@keyframes lab-burst { from { opacity: .9; } to { opacity: 0; } }
@media (prefers-reduced-motion:reduce) {
  .lab-pop, .lab-floor[data-flash="discovery"]::after { animation: none; }
}
.lab-beaker {
  position: absolute; width: 5rem; height: 5.4rem; left: 50%; top: 50%; translate: -50% -25%;
  border: 2px solid #a3d8f787; border-top: 0; border-radius: 0 0 1.2rem 1.2rem;
  background: linear-gradient(0deg,#5fbac875,#546c981a 55%,transparent 56%);
  box-shadow: inset 0 -12px 30px #5bbed551,0 0 42px #68bef852;
}
.lab-floor:not([data-model="tray"]) .lab-beaker { opacity: .5; }
.lab-result { padding: .75rem; background: #1f283a; overflow-wrap: anywhere; }
.lab-result h3 { margin: 0; }
.lab-result p { margin: .35rem 0; }
.lab-result strong, .lab-formula { color: #fed0a1; }
.lab-formula { font-size: 1.7rem; font-weight: 820; }
#lab-sources a, .codex-card a { display: inline-flex; align-items: center; min-height: 44px; color: #f9c79f; text-decoration: underline; }
.lab-hints .play-actions { margin-top: .55rem; }
.lab-picker { width: min(96vw,63rem); }
.lab-picker select, .lab-picker input { width: 100%; margin: .3rem 0; }
.lab-picker .dance-grid { grid-template-rows: repeat(7,44px) .35rem repeat(2,44px); }
.lab-picker .dance-grid.is-filtered { grid-template-rows: auto; }
.lab-picker .dance-tile { padding: 0; color: var(--family,#f3f7ff); }
.codex-grid { grid-template-columns: repeat(auto-fill,minmax(min(100%,11rem),1fr)); }
.codex-card { min-width: 0; padding: .72rem; border: 1px solid #505d76; border-radius: .65rem; background: #192131; overflow-wrap: anywhere; }
.codex-card[data-discovered="true"] { border-color: #d49163; background: #282538; }
.codex-card h2 { margin: .24rem 0; font-size: 1.05rem; }
.codex-card p { margin: .35rem 0; color: #c8d4e7; }
.codex-category { color: #ffc28f; font-size: .84rem; font-weight: 750; }
.battle-counts, .battle-cards, .battle-options { display: grid; gap: .45rem; }
.battle-counts { grid-template-columns: repeat(3,minmax(0,1fr)); margin-bottom: .65rem; }
.battle-counts > span, .battle-pool span { border: 1px solid #505c73; border-radius: .45rem; padding: .45rem; text-align: center; }
.battle-counts strong { display: block; color: #ffc08e; font-size: 1.12rem; }
.battle-pool, .battle-rounds { display: flex; gap: .3rem; flex-wrap: wrap; margin: .45rem 0; }
.battle-cards { grid-template-columns: repeat(2,minmax(0,1fr)); perspective: 820px; }
.battle-card {
  padding: .55rem;
  border-radius: .8rem;
  border: 1px solid color-mix(in srgb,#596984,var(--family,#ffb078) 55%);
  background: radial-gradient(ellipse at 62% 20%,color-mix(in srgb,#1d243a,var(--family,#ffb078) 16%),#121b2a 73%);
  min-width: 0;
}
.battle-owner { margin: 0; color: #ffd3aa; font-size: .84rem; font-weight: 750; }
.battle-card-head { display: flex; justify-content: space-between; gap: .3rem; align-items: center; margin-block: .22rem; }
.battle-card-head h3 { font-size: clamp(.95rem,3vw,1.25rem); margin: 0; overflow-wrap: anywhere; }
.battle-card-head strong { color: var(--family,#ffb078); font-size: clamp(1.25rem,5vw,2.05rem); }
.battle-card-head img { min-width: 0; width: min(37%,7rem); height: auto; aspect-ratio: 7 / 5; object-fit: contain; }
.battle-card dl { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .25rem; margin: 0; }
.battle-card dl div { padding: .25rem .32rem; border: 1px solid #51607b; border-radius: .34rem; overflow-wrap: anywhere; }
.battle-card dt { color: #c3d2e7; font-size: .74rem; }
.battle-card dd { margin: .12rem 0 0; font-weight: 750; font-size: .84rem; }
.battle-flying-card {
  position: fixed; translate: -50% -50%; z-index: 26; pointer-events: none;
  width: 40px; height: 46px; display: grid; place-items: center;
  border: 1px solid var(--family,#ffb078); border-radius: .4rem;
  background: #182338; color: var(--family,#ffb078); font-weight: 800;
}
.battle-card-back {
  display: grid; place-content: center; justify-items: center; gap: .55rem;
  text-align: center; color: #ffddb4; min-width: 0; min-height: 15rem;
  background: radial-gradient(circle at 50% 46%,#493245,#241d34 52%,#161a2b 84%);
  border-color: #ae805d; box-shadow: inset 0 0 0 4px #151628, inset 0 0 0 5px #9b6a56;
}
.battle-card-back .battle-back-brand { font-weight: 820; color: #ffe9d0; }
.battle-back-mark {
  display: grid; place-items: center;
  width: 3.4rem; height: 3.4rem;
  color: #ffbd8b; border-radius: 50%; border: 1px solid #ffbd8b;
  box-shadow: 0 0 25px #ef8d5b40; font-size: 1.85rem;
}
.battle-card-back > span:last-child { color: #e7c1ad; font-size: .87rem; }
.battle-card [data-selected] { border-color: #ffd3a1; background: #3b2e37; }
.battle-card [data-won="true"] { border-color: #8afcd5; box-shadow: inset 0 0 .75rem #60c7a649; background: #214244; }
.battle-arrival .battle-card { animation: battle-flip .35s ease-out both; }
.battle-arrival .battle-card + .battle-card { animation-delay: .05s; }
@keyframes battle-flip { from { opacity: .3; transform: translateY(10px) rotateY(40deg); } }
@keyframes play-arrival { from { opacity: 0; transform: translateY(7px); } }
.battle-options { grid-template-columns: repeat(3,minmax(0,1fr)); margin-block: .65rem; }
.battle-options button { padding-inline: .35rem; font-size: .9rem; }
#battle-ai { margin-top: .65rem; }
.battle-rounds { list-style: none; padding: 0; }
.battle-emoji { overflow-wrap: anywhere; }
@media (width < 570px) {
  .play-scoreband { grid-template-columns: 1fr; }
  .battle-card dl { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .battle-card dl div { padding-inline: .24rem; }
  .battle-options { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .play-badge-grid, .codex-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (prefers-reduced-motion:reduce) {
  .play-progress-toast, .battle-arrival .battle-card { animation: none; }
}

.codex-model { width: 100%; height: auto; display: block; background: #131a28; border-radius: .4rem; margin-block: .4rem; }
