/* Équinoxe — screens: menus, modals, season banner, toasts. Builds on the tokens of base.css. */

/* ------------------------------------------------------------------ */
/* Shared                                                              */
/* ------------------------------------------------------------------ */
.eq-s-spring { --sc: var(--spring); }
.eq-s-summer { --sc: var(--summer); }
.eq-s-autumn { --sc: var(--autumn); }
.eq-s-winter { --sc: var(--winter); }

.eq-ico { display: inline-flex; width: 1em; height: 1em; flex: none; vertical-align: -0.14em; line-height: 0; }
.eq-ico svg { width: 100%; height: 100%; display: block; }

.eq-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#screens button, #toasts button { cursor: pointer; }
#screens :focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
}
#screens :focus:not(:focus-visible) { outline: none; }

.eq-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: var(--text);
}
.eq-subtitle { margin: 2px 0 0; color: var(--text-dim); font-size: 14px; }

/* Backdrop + panel ------------------------------------------------------ */
.eq-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  padding: max(24px, var(--safe-top)) max(24px, var(--safe-right)) max(24px, var(--safe-bottom)) max(24px, var(--safe-left));
  background: rgba(6, 9, 13, 0.62);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity 0.24s var(--ease);
  overflow: hidden;
}
.eq-backdrop.is-open { opacity: 1; }
.eq-backdrop.is-closing { pointer-events: none; }
.eq-backdrop.no-anim, .eq-backdrop.no-anim .eq-panel { transition: none; }

.eq-panel {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  transform: translateY(14px) scale(0.975);
  transition: transform 0.3s var(--ease);
  outline: none;
  overflow: hidden;
}
.eq-backdrop.is-open .eq-panel { transform: none; }

/* Buttons --------------------------------------------------------------- */
.eq-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 22px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font: 700 16px/1.1 var(--font-ui);
  letter-spacing: 0.01em;
  transition: transform 0.15s var(--ease), background 0.15s, border-color 0.15s, box-shadow 0.2s, filter 0.15s;
}
.eq-btn:hover { background: rgba(255, 255, 255, 0.13); border-color: rgba(255, 255, 255, 0.24); transform: translateY(-1px); }
.eq-btn:active { transform: translateY(0) scale(0.98); }
.eq-btn-ico { font-size: 1.2em; }
.eq-btn-ico-slot { display: inline-flex; }
.eq-btn-wide { width: 100%; }
.eq-btn-lg { min-height: 54px; font-size: 18px; padding: 12px 28px; border-radius: 14px; }
.eq-btn-ghost { background: rgba(255, 255, 255, 0.05); }
.eq-btn-primary {
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  border-color: rgba(255, 233, 180, 0.7);
  color: #2b1b02;
  box-shadow: 0 6px 22px rgba(240, 181, 74, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.eq-btn-primary:hover {
  background: linear-gradient(180deg, #ffdc8a, #f6bd55);
  border-color: #fff0c9;
  box-shadow: 0 8px 28px rgba(240, 181, 74, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.eq-btn-danger { color: #ffb4a8; border-color: rgba(239, 106, 90, 0.45); background: rgba(239, 106, 90, 0.1); }
.eq-btn-danger:hover { background: rgba(239, 106, 90, 0.2); border-color: rgba(239, 106, 90, 0.75); }
.eq-btn-mini {
  min-height: 30px;
  padding: 4px 12px;
  font-size: 13px;
  border-radius: 999px;
  font-weight: 700;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
}
.eq-btn-mini:hover { color: var(--text); }

.eq-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  font-size: 22px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  transition: background 0.15s, color 0.15s, transform 0.15s var(--ease);
}
.eq-close:hover { background: rgba(255, 255, 255, 0.14); color: var(--text); transform: rotate(90deg); }

.eq-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent);
}
.eq-head-title { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.eq-head-emblem { font-size: 42px; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4)); }

.eq-cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}
.eq-cost .eq-ico { font-size: 1.1em; }

.eq-ambre-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(240, 181, 74, 0.14);
  border: 1px solid rgba(240, 181, 74, 0.45);
  color: var(--accent-strong);
  font-size: 18px;
  box-shadow: 0 0 18px rgba(240, 181, 74, 0.12);
}
.eq-ambre-pill strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.eq-ambre-ico { font-size: 22px; }

