:root {
  color-scheme: dark;
  --ink: #f7efe4;
  --muted: #b7b0a6;
  --panel: rgba(15, 13, 20, 0.78);
  --panel-strong: rgba(8, 7, 13, 0.92);
  --line: rgba(255, 255, 255, 0.16);
  --gold: #ffcf56;
  --mint: #2ee6a6;
  --rose: #ff6b9a;
  --sky: #71a7ff;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #08070d;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-text-size-adjust: 100%;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

button,
input {
  font: inherit;
}

button {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  display: block;
  background: #08070d;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.hidden {
  display: none !important;
}

.lobby {
  position: fixed;
  inset: 0;
  overflow: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 18px;
  padding: max(24px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 17% 17%, rgba(255, 207, 86, 0.2) 0 7%, transparent 21%),
    radial-gradient(circle at 78% 24%, rgba(113, 167, 255, 0.2) 0 10%, transparent 28%),
    radial-gradient(circle at 58% 84%, rgba(46, 230, 166, 0.12) 0 12%, transparent 34%),
    linear-gradient(180deg, rgba(8, 7, 13, 0.12), rgba(8, 7, 13, 0.86) 58%, rgba(8, 7, 13, 0.98));
  touch-action: pan-y;
}

.lobby::before,
.lobby::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.lobby::before {
  inset: -1px;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(113, 167, 255, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(113, 167, 255, 0.16) 1px, transparent 1px),
    radial-gradient(circle at 50% 40%, transparent 0 23%, rgba(255, 207, 86, 0.3) 23.2% 23.6%, transparent 23.8% 100%);
  background-position: center;
  background-size: 74px 74px, 74px 74px, min(86vw, 780px) min(86vw, 780px);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.22) 72%, transparent);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.22) 72%, transparent);
}

.lobby::after {
  right: max(20px, env(safe-area-inset-right));
  bottom: max(122px, calc(env(safe-area-inset-bottom) + 104px));
  width: min(34vw, 224px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 207, 86, 0.28);
  border-radius: 50%;
  opacity: 0.86;
  background:
    radial-gradient(circle at 37% 32%, rgba(255, 248, 233, 0.75) 0 3%, transparent 4%),
    linear-gradient(24deg, transparent 0 45%, rgba(255, 207, 86, 0.55) 46% 49%, transparent 50%),
    radial-gradient(circle at 42% 38%, #3a533d 0 17%, #142d3a 18% 34%, #101821 35% 56%, transparent 57%),
    repeating-radial-gradient(circle at 50% 50%, rgba(113, 167, 255, 0.4) 0 1px, transparent 2px 16px);
  box-shadow: 0 0 44px rgba(255, 207, 86, 0.18), inset -24px -18px 46px rgba(0, 0, 0, 0.55);
}

.brand {
  position: relative;
  z-index: 1;
  align-self: end;
  max-width: 780px;
  text-shadow: 0 3px 24px rgba(0, 0, 0, 0.62);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  max-width: 11ch;
  margin: 0;
  color: #fff8e9;
  font-size: clamp(3rem, 12vw, 7.4rem);
  line-height: 0.88;
  letter-spacing: 0;
}

.premise {
  max-width: 690px;
  margin: 18px 0 0;
  color: #e7dccb;
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  line-height: 1.42;
}

.join-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 820px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(96px, 0.58fr) minmax(120px, 0.72fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(113, 167, 255, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(113, 167, 255, 0.13), transparent 24% 76%, rgba(46, 230, 166, 0.1)),
    rgba(8, 12, 20, 0.78);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 248, 233, 0.08);
  backdrop-filter: blur(18px);
}

.destination-toggle {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(5, 12, 22, 0.48);
}

.destination-toggle button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: rgba(113, 167, 255, 0.09);
  color: rgba(247, 239, 228, 0.78);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.destination-toggle button.active {
  border-color: rgba(255, 207, 86, 0.46);
  background: linear-gradient(180deg, rgba(255, 207, 86, 0.24), rgba(46, 230, 166, 0.14));
  color: #fff8e9;
  box-shadow: inset 0 1px 0 rgba(255, 248, 233, 0.14);
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

label span {
  color: rgba(255, 207, 86, 0.82);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input {
  width: 100%;
  min-height: 50px;
  border: 1px solid rgba(113, 167, 255, 0.24);
  border-radius: 7px;
  outline: none;
  background:
    linear-gradient(180deg, rgba(255, 248, 233, 0.08), rgba(5, 12, 22, 0.12)),
    rgba(5, 12, 22, 0.62);
  color: var(--ink);
  padding: 0 13px;
  font-size: 1rem;
  box-shadow: inset 0 0 0 1px rgba(255, 248, 233, 0.03);
  touch-action: manipulation;
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}

input::placeholder {
  color: rgba(247, 239, 228, 0.42);
}

input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 207, 86, 0.14), inset 0 0 0 1px rgba(255, 248, 233, 0.08);
}

input[readonly] {
  border-color: rgba(46, 230, 166, 0.24);
  background: rgba(5, 12, 22, 0.42);
  color: rgba(247, 239, 228, 0.78);
}

.lobby button,
.lobby input {
  touch-action: manipulation;
}

.actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 0.7fr 0.88fr;
  gap: 10px;
}

.findable-toggle {
  grid-column: 1 / -1;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 2px 0;
}

.findable-toggle input {
  width: 22px;
  min-width: 22px;
  height: 22px;
  min-height: 22px;
  margin: 0;
  padding: 0;
  border-radius: 5px;
  background: rgba(5, 12, 22, 0.8);
  accent-color: var(--mint);
  box-shadow: none;
  touch-action: manipulation;
}

