/* Layout primitives shared by the game UI. Visual tokens and responsive rules
   live in cosmic.css; no legacy page theme is loaded. */
* {
  box-sizing: border-box;
}
html {
  color-scheme: dark;
}
body {
  margin: 0;
  font: 14px/1.7 var(--font);
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
button,
canvas {
  -webkit-user-select: none;
}
button:disabled {
  cursor: not-allowed;
}
.hidden,
[hidden] {
  display: none !important;
}
.header {
  display: flex;
  align-items: center;
  margin: auto;
}
.brand {
  display: flex;
  align-items: center;
  border: 0;
  background: none;
  text-align: left;
  padding: 0;
}
.brand small {
  display: block;
}
.header nav {
  display: flex;
  align-items: center;
  height: 100%;
}
.nav-link {
  background: none;
  border: 0;
  height: 100%;
  position: relative;
  white-space: nowrap;
}
.nav-link.active:after {
  content: "";
  position: absolute;
  bottom: 0;
}
.header-right {
  display: flex;
  align-items: center;
  margin-left: auto;
}
.screen {
  margin: auto;
}
.eyebrow {
  font-family: var(--mono);
}
.live-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-right: 7px;
}
.primary,
.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 44px;
  padding: 11px 19px;
  white-space: nowrap;
}
.text-button {
  border: 0;
  background: none;
  padding: 10px 0;
}
.library-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.library-title h2 {
  margin: 0;
}
.filters {
  display: flex;
}
.filters button {
  border: 1px solid transparent;
  background: none;
}
.library-layout,
.level-grid {
  display: grid;
  align-items: start;
}
.level-card {
  padding: 0;
  position: relative;
}
.cover-wrap {
  position: relative;
}
.cover-wrap img {
  display: block;
  transition: transform 0.3s;
}
.level-card:hover img {
  transform: scale(1.05);
}
.card-top {
  position: absolute;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-tag {
  padding: 1px 5px;
}
.card-heading h3 {
  margin: 0;
}
.card-star {
  white-space: nowrap;
}
.selection-panel > img {
  width: 100%;
  display: block;
  object-fit: cover;
}
.selection-content {
  position: relative;
}
.field-label {
  display: flex;
  justify-content: space-between;
}
.field-label span {
  font-size: 8px;
  color: var(--muted);
}
.segmented {
  display: flex;
}
.segmented button {
  flex: 1;
  font-size: 11px;
}
.difficulty-select {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.rule-note {
  border-left: 2px solid var(--gold);
}
.start-button {
  width: 100%;
  justify-content: space-between;
}
.selection-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.selection-foot button {
  border: 0;
  background: none;
  padding: 0;
}
.home-footer {
  display: flex;
  justify-content: space-between;
}
.play-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.play-heading > div {
  display: flex;
  gap: 8px;
}
.play-layout {
  display: grid;
  justify-content: center;
}
.table-column {
  margin: 0 auto;
}
.table-topbar {
  display: flex;
  justify-content: space-between;
}
.table-topbar span:last-child {
  color: var(--accent);
}
.board-frame {
  position: relative;
  aspect-ratio: 560/820;
}
.board-frame canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.board-status {
  position: absolute;
  left: 0;
  width: 100%;
  text-align: center;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: opacity 0.15s;
}
.board-status strong {
  text-shadow: 0 2px 8px black;
}
.board-status span {
  display: block;
}
.charge-mini {
  overflow: hidden;
}
.charge-mini i {
  display: block;
  width: 0;
  height: 100%;
}
.controls {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  gap: 8px;
}
.control {
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.control.held {
  transform: translateY(2px);
}
kbd {
  font: 9px var(--mono);
  border: 1px solid #567287;
  padding: 2px 5px;
  color: #afccdc;
}
.table-footer {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin: 8px 3px 0;
}
.score-panel > strong {
  display: block;
}
.score-panel > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.objective {
  display: grid;
  grid-template-columns: 1fr auto;
}
.objective > .track {
  grid-column: 1/-1;
}
.track {
  overflow: hidden;
}
.track i {
  display: block;
  width: 0;
  height: 100%;
  transition: width 0.2s;
}
.run-stats {
  display: flex;
  justify-content: space-between;
}
.run-stats > div {
  flex: 1;
}
.run-stats label {
  display: block;
}
.run-stats b {
  font-family: var(--mono);
  line-height: 1.6;
}
.rescue {
  width: 100%;
  justify-content: space-between;
}
.small-note {
  line-height: 1.9;
}
.mission-card h2 {
  font-weight: 600;
  margin: 12px 0 9px;
}
.mission-card p {
  margin: 0;
}
.pressure-card h3 {
  margin: 10px 0;
}
.pressure-card #pressureDetail {
  margin-top: 10px;
}
.equipped {
  display: flex;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.skin-mini {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}
.equipped small {
  display: block;
}
.controls-guide {
  margin-top: 18px;
}
.controls-guide > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.mobile-hud {
  display: none;
}
.record-filters {
  display: flex;
  align-items: end;
  gap: 16px;
}
.record-filters label {
  flex: 1;
}
.record-filters select {
  display: block;
  width: 100%;
  margin-top: 7px;
}
.podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 24px 0;
}
.podium-card {
  position: relative;
  overflow: hidden;
}
.podium-rank {
  position: absolute;
  right: 14px;
  top: 18px;
  font-family: var(--mono);
}
.podium-card h3 {
  margin: 10px 0;
}
.podium-card p {
  margin: 12px 0 0;
}
.record-table-wrap {
  overflow: auto;
}
.record-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}
.record-table th {
  text-align: left;
  font-weight: 400;
}
.record-table td small {
  display: block;
}
.status-pill {
  border: 1px solid;
  padding: 3px 7px;
  white-space: nowrap;
}
.empty-state {
  display: flex;
  text-align: center;
  flex-direction: column;
}
.empty-state strong {
  font-weight: 500;
}
.records-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
  gap: 15px;
}
.legacy {
  margin-top: 24px;
  border: 1px solid #4c7189;
  padding: 14px;
  font-size: 11px;
}
.legacy summary {
  cursor: pointer;
}
.skin-showcase {
  display: flex;
  align-items: center;
  justify-content: center;
}
.skin-orb {
  position: relative;
  flex-shrink: 0;
}
.skin-grid {
  display: grid;
}
.skin-card {
  text-align: center;
}
.skin-card h3 {
  margin: 0 0 6px;
}
.skin-card .skin-mini {
  margin-left: auto;
  margin-right: auto;
}
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dialog {
  width: 600px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #527d92 transparent;
}
.dialog h2 {
  line-height: 1.35;
  margin: 10px 0 13px;
}
.dialog.narrow {
  text-align: center;
}
.dialog.narrow > button {
  width: 100%;
}
.dialog.narrow > .primary {
  margin-top: 20px;
}
.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}
.dialog-heading h2 {
  margin: 6px 0 12px;
}
.close {
  background: none;
  border: 1px solid;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid;
}
.setting-row b {
  font-weight: 500;
}
.setting-row small {
  display: block;
  margin-top: 4px;
}
.setting-row input[type="text"],
#pilotInput {
  width: 150px;
  min-width: 0;
  padding: 9px;
  font-size: 12px;
  border: 1px solid;
}
.setting-row input[type="checkbox"],
.import-option input {
  cursor: pointer;
  flex-shrink: 0;
}
.setting-row input[type="range"] {
  width: 140px;
}
.settings-buttons {
  display: flex;
  gap: 8px;
  margin: 20px 0 14px;
  flex-wrap: wrap;
}
.settings-buttons button {
  flex: 1;
  padding: 9px;
  gap: 0;
}
.import-option {
  display: flex;
  gap: 8px;
  align-items: center;
}
.settings-dialog > .primary,
.help-dialog > .primary {
  width: 100%;
  margin-top: 12px;
}
.help-dialog {
  width: 650px;
}
.help-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 20px 0;
}
.help-controls > div {
  border: 1px solid;
}
.help-controls b {
  display: block;
  margin: 11px 0 4px;
}
.help-controls p {
  margin: 0;
}
.help-dialog > h3 {
  font-size: 15px;
}
.result-cover {
  position: relative;
  background-size: cover;
  isolation: isolate;
  text-align: center;
}
.result-cover:before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
}
.result-stars {
  min-height: 34px;
}
.result-score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.result-score-row label {
  display: block;
}
.result-body > p {
  margin: 12px 0;
}
.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  border-top: 1px solid;
  border-bottom: 1px solid;
  padding: 15px 0;
  margin: 16px 0;
}
.result-stats span {
  display: block;
}
.result-stats b {
  display: block;
  font-family: var(--mono);
  margin-top: 4px;
}
.result-details {
  line-height: 2;
  margin: 15px 0;
}
.result-details .objective {
  margin: 12px 0;
}
.rank-receipt {
  margin: 17px 0;
}
.record-badge {
  border: 1px solid;
  padding: 4px 8px;
  white-space: nowrap;
}
.intro {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.intro-lockup {
  text-align: center;
  position: relative;
  z-index: 2;
  animation: logoIn 1.2s ease-out both;
}
.intro-lockup h1 {
  margin: 0 0 12px;
  line-height: 1.2;
}
.intro-lockup p {
  margin: 20px 0;
}
.intro-ring {
  position: absolute;
  width: 510px;
  height: 510px;
  border: 1px solid;
  border-radius: 50%;
  transform: rotateX(55deg) rotate(-22deg);
  animation: orbitTurn 12s linear infinite;
}
.intro-ring.r2 {
  width: 680px;
  height: 680px;
  transform: rotateX(55deg) rotate(20deg);
  animation-direction: reverse;
}
.intro-progress {
  margin: 28px auto 0;
  overflow: hidden;
}
.intro-progress i {
  display: block;
  height: 100%;
  width: 0;
  animation: loadProgress 2.7s ease-out forwards;
}
.intro > small {
  position: absolute;
  left: 35px;
  bottom: 30px;
  font: 8px var(--mono);
  letter-spacing: 2px;
  color: #769ab0;
}
#skipIntro {
  position: absolute;
  right: 35px;
  bottom: 28px;
  border: 1px solid;
  padding: 10px 17px;
  font-size: 11px;
}
.toast {
  position: fixed;
  left: 50%;
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
  padding: 12px 20px;
  white-space: normal;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
#celebrationCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 65;
  width: 100%;
  height: 100%;
}
.noscript {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #031421;
  padding: 50px;
  text-align: center;
}
.theme-caption {
  font-size: 9px;
  letter-spacing: 1px;
  color: #b1c8d5;
  margin-top: 10px;
}
.skin-showcase #themeSkinBtn {
  display: flex;
  margin: 10px auto;
  min-width: 220px;
}
.skin-showcase #themeSkinBtn:disabled {
  opacity: 0.65;
}
.skin-card .skin-mini {
  box-shadow: none;
}
.skin-card p {
  line-height: 1.7;
}
.home-intel .track i {
  width: 0;
}
.skin-preview-world {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.15;
  object-fit: cover;
  width: 100%;
  height: 100%;
}
@keyframes logoIn {
  from {
    opacity: 0;
    transform: scale(0.8);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}
@keyframes orbitTurn {
  to {
    transform: rotateX(55deg) rotate(338deg);
  }
}
@keyframes loadProgress {
  to {
    width: 100%;
  }
}