/* ------------------------------------------------------------------ */
/* Main menu                                                           */
/* ------------------------------------------------------------------ */
.eq-menu {
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  background:
    radial-gradient(ellipse 80% 70% at 50% 42%, rgba(9, 13, 19, 0.42) 0%, rgba(7, 10, 15, 0.82) 100%);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.eq-aurora { position: absolute; inset: 0; overflow: hidden; pointer-events: none; mix-blend-mode: screen; }
.eq-aurora i {
  position: absolute;
  width: 56vmax;
  height: 56vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.26;
  will-change: transform;
}
.eq-aurora-a { background: var(--spring); left: -14vmax; top: -18vmax; animation: eq-drift-a 26s ease-in-out infinite alternate; }
.eq-aurora-b { background: var(--summer); right: -16vmax; top: -12vmax; animation: eq-drift-b 31s ease-in-out infinite alternate; }
.eq-aurora-c { background: var(--autumn); right: -10vmax; bottom: -24vmax; animation: eq-drift-a 29s ease-in-out infinite alternate-reverse; }
.eq-aurora-d { background: var(--winter); left: -12vmax; bottom: -22vmax; animation: eq-drift-b 34s ease-in-out infinite alternate-reverse; }
@keyframes eq-drift-a { to { transform: translate(14vmax, 10vmax) scale(1.18); } }
@keyframes eq-drift-b { to { transform: translate(-12vmax, 12vmax) scale(0.88); } }

.eq-menu .eq-panel.eq-menu-panel {
  background: none;
  border: none;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  /* Scrolls on a short screen (phone in landscape): margin: auto on the child centres it without clipping the top. */
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  width: 100%;
  height: 100%;
  max-height: none;
  max-width: none;
  align-items: center;
  justify-content: flex-start;
  transform: none;
}
.eq-menu .eq-panel.eq-menu-panel > * { margin-block: auto; flex: none; }

.eq-view-in { animation: eq-view-in 0.45s var(--ease) both; }
@keyframes eq-view-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.eq-title-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 20px;
  width: min(100%, 900px);
}
.eq-glyphs { display: flex; gap: clamp(14px, 3vw, 26px); margin-bottom: 18px; font-size: clamp(26px, 4vw, 34px); }
.eq-glyph { display: inline-flex; animation: eq-float 5s ease-in-out infinite; animation-delay: calc(var(--i) * -1.25s); filter: drop-shadow(0 0 12px currentColor); }
@keyframes eq-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

.eq-logo {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(40px, 10vw, 104px);
  line-height: 1;
  letter-spacing: 0.07em;
  padding-left: 0.07em;
  background: linear-gradient(100deg, var(--spring), var(--summer) 25%, var(--autumn) 50%, var(--winter) 75%, var(--spring));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: eq-logo-shift 16s linear infinite;
  filter: drop-shadow(0 4px 26px rgba(0, 0, 0, 0.55));
  max-width: 100%;
  white-space: nowrap;
}
@keyframes eq-logo-shift { to { background-position: 300% 0; } }
.eq-tagline {
  margin: 18px 0 38px;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(16px, 2.4vw, 21px);
  color: var(--text);
  opacity: 0.88;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
}
.eq-menu-nav { display: flex; flex-direction: column; gap: 12px; width: min(100%, 340px); }
.eq-menu-nav .eq-btn { justify-content: center; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.eq-foot { margin: 34px 0 0; color: var(--text-faint); font-size: 13px; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7); }

/* New game ------------------------------------------------------------- */
.eq-setup {
  display: flex;
  flex-direction: column;
  width: min(1060px, 100%);
  max-height: 100%;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  overflow: hidden;
}
.eq-menu .eq-panel.eq-menu-panel { padding: 24px; }
.eq-setup-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--panel-border); }
.eq-setup-head .eq-title { text-align: center; }
.eq-back { min-height: 40px; padding: 8px 16px; font-size: 15px; }
.eq-back .eq-btn-ico { transform: rotate(0deg); }
.eq-setup-spacer { width: 100px; }
.eq-setup-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 22px 18px; touch-action: pan-y; }
.eq-section {
  margin: 16px 0 10px;
  font: 800 12px/1 var(--font-ui);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.eq-tribes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.eq-tribe {
  --tc: #888;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 14px 12px;
  text-align: left;
  border-radius: 16px;
  border: 1.5px solid var(--panel-border);
  background: linear-gradient(170deg, color-mix(in srgb, var(--tc) 14%, transparent), rgba(255, 255, 255, 0.03) 60%);
  color: var(--text);
  font: 400 13.5px/1.35 var(--font-ui);
  transition: transform 0.2s var(--ease), border-color 0.2s, box-shadow 0.25s, background 0.2s;
}
.eq-tribe:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--tc) 70%, white 10%); }
.eq-tribe.is-on {
  border-color: var(--tc);
  background: linear-gradient(170deg, color-mix(in srgb, var(--tc) 30%, transparent), color-mix(in srgb, var(--tc) 6%, transparent) 70%);
  box-shadow: 0 0 0 1px var(--tc), 0 10px 34px color-mix(in srgb, var(--tc) 38%, transparent);
}
.eq-tribe-check {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  font-size: 15px;
  border-radius: 50%;
  background: var(--tc);
  color: #0e141b;
  transform: scale(0);
  transition: transform 0.25s var(--ease);
}
.eq-tribe.is-on .eq-tribe-check { transform: scale(1); }
.eq-tribe-head { display: flex; align-items: center; gap: 12px; }
.eq-tribe-emblem { font-size: 52px; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.45)); transition: transform 0.3s var(--ease); }
.eq-tribe:hover .eq-tribe-emblem, .eq-tribe.is-on .eq-tribe-emblem { transform: scale(1.08) rotate(-3deg); }
.eq-tribe-id { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.eq-tribe-name { font: 700 22px/1.1 var(--font-display); color: var(--tcl, var(--text)); }
.eq-tribe-season { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; color: var(--sc, var(--text-dim)); }
.eq-tribe-lore { margin: 0; font: italic 500 14px/1.35 var(--font-display); color: var(--text-dim); }
.eq-tribe-facts { margin: 0; display: grid; gap: 1px; }
.eq-tribe-facts dt { margin-top: 5px; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tcl, var(--accent)); }
.eq-tribe-facts dd { margin: 0; color: var(--text); }
.eq-tribe-start { margin-top: auto; padding-top: 6px; font-size: 12px; color: var(--text-faint); }