.findable-toggle span {
  color: rgba(231, 220, 203, 0.86);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.actions button {
  min-height: 52px;
  border: 1px solid rgba(255, 207, 86, 0.5);
  border-radius: 7px;
  color: #130f08;
  background: linear-gradient(180deg, #ffe083, var(--gold));
  box-shadow: 0 12px 28px rgba(255, 207, 86, 0.16), inset 0 1px 0 rgba(255, 248, 233, 0.6);
  font-weight: 900;
  letter-spacing: 0.02em;
}

.actions button:nth-child(2) {
  border-color: rgba(46, 230, 166, 0.48);
  color: #07130f;
  background: linear-gradient(180deg, #6af0bf, var(--mint));
  box-shadow: 0 12px 28px rgba(46, 230, 166, 0.14), inset 0 1px 0 rgba(255, 248, 233, 0.5);
}

.actions button:last-child {
  border-color: rgba(113, 167, 255, 0.5);
  color: #07130f;
  background: linear-gradient(180deg, #9ec3ff, var(--sky));
  box-shadow: 0 12px 28px rgba(113, 167, 255, 0.16), inset 0 1px 0 rgba(255, 248, 233, 0.5);
}

.status {
  grid-column: 1 / -1;
  min-height: 20px;
  margin: 0;
  color: rgba(183, 176, 166, 0.92);
  font-size: 0.86rem;
}

.auth-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  min-width: 0;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-summary {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.auth-summary span,
.auth-fields span {
  display: block;
  color: rgba(113, 167, 255, 0.84);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-summary strong {
  display: block;
  overflow: hidden;
  color: #fff8e9;
  font-size: 0.98rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-summary small {
  display: block;
  margin-top: 2px;
  color: rgba(183, 176, 166, 0.86);
  font-size: 0.76rem;
}

.auth-fields {
  display: grid;
  grid-template-columns: minmax(120px, 0.74fr) minmax(150px, 1fr) minmax(140px, 0.9fr) auto;
  gap: 9px;
  align-items: end;
}

.auth-fields input {
  min-height: 42px;
  font-size: 0.92rem;
}

.auth-actions,
.auth-signed-actions {
  display: flex;
  gap: 8px;
}

.auth-actions button,
.auth-signed-actions button {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(113, 167, 255, 0.28);
  border-radius: 7px;
  background: rgba(113, 167, 255, 0.14);
  color: #dce9ff;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-actions button:first-child,
.auth-signed-actions button:first-child {
  border-color: rgba(46, 230, 166, 0.42);
  background: rgba(46, 230, 166, 0.15);
  color: var(--mint);
}

.auth-actions button.auth-subtle {
  min-width: 74px;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(231, 220, 203, 0.78);
}

.auth-status {
  min-height: 17px;
  margin: 0;
  color: rgba(183, 176, 166, 0.86);
  font-size: 0.78rem;
}

.room-browser {
  grid-column: 1 / -1;
  display: grid;
  gap: 9px;
  min-width: 0;
}

.room-browser-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.room-browser-header span {
  display: block;
  color: rgba(255, 207, 86, 0.78);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.room-browser-header strong {
  display: block;
  color: #fff8e9;
  font-size: 0.98rem;
}

.room-browser-header button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(113, 167, 255, 0.28);
  border-radius: 7px;
  background: rgba(113, 167, 255, 0.14);
  color: #dce9ff;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lobby-section {
  min-width: 0;
}

.lobby-section-body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.lobby-section.collapsed .lobby-section-body {
  display: none;
}

.lobby .section-toggle {
  position: relative;
  width: 100%;
  min-height: 0;
  padding: 0 28px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  text-align: left;
  text-transform: none;
}

.lobby .section-toggle::after {
  content: "";
  position: absolute;
  right: 5px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid rgba(255, 207, 86, 0.82);
  border-bottom: 2px solid rgba(255, 207, 86, 0.82);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 160ms ease;
}

.lobby-section.collapsed .section-toggle::after {
  transform: translateY(-50%) rotate(-45deg);
}

.room-list {
  display: grid;
  gap: 7px;
  max-height: min(24vh, 190px);
  overflow: auto;
  padding-right: 2px;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.room-row,
.room-list-empty {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 7px;
  background: rgba(5, 12, 22, 0.48);
}

.room-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(48px, max-content) minmax(64px, max-content) minmax(54px, max-content);
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  padding: 8px 10px;
  color: var(--ink);
  text-align: left;
}

.room-row > * {
  min-width: 0;
}

.room-row:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.room-row-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.room-row-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.room-activity-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 999px;
  background: rgba(183, 176, 166, 0.72);
  box-shadow: 0 0 0 3px rgba(183, 176, 166, 0.08);
}

.room-row[data-popularity="hot"] .room-activity-dot {
  background: var(--rose);
  box-shadow: 0 0 0 3px rgba(255, 107, 154, 0.13), 0 0 16px rgba(255, 107, 154, 0.5);
}

.room-row[data-popularity="active"] .room-activity-dot {
  background: var(--mint);
  box-shadow: 0 0 0 3px rgba(46, 230, 166, 0.13), 0 0 14px rgba(46, 230, 166, 0.42);
}

.room-row[data-popularity="quiet"] .room-activity-dot {
  background: var(--sky);
  box-shadow: 0 0 0 3px rgba(113, 167, 255, 0.12);
}

.room-row strong {
  display: block;
  overflow: hidden;
  color: #fff8e9;
  font-size: 1rem;
  line-height: 1.08;
  overflow-wrap: anywhere;
  white-space: normal;
}

.room-row span {
  overflow: hidden;
  color: rgba(183, 176, 166, 0.88);
  font-size: 0.76rem;
  line-height: 1.22;
  overflow-wrap: anywhere;
  white-space: normal;
}

.room-heat {
  box-sizing: border-box;
  min-width: 58px;
  max-width: 100%;
  overflow: hidden;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(113, 167, 255, 0.13);
  color: var(--sky);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
  text-align: center;
  text-transform: uppercase;
  white-space: normal;
}

.room-row[data-popularity="hot"] .room-heat {
  background: rgba(255, 107, 154, 0.16);
  color: var(--rose);
}

.room-row[data-popularity="active"] .room-heat {
  background: rgba(46, 230, 166, 0.14);
  color: var(--mint);
}

.room-row[data-popularity="empty"] .room-heat {
  background: rgba(183, 176, 166, 0.12);
  color: rgba(231, 220, 203, 0.76);
}

.room-row em {
  box-sizing: border-box;
  min-width: 66px;
  max-width: 100%;
  overflow: hidden;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(46, 230, 166, 0.14);
  color: var(--mint);
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1.08;
  overflow-wrap: anywhere;
  text-align: center;
  white-space: normal;
}

.room-row[data-joinable="0"] em {
  background: rgba(255, 107, 154, 0.13);
  color: var(--rose);
}

.room-row small {
  box-sizing: border-box;
  min-width: 76px;
  max-width: 100%;
  overflow: hidden;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(46, 230, 166, 0.13);
  color: var(--mint);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
  text-align: center;
  text-transform: uppercase;
  white-space: normal;
}

.room-row[data-locked="1"] small {
  background: rgba(255, 207, 86, 0.14);
  color: var(--gold);
}

.room-kind {
  color: var(--sky);
  font-weight: 800;
}

.room-list-empty {
  display: grid;
  place-items: center;
  padding: 10px;
  color: rgba(183, 176, 166, 0.86);
  font-size: 0.82rem;
  text-align: center;
}

.room-password-prompt {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(4, 6, 10, 0.62);
  backdrop-filter: blur(10px);
}

.room-password-card {
  width: min(100%, 380px);
  display: grid;
  gap: 11px;
  padding: 16px;
  border: 1px solid rgba(255, 207, 86, 0.32);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 207, 86, 0.12), transparent 44%),
    rgba(8, 12, 20, 0.94);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 248, 233, 0.08);
}

.room-password-card span {
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.room-password-card strong {
  color: #fff8e9;
  font-size: 1.7rem;
  line-height: 1;
}

.room-password-card p {
  margin: 0;
  color: rgba(231, 220, 203, 0.82);
  font-size: 0.9rem;
  line-height: 1.35;
}

.room-password-actions {
  display: grid;
  grid-template-columns: 0.72fr 1fr;
  gap: 9px;
}

.room-password-actions button {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: rgba(113, 167, 255, 0.14);
  color: #dce9ff;
  font-weight: 900;
}

.room-password-actions button:last-child {
  border-color: rgba(46, 230, 166, 0.46);
  background: linear-gradient(180deg, #6af0bf, var(--mint));
  color: #07130f;
}

.system-panel {
  position: fixed;
  inset: 0;
  z-index: 9;
  overflow: hidden;
  padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 207, 86, 0.12), transparent 34%),
    linear-gradient(180deg, #02040b, #08070d 70%, #020309);
  touch-action: none;
}

.system-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  display: block;
  touch-action: none;
}

.system-sheet {
  position: relative;
  z-index: 1;
  width: min(100%, 960px);
  min-height: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 14px;
  pointer-events: none;
}

.system-panel.entry-transition .system-sheet {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.98);
  transition: opacity 180ms ease, transform 220ms ease;
}

.system-panel.entry-transition.surface-handoff {
  background: transparent;
}

.system-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid rgba(113, 167, 255, 0.26);
  border-radius: 8px;
  background: rgba(8, 12, 20, 0.76);
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.36);
  pointer-events: auto;
}

.system-header span,
.system-selected-copy span {
  display: block;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.system-header h2 {
  margin: 2px 0 4px;
  color: #fff8e9;
  font-size: clamp(1.9rem, 6vw, 3.6rem);
  line-height: 1;
  letter-spacing: 0;
}

.system-header p {
  max-width: 620px;
  margin: 0;
  color: rgba(231, 220, 203, 0.84);
  line-height: 1.35;
}

.system-header button,
.system-dossier button {
  min-height: 42px;
  border: 1px solid rgba(255, 207, 86, 0.42);
  border-radius: 7px;
  background: linear-gradient(180deg, #ffe083, var(--gold));
  color: #130f08;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.system-header button {
  min-width: 112px;
  padding: 0 14px;
}

.system-dossier {
  grid-column: 2;
  align-self: end;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 207, 86, 0.12), transparent 45%),
    rgba(5, 12, 22, 0.76);
  box-shadow: 0 18px 62px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 248, 233, 0.08);
  backdrop-filter: blur(16px);
  pointer-events: auto;
}

