/* ─── Reset & base ─────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0b0c14;
  --surface:    #12141f;
  --surface2:   #1a1d2e;
  --border:     #252840;
  --text:       #d4d6f0;
  --text-dim:   #6b6e8a;
  --accent:     #7c6df5;
  --accent2:    #3ecfb0;
  --warn:       #e8a33a;
  --danger:     #e05050;
  --success:    #4caf82;
  --partial:    #e8a33a;
  --failure:    #e05050;
  --font:       'Courier New', Courier, monospace;
  --radius:     6px;
}

html {
  height: 100%;
  background-color: var(--bg);
  background-image: linear-gradient(rgba(5, 6, 12, 0.55), rgba(5, 6, 12, 0.55)), url('../assets/backgrounds/T_B.png');
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
}

body {
  height: 100%;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 960px;
  margin: 0 auto;
}

/* ─── Top bar ──────────────────────────────────────────────────────────────── */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
  background: rgba(11, 12, 20, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  z-index: 10;
}

.home-link {
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  letter-spacing: 1px;
  white-space: nowrap;
  transition: color 0.15s;
}
.home-link:hover { color: var(--text); }

.game-title {
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 4px;
  color: var(--accent);
  flex: 1;
  text-align: center;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.resource-display {
  font-size: 15px;
  color: var(--warn);
  letter-spacing: 1px;
}

.btn-signout {
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.btn-signout:hover { color: var(--danger); border-color: var(--danger); }

/* Options button + dropdown */
.options-wrap {
  position: relative;
}

.btn-options {
  font-size: 15px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s;
}
.btn-options:hover { color: var(--text); border-color: var(--text-dim); }

.options-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 170px;
  padding: 6px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

.options-menu.hidden { display: none; }

.options-item {
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 1px;
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 7px 10px;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}
.options-item:hover { background: var(--surface2); color: var(--text); }
.options-item.danger-item { color: var(--danger); }
.options-item.danger-item:hover { background: #2e1010; color: #ff6060; }

.options-confirm-label {
  font-size: 11px;
  color: var(--text-dim);
  padding: 4px 10px;
  display: block;
}

.options-separator {
  height: 1px;
  background: var(--border);
  margin: 2px 0;
}

.options-file-label {
  cursor: pointer;
}

/* ─── Tab bar ──────────────────────────────────────────────────────────────── */

.tab-bar {
  display: flex;
  border-bottom: none;
  flex-shrink: 0;
  background: rgba(11, 12, 20, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}

.tab-btn {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  position: relative;
}

.tab-btn:hover  { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); background: rgba(124, 109, 245, 0.08); }

.tab-btn.tab-unread::after {
  content: '✦';
  position: absolute;
  top: 4px;
  right: 5px;
  font-size: 9px;
  line-height: 1;
  color: var(--accent);
  text-shadow: 0 0 4px rgba(124, 109, 245, 0.7);
  animation: menu-badge-pulse 1.6s ease-in-out infinite;
  pointer-events: none;
}

/* ─── Tab content ──────────────────────────────────────────────────────────── */

.tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.dim-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.btn-dim-shift {
  position: relative;
  font-family: var(--font);
  font-size: 11px;
  background: none;
  border: 1px solid var(--accent2);
  color: var(--accent2);
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s, color 0.15s;
}

.btn-dim-shift:hover:not(:disabled) { background: var(--accent2); color: var(--bg); }
.btn-dim-shift:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-dim-shift.shift-primed {
  border-color: var(--accent2);
  color: var(--accent2);
  overflow: hidden;
  animation: shift-glow 2.4s ease-in-out infinite;
}
.btn-dim-shift.shift-primed::after {
  content: '';
  position: absolute;
  top: 0; left: -75%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(80,220,200,0.22), transparent);
  animation: shift-shimmer 3.2s ease-in-out infinite;
}
@keyframes shift-shimmer {
  0%   { left: -75%; }
  100% { left: 125%; }
}
@keyframes shift-glow {
  0%, 100% { box-shadow: 0 0 4px rgba(80,220,200,0.15); }
  50%       { box-shadow: 0 0 12px rgba(80,220,200,0.55); }
}

.section-header h2 {
  font-size: 15px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
}

.roster-count {
  font-size: 12px;
  color: var(--text-dim);
}

.btn-expand-roster {
  margin-left: auto;
  padding: 4px 10px;
  font-size: 11px;
  letter-spacing: 1px;
  background: transparent;
  border: 1px solid var(--accent2);
  color: var(--accent2);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s, color 0.15s;
}
.btn-expand-roster:hover:not(:disabled) {
  background: var(--accent2);
  color: #000;
}
.btn-expand-roster:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-expand-roster .res-icon {
  width: 12px;
  height: 12px;
}

.maxed-label {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-dim);
}

.empty-state {
  color: var(--text-dim);
  text-align: center;
  margin-top: 48px;
  font-style: italic;
}

/* ─── Hopper roster ─────────────────────────────────────────────────────────── */

.hopper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.hopper-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: border-color 0.15s;
  box-shadow: 0 2px 16px rgba(0,0,0,0.5);
  position: relative;
  overflow: hidden;
}

.hopper-card-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  opacity: 0.07;
  pointer-events: none;
}

.hopper-card:hover { border-color: var(--accent); }

.hopper-card.dead {
  opacity: 0.45;
  filter: grayscale(0.6);
  border-style: dashed;
}

.hopper-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.hopper-dot {
  font-size: 22px;
  color: var(--accent);
  flex-shrink: 0;
  line-height: 1;
  margin-top: 1px;
  opacity: 0.5;
}

.hopper-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hopper-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hopper-name {
  font-size: 15px;
  font-weight: bold;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hopper-personality {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.intro-card-compat {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-left: 8px;
  opacity: 0;
  transition: opacity 0.08s linear;
}
.intro-card-compat.visible        { opacity: 1; }
.intro-card-compat.compat-pos     { color: #8fd4a8; }
.intro-card-compat.compat-neutral { color: var(--text-dim); }
.intro-card-compat.compat-neg     { color: #e05252; }

.hopper-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}

.hopper-status {
  font-size: 10px;
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}

.hopper-synth-report {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-dim);
  font-style: italic;
  margin: 0;
  padding: 10px 12px;
  border-left: 2px solid var(--border);
  opacity: 0.85;
}

/* ─── Hopper detail modal ─────────────────────────────────────────────────── */

.hopper-modal {
  width: min(580px, 95vw);
  position: relative;
}

.hopper-modal-body {
  padding: 0 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.hopper-modal-art {
  position: relative;
  height: 220px;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  flex-shrink: 0;
}

.hopper-art-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
}

.hopper-art-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10,10,18,0.95) 0%, rgba(10,10,18,0.2) 60%, transparent 100%);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 16px 20px;
}

.hopper-modal-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.hopper-modal-title .hopper-icon {
  font-size: 22px;
}

.hopper-modal-title .hopper-name {
  display: block;
  font-size: 16px;
  font-weight: bold;
  color: var(--text);
}