.eq-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 24px; }
.eq-field-span2 { grid-column: span 2; }
.eq-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.eq-field-label { font-weight: 800; font-size: 14px; color: var(--text); }
.eq-field-hint { margin: 0; font-size: 13px; color: var(--text-dim); min-height: 2.7em; }

.eq-seg { display: flex; gap: 6px; padding: 4px; border-radius: 14px; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--panel-border); }
.eq-seg-item {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 44px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  font: 700 15px/1.15 var(--font-ui);
  transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.2s;
}
.eq-seg-item:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.eq-seg-item.is-on {
  background: linear-gradient(180deg, rgba(240, 181, 74, 0.28), rgba(240, 181, 74, 0.14));
  border-color: rgba(240, 181, 74, 0.7);
  color: var(--accent-strong);
  box-shadow: 0 0 16px rgba(240, 181, 74, 0.16);
}
.eq-seg-sub { font-size: 12px; font-weight: 600; opacity: 0.75; font-variant-numeric: tabular-nums; }
.eq-seg-badge {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--good);
}
.eq-seg-badge[hidden] { display: none; }

.eq-opps { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 36px; }
.eq-opp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px 3px 5px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: color-mix(in srgb, var(--tc) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--tc) 55%, transparent);
  animation: eq-pop 0.3s var(--ease) both;
}
.eq-opp-emblem { font-size: 24px; }
@keyframes eq-pop { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: none; } }

.eq-seed { display: flex; gap: 8px; align-items: center; }
.eq-input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font: 700 16px/1 var(--font-ui);
  letter-spacing: 0.05em;
  user-select: text;
  -webkit-user-select: text;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.eq-input::placeholder { color: var(--text-faint); font-weight: 600; letter-spacing: 0; }
.eq-input:hover { border-color: rgba(255, 255, 255, 0.26); }
.eq-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(240, 181, 74, 0.25); }

.eq-setup-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-top: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.22);
}
.eq-summary { color: var(--text-dim); font-size: 14px; font-weight: 600; }

/* ------------------------------------------------------------------ */
/* Tech tree                                                           */
/* ------------------------------------------------------------------ */
.eq-tech .eq-panel { width: min(1180px, 100%); height: min(860px, 100%); }
.eq-tree-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 18px 22px 10px; touch-action: pan-x pan-y; }
.eq-tree {
  position: relative;
  display: grid;
  grid-template-columns: 30px repeat(5, minmax(150px, 1fr));
  grid-template-rows: auto repeat(4, auto);
  gap: 30px 16px;
  min-width: 860px;
}
.eq-tree-lines { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; z-index: 0; }
.eq-line { fill: none; stroke-width: 2.5; stroke-linecap: round; }
.eq-line-dim { stroke: rgba(255, 255, 255, 0.16); stroke-dasharray: 3 6; }
.eq-line-active { stroke: var(--accent); stroke-dasharray: 7 6; filter: drop-shadow(0 0 4px rgba(240, 181, 74, 0.6)); animation: eq-flow 1.2s linear infinite; }
.eq-line-done { stroke: var(--accent); filter: drop-shadow(0 0 3px rgba(240, 181, 74, 0.4)); }
@keyframes eq-flow { to { stroke-dashoffset: -26; } }
circle.eq-line-dot { stroke: none; }
circle.eq-line-dim { fill: rgba(255, 255, 255, 0.25); }
circle.eq-line-active, circle.eq-line-done { fill: var(--accent); }