.system-selected-copy {
  display: grid;
  gap: 6px;
}

.system-selected-copy strong {
  overflow: hidden;
  color: #fff8e9;
  font-size: 1.32rem;
  line-height: 1.05;
  overflow-wrap: anywhere;
  white-space: normal;
}

.system-selected-copy p {
  margin: 0;
  color: rgba(231, 220, 203, 0.84);
  font-size: 0.9rem;
  line-height: 1.38;
  overflow-wrap: anywhere;
}

.system-planet-list {
  grid-column: 1 / -1;
  align-self: end;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
  pointer-events: auto;
}

.system-planet-button {
  min-height: 54px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(5, 12, 22, 0.6);
  color: #fff8e9;
  text-align: left;
  backdrop-filter: blur(12px);
}

.system-planet-button::before {
  content: "";
  width: 24px;
  aspect-ratio: 1;
  margin-top: 2px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 248, 233, 0.9), transparent 0 16%, transparent 26%),
    linear-gradient(135deg, var(--planet-ground-a, #6f5737), var(--planet-ground-b, #ab8349) 54%, var(--planet-ground-c, #362b29));
  box-shadow: inset -7px -5px 10px rgba(0, 0, 0, 0.48), 0 0 16px var(--planet-glow, rgba(255, 207, 86, 0.28));
}

.system-planet-button[aria-pressed="true"] {
  border-color: rgba(255, 207, 86, 0.5);
  background: rgba(255, 207, 86, 0.14);
}

.system-planet-button strong,
.system-planet-button span {
  overflow: hidden;
  line-height: 1.12;
  overflow-wrap: anywhere;
  white-space: normal;
}

.system-planet-button strong {
  font-size: 0.84rem;
}

.system-planet-button span {
  color: rgba(231, 220, 203, 0.72);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.16;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.system-planet-button > i {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-style: normal;
}

.system-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.system-traits i {
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(247, 239, 228, 0.82);
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.system-dossier button {
  width: 100%;
}

.hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}

.hud-row.top {
  display: grid;
  grid-template-columns: 1.1fr repeat(3, minmax(64px, 0.72fr));
  gap: 7px;
  max-width: 760px;
}

.readout {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 7px;
  background: rgba(8, 7, 13, 0.7);
  backdrop-filter: blur(14px);
}

.readout span {
  display: block;
  color: var(--muted);
  font-size: 0.63rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.readout strong {
  display: block;
  overflow: hidden;
  color: #fff8e9;
  font-size: clamp(0.95rem, 4vw, 1.34rem);
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-code-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.room-code-line strong {
  flex: 1 1 auto;
}

.invite-button {
  min-height: 26px;
  flex: 0 0 auto;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  background: rgba(46, 230, 166, 0.9);
  color: #07130f;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: auto;
}

.hud-row.meters {
  width: min(100%, 420px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.hud-row.legal-meters {
  width: min(100%, 620px);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 8px;
  margin-top: 8px;
}

.bonus-toggle {
  min-height: 32px;
  margin-top: 8px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 7px;
  background: rgba(8, 7, 13, 0.58);
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: auto;
  backdrop-filter: blur(12px);
}

.hud.bonuses-minimized .writ-panel,
.hud.bonuses-minimized .mission-panel {
  display: none;
}

.hud.bonuses-minimized .bonus-toggle {
  color: var(--mint);
}

.meter {
  position: relative;
  height: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.meter span {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--sky));
  transform-origin: left center;
}

.meter strong {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff8e9;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.82);
  text-transform: uppercase;
}

.meter.hull span {
  background: linear-gradient(90deg, var(--rose), var(--gold));
}

.legal-meter {
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: rgba(8, 7, 13, 0.58);
  backdrop-filter: blur(12px);
}

.legal-meter span {
  display: block;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.legal-meter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.legal-meter-head strong {
  color: #fff8e9;
  font-size: 0.66rem;
  line-height: 1;
  white-space: nowrap;
}

.legal-meter > div:not(.legal-meter-head) {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
}

.legal-meter i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  transform-origin: left center;
}

.legal-meter.heat i {
  background: linear-gradient(90deg, #2ee6a6, #ffcf56 48%, #ff6b9a);
}

.legal-meter.integrity i {
  background: linear-gradient(90deg, #ff6b9a, #ffcf56 44%, #2ee6a6);
}

.legal-meter.pressure i {
  background: linear-gradient(90deg, #71a7ff, #b38cff 52%, #ff6b9a);
}

.legal-meter.resonance {
  min-width: 78px;
}

.legal-meter strong {
  display: block;
  color: #fff8e9;
  font-size: 0.95rem;
  line-height: 1;
}

.legal-meter .legal-meter-head strong {
  font-size: 0.66rem;
  white-space: nowrap;
}

.crew-list {
  position: absolute;
  top: max(112px, calc(env(safe-area-inset-top) + 112px));
  right: max(12px, env(safe-area-inset-right));
  display: grid;
  gap: 5px;
  min-width: 156px;
  pointer-events: auto;
}

.crew-member {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  background: rgba(8, 7, 13, 0.58);
  color: #f4eadb;
  font-size: 0.78rem;
  backdrop-filter: blur(12px);
}

.crew-member.self {
  grid-template-columns: auto minmax(0, 1fr);
}

.crew-member.tethered {
  border-color: rgba(113, 167, 255, 0.46);
  background: rgba(22, 31, 48, 0.72);
}

.crew-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
}

.crew-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crew-tether {
  min-height: 24px;
  padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(113, 167, 255, 0.82);
  color: #07111f;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.crew-tether[aria-pressed="true"] {
  background: rgba(46, 230, 166, 0.92);
  color: #07130f;
}

.crew-tether:disabled {
  cursor: default;
  opacity: 0.36;
}

.mission-panel {
  position: absolute;
  left: max(12px, env(safe-area-inset-left));
  top: max(276px, calc(env(safe-area-inset-top) + 276px));
  width: min(340px, calc(100vw - 24px));
  padding: 9px 11px;
  border: 1px solid rgba(113, 167, 255, 0.22);
  border-radius: 7px;
  background: rgba(8, 7, 13, 0.58);
  backdrop-filter: blur(12px);
  pointer-events: auto;
}

.mission-panel span,
.mission-panel em {
  display: block;
  color: #71a7ff;
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mission-panel strong {
  display: block;
  margin-top: 3px;
  color: #fff8e9;
  font-size: 0.9rem;
  line-height: 1.08;
}

.mission-panel p {
  margin: 5px 0 8px;
  color: #dce9f7;
  font-size: 0.74rem;
  line-height: 1.24;
}

.mission-close-hint {
  display: block;
  margin-top: 5px;
  color: rgba(220, 233, 247, 0.62);
  font-size: 0.68rem;
  font-weight: 800;
}

.mission-progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.mission-progress i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #71a7ff, #2ee6a6);
  transform: scaleX(0);
  transform-origin: left center;
}

.mission-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
}

.mission-tethered {
  border-color: rgba(46, 230, 166, 0.48);
  background: rgba(9, 22, 23, 0.7);
}

.mission-actions button {
  min-height: 25px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(113, 167, 255, 0.84);
  color: #07111f;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mission-actions button[aria-pressed="true"] {
  background: rgba(46, 230, 166, 0.92);
  color: #07130f;
}

.mission-actions button:disabled {
  cursor: default;
  opacity: 0.38;
}

.writ-panel {
  position: absolute;
  left: max(12px, env(safe-area-inset-left));
  top: max(122px, calc(env(safe-area-inset-top) + 122px));
  width: min(340px, calc(100vw - 24px));
  padding: 10px 12px;
  border: 1px solid rgba(255, 207, 86, 0.24);
  border-radius: 7px;
  background: rgba(8, 7, 13, 0.66);
  backdrop-filter: blur(12px);
  cursor: pointer;
  pointer-events: auto;
}

.writ-panel span,
.writ-panel em {
  display: block;
  color: var(--gold);
  font-size: 0.64rem;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.writ-panel strong {
  display: block;
  margin-top: 3px;
  color: #fff8e9;
  font-size: 0.98rem;
  line-height: 1.06;
}

.writ-panel p {
  margin: 6px 0 8px;
  color: #e7dccb;
  font-size: 0.78rem;
  line-height: 1.25;
}

.writ-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.writ-progress i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--rose));
  transform: scaleX(0);
  transform-origin: left center;
}

.writ-panel em {
  margin-top: 6px;
  color: var(--mint);
}

.writ-close-hint {
  display: block;
  margin-top: 5px;
  color: rgba(247, 239, 228, 0.58);
  font-size: 0.68rem;
  font-weight: 800;
}

.story-beat {
  position: absolute;
  left: max(12px, env(safe-area-inset-left));
  bottom: calc(142px + env(safe-area-inset-bottom));
  width: min(420px, calc(100vw - 24px));
  padding: 10px 12px;
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  background: rgba(8, 7, 13, 0.62);
  color: #f4eadb;
  font-size: 0.9rem;
  line-height: 1.26;
  backdrop-filter: blur(12px);
  opacity: 1;
  transition: opacity 160ms ease;
}

.notice-stack {
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  bottom: calc(142px + env(safe-area-inset-bottom));
  display: grid;
  gap: 7px;
  width: min(300px, calc(100vw - 24px));
}

.notice {
  padding: 8px 10px;
  border-radius: 7px;
  background: rgba(8, 7, 13, 0.7);
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.2;
  backdrop-filter: blur(12px);
}

.invite-toast {
  position: absolute;
  top: calc(74px + env(safe-area-inset-top));
  left: 50%;
  z-index: 8;
  min-height: 36px;
  padding: 9px 14px;
  border: 1px solid rgba(46, 230, 166, 0.42);
  border-radius: 7px;
  background: rgba(5, 14, 17, 0.82);
  color: var(--mint);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -8px);
  transition: opacity 220ms ease, transform 220ms ease;
  backdrop-filter: blur(14px);
}

.invite-toast.active {
  opacity: 1;
  transform: translate(-50%, 0);
}

.field-pack-actions {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(112px + env(safe-area-inset-bottom));
  z-index: 16;
  display: grid;
  gap: 8px;
  pointer-events: auto;
}

.field-pack-actions:empty {
  display: none;
}

.field-pack-action {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 126px;
  min-height: 54px;
  padding: 6px 9px 6px 7px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(113, 167, 255, 0.9);
  color: #07111f;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(12px);
}

.field-pack-action.bomb {
  background: rgba(255, 207, 86, 0.94);
  color: #140f08;
}

.field-pack-action.jet {
  background: rgba(46, 230, 166, 0.94);
  color: #07130f;
}

.field-pack-action.relay {
  background: rgba(179, 140, 255, 0.94);
  color: #12091f;
}

.field-pack-action.lift {
  background: rgba(143, 232, 255, 0.94);
  color: #06131a;
}

.field-pack-action:disabled {
  opacity: 0.46;
}

.field-pack-action-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(8, 7, 13, 0.22);
  color: inherit;
  font-size: 1rem;
  font-weight: 900;
}

.field-pack-action-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
  text-align: left;
}