.hopper-modal-title .hopper-personality {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hopper-modal-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.hopper-modal-section {
  margin-top: 20px;
}

/* ── Relationships section ─────────────────────────────────────────────────── */
.hopper-relations-list { display: flex; flex-direction: column; gap: 6px; }

.relation-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.relation-name     { color: var(--text); }
.relation-affinity { color: #e8748a; letter-spacing: 0.5px; }

.relation-bond {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 3px;
  opacity: 0.9;
}
.bond-friends { background: rgba(143, 212, 168, 0.15); color: #8fd4a8; }
.bond-rivals  { background: rgba(232, 168,  75, 0.15); color: #e8a84b; }
.bond-lovers  { background: rgba(232, 116, 138, 0.15); color: #e8748a; }
.bond-sworn   { background: rgba(124, 109, 245, 0.15); color: var(--accent); }
.bond-kinship { background: rgba( 62, 207, 176, 0.15); color: var(--accent2); }
.bond-nemesis { background: rgba(192,  57,  43, 0.18); color: #c0392b; }

/* Compact inline bond chip — used in the per-card affinity hover hint */
.bond-pip {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
}

.hopper-modal-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin-bottom: 8px;
  opacity: 0.6;
}

.hopper-modal-stats {
  margin-top: 4px;
}

.personality-tip-wrap {
  position: relative;
  display: inline-block;
  cursor: help;
  border-bottom: 1px dotted var(--text-dim);
}

.personality-tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  white-space: nowrap;
  z-index: 300;
  flex-direction: column;
  gap: 5px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
  pointer-events: none;
}

.personality-tip-wrap:hover .personality-tip {
  display: flex;
}

.pt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
}

.pt-label {
  width: 28px;
  color: var(--text-dim);
  letter-spacing: 1px;
}


.pt-mod {
  width: 28px;
  text-align: right;
  font-size: 10px;
}

.pt-pos { color: var(--success); }
.pt-neg { color: var(--danger); }

/* ─── Stat mod hints (modal hover) ──────────────────────────────────────── */

.stat-mod-hint,
.stat-level-hint,
.stat-relentless-hint,
.stat-lore-hint {
  width: 24px;
  text-align: right;
  font-size: 10px;
  letter-spacing: 0.5px;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.smod-pos { color: var(--success); }
.smod-neg { color: var(--danger); }
.stat-level-hint      { color: var(--accent2); }
.stat-relentless-hint { color: var(--warn); }
.stat-lore-hint       { color: #c07af0; }
.stat-lore-hint.lore-neg { color: var(--danger); opacity: 0.85; }

.hopper-modal.mod-active        .stat-mod-hint        { opacity: 1; }
.hopper-modal.level-active      .stat-level-hint      { opacity: 1; }
.hopper-modal.relentless-active .stat-relentless-hint { opacity: 1; }
.hopper-modal.lore-active       .stat-lore-hint       { opacity: 1; }

.hopper-modal.mod-active .stat-row[data-mod="none"] {
  opacity: 0.3;
  transition: opacity 0.15s;
}

.hopper-modal.mod-active .stat-row[data-mod="pos"] .stat-val,
.hopper-modal.mod-active .stat-row[data-mod="pos"] .stat-label {
  color: var(--success);
  transition: color 0.15s;
}

.hopper-modal.mod-active .stat-row[data-mod="neg"] .stat-val,
.hopper-modal.mod-active .stat-row[data-mod="neg"] .stat-label {
  color: var(--danger);
  transition: color 0.15s;
}

.hopper-modal.level-active .stat-row[data-lvl="none"] {
  opacity: 0.3;
  transition: opacity 0.15s;
}

.hopper-modal.level-active .stat-row[data-lvl="up"] .stat-val,
.hopper-modal.level-active .stat-row[data-lvl="up"] .stat-label {
  color: var(--accent2);
  transition: color 0.15s;
}

.roster-full { color: var(--danger); }

.hopper-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.btn-decommission {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-decommission:hover:not(:disabled) {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-decommission.confirming {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-decommission:disabled {
  opacity: 0.4;
  cursor: default;
}

.hopper-card {
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.hopper-card:hover {
  border-color: var(--accent2);
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

.status-idle        { background: #1a2e1f; color: var(--success); }
.status-on_mission  { background: #2e2510; color: var(--warn); }
.status-generating  { background: #1a1e13; color: #b8d45e; }
.status-dead        { background: #1f1010; color: var(--danger); }
.status-pending     { background: #2e2510; color: var(--warn); }

/* Stat bars */
.hopper-stats { display: flex; flex-direction: column; gap: 6px; }

.stat-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-label {
  width: 28px;
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  flex-shrink: 0;
}

.stat-bar {
  flex: 1;
  display: flex;
  gap: 2px;
}

.pip {
  flex: 1;
  height: 7px;
  border-radius: 1px;
  background: var(--surface2);
}

.pip.on { background: var(--accent); }

.pip.gained { background: var(--accent);   transition: background 0.15s; }
.pip.lost   { background: var(--surface2); transition: background 0.15s; }

.hopper-modal.mod-active .pip.gained { background: var(--success); }
.hopper-modal.mod-active .pip.lost   { background: var(--danger); opacity: 0.5; }

/* Modal three-layer pip states */
.pip.lmod-gain,
.pip.lore-gain,
.pip.lore-loss,
.pip.pmod-gain,
.pip.pmod-loss { transition: background 0.15s; }

.hopper-modal.mod-active   .pip.pmod-gain { background: var(--success); }
.hopper-modal.mod-active   .pip.pmod-loss { background: var(--danger);  opacity: 0.5; }
.hopper-modal.level-active .pip.lmod-gain { background: var(--accent2); }
.hopper-modal.lore-active  .pip.lore-gain { background: #c07af0; }
.hopper-modal.lore-active  .pip.lore-loss { background: #c07af0; opacity: 0.5; }

.stat-val {
  width: 16px;
  font-size: 11px;
  text-align: right;
  color: var(--text-dim);
}

/* Trait badge */

.trait-badge.trait-locked {
  opacity: 0.3;
  filter: grayscale(1);
}

.rep-tier-label {
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--text-dim);
  vertical-align: middle;
  margin-left: 4px;
}

.trait-badge {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 3px;
  background: #1e1630;
  color: #b09cf5;
  border: 1px solid #4a3a8a;
  cursor: help;
}

/* ─── Game tooltip ───────────────────────────────────────────────────────── */

.game-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.08s;

  background: rgba(8, 8, 16, 0.97);
  border: 1px solid var(--accent2);
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.5px;
  line-height: 1.5;
  padding: 6px 12px;
  border-radius: 3px;
  max-width: 260px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(100, 220, 200, 0.05);
}

.game-tooltip.visible {
  opacity: 1;
}

.dead-separator {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 2px;
  margin: 8px 0 4px;
}

/* ─── Dimensions ─────────────────────────────────────────────────────────────── */

.dim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dim-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  transition: border-color 0.15s;
  box-shadow: 0 2px 16px rgba(0,0,0,0.5);
}

.dim-card.dim-locked { box-shadow: 0 0 0 2px var(--accent2), 0 2px 16px rgba(0,0,0,0.5); }

.dim-card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle, hsla(260, 60%, 80%, 0.09) 0.9px, transparent 0.9px);
  background-size: 6px 6px;
  mask-image: radial-gradient(ellipse at top left, black 15%, transparent 65%);
  -webkit-mask-image: radial-gradient(ellipse at top left, black 15%, transparent 65%);
}

.dim-lock-btn {
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em;
  padding: 2px 6px; border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.18);
  background: transparent; color: var(--text-dim);
  cursor: pointer; flex-shrink: 0;
}
.dim-lock-btn.active { border-color: var(--accent2); color: var(--accent2); }
.dim-lock-btn:hover:not(.active) { border-color: rgba(255,255,255,0.35); color: var(--text); }


.dim-card:hover:not(.locked) { border-color: var(--accent); }

.dim-card.locked {
  opacity: 0.45;
  filter: grayscale(0.5);
}

/* ── Planet spinner ───────────────────────────────────────────────────────── */
.dim-planet-outer {
  flex-shrink: 0;
  border-radius: 50%;
  box-shadow: 0 0 32px rgba(160,200,255,0.55), 0 0 64px rgba(160,200,255,0.22);
  position: relative;
  z-index: 1;
}

/* Smaller glow for the compact card size (56px) */
.dim-card .dim-planet-outer {
  box-shadow: 0 0 14px rgba(160,200,255,0.50), 0 0 28px rgba(160,200,255,0.18);
}

.dim-planet {
  background-repeat: no-repeat;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.dim-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dim-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.dim-tier {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-dim);
  display: block;
  margin-bottom: 2px;
}

.dim-name {
  font-size: 14px;
  color: var(--text);
  font-weight: bold;
}

.dim-risk {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
}

.risk-1, .risk-2 { background: #1a2e1f; color: var(--success); }
.risk-3, .risk-4 { background: #252220; color: var(--warn); }
.risk-5, .risk-6 { background: #2e2010; color: #f08030; }
.risk-7, .risk-8 { background: #2e1010; color: var(--danger); }
.risk-9, .risk-10 { background: #3a0808; color: #ff4040; }

.dim-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 10px;
  font-style: italic;
}

.dim-stats { margin-bottom: 8px; }

.dim-stat-group { display: flex; gap: 8px; flex-wrap: wrap; }

.stat-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: 1px;
}

.favored  { background: #1a2e25; color: var(--accent2); }
.punished { background: #2e1a1a; color: var(--danger); }

.dim-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.dim-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-dim);
}

.res-icon {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  margin-right: 4px;
  image-rendering: pixelated;
}

.dim-rewards {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.dim-card-sections {
  display: flex;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.dim-card-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 6px;
  border-right: 1px solid var(--border);
}

.dim-card-cell:last-child {
  border-right: none;
}

.dim-card-yields {
  flex: 3;
}

.dim-card-cell:not(.dim-card-yields) {
  align-items: center;
  justify-content: center;
}

.dim-card-value {
  font-size: 12px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.reward-res-tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.reward-res-tag.flux   { background: #1a1f2e; color: var(--accent2); border: 1px solid var(--accent2); }
.reward-res-tag.strand { background: #1a1e13; color: #b8d45e;         border: 1px solid #b8d45e;        }
.reward-res-tag.shard  { background: #1e1a2e; color: var(--accent);  border: 1px solid var(--accent);  }

.locked-label {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

/* ─── Buttons ────────────────────────────────────────────────────────────────── */

.btn-launch, .btn-action, .btn-upgrade, .btn-confirm, .btn-auth {
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-launch:hover:not([disabled]),
.btn-action:hover:not([disabled]),
.btn-upgrade:hover:not([disabled]),
.btn-confirm:hover:not([disabled]),
.btn-auth:hover {
  background: var(--accent);
  color: var(--bg);
}

.btn-launch[disabled],
.btn-action[disabled],
.btn-upgrade[disabled],
.btn-confirm[disabled] {
  border-color: var(--border);
  color: var(--text-dim);
  cursor: not-allowed;
}

.btn-upgrade {
  border-color: var(--warn);
  color: var(--warn);
}
.btn-upgrade:hover:not([disabled]) {
  background: var(--warn);
  color: var(--bg);
}

/* ─── Assign modal ───────────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: min(520px, 95vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 15px; letter-spacing: 1px; color: var(--text); }

.modal-close {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 16px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.modal-close:hover { opacity: 1; }

.modal-desc {
  padding: 12px 20px 0;
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
}

.modal-cost-row {
  display: flex;
  gap: 16px;
  padding: 10px 20px;
  font-size: 12px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

.risk-inline { color: var(--warn); }

.assign-list {
  overflow-y: auto;
  padding: 8px 12px;
  flex: 1;
}

.assign-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
}

.assign-row:hover { background: var(--surface2); }

.assign-check { width: 14px; height: 14px; cursor: pointer; flex-shrink: 0; }

.assign-info { flex: 1; min-width: 0; }

.assign-name {
  font-size: 13px;
  color: var(--text);
}

.assign-name em {
  font-style: normal;
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 6px;
}

.assign-tags { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }

.tag-fav {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: #1a2e25;
  color: var(--accent2);
}

.tag-pun {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: #2e1a1a;
  color: var(--danger);
}

.assign-fit {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.fit-track {
  width: 60px;
  height: 5px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}

.fit-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.2s;
}

.fit-good { background: var(--accent2); }
.fit-ok   { background: var(--warn); }
.fit-bad  { background: var(--danger); }

.fit-pct { font-size: 10px; color: var(--text-dim); }

.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

.selected-count  { font-size: 12px; color: var(--text-dim); }
.prophet-readout { font-size: 12px; color: var(--accent2); letter-spacing: 1px; }
.prophet-readout.hidden { display: none; }

.squad-affinity        { font-size: 12px; letter-spacing: 0.5px; color: #e8748a; }
.squad-affinity.hidden { display: none; }
.squad-affinity.affinity-high { color: #ff6b8a; text-shadow: 0 0 6px rgba(255, 107, 138, 0.45); }
.squad-affinity.affinity-neg  { color: var(--text-dim); }
.relation-affinity.affinity-neg { color: var(--text-dim); }

/* ── Per-card affinity hover hint ─────────────────────────────────────────── */
.card-affinity-hint {
  font-size: 11px;
  color: #e8748a;
  letter-spacing: 0.5px;
  opacity: 0;
  transition: opacity 0.08s linear;
  pointer-events: none;
}
.card-affinity-hint.visible       { opacity: 1; }
.card-affinity-hint.affinity-neg  { color: var(--text-dim); }

/* Assign modal: positioned at bottom-left of card art */
.card-affinity-hint-art {
  position: absolute;
  bottom: 6px;
  left: 8px;
  background: rgba(0, 0, 0, 0.55);
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 700;
  z-index: 2;
}

.squad-projection { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.squad-projection.hidden { display: none; }
.proj-hopeless   { color: #c0392b; }
.proj-outmatched { color: #e05252; }
.proj-marginal   { color: #e8a84b; }
.proj-even       { color: var(--accent2); }
.proj-advantage  { color: #8fd4a8; }
.proj-strong     { color: #5ecf8a; }

/* ─── Mission log ────────────────────────────────────────────────────────────── */

.log-feed { display: flex; flex-direction: column; gap: 10px; }

.log-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.5);
}

.log-entry.active-mission {
  border-color: var(--warn);
  opacity: 0.8;
}

.log-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.dim-tag {
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.outcome-tag {
  font-size: 10px;
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: 3px;
}

.outcome-success { background: #1a2e1f; color: var(--success); }
.outcome-partial { background: #2e2510; color: var(--partial); }
.outcome-failure { background: #2e1010; color: var(--failure); }
.log-daily-tag   { background: #1a2330; color: var(--accent2); }

.log-time { font-size: 11px; color: var(--text-dim); margin-left: auto; }

.log-narrative {
  font-size: 13px;
  color: var(--text);
  line-height: 1.65;
}

.log-rewards {
  margin-top: 8px;
  font-size: 12px;
  color: var(--accent2);
}

.log-event {
  margin-top: 7px;
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-relation {
  margin-top: 7px;
  font-size: 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.log-relation-text   { color: var(--text-dim); font-style: italic; }
.log-relation-effect { font-weight: 700; letter-spacing: 0.5px; }
.log-relation-bond   { flex-shrink: 0; }

.log-event-head {
  display: flex;
  gap: 7px;
  align-items: baseline;
}

.log-event-effects {
  list-style: none;
  margin: 2px 0 0;
  padding: 4px 0 0 8px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.log-event-effects li {
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.85;
  padding-left: 10px;
  position: relative;
}

.log-event-effects li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: #c07af0;
  font-weight: 700;
}

.log-event-name {
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
  opacity: 0.7;
}

.log-event-lore .log-event-name,
.log-event-lore .log-event-narrative { color: #c07af0; }
.log-event-lore .log-event-name { opacity: 1; }

.log-event-found .log-event-name,
.log-event-found .log-event-narrative { color: var(--accent2); }
.log-event-found .log-event-name { opacity: 1; }

/* ─── Replicator banner ──────────────────────────────────────────────────────── */

.replicator-banner {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
  border-radius: var(--radius);
  margin-bottom: 20px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.replicator-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 60%;
  display: block;
}

.replicator-banner-title {
  position: absolute;
  bottom: 0;
  left: 0;
  padding: 12px 16px;
}

.replicator-banner-title .dim-tier,
.replicator-banner-title .dim-detail-name {
  color: var(--text);
  text-shadow: 0 1px 3px rgba(0,0,0,1), 0 0 8px rgba(0,0,0,1), 0 0 20px rgba(0,0,0,0.9);
}

.replicator-banner-status {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.legacy-buff-badge {
  color: #e8b84b;
  font-size: 10px;
  letter-spacing: 0.03em;
}

/* ─── Upgrades / Replicator / Portal ─────────────────────────────────────────── */

.upgrade-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.5);
}

.upgrade-card.wide { width: 100%; }

.upgrade-icon { font-size: 32px; flex-shrink: 0; }

.upgrade-body  { flex: 1; }

.upgrade-flavor {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  margin-bottom: 10px;
}

.upgrade-effects {
  list-style: none;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.upgrade-effects li::before { content: '· '; }
.upgrade-effects strong { color: var(--text); }

.upgrade-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.maxed-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--accent2);
}

.upgrade-msg {
  margin-top: 10px;
  font-size: 12px;
  color: var(--danger);
  min-height: 16px;
}

.tier-badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--surface2);
  color: var(--accent);
  letter-spacing: 1px;
  margin-left: 8px;
  vertical-align: middle;
}

/* Trait reference list */
.trait-reference, .portal-tiers {
  margin-top: 8px;
}

.ref-title {
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.ref-subtitle {
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.6;
  margin-bottom: 10px;
}

.trait-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
}
.trait-list li::before { content: '· '; }
.trait-list strong { color: #b09cf5; }

/* Portal tier rows */
.portal-tier-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  font-size: 12px;
  opacity: 0.45;
}
.portal-tier-row.unlocked { opacity: 1; }
.portal-tier-row.current  { border-color: var(--accent); }

.pt-label { font-weight: bold; color: var(--accent); width: 42px; flex-shrink: 0; }
.pt-pool  { flex: 1; color: var(--text-dim); font-size: 12px; }
.pt-active { font-size: 10px; color: var(--accent2); }
.pt-locked { font-size: 12px; margin-left: auto; }
.pt-pity  { font-size: 10px; color: #a855f7; border: 1px solid #a855f74d; border-radius: 3px; padding: 0 4px; margin-left: 4px; vertical-align: middle; }

/* Dim tier color hints */
.dim-card.tier-1 { border-left: 2px solid var(--accent2); }  /* teal   */
.dim-card.tier-2 { border-left: 2px solid #38bdf8; }          /* blue   */
.dim-card.tier-3 { border-left: 2px solid var(--warn); }      /* yellow */
.dim-card.tier-4 { border-left: 2px solid var(--danger); }    /* red    */
.dim-card.tier-5 { border-left: 2px solid #a855f7; }          /* purple */

.dim-card:not(.dim-card-pending):not(.dim-card-ready) { cursor: pointer; }

.meta-label {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-right: 4px;
}

/* ─── Dimension detail modal ─────────────────────────────────────────────────── */

.dim-detail-modal { max-width: 460px; width: 90%; overflow: hidden; }

/* Tier accent — top stripe on art container + coloured TIER label */
.modal.tier-1 .dim-art-container { border-top: 2px solid var(--accent2); }
.modal.tier-2 .dim-art-container { border-top: 2px solid #38bdf8; }
.modal.tier-3 .dim-art-container { border-top: 2px solid var(--warn); }
.modal.tier-4 .dim-art-container { border-top: 2px solid var(--danger); }
.modal.tier-5 .dim-art-container { border-top: 2px solid #a855f7; }

.modal.tier-1 .dim-art-title .dim-tier { color: var(--accent2); }
.modal.tier-2 .dim-art-title .dim-tier { color: #38bdf8; }
.modal.tier-3 .dim-art-title .dim-tier { color: var(--warn); }
.modal.tier-4 .dim-art-title .dim-tier { color: var(--danger); }
.modal.tier-5 .dim-art-title .dim-tier { color: #a855f7; }

.dim-art-container {
  position: relative;
  flex-shrink: 0;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #08080f;
  overflow: hidden;
}

.dim-art-container::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle, hsla(260, 60%, 80%, 0.09) 0.9px, transparent 0.9px);
  background-size: 6px 6px;
  mask-image: radial-gradient(ellipse at top left, black 15%, transparent 65%);
  -webkit-mask-image: radial-gradient(ellipse at top left, black 15%, transparent 65%);
}

.dim-art-title {
  position: absolute;
  top: 0;
  left: 0;
  padding: 12px 14px;
}

.dim-art-title .dim-tier,
.dim-art-title .dim-detail-name {
  color: var(--text);
  text-shadow: 0 1px 3px rgba(0,0,0,1), 0 0 8px rgba(0,0,0,1), 0 0 20px rgba(0,0,0,0.9);
}

.dim-art-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  z-index: 2;
}
.dim-art-close:hover { background: rgba(0,0,0,0.8); color: #fff; }

.dim-art-deploy {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 2;
  background: rgba(0,0,0,0.55);
}
.dim-art-deploy:hover:not([disabled]) {
  background: var(--accent);
  border-color: var(--text);
}

.dim-art-blocked {
  position: absolute;
  bottom: 10px;
  right: 10px;
  font-size: 11px;
  color: var(--text-dim);
  background: rgba(0,0,0,0.55);
  padding: 4px 8px;
  border-radius: 3px;
  z-index: 2;
}

.dim-detail-body { padding: 16px 24px 20px; }

.dim-detail-name {
  font-size: 18px;
  color: var(--text);
  font-weight: bold;
  margin-top: 4px;
}

.dim-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.dim-detail-cell {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
}


/* ─── Intro screen ───────────────────────────────────────────────────────────── */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes logoPulse {
  0%, 100% { text-shadow: 0 0 24px rgba(124,109,245,0.35), 0 0 2px rgba(124,109,245,0.6); }
  50%       { text-shadow: 0 0 60px rgba(124,109,245,0.7), 0 0 4px rgba(124,109,245,0.9); }
}

@keyframes borderGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(62,207,176,0.5); }
  50%       { box-shadow: 0 0 14px 3px rgba(62,207,176,0.15); }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.top-bar-bare {
  justify-content: center;
}

/* Full-screen intro layout */
.intro-screen {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 20px;
  overflow: hidden;
}

/* Subtle dot-grid background */
.intro-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(124,109,245,0.12) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
  pointer-events: none;
}

.intro-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  max-width: 520px;
  text-align: center;
  animation: fadeInUp 0.5s ease both;
}

.intro-eyebrow {
  font-size: 10px;
  letter-spacing: 5px;
  color: var(--text-dim);
  text-transform: uppercase;
  opacity: 0;
  animation: fadeInUp 0.5s ease 0.1s both;
  text-shadow: 0 0 6px rgba(0,0,0,1), 0 2px 20px rgba(0,0,0,1);
}

.intro-logo {
  font-size: 64px;
  font-weight: bold;
  letter-spacing: 14px;
  color: var(--accent);
  animation: logoPulse 4s ease-in-out infinite, fadeInUp 0.5s ease 0.2s both;
  opacity: 0;
}

/* Horizontal rule accent */
.intro-lore {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  opacity: 0;
  animation: fadeInUp 0.5s ease 0.3s both;
}

.intro-lore-line {
  padding: 13px 24px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  font-style: italic;
  border-bottom: 1px solid var(--border);
  opacity: 0;
  animation: fadeInUp 0.4s ease both;
}

.intro-lore-line:last-child {
  border-bottom: none;
  color: var(--text);
  font-style: normal;
  font-weight: bold;
  letter-spacing: 0.5px;
}

.intro-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  opacity: 0;
  animation: fadeInUp 0.5s ease 0.9s both;
}

.btn-start-replicator {
  font-family: var(--font);
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  border: 1px solid var(--accent2);
  background: transparent;
  color: var(--accent2);
  padding: 14px 32px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: borderGlow 3s ease-in-out infinite;
  transition: background 0.18s, color 0.18s, transform 0.12s;
  text-shadow: 0 0 6px rgba(0,0,0,1), 0 2px 20px rgba(0,0,0,1);
}
.btn-start-replicator:hover {
  background: var(--accent2);
  color: var(--bg);
  transform: translateY(-1px);
}
.btn-start-replicator:active { transform: translateY(0); }

.btn-start-icon {
  font-size: 16px;
  line-height: 1;
}

.intro-hint {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  text-shadow: 0 0 6px rgba(0,0,0,1), 0 2px 20px rgba(0,0,0,1);
}

/* ─── Starter modal ──────────────────────────────────────────────────────────── */

.intro-modal {
  width: min(800px, 95vw);
}

.intro-modal-sub {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 2px;
}

.intro-hopper-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px 20px;
}

@media (max-width: 600px) {
  .intro-hopper-grid { grid-template-columns: 1fr; }
}

.intro-hopper-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  opacity: 0;
  animation: cardIn 0.3s ease both;
  transition: border-color 0.15s;
}
.intro-hopper-card:hover { border-color: var(--accent); }

.intro-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.intro-card-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.btn-refresh-hopper {
  font-family: var(--font);
  font-size: 13px;
  line-height: 1;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 22px;
  height: 22px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s;
}
.btn-refresh-hopper:hover { color: var(--accent2); border-color: var(--accent2); }


.intro-no-trait {
  font-size: 11px;
  color: var(--border);
  flex-shrink: 0;
}

/* ─── Synth loading animation ────────────────────────────────────────────── */

.synth-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 360px;
}

.synth-label {
  font-size: 13px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--accent2);
  text-shadow: 0 0 6px rgba(0,0,0,1), 0 2px 20px rgba(0,0,0,1);
  width: 100%;
  text-align: center;
}

.synth-dots span {
  opacity: 0;
  animation: synthDot 1.2s infinite;
}
.synth-dots span:nth-child(2) { animation-delay: 0.3s; }
.synth-dots span:nth-child(3) { animation-delay: 0.6s; }

@keyframes synthDot {
  0%, 60%, 100% { opacity: 0; }
  30%            { opacity: 1; }
}

.synth-bar-track {
  width: 280px;
  height: 2px;
  background: rgba(62, 207, 176, 0.15);
  border-radius: 1px;
  overflow: hidden;
}

.synth-bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent2);
  border-radius: 1px;
  transition: width 0.12s ease-out;
}

.synth-counter {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--accent2);
  opacity: 0.6;
  text-shadow: 0 0 6px rgba(0,0,0,1), 0 2px 20px rgba(0,0,0,1);
  width: 100%;
  text-align: center;
}

/* ─── Auth screen ────────────────────────────────────────────────────────────── */

.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.auth-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: min(360px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-title {
  font-size: 28px;
  letter-spacing: 6px;
  color: var(--accent);
  text-align: center;
}

.auth-sub {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  font-style: italic;
}

.auth-tabs {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.auth-tab {
  flex: 1;
  padding: 8px;
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  cursor: pointer;
}

.auth-tab.active { background: var(--surface2); color: var(--accent); }

#auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#auth-form input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 10px 12px;
}

#auth-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-auth {
  margin-top: 4px;
  padding: 10px;
  width: 100%;
  font-size: 13px;
}

.auth-error {
  font-size: 12px;
  color: var(--danger);
  text-align: center;
  min-height: 16px;
}

/* ─── Splash / loading ───────────────────────────────────────────────────────── */

.splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 12px;
}

.splash-title {
  font-size: 36px;
  letter-spacing: 8px;
  color: var(--accent);
}

.splash-sub {
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 2px;
}

.splash-sub.error { color: var(--danger); }

/* ─── Mission pending / ready cards ─────────────────────────────────────────── */

.dim-card-pending {
  opacity: 0.7;
  border-style: dashed;
}

.dim-card-ready {
  border-color: var(--accent2);
  box-shadow: 0 0 12px rgba(62, 207, 176, 0.18);
}

.dim-mission-badge {
  font-size: 10px;
  letter-spacing: 1.5px;
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
}

.pending-badge { background: #252210; color: var(--warn); }
.ready-badge   { background: #102820; color: var(--accent2); }

.dim-deployed-hoppers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.deployed-hopper {
  font-size: 11px;
  color: var(--text-dim);
  background: var(--surface2);
  border-radius: 3px;
  padding: 2px 7px;
}

.mission-countdown {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.dim-card-expedition { flex: 2; }

.dim-card-pending .dim-card-cell:last-child,
.dim-card-ready   .dim-card-cell:last-child { flex: 1; }

.dim-card-collect {
  justify-content: center;
}

.dim-mission-progress {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dim-mission-track {
  flex: 1;
  height: 5px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}

.dim-mission-bar {
  height: 100%;
  background: var(--warn);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.dim-mission-bar-complete { background: var(--accent2); }

.dim-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.dim-expires {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text-dim);
  text-transform: uppercase;
}
.dim-expires.expires-warn { color: var(--warn); }
.dim-expires.expires-crit {
  color: var(--danger);
  animation: dim-expiry-pulse 1.4s ease-in-out infinite;
}
@keyframes dim-expiry-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

.dim-mission-pct {
  font-size: 10px;
  color: var(--text-dim);
  flex-shrink: 0;
  width: 26px;
  text-align: right;
}

.btn-complete-mission {
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: 1px solid var(--accent2);
  background: transparent;
  color: var(--accent2);
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-complete-mission:hover {
  background: var(--accent2);
  color: var(--bg);
}

/* ─── Mission report modal ───────────────────────────────────────────────────── */

.mission-report-modal {
  width: min(520px, 95vw);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mission-report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.outcome-bg-success { background: rgba(76, 175, 130, 0.12); }
.outcome-bg-partial  { background: rgba(232, 163, 58, 0.10); }
.outcome-bg-failure  { background: rgba(224, 80, 80, 0.10); }

.mission-report-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mission-report-tier {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.mission-report-dim-name {
  font-size: 17px;
  font-weight: bold;
  color: var(--text);
}

.mission-report-outcome {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 4px 10px;
  border-radius: 3px;
}

.outcome-success { color: var(--success); background: rgba(76,175,130,0.15); }
.outcome-partial  { color: var(--warn);    background: rgba(232,163,58,0.15); }
.outcome-failure  { color: var(--danger);  background: rgba(224,80,80,0.15); }

.mission-report-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  max-height: 55vh;
}

.mission-report-narrative {
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
  border-left: 2px solid var(--border);
  padding-left: 10px;
  line-height: 1.6;
}

.mission-report-section { display: flex; flex-direction: column; gap: 6px; }

.mission-report-section-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.mission-hopper-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 4px 0;
}

.mission-hopper-result.survived .mission-hopper-name { color: var(--text); }
.mission-hopper-result.lost     .mission-hopper-name { color: var(--text-dim); text-decoration: line-through; }

.mission-fate {
  font-size: 11px;
  letter-spacing: 1px;
}

.mission-hopper-result.survived .mission-fate { color: var(--success); }
.mission-hopper-result.lost     .mission-fate { color: var(--danger); }

.hopper-xp-gain {
  margin-left: 8px;
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.5px;
}

.hopper-levelup {
  margin-left: 6px;
  padding: 1px 5px;
  background: var(--accent);
  color: var(--bg);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  border-radius: 2px;
}

.mission-report-rewards {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.reward-item {
  font-size: 13px;
  color: var(--accent2);
}

.reward-none { font-size: 13px; color: var(--text-dim); }

/* ─── Lore trait badges (hopper modal) ──────────────────────────────────────── */

.lore-trait-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lore-trait-badge {
  background: rgba(192, 122, 240, 0.10);
  border: 1px solid rgba(192, 122, 240, 0.30);
  color: #c07af0;
  border-radius: var(--radius);
  padding: 2px 8px;
  font-size: 11px;
  cursor: default;
  position: relative;
}

/* ─── Mission encounter card ─────────────────────────────────────────────────── */

.mission-event-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mission-event-name {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #c07af0;
}

.mission-event-flavor {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
}

.mission-event-narrative {
  font-size: 13px;
  color: var(--text);
}

.mission-relation-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.mission-relation-text {
  font-size: 13px;
  color: var(--text);
  font-style: italic;
  margin: 0;
}
.rel-effect        { font-size: 12px; font-weight: 700; letter-spacing: 0.5px; align-self: flex-start; }
.rel-effect-pos    { color: #e8748a; }
.rel-effect-neg    { color: var(--text-dim); }
.rel-effect-bond   { align-self: flex-start; }

.mission-event-lore-award,
.mission-event-found {
  font-size: 12px;
  color: #c07af0;
  font-style: italic;
}

.mission-event-effects {
  list-style: none;
  margin: 6px 0 0;
  padding: 8px 10px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mission-event-effects li {
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.4;
  padding-left: 12px;
  position: relative;
}

.mission-event-effects li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: #c07af0;
  font-weight: 700;
}

.mission-report-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.btn-collect {
  font-family: var(--font);
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border: 1px solid var(--accent2);
  background: var(--accent2);
  color: var(--bg);
  padding: 8px 24px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-collect:hover   { opacity: 0.85; }
.btn-collect:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Generator tab ─────────────────────────────────────────────────────────── */

.generator-tab {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 16px;
  max-width: 540px;
  margin: 0 auto;
}

.gen-slots { display: flex; flex-direction: column; gap: 10px; }

.gen-slot {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gen-slot-running { border-color: var(--warn); }
.gen-slot-ready   { border-color: var(--success); }

.gen-slot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gen-hopper-name  { font-size: 14px; color: var(--text); }
.gen-hopper-level { font-size: 11px; color: var(--text-dim); }

.gen-progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.gen-progress-fill {
  height: 100%;
  background: var(--accent2);
  border-radius: 2px;
  transition: width 1s linear;
}

.gen-slot-ready .gen-progress-fill { background: var(--success); }

.gen-slot-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gen-time-left     { font-size: 12px; color: var(--text-dim); }
.gen-yield-preview { font-size: 12px; color: var(--text-dim); }
.gen-ready-label   { font-size: 11px; letter-spacing: 1px; color: var(--success); }

.gen-slot-clickable {
  border-style: dashed;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: row;
  gap: 8px;
  min-height: 64px;
  transition: border-color 0.15s, background 0.15s;
}

.gen-slot-clickable:hover { border-color: var(--accent2); background: #141a1e; }

.gen-slot-locked {
  align-items: center;
  justify-content: center;
  min-height: 64px;
  opacity: 0.4;
}

.gen-slot-plus        { font-size: 20px; color: var(--text-dim); line-height: 1; }
.gen-slot-empty-label { font-size: 12px; color: var(--text-dim); }

.gen-slot-clickable:hover .gen-slot-plus,
.gen-slot-clickable:hover .gen-slot-empty-label { color: var(--accent2); }

/* Generator assign modal */

.gen-assign-modal { max-width: 560px; width: 94vw; }

.gen-modal-hoppers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  padding: 16px 20px;
  max-height: 340px;
  overflow-y: auto;
}

.gen-modal-empty { font-size: 13px; color: var(--text-dim); padding: 24px; text-align: center; }

.gen-hopper-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s;
}

.gen-hopper-card:hover    { border-color: var(--text-dim); }
.gen-hopper-card.selected { border-color: var(--accent2); background: #141a1e; }

.gen-hopper-card-art {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gen-hopper-card-art img { width: 100%; height: 100%; object-fit: cover; }

.gen-hopper-card-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.gen-hopper-card-name-row { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; min-width: 0; }
.gen-hopper-card-name  { font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.gen-hopper-card-sub   { font-size: 10px; color: var(--text-dim); }
.gen-hopper-card-level {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 0.60rem;
  font-weight: 700;
  color: var(--accent2);
  background: rgba(10, 10, 18, 0.72);
  padding: 1px 4px;
  border-radius: 2px;
}

.gen-modal-footer {
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gen-duration-btns { display: flex; gap: 6px; flex-wrap: wrap; }

.btn-duration {
  font-family: var(--font);
  font-size: 11px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 2px;
  transition: color 0.15s, border-color 0.15s;
}

.btn-duration:hover    { color: var(--text); border-color: var(--text-dim); }
.btn-duration.selected { color: var(--accent2); border-color: var(--accent2); }

.gen-modal-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gen-modal-preview { font-size: 13px; color: var(--text-dim); }

.gen-upgrades {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.gen-upgrade-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.gen-upgrade-info  { display: flex; flex-direction: column; gap: 3px; }
.gen-upgrade-label { font-size: 10px; color: var(--text-dim); letter-spacing: 1px; }
.gen-upgrade-value { font-size: 14px; color: var(--text); }
.gen-maxed         { font-size: 11px; color: var(--text-dim); letter-spacing: 1px; }

/* ─── Generator cards (shared shell for all generators) ─────────────────────── */

.gen-card {
  /* Flux generators get a faint amber tint to match var(--warn) title.
     Coil and reel override both background and border-color with their own. */
  background: linear-gradient(160deg, rgba(232,163,58,0.10) 0%, rgba(18,20,31,0.90) 60%);
  border: 1px solid rgba(232, 163, 58, 0.22);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gen-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gen-card-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.gen-card-title-flux { color: var(--warn); }
.gen-card-title-coil { color: var(--accent); }

.gen-card-desc {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: -6px;
}

/* ─── Void Coil ─────────────────────────────────────────────────────────────── */

/* Card-level override to give the Coil a faint purple tint */
.gen-card-coil {
  border-color: rgba(124, 109, 245, 0.22);
  background: linear-gradient(160deg, rgba(124,109,245,0.10) 0%, rgba(18,20,31,0.90) 60%);
  transition: border-color 0.25s, box-shadow 0.25s;
}

/* Holding: border brightens and card pulses with a soft glow */
.gen-card-coil.holding {
  border-color: rgba(124, 109, 245, 0.65);
  box-shadow: 0 0 0 1px rgba(124,109,245,0.2), 0 0 18px rgba(124,109,245,0.14);
}

/* Pop: quick snappy shake when the coil is collected */
.gen-card-coil.coil-pop-shake {
  animation: coil-pop-shake 0.38s ease-out forwards !important;
}

@keyframes coil-pop-shake {
  0%   { transform: translate(0,    0)    rotate(0deg);    }
  12%  { transform: translate(-5px, -3px) rotate(-0.6deg); }
  25%  { transform: translate( 5px,  3px) rotate( 0.6deg); }
  38%  { transform: translate(-4px,  2px) rotate(-0.4deg); }
  52%  { transform: translate( 4px, -2px) rotate( 0.4deg); }
  68%  { transform: translate(-2px,  1px) rotate(-0.2deg); }
  82%  { transform: translate( 2px, -1px) rotate( 0.2deg); }
  100% { transform: translate(0,    0)    rotate(0deg);    }
}

/* Rare pop (strand/shard): dramatic flash overlay on top of the shake */
.gen-card-coil.coil-pop-rare {
  animation: coil-pop-shake 0.38s ease-out forwards,
             coil-pop-rare-flash 0.7s ease-out forwards !important;
}

@keyframes coil-pop-rare-flash {
  0%   { box-shadow: 0 0 0 1px rgba(124,109,245,0.2), 0 0 18px rgba(124,109,245,0.14); }
  18%  { box-shadow: 0 0 0 2px rgba(255,255,255,0.85), 0 0 60px rgba(255,255,255,0.55); }
  100% { box-shadow: 0 0 0 1px rgba(124,109,245,0.2), 0 0 18px rgba(124,109,245,0.14); }
}

/* Charged: pulsing border glow to draw the player's eye */
.gen-card-coil.coil-charged-card {
  border-color: rgba(124, 109, 245, 0.8);
  animation: coil-card-ready 1.2s ease-in-out infinite;
}

@keyframes coil-card-ready {
  0%, 100% { box-shadow: 0 0 0 1px rgba(124,109,245,0.3), 0 0 10px rgba(124,109,245,0.12); }
  50%       { box-shadow: 0 0 0 1px rgba(124,109,245,0.6), 0 0 28px rgba(124,109,245,0.28); }
}

.coil-tier-label {
  font-size: 10px;
  color: var(--text-dim);
}

.coil-bar-wrap { margin-bottom: 2px; }

.coil-bar-track {
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: 4px;
  height: 12px;
  overflow: hidden;
  margin-bottom: 4px;
}

.coil-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3a2a7a, var(--accent));
  border-radius: 4px;
  /* No CSS transition — the rAF loop drives smooth updates at 60fps.
     A CSS transition would fight the rAF and cause visual judder. */
}

/* Holding: scanning shimmer moves right to show active fast-charging */
.coil-bar-fill.holding-bar {
  background: linear-gradient(90deg,
    #3a2a7a 0%, var(--accent) 35%,
    #c8c0ff 50%,
    var(--accent) 65%, #3a2a7a 100%);
  background-size: 200% 100%;
  animation: coil-hold-scan 0.55s linear infinite;
}

@keyframes coil-hold-scan {
  from { background-position: 100% 0; }
  to   { background-position: -100% 0; }
}

.coil-bar-fill.coil-ready {
  background: linear-gradient(90deg, #5a4aaa, #b0a0ff);
  animation: coil-pulse 1.2s ease-in-out infinite;
}

@keyframes coil-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

.coil-bar-status {
  font-size: 10px;
  color: var(--text-dim);
  text-align: right;
}

.coil-bar-status.coil-charged {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.coil-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-coil-hold {
  flex: 1;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-dim);
  font-size: 11px;
  font-family: inherit;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.btn-coil-hold:hover:not(:disabled) {
  background: rgba(124,109,245,0.08);
  border-color: rgba(124,109,245,0.4);
  color: var(--accent);
}

.btn-coil-hold.holding {
  background: rgba(124,109,245,0.3);
  border-color: #b0a4ff;
  color: #ffffff;
  text-shadow: 0 0 8px rgba(200,192,255,0.9);
  animation: coil-hold-btn-glow 0.65s ease-in-out infinite;
}

@keyframes coil-hold-btn-glow {
  0%, 100% {
    box-shadow: 0 0 0 1px rgba(124,109,245,0.55),
                0 0 10px rgba(124,109,245,0.35),
                0 0 22px rgba(124,109,245,0.18);
  }
  50% {
    box-shadow: 0 0 0 2px rgba(160,144,255,0.75),
                0 0 18px rgba(124,109,245,0.55),
                0 0 38px rgba(124,109,245,0.28);
  }
}

.btn-coil-hold:disabled {
  opacity: 0.35;
  cursor: default;
}

.btn-coil-claim {
  padding: 8px 18px;
  background: rgba(124,109,245,0.18);
  border: 1px solid var(--accent);
  border-radius: 5px;
  color: #c0b8ff;
  font-size: 11px;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  animation: coil-claim-pulse 0.85s ease-in-out infinite;
}

/* Faster, glowing pulse — box-shadow breathing makes the button feel alive */
@keyframes coil-claim-pulse {
  0%, 100% {
    background: rgba(124,109,245,0.18);
    box-shadow: 0 0 0   0 rgba(124,109,245,0.0);
  }
  50% {
    background: rgba(124,109,245,0.35);
    box-shadow: 0 0 0 4px rgba(124,109,245,0.18);
  }
}

.btn-coil-claim:hover { background: rgba(124,109,245,0.4); }

.coil-upgrade-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.coil-upgrade-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.coil-upgrade-label { font-size: 10px; color: var(--text-dim); letter-spacing: 1px; }
.coil-upgrade-value { font-size: 12px; color: #8a82c0; }

/* ─── Void Coil reward toast ─────────────────────────────────────────────────── */

.coil-reward-toast {
  position: fixed;
  /* top / left are set by JS to the card centre; transform centres the element on that point */
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(124,109,245,0.35);
  z-index: 1200;
  animation: crt-in 0.18s ease-out;
  pointer-events: none;
  white-space: nowrap;
}

.crt-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.crt-reward {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
}
.crt-reward.crt-dry {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-dim);
  letter-spacing: 0.08em;
}

@keyframes crt-in {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}

.coil-reward-toast.crt-out {
  /* !important so the tier-specific `animation:` rules below don't override it */
  animation: crt-out 0.28s ease-in forwards !important;
}

@keyframes crt-out {
  from { opacity: 1; transform: translate(-50%, -50%); }
  to   { opacity: 0; transform: translate(-50%, calc(-50% - 8px)); }
}

/* ── Tier styling — visual differentiation for big flux & rare resources ─── */

/* Common small flux: slightly muted (default look) */
.coil-reward-toast.crt-tier-small {
  border-color: rgba(124, 109, 245, 0.55);
  box-shadow: 0 4px 18px rgba(124,109,245,0.25);
}

/* Big flux (3-5): gold accent + scaled-up reward text */
.coil-reward-toast.crt-tier-big {
  border-color: #ffce5e;
  box-shadow: 0 4px 28px rgba(255,206,94,0.45), 0 0 0 1px rgba(255,206,94,0.35) inset;
  animation: crt-in 0.18s ease-out, crt-big-pulse 0.6s ease-out;
}
.crt-tier-big .crt-label  { color: #ffce5e; }
.crt-tier-big .crt-reward { font-size: 17px; }

@keyframes crt-big-pulse {
  0%   { transform: translate(-50%, -50%) scale(1.00); }
  35%  { transform: translate(-50%, -50%) scale(1.10); }
  100% { transform: translate(-50%, -50%) scale(1.00); }
}

/* Rare strand/shard: bigger pop, longer dwell, resource-tinted accent */
.coil-reward-toast.crt-tier-rare {
  padding: 14px 26px;
  background: linear-gradient(180deg, var(--surface2), rgba(0,0,0,0.85));
  animation: crt-rare-in 0.32s cubic-bezier(.2,1.6,.4,1);
}
.crt-tier-rare .crt-label  { font-size: 10px; }
.crt-tier-rare .crt-reward { font-size: 19px; letter-spacing: 0.04em; }

.coil-reward-toast.crt-tier-rare.crt-res-strand {
  border-color: #5fe19a;
  box-shadow: 0 4px 32px rgba(95,225,154,0.55), 0 0 0 1px rgba(95,225,154,0.4) inset;
}
.crt-tier-rare.crt-res-strand .crt-label  { color: #5fe19a; }
.crt-tier-rare.crt-res-strand .crt-reward { color: #c8ffd9; }

.coil-reward-toast.crt-tier-rare.crt-res-shard {
  border-color: #ff4d6d;
  box-shadow: 0 4px 32px rgba(255,77,109,0.55), 0 0 0 1px rgba(255,77,109,0.4) inset;
}
.crt-tier-rare.crt-res-shard .crt-label  { color: #ff4d6d; }
.crt-tier-rare.crt-res-shard .crt-reward { color: #ffd0d8; }

@keyframes crt-rare-in {
  0%   { opacity: 0; transform: translate(-50%, calc(-50% + 14px)) scale(0.85); }
  60%  { opacity: 1; transform: translate(-50%, -50%)               scale(1.12); }
  100% { opacity: 1; transform: translate(-50%, -50%)               scale(1.00); }
}

/* ─── Rift Reel ──────────────────────────────────────────────────────────────── */

.gen-card-slot {
  border-color: rgba(64, 200, 224, 0.22);
  background: linear-gradient(160deg, rgba(64,200,224,0.10) 0%, rgba(18,20,31,0.90) 60%);
  transition: border-color 0.25s, box-shadow 0.25s;
}

.gen-card-title-slot { color: #40c8e0; }

.slot-cost-label {
  font-size: 10px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 3px;
}

/* ── Reel assembly ── */

.slot-machine {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 14px 0 10px;
}

.slot-reels {
  display: flex;
  align-items: center;
  gap: 6px;
}

.slot-reel-sep {
  color: var(--border);
  font-size: 20px;
  line-height: 1;
  user-select: none;
}

.slot-reel-wrap {
  width: 64px;
  height: 56px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0,0,0,0.35);
  position: relative;
}

/* Subtle top/bottom fade so icons appear to emerge from / disappear into shadow */
.slot-reel-wrap::before,
.slot-reel-wrap::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 14px;
  z-index: 2;
  pointer-events: none;
}
.slot-reel-wrap::before { top: 0;    background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent); }
.slot-reel-wrap::after  { bottom: 0; background: linear-gradient(to top,    rgba(0,0,0,0.5), transparent); }

.slot-reel-strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.slot-icon {
  width: 64px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.slot-res-icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.slot-icon-void {
  font-size: 18px;
  color: var(--text-dim);
  opacity: 0.5;
}

.slot-icon-hopper {
  /* no background — matches other icon cells so no band visible while scrolling */
  display: flex;
  align-items: center;
  justify-content: center;
}

.slot-hopper-icon {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 50%;
  /* border + inset shadow stay inside the box model — never clipped by overflow:hidden */
  border: 2px solid rgba(64,200,224,0.5);
  box-shadow: inset 0 0 6px rgba(64,200,224,0.2);
  animation: hopper-circle-glow 1.6s ease-in-out infinite;
}

@keyframes hopper-circle-glow {
  0%, 100% {
    border-color: rgba(64,200,224,0.3);
    box-shadow: inset 0 0  4px rgba(64,200,224,0.10);
  }
  50% {
    border-color: rgba(64,200,224,1.0);
    box-shadow: inset 0 0 14px rgba(64,200,224,0.55);
  }
}

/* ── Result text ── */

.slot-result-text {
  min-height: 18px;
  font-size: 12px;
  font-weight: 700;
  color: #40c8e0;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Spin button ── */

.slot-controls {
  display: flex;
  justify-content: center;
}

.btn-slot-spin {
  padding: 9px 28px;
  min-width: 155px;   /* prevents the card shrinking when icon disappears during spin */
  min-height: 36px;
  justify-content: center;
  background: rgba(64,200,224,0.10);
  border: 1px solid rgba(64,200,224,0.55);
  border-radius: 5px;
  color: #40c8e0;
  font-size: 12px;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.12s, border-color 0.12s;
}

.btn-slot-spin:hover:not(:disabled) {
  background: rgba(64,200,224,0.20);
  border-color: #40c8e0;
}

.btn-slot-spin:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Active spin in progress — distinct from "disabled due to no flux" */
.btn-slot-spin.slot-btn-spinning {
  color: rgba(64,200,224,0.55);
  border-color: rgba(64,200,224,0.3);
  letter-spacing: 0.12em;
  animation: slot-btn-pulse 0.65s ease-in-out infinite;
}

@keyframes slot-btn-pulse {
  0%, 100% { opacity: 0.45; }
  50%       { opacity: 0.75; }
}

/* ── Reel grinding glow (while spinning) ── */

.slot-reels.slot-reels-spinning .slot-reel-wrap {
  border-color: rgba(64,200,224,0.65);
  animation: slot-reel-grind 0.75s ease-in-out infinite;
}

/* Stagger each reel so they pulse slightly out of phase */
.slot-reels.slot-reels-spinning .slot-reel-wrap:nth-child(1) { animation-delay: 0s;     }
.slot-reels.slot-reels-spinning .slot-reel-wrap:nth-child(3) { animation-delay: 0.25s;  }
.slot-reels.slot-reels-spinning .slot-reel-wrap:nth-child(5) { animation-delay: 0.50s;  }

@keyframes slot-reel-grind {
  0%, 100% { box-shadow: 0 0  6px rgba(64,200,224,0.20), inset 0 0  4px rgba(64,200,224,0.06); }
  50%      { box-shadow: 0 0 16px rgba(64,200,224,0.50), inset 0 0 10px rgba(64,200,224,0.14); }
}

/* ── Outcome animations ── */

.gen-card-slot.slot-win {
  animation: slot-win-flash 0.7s ease-out forwards;
}

@keyframes slot-win-flash {
  0%   { border-color: rgba(64,200,224,0.9); box-shadow: 0 0 0 1px rgba(64,200,224,0.4), 0 0 22px rgba(64,200,224,0.3); }
  100% { border-color: rgba(64,200,224,0.22); box-shadow: none; }
}

.gen-card-slot.slot-lose {
  animation: slot-lose-shake 0.32s ease-out forwards;
}

@keyframes slot-lose-shake {
  0%, 100% { transform: translateX(0); }
  20%  { transform: translateX(-4px); }
  50%  { transform: translateX( 4px); }
  80%  { transform: translateX(-2px); }
}

/* ─── Rift Reel reward toast ─────────────────────────────────────────────────── */

.slot-reward-toast {
  position: fixed;
  /* top/left set to card centre by JS; transform centres the element on that point */
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--surface2);
  border: 1px solid rgba(64,200,224,0.5);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
  z-index: 1200;
  white-space: nowrap;
  animation: srt-in 0.15s ease-out;
}

.srt-amount { color: var(--text); }

.srt-type {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #40c8e0;
}

@keyframes srt-in {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}

.slot-reward-toast.srt-out {
  /* !important so tier-specific `animation:` rules below don't override the exit */
  animation: srt-out 0.28s ease-in forwards !important;
}

@keyframes srt-out {
  from { opacity: 1; transform: translate(-50%, -50%); }
  to   { opacity: 0; transform: translate(-50%, calc(-50% - 14px)); }
}

/* ── Tier styling — visual differentiation by reward rarity ──────────────── */

/* Common (flux) — quiet pop, default look with slightly muted border */
.slot-reward-toast.srt-tier-common {
  border-color: rgba(124, 109, 245, 0.45);
}

/* Uncommon (strand) — green tint, soft scale-in, longer dwell handled in JS */
.slot-reward-toast.srt-tier-uncommon.srt-res-strand {
  border-color: #5fe19a;
  box-shadow: 0 4px 22px rgba(95,225,154,0.45);
  padding: 7px 14px;
  animation: srt-uncommon-in 0.22s ease-out;
}
.srt-tier-uncommon.srt-res-strand .srt-amount { color: #c8ffd9; }
.srt-tier-uncommon.srt-res-strand .srt-type   { color: #5fe19a; }

@keyframes srt-uncommon-in {
  0%   { opacity: 0; transform: translate(-50%, calc(-50% + 8px)) scale(0.95); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.00); }
}

/* Rare (shard) — full crimson treatment + bouncy entry + bigger amount text */
.slot-reward-toast.srt-tier-rare.srt-res-shard {
  border-color: #ff4d6d;
  box-shadow: 0 4px 32px rgba(255,77,109,0.55), 0 0 0 1px rgba(255,77,109,0.4) inset;
  padding: 9px 18px;
  background: linear-gradient(180deg, var(--surface2), rgba(0,0,0,0.85));
  animation: srt-rare-in 0.32s cubic-bezier(.2,1.6,.4,1);
}
.srt-tier-rare.srt-res-shard .srt-amount { color: #ffd0d8; font-size: 16px; }
.srt-tier-rare.srt-res-shard .srt-type   { color: #ff4d6d; font-size: 10px; }

@keyframes srt-rare-in {
  0%   { opacity: 0; transform: translate(-50%, calc(-50% + 14px)) scale(0.85); }
  60%  { opacity: 1; transform: translate(-50%, -50%) scale(1.10); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.00); }
}

/* Card flash — rare or legendary win pulses the slot card briefly */
.gen-card-slot.slot-pop-rare {
  animation: slot-pop-rare-flash 0.7s ease-out forwards;
}
@keyframes slot-pop-rare-flash {
  0%   { box-shadow: 0 0 0 1px rgba(64,200,224,0.22), 0 0 18px rgba(64,200,224,0.14); }
  18%  { box-shadow: 0 0 0 2px rgba(255,255,255,0.85), 0 0 60px rgba(255,255,255,0.55); }
  100% { box-shadow: 0 0 0 1px rgba(64,200,224,0.22), 0 0 18px rgba(64,200,224,0.14); }
}

/* Escaped variant — roster was full, hopper lost to the rift */
.slot-reward-toast.slot-reward-escaped {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 14px;
  border-color: rgba(180,120,60,0.7);
  box-shadow: 0 0 14px rgba(180,120,60,0.18);
}

.slot-reward-toast.slot-reward-escaped .srt-jackpot-label {
  color: rgba(220,150,80,0.9);
}

.slot-reward-toast.slot-reward-escaped .srt-hopper-name {
  color: var(--text-dim);
}

.slot-reward-toast.slot-reward-escaped .srt-type {
  color: rgba(200,120,60,0.8);
}

/* Jackpot variant — stacked layout, brighter border, longer display */
.slot-reward-toast.slot-reward-jackpot {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 14px;
  border-color: rgba(64,200,224,0.8);
  box-shadow: 0 0 14px rgba(64,200,224,0.25);
}

.srt-jackpot-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: #40c8e0;
}

.srt-hopper-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
}

/* ─── Void Coil hold sparks ──────────────────────────────────────────────────── */

/* Fixed-position host div that tracks the hold button's bounding rect */
.coil-sparks {
  position: fixed;
  pointer-events: none;
  z-index: 500;
  overflow: visible;
}

/* Individual spark particle */
.coil-spark {
  position: absolute;
  border-radius: 50%;
  animation: coil-spark-fly var(--dur, 0.38s) ease-out forwards;
}

@keyframes coil-spark-fly {
  0%   { transform: translate(0, 0) scale(1);    opacity: 0.95; }
  60%  { opacity: 0.7; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}

/* ─── Dev panel ─────────────────────────────────────────────────────────────── */

.dev-panel-modal { max-width: 280px; width: 90vw; }

.dev-panel-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px 12px;
}

.dev-infuse-section {
  padding: 12px 20px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dev-section-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
}

.dev-coil-btn {
  flex: 1 1 0;
  font-size: 11px;
  padding: 6px 4px;
}
.dev-coil-small  { border-color: rgba(124, 109, 245, 0.55); color: #c8c0ff; }
.dev-coil-big    { border-color: #ffce5e;                   color: #ffce5e; }
.dev-coil-strand { border-color: #5fe19a;                   color: #5fe19a; }
.dev-coil-shard  { border-color: #ff4d6d;                   color: #ff4d6d; }
.dev-slot-jackpot { border-color: #40c8e0;                  color: #40c8e0; }

.dev-infuse-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dev-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 5px 8px;
  font-family: var(--font);
  font-size: 12px;
  width: 100%;
}

.dev-infuse-empty {
  font-size: 12px;
  color: var(--text-dim);
}

/* ─── Assign modal (card grid) ──────────────────────────────────────────────── */

.assign-modal { max-width: 600px; width: 94vw; }

.assign-art-pills-left {
  position: absolute;
  bottom: 10px;
  left: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.assign-art-pills-right {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.art-pill {
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 3px;
  padding: 2px 7px;
  font-size: 11px;
  color: var(--text);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.pill-label {
  font-size: 9px;
  letter-spacing: 1px;
  color: rgba(212,214,240,0.4);
  text-transform: uppercase;
  flex-shrink: 0;
  margin-right: 3px;
}

.pill-sep { color: rgba(212,214,240,0.25); margin: 0 2px; }

.yield-modifier {
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
  letter-spacing: 0.5px;
}
.yield-modifier:empty                       { display: none; }
.yield-modifier[data-kind="volatile"]       { color: #c07af0; }
.yield-modifier[data-kind="blessed"]        { color: var(--success); }

.art-pill-fav    { color: var(--accent2);  border-color: rgba(62,207,176,0.25); }
.art-pill-pun    { color: var(--danger);   border-color: rgba(224,80,80,0.25); }
.art-pill-flux   { color: var(--accent2); }
.art-pill-shard  { color: var(--accent); }
.pill-safe       { color: var(--success); }
.pill-warn       { color: var(--warn); }
.pill-hot        { color: #f08030; }
.pill-danger     { color: var(--danger); }
.pill-crit       { color: #ff4040; }


.assign-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.assign-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 180px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.assign-card:hover    { border-color: var(--accent); }
.assign-card.selected {
  border-color: var(--accent2);
  box-shadow: 0 0 0 1px var(--accent2), 0 0 12px rgba(62,207,176,0.2);
}

.assign-card-art {
  height: 90px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface);
  position: relative;
}

.assign-card-overlays {
  position: absolute;
  top: 4px;
  left: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.assign-card-level,
.assign-card-age {
  font-size: 0.60rem;
  font-weight: 700;
  background: rgba(10, 10, 18, 0.72);
  padding: 1px 4px;
  border-radius: 2px;
  line-height: 1.4;
}

.assign-card-level { color: var(--accent2); }
.assign-card-age   { color: var(--text-dim); }

.assign-card-info {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1;
  padding: 3px 5px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: background 0.12s, color 0.12s;
}
.assign-card-info:hover { background: rgba(0,0,0,0.85); color: var(--text); }

.assign-trait-badge {
  font-size: 9px;
  padding: 1px 5px;
  align-self: flex-start;
}

.assign-art-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
}

.assign-card-body {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.assign-card-name {
  font-size: 13px;
  font-weight: bold;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.assign-card .assign-fit {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
}

.assign-card .fit-track {
  flex: 1;
  width: auto;
}

.assign-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
}

/* ─── Scrollbar ─────────────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }

/* ─── Hopper level badge (modal art overlay) ─────────────────────────────── */

.hopper-level-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  cursor: help;
  background: rgba(0,0,0,0.70);
  border: 1px solid var(--accent2);
  border-radius: 4px;
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.level-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.level-num {
  font-size: 0.80rem;
  font-weight: 700;
  color: var(--accent2);
  letter-spacing: 0.08em;
}

.level-xp {
  font-size: 0.60rem;
  color: var(--text-dim);
}

.level-xp.max {
  color: var(--accent);
  font-weight: 700;
}

.level-bar {
  width: 72px;
  height: 3px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
}

.level-bar-fill {
  height: 100%;
  background: var(--accent2);
  border-radius: 2px;
}

.level-tip {
  display: none;
  flex-direction: column;
  gap: 3px;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--accent2);
  border-radius: 4px;
  padding: 6px 8px;
  white-space: nowrap;
  z-index: 10;
}

.hopper-modal.level-active .level-tip { display: flex; }

.lt-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.lt-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.lt-val {
  font-size: 0.70rem;
  font-weight: 700;
  color: var(--accent2);
  margin-left: auto;
}

.lt-val.lt-pos { color: var(--success); }
.lt-val.lt-neg { color: var(--danger); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ─── Dimensions searching state ─────────────────────────────────────────────── */

.dim-searching {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 16px;
  padding-top: 240px;
}

#dim-radar {
  display: block;
  image-rendering: crisp-edges;
}

.dim-search-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent2);
}

/* ─── Age phase badges ───────────────────────────────────────────────────────── */

.hopper-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.hopper-status-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.age-phase-badge {
  font-size: 0.60rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 5px;
  border-radius: 3px;
  white-space: nowrap;
}

.phase-juvenile { background: #1a1b2e; color: #8890cc; border: 1px solid #3a3f6e; }
.phase-young    { background: #0f1e1a; color: #5ec4a0; border: 1px solid #2a5c4c; }
.phase-adult    { background: #0e1e10; color: #7ddb6a; border: 1px solid #2e5a2a; }
.phase-seasoned { background: #1e1a0a; color: #d4a845; border: 1px solid #6a4e12; }
.phase-aged     { background: #1e130a; color: #d47a38; border: 1px solid #6a3a10; }
.phase-ancient  { background: #1e0a0a; color: #d44040; border: 1px solid #6a1a1a; }

/* ─── Age info in modal ──────────────────────────────────────────────────────── */

.hopper-age-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.age-risk-label {
  font-size: 0.65rem;
  color: #d47a38;
}

.age-death-risk {
  color: #d44040;
}

/* ─── Retire button ──────────────────────────────────────────────────────────── */

.btn-retire {
  background: #0e1e10;
  color: #7ddb6a;
  border: 1px solid #2e5a2a;
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s, border-color 0.15s;
}

.btn-retire:hover { background: #152a17; border-color: #4a8a44; }
.btn-retire.confirming { background: #1a2e10; border-color: #7ddb6a; }
.btn-retire:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Retired & Hall of Fame sections ───────────────────────────────────────── */

.hof-section {
  margin-top: 28px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.hof-header {
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.10em;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 10px;
}

.hof-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 4px;
  margin-bottom: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.hof-name {
  font-size: 0.80rem;
  font-weight: 700;
  color: var(--text);
  min-width: 80px;
}

.hof-info {
  font-size: 0.65rem;
  color: var(--text-dim);
}

.hof-cause {
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.hof-retired { color: #7ddb6a; }
.hof-lost    { color: #d44040; }

/* ─── Retired section ────────────────────────────────────────────────────────── */

.retired-entry { align-items: center; cursor: pointer; }
.retired-entry:hover { background: rgba(255,255,255,0.03); border-radius: 4px; }

.retired-entry-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-induct-small {
  font-size: 0.60rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid rgba(192, 122, 240, 0.40);
  background: rgba(192, 122, 240, 0.08);
  color: #c07af0;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s;
}
.btn-induct-small:hover:not(:disabled) { background: rgba(192, 122, 240, 0.20); }
.btn-induct-small:disabled { opacity: 0.45; cursor: default; }

/* ─── Hall of Fame entries ───────────────────────────────────────────────────── */

.hof-fame-section .hof-fame-entry {
  cursor: pointer;
  transition: background 0.12s;
}
.hof-fame-section .hof-fame-entry:hover { background: rgba(255,255,255,0.04); }

.hof-fame-art-wrap {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 4px;
  background: var(--bg);
}
.hof-fame-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hof-fame-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hof-trait-name {
  font-size: 0.60rem;
  color: #b09cf5;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hof-inducted-date {
  font-size: 0.60rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ─── Hall of Fame detail modal ──────────────────────────────────────────────── */

.hof-detail-modal {
  max-width: 460px;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
}

.hof-detail-art-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  position: relative;
}

.hof-detail-art {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.hof-detail-header {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hof-detail-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.hof-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.hof-detail-inducted {
  font-size: 0.60rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.hof-detail-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.hof-cause-badge {
  font-size: 0.60rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
}
.hof-cause-badge.hof-retired { background: rgba(125,219,106,0.10); border: 1px solid rgba(125,219,106,0.30); }
.hof-cause-badge.hof-lost    { background: rgba(212,64,64,0.10);   border: 1px solid rgba(212,64,64,0.30); }

.hof-modal-close {
  position: absolute;
  top: 0;
  right: 0;
}

.hof-detail-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hof-narrative {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.6;
  font-style: italic;
  border-left: 2px solid var(--border);
  padding-left: 10px;
}

.hof-detail-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hof-detail-bonds {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.hof-detail-bonds-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-dim);
  opacity: 0.6;
  margin-bottom: 8px;
}
.hof-detail-bonds-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hof-detail-footer {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.btn-hof-remove {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 4px;
  border: 1px solid rgba(212, 64, 64, 0.35);
  background: rgba(212, 64, 64, 0.07);
  color: #d44040;
  cursor: pointer;
  transition: background 0.12s;
}
.btn-hof-remove:hover:not(:disabled) { background: rgba(212, 64, 64, 0.18); }
.btn-hof-remove.confirming { border-color: #d44040; background: rgba(212, 64, 64, 0.20); }
.btn-hof-remove:disabled { opacity: 0.45; cursor: default; }

/* ─── Induct button in hopper modal footer ───────────────────────────────────── */

.btn-induct {
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 4px;
  border: 1px solid rgba(192, 122, 240, 0.40);
  background: rgba(192, 122, 240, 0.08);
  color: #c07af0;
  cursor: pointer;
  transition: background 0.12s;
}
.btn-induct:hover:not(:disabled) { background: rgba(192, 122, 240, 0.20); }
.btn-induct:disabled { opacity: 0.45; cursor: default; }

/* ─── Daily bonus toast ──────────────────────────────────────────────────────── */

@keyframes dbt-in  { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dbt-out { from { opacity: 1; transform: translateY(0); }   to { opacity: 0; transform: translateY(16px); } }

.daily-bonus-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  animation: dbt-in 0.28s ease forwards;
}
.daily-bonus-toast.dbt-out { animation: dbt-out 0.24s ease forwards; }

.dbt-inner {
  position: relative;
  background: #12121e;
  border: 1px solid rgba(98, 180, 255, 0.35);
  border-radius: 8px;
  padding: 14px 36px 14px 18px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.55);
  min-width: 160px;
}

.dbt-title {
  font-size: 0.60rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.dbt-reward {
  font-size: 1.4rem;
  font-weight: 700;
  color: #62b4ff;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}
.dbt-reward .res-icon { width: 18px; height: 18px; }

.dbt-streak {
  font-size: 0.62rem;
  color: var(--text-dim);
  margin-top: 3px;
}

.dbt-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
}
.dbt-close:hover { color: var(--text); }

/* ─── Modal profile info row ─────────────────────────────────────────────────── */

.hopper-profile-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: var(--surface2);
  border-radius: 4px;
}

.hpi-label {
  font-size: 0.60rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  white-space: nowrap;
}

.hpi-value {
  font-size: 0.72rem;
  color: var(--text);
}

.card-level-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.card-level-badge {
  font-size: 0.60rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent2);
}

/* ─── Hopper tags ────────────────────────────────────────────────────────────── */

.hopper-name-line {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tag-icon {
  font-size: 0.75rem;
  line-height: 1;
  flex-shrink: 0;
}

.tag-heart   { color: #e05080; }
.tag-star    { color: #e8c040; }
.tag-hex     { color: #4caf82; }
.tag-circle  { color: #4aa0e8; }
.tag-diamond { color: #9b7ae0; }
.tag-skull   { color: #8890aa; }
.tag-bolt    { color: #e8a33a; }
.tag-flag    { color: #e06040; }

/* ─── Modal tag row & picker ─────────────────────────────────────────────────── */

.modal-tag-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
  position: relative;
}

.modal-tag-icons {
  display: flex;
  gap: 4px;
}

.modal-tag-icons .tag-icon { font-size: 0.85rem; }

.btn-tag-edit {
  background: rgba(10, 10, 18, 0.72);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 3px;
  padding: 2px 8px;
  font-family: var(--font);
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.btn-tag-edit:hover, .btn-tag-edit.active { border-color: var(--accent); color: var(--accent); }

.tag-picker {
  position: absolute;
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 6px;
  z-index: 50;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

.tag-opt {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.12s, background 0.12s;
}
.tag-opt:hover           { border-color: var(--text-dim); }
.tag-opt.sel             { border-color: var(--accent); background: rgba(124,109,245,0.15); }
.tag-opt.maxed           { opacity: 0.3; cursor: not-allowed; }
.tag-opt .tag-icon       { font-size: 0.85rem; }

/* ─── Rename button & input ──────────────────────────────────────────────────── */

.btn-rename {
  background: rgba(10, 10, 18, 0.72);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 3px;
  padding: 2px 8px;
  font-family: var(--font);
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-rename:hover        { border-color: var(--accent); color: var(--accent); }
.btn-rename:disabled     { opacity: 0.4; cursor: not-allowed; }

.rename-input {
  background: rgba(10, 10, 18, 0.85);
  border: none;
  border-bottom: 1px solid var(--accent);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  font-weight: bold;
  width: 140px;
  outline: none;
  padding: 0 2px;
}

/* ─── Void badge (top bar) ───────────────────────────────────────────────────── */

.void-badge {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 3px 10px;
  white-space: nowrap;
  box-shadow: 0 0 8px rgba(124, 109, 245, 0.35), inset 0 0 8px rgba(124, 109, 245, 0.08);
  animation: void-pulse 3s ease-in-out infinite;
}

@keyframes void-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(124, 109, 245, 0.35), inset 0 0 8px rgba(124, 109, 245, 0.08); }
  50%       { box-shadow: 0 0 14px rgba(124, 109, 245, 0.6), inset 0 0 10px rgba(124, 109, 245, 0.15); }
}


/* ─── Void Ascension (portal tab) ───────────────────────────────────────────── */

.void-ascension-panel {
  margin-top: 24px;
  border: 1px solid rgba(124, 109, 245, 0.4);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: rgba(124, 109, 245, 0.04);
}

.void-asc-title {
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--accent);
  margin-bottom: 6px;
}

.void-asc-active {
  font-size: 11px;
  color: var(--accent2);
  margin-bottom: 10px;
}

.void-asc-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
  line-height: 1.5;
}

.void-asc-bonus {
  list-style: none;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.void-asc-bonus li {
  font-size: 12px;
  color: var(--accent2);
}
.void-asc-bonus li::before { content: '+ '; }

.btn-ascend {
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 1px;
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 7px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-ascend:hover {
  background: var(--accent);
  color: #fff;
}

.ascend-confirm-warn {
  font-size: 12px;
  color: var(--warn);
  margin-bottom: 10px;
  line-height: 1.5;
}

.ascend-confirm-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-secondary-sm {
  font-family: var(--font);
  font-size: 12px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-secondary-sm:hover { border-color: var(--text-dim); color: var(--text); }

.btn-void-confirm {
  font-family: var(--font);
  font-size: 12px;
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-void-confirm:hover {
  background: var(--danger);
  color: #fff;
}

/* ─── Tutorial spotlight overlay ────────────────────────────────────────────── */

.tut-strip {
  z-index: 9000;
  background: rgba(0, 0, 0, 0.78);
  pointer-events: all;
}

.tut-blocker {
  z-index: 9000;
  pointer-events: all;
  background: transparent;
}

.tut-veil {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.78);
  pointer-events: all;
}

.tut-card {
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(124, 109, 245, 0.2);
  pointer-events: all;
  animation: tut-card-in 0.18s ease-out both;
}

@keyframes tut-card-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.tut-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.tut-card-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tut-card-counter {
  font-weight: normal;
  letter-spacing: 0;
  color: var(--text-dim);
}

.tut-card-skip {
  font-family: var(--font);
  font-size: 10px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  transition: color 0.15s;
}
.tut-card-skip:hover { color: var(--text); }

.tut-card-text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}

.tut-card-next {
  display: block;
  width: 100%;
  margin-top: 12px;
  font-family: var(--font);
  font-size: 12px;
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s;
}
.tut-card-next:hover { opacity: 0.85; }

/* ─── Mobile layout (≤640px) ────────────────────────────────────────────────── */

@media (max-width: 640px) {
  /* Tab content — tighter padding */
  .tab-content { padding: 12px; }

  /* Tab bar — smaller text, keep all 6 tabs on one row */
  .tab-btn {
    font-size: 9px;
    letter-spacing: 0;
    padding: 0 2px;
    min-height: 44px;
  }

  /* Top bar — tighter */
  .top-bar { padding: 8px 12px; gap: 8px; }

  /* Resource icons in header — smaller */
  .top-bar .res-icon { width: 14px; height: 14px; }

  /* Resource display — smaller font */
  .resource-display { font-size: 12px; letter-spacing: 0; }

  /* Void badge — hide at narrow widths to avoid crowding the top bar */
  .void-badge { display: none; }

  /* Dimensions — single column */
  .dim-grid { grid-template-columns: 1fr; }

  /* Dim detail modal — full-width body padding */
  .dim-detail-body { padding: 12px 14px 16px; }

  /* Assign modal — tighter card grid */
  .assign-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

  /* Assign modal footer — stack on very narrow screens */
  .assign-footer { flex-wrap: wrap; gap: 8px; }

  /* Key action buttons — meet 44px touch target */
  .btn-launch,
  .btn-action,
  .btn-confirm,
  .btn-collect,
  .btn-complete-mission {
    min-height: 44px;
    padding: 10px 14px;
  }

  /* Options menu — prevent overflow past left edge of screen */
  .options-menu { max-width: calc(100vw - 20px); }

  /* Mission report modal body — less max-height on short screens */
  .mission-report-body { max-height: 45vh; }

  /* Hopper modal art — shorter on mobile */
  .hopper-modal-art { height: 160px; }

  /* Generator tab — full width, no centering needed */
  .generator-tab { padding: 12px; }

  /* Upgrade cards — horizontal layout can go vertical on very narrow */
  .upgrade-card { flex-direction: column; gap: 10px; }
  .upgrade-icon { font-size: 24px; }

  /* Intro hopper grid — already has a 600px breakpoint, reinforce for 640 */
  .intro-hopper-grid { grid-template-columns: 1fr; }

  /* Intro content — less padding */
  .intro-screen { padding: 20px 14px; }
  .intro-logo { font-size: 48px; letter-spacing: 8px; }

  /* Replicator banner — shorter */
  .replicator-banner { height: 140px; }

  /* Daily bonus toast — keep away from edge */
  .daily-bonus-toast { bottom: 16px; right: 12px; }

  /* Tutorial card — ensure it fits within viewport */
  .tut-card { max-width: calc(100vw - 32px); }
}

/* ─── Version label (bottom-left, click-to-copy) ────────────────────────────── */

.app-version {
  position: fixed;
  bottom: max(6px, env(safe-area-inset-bottom));
  left:   max(8px, env(safe-area-inset-left));
  font-family: var(--font);
  font-size: 9px;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  opacity: 0.35;
  z-index: 1;
  font-variant-numeric: tabular-nums;
  transition: opacity 0.15s, color 0.15s;
  /* button reset */
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font-style: normal;
  text-transform: none;
}
.app-version:hover { opacity: 0.85; color: var(--accent); }
.app-version:focus { outline: none; opacity: 0.85; }
.app-version.app-version-copied {
  opacity: 0.95;
  color: var(--success);
}

/* ─── Top-left general menu (☰ button + dropdown) ────────────────────────── */

.top-left {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.menu-wrap {
  position: relative;
}

.btn-menu {
  font-size: 16px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s;
  position: relative;
}
.btn-menu:hover { color: var(--text); border-color: var(--text-dim); }

/* Notification badge — appears when there's something unread inside the menu */
.btn-menu.btn-menu-unread::after {
  content: '✦';
  position: absolute;
  top: -3px;
  right: -3px;
  font-size: 9px;
  line-height: 1;
  color: var(--accent);
  text-shadow: 0 0 4px rgba(124, 109, 245, 0.7);
  animation: menu-badge-pulse 1.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes menu-badge-pulse {
  0%, 100% { transform: scale(1.00); filter: drop-shadow(0 0 0 rgba(124,109,245,0)); }
  50%      { transform: scale(1.25); filter: drop-shadow(0 0 4px rgba(124,109,245,0.6)); }
}

.game-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 180px;
  padding: 6px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.game-menu.hidden { display: none; }

.menu-item {
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 1px;
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 7px 10px;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.menu-item:hover                    { background: var(--surface2); color: var(--text); }
.menu-item:disabled                 { opacity: 0.4; cursor: not-allowed; }
.menu-item:disabled:hover           { background: none; color: var(--text-dim); }

.menu-item-badge {
  font-size: 11px;
  color: var(--accent);
  text-shadow: 0 0 4px rgba(124, 109, 245, 0.6);
  animation: menu-badge-pulse 1.6s ease-in-out infinite;
}

/* ─── Patch notes modal ──────────────────────────────────────────────────── */

.patch-notes-modal {
  max-width: 520px;
  width: 92vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.patch-notes-body {
  overflow-y: auto;
  padding: 12px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.pn-entry {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border);
}
.pn-entry:last-child { border-bottom: none; padding-bottom: 0; }

.pn-entry-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.pn-entry-date {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.pn-entry-version {
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  user-select: text;
}

.pn-entry-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.pn-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pn-section-label {
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-dim);
}

.pn-section-new     .pn-section-label { color: var(--success); }
.pn-section-changed .pn-section-label { color: var(--accent2); }
.pn-section-fixed   .pn-section-label { color: var(--warn); }

.pn-list {
  list-style: none;
  margin: 0;
  padding-left: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pn-list li {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
  position: relative;
  padding-left: 12px;
}
.pn-list li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--text-dim);
  font-weight: 700;
}