.eq-branch {
  align-self: end;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  font: 700 13px/1 var(--font-ui);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.eq-tier {
  align-self: center;
  justify-self: center;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font: 700 12px/1 var(--font-display);
  color: var(--text-faint);
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04);
}

.eq-node {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 112px;
  padding: 12px 13px 10px;
  text-align: left;
  border-radius: 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  color: var(--text);
  font: 400 13px/1.35 var(--font-ui);
  transition: transform 0.18s var(--ease), box-shadow 0.25s, border-color 0.2s, background 0.2s;
}
.eq-node-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.eq-node-name { font: 700 16px/1.15 var(--font-display); }
.eq-node-badge { font-size: 18px; }
.eq-node-desc { margin: 0; flex: 1; color: var(--text-dim); font-size: 12.5px; }
.eq-node-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; font-weight: 800; }
.eq-lack { font-size: 11.5px; font-weight: 700; color: var(--bad); }

.eq-node.is-researched {
  border-color: rgba(240, 181, 74, 0.75);
  background: linear-gradient(170deg, rgba(240, 181, 74, 0.26), rgba(240, 181, 74, 0.08));
  cursor: default;
}
.eq-node.is-researched .eq-node-name { color: var(--accent-strong); }
.eq-node.is-researched .eq-node-desc { color: var(--text); opacity: 0.85; }
.eq-node.is-researched .eq-node-badge, .eq-node-done { color: var(--accent-strong); }
.eq-node-done { gap: 6px; font-size: 13px; }

.eq-node.is-available.is-affordable {
  border-color: var(--accent-strong);
  background: linear-gradient(170deg, rgba(255, 207, 110, 0.18), rgba(255, 255, 255, 0.05));
  animation: eq-glow 2.2s ease-in-out infinite;
}
.eq-node.is-affordable:hover { transform: translateY(-3px) scale(1.02); }
.eq-node.is-affordable:active { transform: scale(0.98); }
.eq-node.is-picked { animation: none; box-shadow: 0 0 0 3px var(--accent-strong), 0 0 36px rgba(255, 207, 110, 0.7); }
@keyframes eq-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 207, 110, 0), 0 4px 18px rgba(240, 181, 74, 0.18); }
  50% { box-shadow: 0 0 0 3px rgba(255, 207, 110, 0.32), 0 6px 30px rgba(240, 181, 74, 0.42); }
}
.eq-node.is-poor { cursor: not-allowed; }
.eq-node.is-poor .eq-cost { color: var(--bad); }
.eq-node.is-poor .eq-node-name { color: #e6ddc9; }
.eq-node.is-locked { cursor: not-allowed; opacity: 0.55; border-style: dashed; background: rgba(255, 255, 255, 0.025); }
.eq-node.is-locked .eq-node-badge { color: var(--text-faint); }
.eq-cost-dim { color: var(--text-faint); }
.eq-node-req { color: var(--text-faint); font-weight: 700; font-size: 12px; align-items: center; }
.eq-node-req .eq-ico { font-size: 14px; }

.eq-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 12px 22px 16px; border-top: 1px solid var(--panel-border); color: var(--text-dim); font-size: 13px; }
.eq-legend-item { display: inline-flex; align-items: center; gap: 8px; }
.eq-swatch { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid rgba(255, 255, 255, 0.25); }
.eq-swatch-done { background: rgba(240, 181, 74, 0.5); border-color: var(--accent); }
.eq-swatch-ok { background: rgba(255, 207, 110, 0.2); border-color: var(--accent-strong); box-shadow: 0 0 8px rgba(240, 181, 74, 0.6); }
.eq-swatch-poor { border-color: var(--bad); }
.eq-swatch-lock { border-style: dashed; opacity: 0.6; }