.field-pack-action-copy strong,
.field-pack-action-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-pack-action-copy strong {
  font-size: 0.78rem;
}

.field-pack-action-copy small {
  font-size: 0.64rem;
  font-weight: 900;
  opacity: 0.78;
}

.quick-actions {
  position: absolute;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  z-index: 14;
  display: grid;
  grid-template-columns: repeat(5, minmax(58px, 78px));
  gap: 8px;
  pointer-events: auto;
  transform: translateX(-50%);
}

.quick-actions button,
.store-actions button,
.escape-actions button,
.upgrade-item button,
.gear-item button,
.backpack-actions button,
.backpack-row button,
.skin-item button {
  min-height: 42px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: rgba(255, 207, 86, 0.92);
  color: #140f08;
  font-size: 0.82rem;
  font-weight: 900;
}

.quick-actions button:disabled,
.store-actions button:disabled,
.escape-actions button:disabled,
.upgrade-item button:disabled,
.gear-item button:disabled,
.backpack-actions button:disabled,
.backpack-row button:disabled,
.skin-item button:disabled {
  cursor: default;
  opacity: 0.42;
}

.quick-actions button:nth-child(2),
.store-actions button:nth-child(1),
.escape-actions button:nth-child(2) {
  background: rgba(46, 230, 166, 0.92);
  color: #07130f;
}

.quick-actions button:nth-child(3),
.store-actions button:nth-child(4) {
  background: rgba(255, 107, 154, 0.92);
  color: #19070f;
}

.quick-actions button:nth-child(4) {
  background: rgba(113, 167, 255, 0.94);
  color: #07111f;
}

.credit-gain-pop {
  position: fixed;
  z-index: 70;
  pointer-events: none;
  transform: translate(-50%, 0);
  color: #2ee6a6;
  font-size: 0.92rem;
  font-weight: 950;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55), 0 0 14px rgba(46, 230, 166, 0.35);
  animation: credit-gain-pop 1.2s ease-out forwards;
}

@keyframes credit-gain-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, 6px) scale(0.92);
  }

  18% {
    opacity: 1;
    transform: translate(-50%, -3px) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -34px) scale(1.08);
  }
}

#selfDestructButton,
.backpack-actions button {
  background: rgba(255, 75, 75, 0.94);
  color: #210606;
}

#selfDestructButton,
#fieldPackButton {
  display: grid;
  place-items: center;
  line-height: 1.05;
}

#fieldPackButton.armed {
  border-color: rgba(113, 167, 255, 0.58);
  background: rgba(113, 167, 255, 0.94);
  color: #07111f;
}

#selfDestructButton.armed {
  border-color: rgba(255, 207, 86, 0.62);
  background: rgba(255, 207, 86, 0.96);
  color: #180f05;
}

#selfDestructButton span,
#fieldPackButton span {
  display: block;
}

.store-panel {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  align-items: end;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(8, 7, 13, 0.58);
  pointer-events: auto;
  backdrop-filter: blur(10px);
}

.store-sheet {
  width: min(100%, 780px);
  max-height: min(86dvh, 760px);
  margin: 0 auto;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(12, 11, 17, 0.94);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.58);
  -webkit-overflow-scrolling: touch;
}

.backpack-panel {
  z-index: 31;
}

.store-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(12, 11, 17, 0.96);
}

.store-header span,
.store-stats span,
.inventory-row span,
.upgrade-copy span,
.gear-copy span,
.backpack-copy span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.store-header h2 {
  margin: 2px 0 0;
  color: #fff8e9;
  font-size: 1.28rem;
  line-height: 1.05;
}

.close-button {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
}

.store-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px 12px 0;
}

.store-stats div {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
}

.store-stats strong {
  display: block;
  overflow: hidden;
  color: #fff8e9;
  font-size: 1.2rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px;
}

.escape-panel {
  display: grid;
  gap: 9px;
  margin: 0 12px 12px;
  padding: 12px;
  border: 1px solid rgba(113, 167, 255, 0.24);
  border-radius: 7px;
  background: rgba(113, 167, 255, 0.08);
}

.escape-copy {
  display: grid;
  gap: 4px;
}

.escape-copy span {
  color: var(--sky);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.escape-copy strong {
  color: #fff8e9;
  font-size: 1rem;
}

.escape-copy p {
  margin: 0;
  color: #d8d0c7;
  font-size: 0.82rem;
  line-height: 1.25;
}

.escape-progress {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.escape-progress i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sky), var(--mint), var(--gold));
  transform: scaleX(0);
  transform-origin: left center;
}

.escape-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.escape-meta span {
  min-width: 0;
  padding: 7px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.escape-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.inventory-list,
.upgrade-list,
.gear-list,
.backpack-list,
.skin-list {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
  touch-action: pan-y;
}

.inventory-row,
.upgrade-item,
.gear-item,
.backpack-row,
.skin-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
}

.inventory-row strong,
.upgrade-copy strong,
.gear-copy strong,
.backpack-copy strong,
.skin-copy strong {
  display: block;
  overflow-wrap: anywhere;
  color: #fff8e9;
  font-size: 0.98rem;
}

.inventory-row em {
  color: var(--gold);
  font-style: normal;
  font-weight: 900;
}

.depot-panel {
  align-items: center;
  background:
    radial-gradient(ellipse at 50% 105%, rgba(255, 207, 86, 0.28) 0 22%, transparent 48%),
    linear-gradient(180deg, rgba(30, 25, 42, 0.88) 0%, rgba(154, 91, 62, 0.58) 44%, rgba(211, 147, 86, 0.62) 100%);
  backdrop-filter: blur(5px) saturate(1.08);
}

.depot-sheet {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(100%, 880px);
  max-height: min(91dvh, 820px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(246, 242, 231, 0.94);
  color: #17131a;
  box-shadow: 0 26px 100px rgba(13, 10, 12, 0.44);
}

.depot-hero {
  position: relative;
  min-height: 210px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 207, 86, 0.42) 0 9%, transparent 20%),
    linear-gradient(180deg, #2c2941 0%, #7c4a4b 48%, #c48250 72%, #d5a161 100%);
}

.depot-hero::before {
  position: absolute;
  left: 50%;
  bottom: 22px;
  width: min(92%, 720px);
  height: 132px;
  border-radius: 8px 8px 0 0;
  background:
    linear-gradient(90deg, transparent 0 6%, rgba(46, 230, 166, 0.78) 6% 18%, transparent 18% 82%, rgba(113, 167, 255, 0.76) 82% 94%, transparent 94%),
    linear-gradient(180deg, #605449 0 16%, #2a2528 16% 68%, #776553 68% 100%);
  box-shadow:
    -190px 38px 0 -18px #4e4540,
    190px 38px 0 -18px #4e4540,
    0 58px 0 -20px #352f2f,
    0 0 0 1px rgba(255, 255, 255, 0.16),
    0 22px 38px rgba(54, 34, 21, 0.28);
  content: "";
  transform: translateX(-50%);
}

.depot-hero::after {
  position: absolute;
  inset: auto 0 0;
  height: 70px;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(255, 207, 86, 0.24) 0 30%, transparent 62%),
    linear-gradient(180deg, rgba(246, 242, 231, 0), rgba(246, 242, 231, 0.98));
  content: "";
  pointer-events: none;
}

.depot-panel .store-header {
  position: relative;
  z-index: 1;
  border-bottom: 0;
  background: transparent;
}

.depot-panel .store-header span,
.depot-panel .store-stats span,
.depot-panel .store-section-title span,
.depot-panel .inventory-row span,
.depot-panel .upgrade-copy span,
.depot-panel .gear-copy span {
  color: rgba(62, 49, 38, 0.72);
}

.depot-panel .store-header span {
  color: rgba(255, 248, 233, 0.86);
}

.depot-panel .store-header h2 {
  color: #fff8e9;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.42);
}

.depot-panel .close-button {
  background: rgba(255, 248, 233, 0.88);
  color: #17131a;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.18);
}

.depot-panel .store-stats {
  position: relative;
  z-index: 1;
  gap: 10px;
  padding: 94px 14px 14px;
}

.depot-panel .store-stats div {
  border-color: rgba(255, 255, 255, 0.56);
  background: rgba(255, 248, 233, 0.9);
  box-shadow: 0 10px 30px rgba(42, 30, 22, 0.16);
}

.depot-panel .store-stats strong {
  color: #17131a;
}

.depot-quick-services {
  position: absolute;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 14;
  display: flex;
  gap: 8px;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.depot-quick-services.active {
  pointer-events: auto;
  opacity: 0.86;
  transform: translate(-50%, 0);
}

.depot-quick-services button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  background: rgba(8, 7, 13, 0.5);
  color: rgba(255, 248, 233, 0.86);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
}

.depot-quick-services button:disabled {
  cursor: default;
  opacity: 0.42;
}

.store-scroll {
  display: grid;
  gap: 12px;
  overflow: auto;
  padding: 14px;
  -webkit-overflow-scrolling: touch;
}

.store-hover-description {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(36, 89, 119, 0.18);
  border-radius: 8px;
  background: rgba(255, 252, 243, 0.94);
  color: #3e3329;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.3;
  box-shadow: 0 8px 26px rgba(48, 36, 26, 0.1);
}

.depot-panel [data-store-description]:hover,
.depot-panel [data-store-description]:focus,
.depot-panel [data-store-description]:focus-within {
  border-color: rgba(36, 89, 119, 0.34);
}

.depot-panel .upgrade-item[data-store-description]:hover,
.depot-panel .upgrade-item[data-store-description]:focus-within,
.depot-panel .gear-item[data-store-description]:hover,
.depot-panel .gear-item[data-store-description]:focus-within {
  background: rgba(255, 255, 255, 0.9);
}

.store-section {
  display: grid;
  gap: 10px;
  min-width: 0;
  border: 1px solid rgba(54, 42, 32, 0.14);
  border-radius: 8px;
  background: rgba(255, 252, 243, 0.82);
  box-shadow: 0 10px 32px rgba(48, 36, 26, 0.08);
}

.store-section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 0;
}

.store-section-title strong {
  color: #17131a;
  font-size: 0.98rem;
}

.depot-panel .store-actions {
  padding: 0 12px 12px;
}