/* ------------------------------------------------------------------ */
/* Game over                                                           */
/* ------------------------------------------------------------------ */
.eq-gameover { background: rgba(5, 8, 12, 0.72); }
.eq-gameover .eq-panel {
  width: min(760px, 100%);
  padding: 32px 30px 26px;
  align-items: center;
  text-align: center;
  overflow: auto;
}
.is-victory .eq-panel {
  border-color: rgba(255, 207, 110, 0.55);
  background: radial-gradient(ellipse 90% 60% at 50% 0%, rgba(240, 181, 74, 0.2), transparent 70%), var(--panel);
  box-shadow: var(--shadow), 0 0 80px rgba(240, 181, 74, 0.22);
}
.is-defeat .eq-panel {
  border-color: rgba(239, 106, 90, 0.35);
  background: radial-gradient(ellipse 90% 60% at 50% 0%, rgba(120, 140, 170, 0.16), transparent 70%), var(--panel);
}
.eq-gameover-seasons { display: flex; gap: 14px; font-size: 24px; margin-bottom: 10px; }
.is-victory .eq-gameover-seasons .eq-ico { animation: eq-float 3s ease-in-out infinite; }
.is-victory .eq-gameover-seasons .eq-ico:nth-child(2) { animation-delay: -0.75s; }
.is-victory .eq-gameover-seasons .eq-ico:nth-child(3) { animation-delay: -1.5s; }
.is-victory .eq-gameover-seasons .eq-ico:nth-child(4) { animation-delay: -2.25s; }
.is-defeat .eq-gameover-seasons { opacity: 0.45; filter: grayscale(0.6); }
.eq-gameover-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(38px, 8vw, 62px);
  line-height: 1.05;
  letter-spacing: 0.02em;
}
.is-victory .eq-gameover-title {
  background: linear-gradient(100deg, #ffe39a, #ffb43c 45%, #fff2c4 70%, #ffcf6e);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: eq-logo-shift 6s linear infinite, eq-title-in 0.8s var(--ease) both;
  filter: drop-shadow(0 4px 20px rgba(240, 181, 74, 0.35));
}
.is-defeat .eq-gameover-title { color: #d6d3cc; animation: eq-title-in 0.8s var(--ease) both; }
@keyframes eq-title-in { from { opacity: 0; transform: translateY(-14px) scale(0.92); } to { opacity: 1; transform: none; } }
.eq-gameover-reason { margin: 10px 0 6px; max-width: 520px; font-size: 17px; line-height: 1.45; color: var(--text); opacity: 0.9; }
.eq-gameover-rounds { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 18px; font-size: 14px; font-weight: 700; color: var(--text-dim); }
.eq-gameover-actions { margin-top: 22px; }

.eq-table-wrap { width: 100%; overflow-x: auto; text-align: left; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
.eq-table { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: 15px; }
.eq-table th { padding: 4px 10px; text-align: left; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); white-space: nowrap; }
.eq-table th .eq-ico { font-size: 15px; margin-right: 5px; }
.eq-table td { padding: 10px; background: rgba(255, 255, 255, 0.05); vertical-align: middle; }
.eq-table td:first-child { border-radius: 12px 0 0 12px; }
.eq-table td:last-child { border-radius: 0 12px 12px 0; }
.eq-num { text-align: right; font-variant-numeric: tabular-nums; }
th.eq-num { text-align: right; }
.eq-rank { width: 36px; text-align: center; font: 700 17px var(--font-display); color: var(--text-dim); }
th.eq-rank { padding: 0; }
.eq-crown { font-size: 22px; color: var(--accent-strong); filter: drop-shadow(0 0 8px rgba(255, 207, 110, 0.7)); }
.eq-who { min-width: 150px; }
.eq-who > .eq-ico, .eq-who .eq-row-emblem { float: left; margin-right: 10px; }
.eq-row-emblem { font-size: 36px; }
.eq-who-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.eq-who-text strong { font-weight: 800; }
.eq-who-tribe { font-size: 12.5px; color: var(--tc, var(--text-dim)); font-weight: 700; }
.eq-you { margin-left: 8px; padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); font-size: 10.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; vertical-align: 1px; }
.eq-score { font: 800 20px var(--font-display); color: var(--accent-strong); }
.eq-row.is-winner td { background: rgba(240, 181, 74, 0.16); }
.eq-row.is-winner td:first-child { box-shadow: inset 3px 0 var(--accent); }
.eq-row.is-dead td { opacity: 0.6; }
.eq-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.eq-badge.is-alive { color: var(--good); background: rgba(111, 208, 140, 0.13); }
.eq-badge.is-out { color: var(--bad); background: rgba(239, 106, 90, 0.13); }
.eq-state { text-align: right; }

.eq-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.eq-gameover .eq-panel > :not(.eq-confetti) { position: relative; z-index: 1; }
.eq-confetti-piece { position: absolute; top: -20px; border-radius: 2px; opacity: 0; animation: eq-fall linear infinite; }
@keyframes eq-fall {
  0% { transform: translate(0, -20px) rotate(0); opacity: 0; }
  8% { opacity: 0.95; }
  100% { transform: translate(var(--drift), 640px) rotate(var(--spin)); opacity: 0.9; }
}

/* ------------------------------------------------------------------ */
/* Help                                                                */
/* ------------------------------------------------------------------ */
.eq-help .eq-panel { width: min(900px, 100%); height: min(860px, 100%); }
.eq-help-nav { display: flex; gap: 8px; padding: 10px 22px; overflow-x: auto; border-bottom: 1px solid var(--panel-border); scrollbar-width: none; }
.eq-help-nav::-webkit-scrollbar { display: none; }
.eq-chip-btn { min-height: 34px; padding: 6px 14px; font-size: 14px; border-radius: 999px; white-space: nowrap; flex: none; }
.eq-help-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px 26px 30px; line-height: 1.55; font-size: 15.5px; touch-action: pan-y; user-select: text; -webkit-user-select: text; outline: none; }
.eq-help-sec { padding-top: 22px; }
.eq-help-h { margin: 0 0 10px; font: 700 24px/1.2 var(--font-display); color: var(--accent-strong); }
.eq-help-p { margin: 0 0 12px; color: var(--text); opacity: 0.92; }
.eq-help-list { margin: 0 0 12px; padding-left: 22px; }
.eq-help-list li { margin: 6px 0; }
.eq-help-list li::marker { color: var(--accent); }
.eq-help-grid { display: grid; gap: 12px; margin: 14px 0; }
.eq-help-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.eq-help-card {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04);
  border-top: 3px solid var(--sc, var(--tc, var(--panel-border)));
}
.eq-help-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.eq-help-card-head > div { display: flex; flex-direction: column; gap: 2px; }
.eq-help-card-ico { font-size: 32px; }
.eq-help-emblem { font-size: 42px; }
.eq-help-card-name { font: 700 20px/1.1 var(--font-display); }
.eq-help-tribe .eq-help-card-name { color: var(--tc); }
.eq-help-card-sub { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; color: var(--sc, var(--text-dim)); }
.eq-help-card-lore { margin: 0 0 8px; font: italic 500 14.5px/1.4 var(--font-display); color: var(--text-dim); }
.eq-help-card-text { margin: 0 0 6px; font-size: 14px; line-height: 1.45; }
.eq-help-card-text.eq-dim { color: var(--text-faint); font-size: 13px; }
.eq-help-table td { font-size: 14px; }
.eq-help-table th { white-space: normal; }
.eq-help-table th.eq-num { white-space: nowrap; }
.eq-unit-name { min-width: 170px; }
.eq-unit-name strong { display: block; font-size: 15px; }
.eq-unit-desc { display: block; margin-top: 2px; font-size: 12.5px; color: var(--text-dim); line-height: 1.35; }
.eq-unit-tech { white-space: nowrap; color: var(--text-dim); }
.eq-unit-req { display: none; margin-top: 3px; font-size: 12px; font-weight: 700; color: var(--accent); }
.eq-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.eq-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--panel-border); background: rgba(255, 255, 255, 0.05); font-size: 13.5px; }
.eq-chip b { color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.eq-controls { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 0; align-items: baseline; }
.eq-controls dt { margin: 0; }
.eq-controls dd { margin: 0; color: var(--text); opacity: 0.9; }
kbd {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-bottom-width: 3px;
  background: rgba(255, 255, 255, 0.08);
  font: 700 13px/1.4 var(--font-ui);
}

/* ------------------------------------------------------------------ */
/* Pause + confirm                                                     */
/* ------------------------------------------------------------------ */
.eq-pause .eq-panel { width: min(380px, 100%); padding: 28px 26px 26px; text-align: center; overflow: auto; }
.eq-pause .eq-title { font-size: 34px; font-weight: 900; }
.eq-pause .eq-subtitle { margin: 6px 0 22px; font-size: 13.5px; }
.eq-stack { display: flex; flex-direction: column; gap: 10px; }

.eq-confirm { background: rgba(5, 8, 12, 0.55); }
.eq-confirm .eq-panel { width: min(430px, 100%); padding: 26px 24px 22px; }
.eq-confirm-msg { margin: 0 0 22px; font-size: 17px; line-height: 1.5; text-align: center; }
.eq-confirm-actions { display: flex; gap: 10px; }
.eq-confirm-actions .eq-btn { flex: 1; }

/* ------------------------------------------------------------------ */
/* Season banner                                                       */
/* ------------------------------------------------------------------ */
#screens > .eq-banner {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  pointer-events: none;
  z-index: 5;
}
#screens > .eq-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 50%, color-mix(in srgb, var(--sc) 30%, transparent), transparent 70%);
  animation: eq-banner-wash 1.8s ease-in-out both;
}
.eq-banner-card {
  position: relative;
  width: min(560px, 100%);
  padding: 26px 32px 24px;
  text-align: center;
  border-radius: 26px;
  border: 1.5px solid color-mix(in srgb, var(--sc) 70%, transparent);
  background: linear-gradient(170deg, color-mix(in srgb, var(--sc) 18%, rgba(14, 20, 27, 0.9)), rgba(14, 20, 27, 0.92) 70%);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: 0 0 90px color-mix(in srgb, var(--sc) 45%, transparent), 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  animation: eq-banner 1.8s var(--ease) both;
}
.eq-banner-glyph { display: inline-grid; place-items: center; width: 82px; height: 82px; margin-top: -58px; margin-bottom: 8px; font-size: 48px; border-radius: 50%; background: var(--panel-solid); border: 1.5px solid color-mix(in srgb, var(--sc) 70%, transparent); box-shadow: 0 0 40px color-mix(in srgb, var(--sc) 65%, transparent); }
.eq-banner-year { font: 800 13px/1 var(--font-ui); letter-spacing: 0.3em; text-transform: uppercase; color: var(--text-dim); }
.eq-banner-name { margin: 8px 0 2px; font: 900 clamp(46px, 11vw, 70px)/1.05 var(--font-display); color: var(--sc); text-shadow: 0 0 36px color-mix(in srgb, var(--sc) 60%, transparent); }
.eq-banner-title { font: italic 600 22px/1.2 var(--font-display); color: var(--text); }
.eq-banner-effect { margin: 12px auto 0; max-width: 420px; font-size: 15px; line-height: 1.45; color: var(--text-dim); }
@keyframes eq-banner {
  0% { opacity: 0; transform: translateY(26px) scale(0.94); }
  22% { opacity: 1; transform: translateY(0) scale(1); }
  78% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-16px) scale(1.03); }
}
@keyframes eq-banner-wash { 0% { opacity: 0; } 25% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }

/* ------------------------------------------------------------------ */
/* Toasts                                                              */
/* ------------------------------------------------------------------ */
body.eq-has-modal #toasts > .eq-toast-stack {
  top: auto;
  bottom: 20px;
  flex-direction: column-reverse;
}
#toasts > .eq-toast-stack {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(100vw - 24px, 480px);
  pointer-events: none;
}
.eq-toast {
  --tk: var(--info);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 10px 18px 10px 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--tk) 45%, var(--panel-border));
  border-left: 4px solid var(--tk);
  background: linear-gradient(90deg, color-mix(in srgb, var(--tk) 16%, transparent), transparent 70%), var(--panel);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
  font: 700 15px/1.3 var(--font-ui);
  color: var(--text);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-12px) scale(0.96);
  transition: opacity 0.28s var(--ease), transform 0.3s var(--ease);
}
.eq-toast.is-in { opacity: 1; transform: none; }
.eq-toast.is-out { opacity: 0; transform: translateY(-8px) scale(0.96); transition-duration: 0.22s; }
.eq-toast.is-pulse { animation: eq-toast-pulse 0.35s var(--ease); }
@keyframes eq-toast-pulse { 40% { transform: scale(1.04); } }
.eq-toast-good { --tk: var(--good); }
.eq-toast-bad { --tk: var(--bad); }
.eq-toast-season { --tk: var(--accent); }
.eq-toast-ico { font-size: 20px; color: var(--tk); }
.eq-toast-dot { width: 9px; height: 9px; margin: 0 5px; border-radius: 50%; background: var(--tk); flex: none; box-shadow: 0 0 10px var(--tk); }
.eq-toast-text { min-width: 0; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */
@media (max-width: 1000px) {
  .eq-tribes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .eq-fields { grid-template-columns: 1fr 1fr; }
  .eq-field-span2 { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .eq-backdrop { padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left); }
  .eq-panel, .eq-setup { border-radius: 0; border-left: none; border-right: none; }
  .eq-tech .eq-panel, .eq-help .eq-panel { width: 100%; height: 100%; max-height: 100%; }
  .eq-menu .eq-panel.eq-menu-panel { padding: 0; }
  .eq-menu .eq-panel.eq-menu-panel > .eq-setup { margin-block: 0; }
  .eq-setup { width: 100%; height: 100%; border-radius: 0; border: none; }
  .eq-setup-head { padding: 10px 12px; }
  .eq-setup-head .eq-title { font-size: 22px; }
  .eq-back { padding: 8px 12px; }
  .eq-setup-spacer { width: 0; }
  .eq-setup-body { padding: 0 14px 14px; }
  .eq-tribes { grid-template-columns: 1fr; gap: 10px; }
  .eq-tribe { padding: 12px; gap: 6px; }
  .eq-tribe-emblem { font-size: 44px; }
  .eq-fields { grid-template-columns: 1fr; gap: 14px; }
  .eq-field-span2 { grid-column: auto; }
  .eq-tribe:not(.is-on) .eq-tribe-lore, .eq-tribe:not(.is-on) .eq-tribe-facts, .eq-tribe:not(.is-on) .eq-tribe-start { display: none; }
  .eq-tribe:not(.is-on) { padding: 10px 12px; }
  .eq-tribe:not(.is-on) .eq-tribe-emblem { font-size: 36px; }
  .eq-field-hint { min-height: 0; }
  .eq-setup-foot { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 14px 10px; }
  .eq-summary { text-align: center; font-size: 13px; }
  .eq-setup-foot .eq-btn { width: 100%; }

  .eq-head { padding: 12px 14px; gap: 10px; }
  .eq-head-emblem { font-size: 34px; }
  .eq-title { font-size: 22px; }
  .eq-ambre-pill { padding: 6px 12px; font-size: 16px; }
  .eq-ambre-pill strong { font-size: 17px; }
  .eq-tree-scroll { padding: 12px 12px 6px; }
  .eq-tree { grid-template-columns: 22px repeat(5, 150px); gap: 26px 10px; min-width: 0; }
  .eq-tier { width: 20px; height: 20px; font-size: 10px; }
  .eq-legend { padding: 10px 14px 12px; gap: 6px 16px; font-size: 12px; }

  .eq-gameover .eq-panel { padding: 22px 14px 18px; border-radius: 0; width: 100%; height: 100%; max-height: 100%; justify-content: center; }
  .eq-gameover-reason { font-size: 15.5px; }
  .eq-table { font-size: 14px; }
  .eq-table td { padding: 8px 6px; }
  .eq-table th { padding: 4px 6px; }
  .eq-th-text { display: none; }
  .eq-state .eq-th-text { display: none; }
  .eq-badge { padding: 4px; font-size: 14px; }
  .eq-who { min-width: 0; }
  .eq-row-emblem { font-size: 30px; margin-right: 8px; }
  .eq-rank { width: 26px; font-size: 15px; }
  .eq-score { font-size: 17px; }

  .eq-help-body { padding: 4px 16px 26px; font-size: 15px; }
  .eq-help-nav { padding: 8px 14px; }
  .eq-help-grid-4 { grid-template-columns: 1fr; }
  .eq-help-table .eq-unit-name { min-width: 0; }
  .eq-help-table th.eq-num, .eq-help-table td.eq-num { padding-left: 3px; padding-right: 3px; }
  .eq-help-table th.eq-num .eq-ico { margin-right: 0; }
  .eq-help-table .eq-th-text { display: none; }
  .eq-unit-tech { display: none; }
  .eq-unit-req { display: block; }
  .eq-cards, .eq-cards tbody { display: block; }
  .eq-cards thead { display: none; }
  .eq-cards tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 10px 12px; margin-bottom: 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); }
  .eq-cards td { display: block; padding: 0; background: none; border-radius: 0; }
  .eq-cards td::before { content: attr(data-l); display: block; font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
  .eq-cards td:first-child, .eq-cards td:last-child { grid-column: 1 / -1; }
  .eq-cards td.eq-num { text-align: left; }
  .eq-help-h { font-size: 22px; }
  .eq-controls { grid-template-columns: 1fr; gap: 2px 0; }
  .eq-controls dd { margin-bottom: 10px; }

  .eq-pause .eq-panel, .eq-confirm .eq-panel { border-radius: 20px; border: 1px solid var(--panel-border); }
  .eq-pause, .eq-confirm { padding: 16px; }
  #toasts > .eq-toast-stack { top: 64px; }
}

@media (max-width: 420px) {
  .eq-menu-nav { width: 100%; }
  .eq-title-view { padding: 20px 20px; }
  .eq-tagline { margin: 14px 0 28px; }
}

@media (max-height: 560px) and (min-width: 721px) {
  .eq-tagline { margin: 10px 0 20px; }
  .eq-glyphs { margin-bottom: 8px; }
  .eq-foot { margin-top: 16px; }
}

/* Phone in landscape: every pixel of height counts, panels become full-height cards. */
@media (max-height: 480px) {
  .eq-backdrop { padding: max(8px, var(--safe-top)) max(12px, var(--safe-right)) max(8px, var(--safe-bottom)) max(12px, var(--safe-left)); }
  .eq-panel { border-radius: 16px; }
  .eq-menu { padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left); }
  .eq-logo { font-size: clamp(34px, 12vh, 64px); }
  .eq-tagline { margin: 8px 0 14px; }
  .eq-glyphs { margin-bottom: 6px; }
  .eq-title-view { padding: 12px 20px; }
  .eq-menu-nav { gap: 8px; }
  .eq-menu-nav .eq-btn-lg { min-height: 46px; padding-block: 8px; font-size: 16px; }
  .eq-foot { margin-top: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .eq-aurora i, .eq-glyph, .eq-logo, .eq-node.is-affordable, .eq-line-active, .eq-confetti-piece { animation: none !important; }
  .eq-confetti { display: none; }
}