.depot-panel .store-actions button,
.depot-panel .escape-actions button,
.depot-panel .upgrade-item button,
.depot-panel .gear-item button {
  border: 0;
  background: linear-gradient(180deg, #ffdc70, #f0aa38);
  color: #211304;
  box-shadow: 0 9px 18px rgba(110, 72, 21, 0.18);
}

.depot-panel .store-actions button:nth-child(1),
.depot-panel .escape-actions button:nth-child(2) {
  background: linear-gradient(180deg, #57efba, #20b97e);
  color: #03140e;
}

.depot-panel .store-actions button:nth-child(4) {
  background: linear-gradient(180deg, #ff91b2, #df4e80);
  color: #230713;
}

.depot-panel .store-actions button:disabled,
.depot-panel .escape-actions button:disabled,
.depot-panel .upgrade-item button:disabled,
.depot-panel .gear-item button:disabled {
  background: #d9d2c3;
  color: rgba(40, 31, 25, 0.48);
  box-shadow: none;
}

.depot-panel .escape-panel {
  margin: 0;
  border-color: rgba(36, 89, 119, 0.22);
  background:
    linear-gradient(135deg, rgba(113, 167, 255, 0.16), rgba(46, 230, 166, 0.1)),
    rgba(255, 252, 243, 0.88);
  box-shadow: 0 10px 32px rgba(35, 74, 95, 0.11);
}

.depot-panel .escape-copy span {
  color: #286f91;
}

.depot-panel .escape-copy strong,
.depot-panel .inventory-row strong,
.depot-panel .upgrade-copy strong,
.depot-panel .gear-copy strong {
  color: #17131a;
}

.depot-panel .escape-copy p {
  color: #4f4339;
}

.depot-panel .escape-progress {
  background: rgba(48, 42, 35, 0.12);
}

.depot-panel .escape-meta span {
  background: rgba(255, 255, 255, 0.62);
  color: #5a4b3d;
}

.depot-panel .inventory-list,
.depot-panel .upgrade-list,
.depot-panel .gear-list {
  padding: 0 12px 12px;
}

.depot-panel .inventory-row,
.depot-panel .upgrade-item,
.depot-panel .gear-item {
  border-color: rgba(54, 42, 32, 0.12);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 4px 0 0 rgba(255, 207, 86, 0.5);
}

.depot-panel .gear-item {
  box-shadow: inset 4px 0 0 rgba(113, 167, 255, 0.5);
}

.depot-panel .inventory-row {
  box-shadow: inset 4px 0 0 rgba(46, 230, 166, 0.45);
}

.store-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.store-chip {
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(23, 19, 26, 0.07);
  color: #5a4b3d;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.store-level {
  display: grid;
  grid-template-columns: repeat(var(--max-level, 6), minmax(8px, 1fr));
  gap: 4px;
  width: min(150px, 100%);
  margin-top: 8px;
}

.store-level i {
  height: 5px;
  border-radius: 999px;
  background: rgba(23, 19, 26, 0.12);
}

.store-level i.filled {
  background: linear-gradient(90deg, #ffcf56, #2ee6a6);
}

.depot-panel .inventory-row em {
  color: #926312;
}

.skin-store-status {
  margin: 0;
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

.starter-color-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 10px 12px 12px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 4px 0 0 var(--starter-color, #ffcf56);
}

.starter-color-panel.equipped {
  border-color: rgba(255, 255, 255, 0.28);
}

.starter-color-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.starter-color-copy span,
.starter-color-custom span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.starter-color-copy strong {
  color: #fff8e9;
  font-size: 0.92rem;
}

.starter-color-swatches {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 7px;
}

.starter-color-swatches button {
  aspect-ratio: 1;
  min-height: 34px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  box-shadow: inset 0 0 0 2px rgba(8, 7, 13, 0.35);
}

.starter-color-swatches button.selected {
  border-color: #fff8e9;
  box-shadow: 0 0 0 2px var(--starter-color, #ffcf56), inset 0 0 0 2px rgba(8, 7, 13, 0.35);
}

.starter-color-custom {
  display: grid;
  justify-items: end;
  gap: 5px;
}

.starter-color-custom input {
  width: 46px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  background: transparent;
}

.skin-item {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.skin-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.skin-copy span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.2;
}

.skin-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.skin-badges span {
  width: fit-content;
  padding: 3px 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.skin-rarity {
  color: #fff8e9;
  background: rgba(113, 167, 255, 0.16);
}

.skin-cost {
  color: var(--gold);
  background: rgba(255, 207, 86, 0.1);
}

.skin-effect {
  color: var(--mint);
  background: rgba(46, 230, 166, 0.1);
}

.skin-preview {
  position: relative;
  width: 104px;
  height: 76px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.07);
}

.skin-preview-canvas {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: block;
  width: 104px;
  height: 76px;
}

.skin-preview::before {
  content: none;
  position: absolute;
  left: 19px;
  top: 12px;
  width: 34px;
  height: 23px;
  z-index: 2;
  border-radius: 5px;
  clip-path: polygon(0 18%, 70% 0, 100% 30%, 100% 70%, 70% 100%, 0 82%);
  background: var(--skin-primary, var(--gold));
  box-shadow: -9px 0 0 rgba(8, 7, 13, 0.9), 0 0 16px var(--skin-glow, rgba(255, 207, 86, 0.24));
}

.skin-preview::after {
  content: none;
  position: absolute;
  left: 43px;
  top: 18px;
  width: 9px;
  height: 10px;
  z-index: 4;
  border-radius: 2px;
  background: var(--skin-glass, #fff8e9);
  box-shadow: inset 3px 0 0 rgba(8, 7, 13, 0.68);
}

.skin-stripe {
  display: none;
  position: absolute;
  left: 12px;
  top: 10px;
  width: 9px;
  height: 26px;
  z-index: 3;
  border-radius: 3px;
  background: var(--skin-accent, var(--mint));
  box-shadow: 16px -5px 0 -3px rgba(8, 7, 13, 0.9), 16px 5px 0 -3px rgba(8, 7, 13, 0.9);
}

.skin-preview-effects {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.skin-preview-effects span {
  position: absolute;
  display: block;
  color: var(--skin-accent, var(--mint));
  background: currentColor;
}

.skin-preview-effects-stripe span {
  left: 12px;
  top: 8px;
  width: 40px;
  height: 24px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  opacity: 0;
  animation: skinPreviewPulse 1.8s ease-out infinite;
  animation-delay: var(--delay-wide);
}

.skin-preview-effects-scanner span {
  left: 28px;
  top: 16px;
  width: 8px;
  height: 8px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  opacity: 0;
  animation: skinPreviewScan 1.8s ease-out infinite;
  animation-delay: var(--delay-slow);
}

.skin-preview-effects-slash span {
  left: calc(8px + var(--offset-8));
  top: 33px;
  width: 4px;
  height: 4px;
  border-radius: 1px;
  transform: rotate(35deg);
  opacity: 0;
  animation: skinPreviewSpark 1.15s ease-out infinite;
  animation-delay: var(--delay-fast);
}

.skin-preview-effects-ripple span {
  left: calc(4px + var(--offset-10));
  bottom: -8px;
  width: calc(6px + var(--offset-1));
  height: calc(6px + var(--offset-1));
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  opacity: 0;
  animation: skinPreviewBubble 1.75s ease-out infinite;
  animation-delay: var(--delay-medium);
}

.skin-preview-effects-void span {
  left: 11px;
  top: 7px;
  width: 42px;
  height: 26px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  opacity: 0.32;
  animation: skinPreviewWarp 2.4s ease-in-out infinite;
  animation-delay: var(--delay-warp);
}

.skin-preview-effects-seal span {
  left: 18px;
  top: 7px;
  width: 28px;
  height: 28px;
  border: 1px solid currentColor;
  background: transparent;
  opacity: 0.34;
  animation: skinPreviewSeal 2.6s linear infinite;
  animation-delay: var(--delay-reverse);
}

.skin-preview-effects-seal span:nth-child(even) {
  border-radius: 50%;
}

.skin-preview-effects-orbit span {
  left: 30px;
  top: 18px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  transform-origin: 2px 2px;
  animation: skinPreviewOrbit 2s linear infinite;
}

.skin-preview-effects-eclipse span:nth-child(1) {
  left: 14px;
  top: 6px;
  width: 36px;
  height: 28px;
  border-radius: 50%;
  background: #ff6b9a;
  opacity: 0.22;
  animation: skinPreviewGlow 1.6s ease-in-out infinite;
}

.skin-preview-effects-eclipse span:nth-child(2) {
  left: 20px;
  top: 8px;
  width: 30px;
  height: 25px;
  border-radius: 50%;
  background: #08070d;
  opacity: 0.7;
  animation: skinPreviewEclipse 2.2s ease-in-out infinite;
}

.skin-preview-effects-eclipse span:nth-child(3) {
  left: 9px;
  top: 7px;
  width: 46px;
  height: 25px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  opacity: 0.35;
  animation: skinPreviewPulse 1.9s ease-out infinite;
}

.skin-preview-effects-prism span {
  left: 48px;
  top: calc(7px + var(--offset-5));
  width: 12px;
  height: 9px;
  clip-path: polygon(100% 50%, 0 0, 12% 100%);
  background: hsl(var(--hue), 96%, 64%);
  opacity: 0;
  animation: skinPreviewPrism 1.25s ease-out infinite;
  animation-delay: var(--delay-fast);
}

.skin-preview-effects-crown span {
  left: calc(10px + var(--offset-8));
  top: calc(3px + var(--beam-top));
  width: 5px;
  height: 18px;
  border-radius: 999px;
  opacity: 0.26;
  transform-origin: bottom center;
  animation: skinPreviewBeam 1.65s ease-in-out infinite;
  animation-delay: var(--delay-fast);
}

@keyframes skinPreviewPulse {
  0% {
    opacity: 0.42;
    transform: scale(0.6);
  }
  100% {
    opacity: 0;
    transform: scale(1.45);
  }
}

@keyframes skinPreviewScan {
  0% {
    opacity: 0.5;
    transform: scale(0.25);
  }
  100% {
    opacity: 0;
    transform: scale(5.5);
  }
}

@keyframes skinPreviewSpark {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(35deg) scale(0.55);
  }
  20% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: translate(12px, -32px) rotate(35deg) scale(0.2);
  }
}

@keyframes skinPreviewBubble {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.65);
  }
  20% {
    opacity: 0.45;
  }
  100% {
    opacity: 0;
    transform: translateY(-46px) scale(1.25);
  }
}

@keyframes skinPreviewWarp {
  0%,
  100% {
    transform: rotate(-12deg) scale(0.84, 1.04);
  }
  50% {
    transform: rotate(18deg) scale(1.2, 0.78);
  }
}

@keyframes skinPreviewSeal {
  0% {
    transform: rotate(0deg) scale(0.82);
  }
  100% {
    transform: rotate(360deg) scale(1.08);
  }
}

@keyframes skinPreviewOrbit {
  0% {
    opacity: 0.45;
    transform: rotate(var(--orbit-angle)) translateX(27px);
  }
  100% {
    opacity: 0.45;
    transform: rotate(calc(var(--orbit-angle) + 360deg)) translateX(27px);
  }
}

@keyframes skinPreviewGlow {
  0%,
  100% {
    transform: scale(0.9);
    opacity: 0.16;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.32;
  }
}

@keyframes skinPreviewEclipse {
  0%,
  100% {
    transform: translateX(-6px);
  }
  50% {
    transform: translateX(5px);
  }
}

@keyframes skinPreviewPrism {
  0% {
    opacity: 0;
    transform: translateX(0) scale(0.7);
  }
  25% {
    opacity: 0.75;
  }
  100% {
    opacity: 0;
    transform: translateX(-52px) scale(0.15);
  }
}

@keyframes skinPreviewBeam {
  0%,
  100% {
    opacity: 0.12;
    transform: rotate(-24deg) scaleY(0.55);
  }
  50% {
    opacity: 0.5;
    transform: rotate(20deg) scaleY(1.1);
  }
}

.skin-preview-scanner .skin-stripe,
.skin-preview-slash .skin-stripe {
  left: 27px;
  top: 11px;
  width: 4px;
  height: 24px;
  border-radius: 2px;
  transform: none;
  box-shadow: 8px 0 0 var(--skin-accent, var(--mint)), 16px 0 0 var(--skin-accent, var(--mint));
}

.skin-preview-slash .skin-stripe {
  left: 34px;
  top: 7px;
  height: 32px;
  transform: rotate(35deg);
  box-shadow: 9px 0 0 -1px var(--skin-accent, var(--mint));
}

.skin-preview-ripple .skin-stripe {
  left: 27px;
  top: 12px;
  width: 24px;
  height: 22px;
  border: 2px solid var(--skin-accent, var(--mint));
  border-left: 0;
  border-radius: 2px 50% 50% 2px;
  background: transparent;
  transform: none;
  box-shadow: none;
}

.skin-preview-void .skin-stripe,
.skin-preview-eclipse .skin-stripe {
  left: 8px;
  top: 7px;
  width: 54px;
  height: 32px;
  border: 2px solid var(--skin-accent, var(--mint));
  border-radius: 50%;
  background: transparent;
  transform: rotate(-8deg);
  box-shadow: none;
}

.skin-preview-orbit .skin-stripe,
.skin-preview-crown .skin-stripe {
  left: 5px;
  top: 8px;
  width: 58px;
  height: 30px;
  border: 1px solid var(--skin-accent, var(--mint));
  border-radius: 50%;
  background: transparent;
  transform: rotate(12deg);
  box-shadow: none;
}

.skin-preview-prism .skin-stripe {
  left: 24px;
  top: 13px;
  width: 31px;
  height: 21px;
  background: linear-gradient(90deg, #ff6b9a, #ffcf56, #2ee6a6, #71a7ff);
  clip-path: polygon(0 100%, 42% 0, 100% 86%);
  transform: none;
  box-shadow: none;
}

.skin-preview-seal .skin-stripe {
  left: 25px;
  top: 13px;
  width: 20px;
  height: 20px;
  border: 2px solid var(--skin-accent, var(--mint));
  border-radius: 50%;
  background: transparent;
  transform: none;
  box-shadow: none;
}

.skin-item button {
  min-width: 82px;
  padding: 0 10px;
}

.skin-item.equipped {
  border-color: rgba(46, 230, 166, 0.38);
  background: rgba(46, 230, 166, 0.1);
}

.skin-item.affordable {
  border-color: rgba(255, 207, 86, 0.32);
  background: rgba(255, 207, 86, 0.08);
}

.skin-item.locked .skin-preview {
  filter: saturate(0.58) brightness(0.78);
}

.upgrade-item button {
  min-width: 84px;
  padding: 0 10px;
}

.gear-item button {
  min-width: 84px;
  padding: 0 10px;
}

.backpack-actions {
  display: grid;
  padding: 12px;
}

.field-pack-status {
  margin: 0;
  padding: 0 12px 12px;
  color: rgba(231, 220, 203, 0.82);
  font-size: 0.84rem;
}

.field-pack-row.active {
  border-color: rgba(113, 167, 255, 0.42);
  background: rgba(113, 167, 255, 0.12);
}

.field-pack-row.active button {
  background: rgba(46, 230, 166, 0.94);
  color: #07130f;
}

.backpack-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.backpack-row button {
  min-width: 74px;
  padding: 0 10px;
}

.backpack-row button:first-child {
  background: rgba(255, 207, 86, 0.92);
  color: #140f08;
}

.backpack-row button:last-child {
  background: rgba(255, 107, 154, 0.92);
  color: #19070f;
}

.field-pack-row button {
  background: rgba(113, 167, 255, 0.94);
  color: #07111f;
}

.touch-controls {
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  padding: 0 max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.stick-zone {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 1;
  width: min(48vw, 320px);
  height: min(42dvh, 320px);
  pointer-events: auto;
  touch-action: none;
}

.stick-base {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: 124px;
  height: 124px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(8, 7, 13, 0.38);
  pointer-events: auto;
  backdrop-filter: blur(10px);
}

.stick-base.dynamic {
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.36), 0 0 0 1px rgba(46, 230, 166, 0.12);
}

.stick-nub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(255, 207, 86, 0.28);
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.18), 0 12px 34px rgba(0, 0, 0, 0.34);
  transform: translate(-50%, -50%);
}

.button-cluster {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, 78px);
  gap: 12px;
  pointer-events: auto;
}

.round-button {
  position: relative;
  width: 78px;
  height: 78px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: rgba(8, 7, 13, 0.44);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(12px);
}

.round-button:active,
.round-button.active {
  transform: translateY(2px) scale(0.98);
}

.round-button.thrust span {
  position: absolute;
  left: 50%;
  top: 47%;
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-bottom: 29px solid var(--mint);
  filter: drop-shadow(0 0 10px rgba(46, 230, 166, 0.7));
  transform: translate(-50%, -50%);
}

.round-button.drill span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 38px;
  border-radius: 50% 50% 8px 8px;
  background: linear-gradient(180deg, #fff3c6, var(--gold) 48%, #f27d42);
  box-shadow: 0 0 14px rgba(255, 207, 86, 0.7);
  transform: translate(-50%, -50%) rotate(45deg);
}

.playstation-browser #game {
  outline: none;
}

.playstation-browser .touch-controls {
  z-index: 15;
}

.playstation-browser .stick-zone {
  width: min(42vw, 360px);
  height: min(54dvh, 420px);
}

.playstation-browser .stick-base {
  width: 156px;
  height: 156px;
  background: rgba(8, 7, 13, 0.62);
}

.playstation-browser .button-cluster {
  grid-template-columns: repeat(2, 104px);
  gap: 16px;
}

.playstation-browser .round-button {
  width: 104px;
  height: 104px;
  background: rgba(8, 7, 13, 0.72);
}

.playstation-browser .round-button::after {
  position: absolute;
  left: 50%;
  bottom: 13px;
  color: rgba(255, 248, 233, 0.9);
  content: attr(aria-label);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transform: translateX(-50%);
}

@media (max-width: 680px) {
  .lobby {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 12px;
    min-height: 100dvh;
    padding: calc(env(safe-area-inset-top) + 12px) max(12px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 14px) max(12px, env(safe-area-inset-left));
  }

  .lobby::before {
    opacity: 0.24;
    background-size: 58px 58px, 58px 58px, min(112vw, 620px) min(112vw, 620px);
  }

  .lobby::after {
    right: max(10px, env(safe-area-inset-right));
    bottom: auto;
    top: calc(env(safe-area-inset-top) + 74px);
    width: min(38vw, 148px);
    opacity: 0.48;
  }

  .brand {
    align-self: stretch;
    max-width: none;
    padding-right: min(32vw, 124px);
  }

  .eyebrow {
    margin-bottom: 6px;
    font-size: 0.64rem;
    line-height: 1.2;
  }

  h1 {
    max-width: none;
    font-size: clamp(2.35rem, 13.4vw, 4rem);
    line-height: 0.94;
  }

  .premise {
    max-width: none;
    margin-top: 8px;
    font-size: 0.86rem;
    line-height: 1.32;
  }

  .join-panel {
    grid-template-columns: 1fr;
    gap: 9px;
    padding: 11px;
  }

  .destination-toggle {
    gap: 6px;
  }

  .destination-toggle button {
    min-height: 38px;
    font-size: 0.68rem;
  }

  input {
    min-height: 44px;
    font-size: 0.95rem;
  }

  .actions {
    gap: 8px;
  }

  .actions button {
    min-height: 46px;
    padding: 0 8px;
    font-size: 0.86rem;
  }

  .actions {
    grid-template-columns: 1fr 0.62fr;
  }

  .actions .skin-action {
    grid-column: 1 / -1;
  }

  .auth-summary {
    align-items: start;
    flex-direction: column;
  }

  .auth-fields {
    grid-template-columns: 1fr;
  }

  .auth-actions,
  .auth-signed-actions {
    width: 100%;
  }

  .auth-actions button,
  .auth-signed-actions button {
    flex: 1 1 0;
  }

  .room-list {
    max-height: min(18dvh, 148px);
  }

  .room-row {
    grid-template-columns: minmax(0, 1fr) minmax(48px, max-content) minmax(54px, max-content);
    gap: 6px;
    min-height: 46px;
    padding: 7px 8px;
  }

  .room-row .room-heat {
    grid-column: 2;
  }

  .room-row small {
    display: none;
  }

  .room-row em {
    min-width: 58px;
  }

  .system-panel {
    padding: calc(env(safe-area-inset-top) + 12px) max(12px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 12px) max(12px, env(safe-area-inset-left));
  }

  .system-sheet {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    gap: 10px;
  }

  .system-header {
    align-items: stretch;
    flex-direction: column;
    padding: 12px;
  }

  .system-header button {
    width: 100%;
  }

  .system-header p {
    font-size: 0.82rem;
  }

  .system-dossier {
    grid-column: 1;
    align-self: end;
    gap: 9px;
    padding: 11px;
  }

  .system-selected-copy strong {
    font-size: 1.05rem;
  }

  .system-selected-copy p {
    font-size: 0.78rem;
  }

  .system-planet-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .system-planet-button {
    min-height: 46px;
    padding: 6px;
  }

  .system-planet-button::before {
    width: 19px;
  }

  .hud-row.top {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .readout.room {
    grid-column: 1 / -1;
  }

  .readout {
    padding: 7px;
  }

  .readout strong {
    font-size: clamp(0.82rem, 3.2vw, 1.08rem);
  }

  .invite-button {
    min-height: 24px;
    padding: 0 6px;
    font-size: 0.58rem;
  }

  .room-code-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
  }

  .room-code-line strong {
    min-width: 0;
  }

  .crew-list {
    top: auto;
    bottom: calc(250px + env(safe-area-inset-bottom));
    right: max(12px, env(safe-area-inset-right));
  }

  .hud-row.legal-meters {
    grid-template-columns: 1fr 1fr 1fr;
    width: min(100%, 300px);
  }

  .legal-meter.resonance {
    display: none;
  }

  .writ-panel {
    top: calc(138px + env(safe-area-inset-top));
    width: min(310px, calc(100vw - 24px));
  }

  .mission-panel {
    top: calc(286px + env(safe-area-inset-top));
    width: min(310px, calc(100vw - 24px));
  }

  .story-beat {
    bottom: calc(152px + env(safe-area-inset-bottom));
    font-size: 0.82rem;
  }

  .notice-stack {
    display: none;
  }

  .quick-actions {
    left: 50%;
    right: auto;
    top: auto;
    bottom: calc(148px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(5, minmax(44px, 1fr));
    width: min(100%, 392px);
    transform: translateX(-50%);
  }

  .quick-actions button {
    min-height: 38px;
    padding: 0 4px;
    font-size: 0.62rem;
  }

  .field-pack-actions {
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(240px + env(safe-area-inset-bottom));
    gap: 6px;
  }

  .field-pack-action {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 4px;
    min-width: 74px;
    min-height: 64px;
    padding: 6px 5px;
  }

  .field-pack-action-copy {
    text-align: center;
  }

  .field-pack-action-copy strong {
    font-size: 0.68rem;
  }

  .field-pack-action-copy small {
    font-size: 0.58rem;
  }

  .store-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .depot-panel {
    align-items: end;
  }

  .depot-sheet {
    max-height: min(92dvh, 760px);
  }

  .depot-hero {
    min-height: 168px;
  }

  .depot-quick-services {
    left: auto;
    right: max(18px, env(safe-area-inset-right));
    bottom: calc(104px + env(safe-area-inset-bottom));
    transform: translateY(4px);
  }

  .depot-quick-services.active {
    transform: translateY(0);
  }

  .store-scroll {
    gap: 10px;
    padding: 10px;
  }

  .store-actions {
    grid-template-columns: repeat(2, 1fr);
  }

  .escape-meta,
  .escape-actions {
    grid-template-columns: 1fr;
  }

  .starter-color-panel {
    grid-template-columns: 1fr;
  }

  .starter-color-custom {
    justify-items: start;
  }

  .inventory-row,
  .upgrade-item,
  .gear-item,
  .backpack-row,
  .skin-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .upgrade-item button,
  .gear-item button,
  .backpack-row button,
  .skin-item button {
    width: 100%;
  }

  .story-beat {
    bottom: calc(202px + env(safe-area-inset-bottom));
  }
}

@media (max-height: 560px) {
  .brand {
    align-self: center;
  }

  h1 {
    font-size: clamp(2.4rem, 10vw, 4rem);
  }

  .premise {
    display: none;
  }

  .story-beat,
  .crew-list,
  .mission-panel,
  .writ-panel {
    display: none;
  }

  .store-sheet {
    max-height: calc(100dvh - 20px);
  }

  .field-pack-actions {
    bottom: calc(96px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(4, minmax(58px, 1fr));
    right: max(12px, env(safe-area-inset-right));
    left: max(12px, env(safe-area-inset-left));
  }

  .field-pack-action {
    min-width: 0;
  }

  .depot-hero {
    min-height: 132px;
  }

  .depot-panel .store-stats {
    padding-top: 18px;
  }
}
