:root {
  color-scheme: dark;
  --bg: #121214;
  --bg-deep: #0b0b0d;
  --surface: #1a1a1e;
  --surface-2: #222228;
  --surface-3: #2a2a31;
  --line: rgba(238, 233, 220, 0.11);
  --line-strong: rgba(212, 175, 55, 0.42);
  --gold: #d4af37;
  --gold-light: #efd77b;
  --gold-dark: #8f7424;
  --cream: #eee9dc;
  --muted: #aaa69c;
  --muted-2: #77746d;
  --red: #8a201c;
  --red-light: #d76556;
  --green: #65a979;
  --blue: #7099c8;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  --radius: 18px;
  --radius-sm: 12px;
  --transition: 160ms ease;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--cream);
  background:
    radial-gradient(circle at 14% 0%, rgba(212, 175, 55, 0.09), transparent 32rem),
    radial-gradient(circle at 86% 100%, rgba(138, 32, 28, 0.08), transparent 30rem),
    var(--bg);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3,
strong {
  letter-spacing: -0.02em;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.noscript {
  padding: 1rem;
  color: #fff;
  background: #8a201c;
  text-align: center;
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(480px, 2.2fr) auto;
  align-items: center;
  gap: 1rem;
  min-height: 74px;
  padding: 0.75rem clamp(1rem, 2.2vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(18, 18, 20, 0.9);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  color: var(--gold-light);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.13rem;
  font-weight: 700;
}

.brand small {
  margin-top: 0.12rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-mark {
  position: relative;
  width: 42px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: linear-gradient(145deg, #28282e, #17171a);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.018);
}

.brand-mark::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 7px;
  width: 13px;
  height: 6px;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  background: #202025;
}

.brand-lens {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 19px;
  height: 19px;
  border: 3px solid var(--gold-dark);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #566b75 0 10%, #18252c 20%, #080b0d 62%, #000 100%);
  transform: translate(-50%, -50%);
}

.resource-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.018);
}

.resource {
  min-width: 0;
  padding: 0.55rem 0.8rem;
  border-left: 1px solid var(--line);
}

.resource:first-child {
  border-left: 0;
}

.resource-label {
  display: block;
  margin-bottom: 0.12rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.67rem;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.resource strong {
  display: block;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-main strong {
  color: var(--gold-light);
}

.topbar-actions {
  display: flex;
  gap: 0.5rem;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), transform var(--transition);
}

.icon-button:hover {
  border-color: var(--line-strong);
  color: var(--gold-light);
  transform: translateY(-1px);
}

.game-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(360px, 1.45fr) minmax(320px, 1.05fr);
  gap: 1rem;
  width: min(1720px, 100%);
  margin: 0 auto;
  padding: 1rem clamp(0.75rem, 1.5vw, 1.5rem);
  flex: 1;
}

.panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(34, 34, 40, 0.94), rgba(24, 24, 28, 0.96));
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.2rem;
  border-bottom: 1px solid var(--line);
}

.panel-heading h1,
.panel-heading h2 {
  margin: 0.18rem 0 0;
  font-family: Georgia, "Times New Roman", serif;
}

.panel-heading h1 {
  font-size: clamp(1.35rem, 2vw, 1.8rem);
}

.panel-heading h2 {
  font-size: 1.45rem;
}

.eyebrow {
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.era-chip {
  flex: 0 0 auto;
  padding: 0.38rem 0.58rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.08);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.capture-panel {
  display: flex;
  flex-direction: column;
}

.camera-stage {
  position: relative;
  display: flex;
  min-height: 400px;
  padding: 1.35rem;
  align-items: center;
  justify-content: center;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 48%, rgba(212, 175, 55, 0.16), transparent 33%),
    linear-gradient(160deg, #1c1a17 0%, #0e0e10 75%);
}

.camera-stage::before,
.camera-stage::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
}

.camera-stage::before {
  inset: 1.2rem;
  border: 1px solid rgba(212, 175, 55, 0.12);
  border-radius: 50% 50% 42% 42%;
  opacity: 0.7;
}

.camera-stage::after {
  right: 12%;
  bottom: 7%;
  left: 12%;
  height: 17%;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  filter: blur(22px);
}

.stage-grain {
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: 0.11;
  background-image: url("../assets/grain.svg");
  background-size: 180px;
  mix-blend-mode: screen;
  pointer-events: none;
}

.camera-name {
  position: absolute;
  z-index: 2;
  top: 1.15rem;
  left: 1.25rem;
  max-width: calc(100% - 2.5rem);
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
  font-style: italic;
}

.capture-button {
  position: relative;
  z-index: 2;
  display: flex;
  width: min(260px, 82%);
  aspect-ratio: 1 / 1;
  padding: 1.5rem;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.45rem;
  border: 1px solid rgba(212, 175, 55, 0.48);
  border-radius: 50%;
  color: var(--cream);
  background:
    radial-gradient(circle at 48% 40%, #333036 0%, #202024 47%, #0b0b0d 100%);
  box-shadow:
    inset 0 0 0 8px rgba(0, 0, 0, 0.28),
    inset 0 0 0 10px rgba(212, 175, 55, 0.16),
    0 22px 45px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 80ms ease, box-shadow var(--transition), border-color var(--transition);
}

.capture-button:hover {
  border-color: var(--gold-light);
  box-shadow:
    inset 0 0 0 8px rgba(0, 0, 0, 0.24),
    inset 0 0 0 10px rgba(212, 175, 55, 0.24),
    0 25px 60px rgba(0, 0, 0, 0.48),
    0 0 35px rgba(212, 175, 55, 0.1);
}

.capture-button:active,
.capture-button.is-clicked {
  transform: scale(0.96);
}

.capture-button-ring {
  position: absolute;
  inset: 12px;
  border: 1px dashed rgba(212, 175, 55, 0.24);
  border-radius: 50%;
  animation: slow-spin 26s linear infinite;
}

.capture-action {
  color: var(--gold-light);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.capture-button > strong {
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.camera-illustration {
  position: relative;
  display: block;
  width: 116px;
  height: 96px;
  margin-bottom: 0.35rem;
}

.camera-body {
  position: absolute;
  top: 25px;
  left: 8px;
  width: 100px;
  height: 58px;
  border: 2px solid #b89430;
  border-radius: 9px 13px 10px 8px;
  background: linear-gradient(145deg, #4a4032, #171719 62%);
  box-shadow: inset 0 0 0 4px rgba(0, 0, 0, 0.25), 0 10px 18px rgba(0, 0, 0, 0.3);
}

.camera-top {
  position: absolute;
  top: -14px;
  left: 14px;
  width: 40px;
  height: 15px;
  border: 2px solid #b89430;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  background: #282326;
}

.camera-lens {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 40px;
  height: 40px;
  border: 4px solid #9d8330;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 34%, rgba(255,255,255,0.48) 0 5%, transparent 7%),
    radial-gradient(circle, #334a56 0 17%, #12242e 34%, #07090b 68%, #000 100%);
  box-shadow: 0 0 0 3px #171719;
}

.camera-bellows {
  position: absolute;
  top: 15px;
  left: 10px;
  width: 31px;
  height: 30px;
  opacity: 0.65;
  background: repeating-linear-gradient(90deg, #6d5532 0 3px, #282024 3px 6px);
  transform: skewY(-4deg);
}

.instant-event {
  position: absolute;
  z-index: 8;
  top: var(--instant-y, 24%);
  left: var(--instant-x, 68%);
  display: flex;
  width: 104px;
  height: 104px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 1px solid var(--gold-light);
  border-radius: 50%;
  color: #18130a;
  background: radial-gradient(circle, #fff4b8 0%, #d4af37 56%, #8d6d12 100%);
  box-shadow: 0 0 0 7px rgba(212, 175, 55, 0.1), 0 0 42px rgba(212, 175, 55, 0.55);
  cursor: pointer;
  transform: translate(-50%, -50%);
  animation: instant-enter 240ms ease-out, instant-float 1.8s ease-in-out infinite alternate;
}

.instant-event[hidden] {
  display: none;
}

.instant-event strong {
  width: 80%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.82rem;
  line-height: 1;
  text-align: center;
}

.instant-event small {
  margin-top: 0.28rem;
  font-size: 0.68rem;
  font-weight: 800;
}

.instant-event-pulse {
  position: absolute;
  inset: -12px;
  border: 1px solid rgba(239, 215, 123, 0.65);
  border-radius: 50%;
  animation: instant-pulse 1.1s ease-out infinite;
}

.floating-gains {
  position: absolute;
  z-index: 12;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.floating-gain {
  position: absolute;
  left: var(--gain-x, 50%);
  bottom: 25%;
  color: var(--gold-light);
  font-weight: 800;
  text-shadow: 0 2px 12px #000;
  transform: translateX(-50%);
  animation: gain-up 900ms ease-out forwards;
}

.capture-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.capture-metrics > div {
  min-width: 0;
  padding: 0.82rem 0.7rem;
  border-left: 1px solid var(--line);
  text-align: center;
}

.capture-metrics > div:first-child {
  border-left: 0;
}

.capture-metrics span,
.capture-metrics strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.capture-metrics span {
  color: var(--muted);
  font-size: 0.65rem;
  text-transform: uppercase;
}

.capture-metrics strong {
  margin-top: 0.2rem;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.buffs {
  display: flex;
  min-height: 50px;
  padding: 0.65rem 0.9rem;
  align-items: center;
  gap: 0.45rem;
  overflow-x: auto;
}

.buff-chip {
  flex: 0 0 auto;
  padding: 0.36rem 0.55rem;
  border: 1px solid rgba(101, 169, 121, 0.35);
  border-radius: 999px;
  color: #b8e4c3;
  background: rgba(101, 169, 121, 0.1);
  font-size: 0.68rem;
  white-space: nowrap;
}

.buff-chip.lab {
  border-color: rgba(215, 101, 86, 0.4);
  color: #f0b6ad;
  background: rgba(138, 32, 28, 0.17);
}

.buff-empty {
  color: var(--muted-2);
  font-size: 0.72rem;
  font-style: italic;
}

.era-progress-block {
  padding: 0.95rem 1rem 1.1rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.48rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.progress-label strong {
  color: var(--cream);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #0d0d0f;
  box-shadow: inset 0 0 0 1px var(--line);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-light));
  transition: width 280ms ease;
}

.center-panel {
  display: flex;
  min-height: 680px;
  flex-direction: column;
}

.tabs,
.shop-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
}

.tabs {
  min-height: 58px;
  padding: 0 0.7rem;
  align-items: flex-end;
  gap: 0.2rem;
}

.tab-button,
.shop-tab {
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.tab-button {
  position: relative;
  padding: 1.02rem 0.78rem 0.92rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.tab-button::after {
  content: "";
  position: absolute;
  right: 0.7rem;
  bottom: -1px;
  left: 0.7rem;
  height: 2px;
  background: transparent;
}

.tab-button:hover,
.tab-button.active {
  color: var(--cream);
}

.tab-button.active::after {
  background: var(--gold);
}

.tab-content {
  display: none;
  min-height: 0;
  padding: 1rem;
  overflow-y: auto;
  flex: 1;
}

.tab-content.active {
  display: block;
}

.section-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1.05rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.018);
}

.section-intro h2,
.section-intro h3 {
  margin: 0.15rem 0 0.45rem;
  font-family: Georgia, "Times New Roman", serif;
}

.section-intro p {
  max-width: 64ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.section-stat {
  flex: 0 0 auto;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  text-align: right;
}

.section-stat span,
.section-stat strong {
  display: block;
}

.section-stat span {
  color: var(--muted);
  font-size: 0.64rem;
  text-transform: uppercase;
}

.section-stat strong {
  margin-top: 0.18rem;
  color: var(--gold-light);
  font-variant-numeric: tabular-nums;
}

.timeline-list {
  position: relative;
  display: grid;
  gap: 0.7rem;
}

.timeline-list::before {
  content: "";
  position: absolute;
  top: 1.8rem;
  bottom: 1.8rem;
  left: 26px;
  width: 1px;
  background: linear-gradient(var(--gold-dark), var(--line));
}

.timeline-card {
  position: relative;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 0.8rem;
  padding: 0.9rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.018);
}

.timeline-card.current {
  border-color: var(--line-strong);
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.08), rgba(255, 255, 255, 0.018));
}

.timeline-card.locked {
  opacity: 0.58;
}

.timeline-node {
  position: relative;
  z-index: 2;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--gold-light);
  background: var(--surface-2);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.timeline-card.locked .timeline-node {
  color: var(--muted);
  border-color: var(--line);
}

.timeline-copy {
  min-width: 0;
}

.timeline-copy h3 {
  margin: 0 0 0.18rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
}

.timeline-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.timeline-meta {
  text-align: right;
}

.timeline-meta span,
.timeline-meta strong {
  display: block;
}

.timeline-meta span {
  color: var(--muted);
  font-size: 0.65rem;
}

.timeline-meta strong {
  margin-top: 0.18rem;
  color: var(--gold-light);
  font-size: 0.75rem;
}

.history-note {
  margin-top: 1rem;
  padding: 1rem;
  border-left: 3px solid var(--gold-dark);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgba(212, 175, 55, 0.045);
}

.history-note h3 {
  margin-bottom: 0.35rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
}

.history-note p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.lab-shell {
  position: relative;
}

.lab-shell::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -1rem;
  background: radial-gradient(circle at 50% 10%, rgba(138, 32, 28, 0.17), transparent 55%);
}

.lab-status {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid rgba(215, 101, 86, 0.28);
  border-radius: var(--radius-sm);
  background: rgba(87, 16, 14, 0.16);
}

.lab-status.idle {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.lab-status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.lab-status h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
}

.lab-status-time {
  color: #f0b6ad;
  font-variant-numeric: tabular-nums;
  font-size: 0.76rem;
  font-weight: 700;
}

.lab-status p {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.lab-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #0d0d0f;
}

.lab-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #681511, #d76556);
}

.recipe-grid,
.museum-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.recipe-card,
.museum-card {
  display: flex;
  min-height: 155px;
  padding: 0.9rem;
  justify-content: space-between;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.018);
}

.recipe-card:hover,
.museum-card:hover {
  border-color: rgba(212, 175, 55, 0.25);
}

.recipe-card.locked,
.museum-card.locked {
  opacity: 0.5;
}

.card-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
}

.recipe-card h3,
.museum-card h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.95rem;
}

.recipe-card p,
.museum-card p {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.45;
}

.recipe-card small,
.museum-card small {
  color: var(--muted-2);
  font-size: 0.66rem;
}

.recipe-cost {
  color: #f0b6ad;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.card-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin-top: 0.8rem;
}

.prestige-card {
  margin-bottom: 1rem;
  padding: 1.15rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background:
    radial-gradient(circle at 90% 10%, rgba(212, 175, 55, 0.13), transparent 40%),
    rgba(212, 175, 55, 0.035);
}

.prestige-card h2 {
  margin: 0.18rem 0 0.5rem;
  font-family: Georgia, "Times New Roman", serif;
}

.prestige-card p {
  color: var(--muted);
  font-size: 0.79rem;
  line-height: 1.5;
}

.prestige-reward {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.15);
}

.prestige-reward span,
.prestige-reward strong {
  display: block;
}

.prestige-reward span {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
}

.prestige-reward strong {
  margin-top: 0.15rem;
  color: var(--gold-light);
  font-size: 1.25rem;
}

.museum-level {
  display: inline-flex;
  min-width: 26px;
  height: 26px;
  padding: 0 0.35rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--gold-light);
  font-size: 0.68rem;
  font-weight: 800;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.stat-card {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.018);
}

.stat-card span,
.stat-card strong {
  display: block;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.69rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stat-card strong {
  margin-top: 0.32rem;
  color: var(--cream);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.save-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.save-tools h3,
.save-tools p {
  width: 100%;
}

.save-tools h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.save-tools p {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.shop-panel {
  display: flex;
  min-height: 680px;
  flex-direction: column;
}

.shop-heading {
  align-items: center;
}

.buy-modes {
  display: flex;
  padding: 0.18rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #121214;
}

.buy-mode {
  min-width: 34px;
  padding: 0.36rem 0.45rem;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 0.68rem;
  cursor: pointer;
}

.buy-mode.active {
  color: #17130a;
  background: var(--gold);
  font-weight: 800;
}

.shop-tabs {
  min-height: 48px;
}

.shop-tab {
  flex: 1;
  padding: 0.8rem;
  border-right: 1px solid var(--line);
  font-size: 0.75rem;
  font-weight: 700;
}

.shop-tab:last-child {
  border-right: 0;
}

.shop-tab.active {
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.05);
}

.shop-list {
  display: none;
  min-height: 0;
  padding: 0.7rem;
  overflow-y: auto;
  flex: 1;
}

.shop-list.active {
  display: block;
}

.shop-era-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.8rem 0.25rem 0.45rem;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.shop-era-label::after {
  content: "";
  height: 1px;
  background: var(--line);
  flex: 1;
}

.shop-era-label:first-child {
  margin-top: 0.15rem;
}

.shop-item {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
  padding: 0.78rem;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.018);
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.shop-item:hover {
  border-color: rgba(212, 175, 55, 0.28);
  background: rgba(212, 175, 55, 0.025);
}

.shop-item.affordable {
  border-color: rgba(212, 175, 55, 0.36);
}

.shop-item.locked {
  opacity: 0.48;
}

.shop-item.purchased {
  border-color: rgba(101, 169, 121, 0.28);
  background: rgba(101, 169, 121, 0.035);
}

.shop-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--gold-light);
  background: linear-gradient(145deg, var(--surface-3), #151519);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.12rem;
  font-weight: 700;
}

.shop-copy {
  min-width: 0;
}

.shop-copy h3 {
  margin: 0;
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-copy p {
  margin: 0.24rem 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-production {
  display: block;
  margin-top: 0.25rem;
  color: var(--gold-light);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.shop-purchase {
  display: flex;
  min-width: 82px;
  align-items: flex-end;
  flex-direction: column;
  gap: 0.28rem;
}

.shop-owned {
  color: var(--muted);
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
}

.shop-cost {
  color: var(--cream);
  font-size: 0.72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.shop-item.affordable .shop-cost {
  color: var(--gold-light);
}

.shop-buy-button {
  min-width: 78px;
  padding: 0.42rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #111113;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
}

.shop-buy-button:not(:disabled):hover {
  border-color: var(--gold);
  color: #17130a;
  background: var(--gold);
}

.shop-item.upgrade-item {
  grid-template-columns: 46px minmax(0, 1fr) auto;
}

.shop-empty {
  padding: 2rem 1rem;
  color: var(--muted);
  text-align: center;
  font-size: 0.78rem;
  line-height: 1.5;
}

.button {
  display: inline-flex;
  min-height: 38px;
  padding: 0.58rem 0.8rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 0.73rem;
  font-weight: 800;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition), transform var(--transition);
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button-primary {
  border-color: var(--gold);
  color: #17130a;
  background: var(--gold);
}

.button-primary:hover:not(:disabled) {
  background: var(--gold-light);
}

.button-secondary {
  border-color: rgba(215, 101, 86, 0.32);
  color: #f0b6ad;
  background: rgba(138, 32, 28, 0.13);
}

.button-ghost {
  color: var(--muted);
  background: transparent;
}

.button-danger {
  border-color: rgba(215, 101, 86, 0.35);
  color: #f0b6ad;
  background: transparent;
}

.button:disabled {
  opacity: 0.42;
}

.footer {
  display: flex;
  width: min(1720px, 100%);
  margin: 0 auto;
  padding: 0.35rem 1.5rem 0.9rem;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted-2);
  font-size: 0.66rem;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  width: min(360px, calc(100vw - 2rem));
  gap: 0.55rem;
  pointer-events: none;
}

.toast {
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--cream);
  background: rgba(28, 28, 32, 0.97);
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.38);
  font-size: 0.76rem;
  line-height: 1.45;
  animation: toast-in 220ms ease-out;
}

.toast strong {
  display: block;
  margin-bottom: 0.14rem;
  color: var(--gold-light);
}

.modal {
  width: min(520px, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  color: var(--cream);
  background: var(--surface);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.65);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(5px);
}

.modal-card {
  position: relative;
  padding: 1.35rem;
}

.modal-card h2 {
  margin: 0.2rem 2rem 0.75rem 0;
  font-family: Georgia, "Times New Roman", serif;
}

.modal-body {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.modal-body strong {
  color: var(--cream);
}

.modal-actions {
  display: flex;
  margin-top: 1.2rem;
  justify-content: flex-end;
  gap: 0.6rem;
}

.modal-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 1.35rem;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--cream);
  background: rgba(255, 255, 255, 0.045);
}

@keyframes slow-spin {
  to { transform: rotate(360deg); }
}

@keyframes instant-enter {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes instant-float {
  from { margin-top: -4px; }
  to { margin-top: 5px; }
}

@keyframes instant-pulse {
  from { opacity: 0.8; transform: scale(0.8); }
  to { opacity: 0; transform: scale(1.45); }
}

@keyframes gain-up {
  0% { opacity: 0; transform: translate(-50%, 12px) scale(0.82); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -75px) scale(1.08); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: auto 1fr auto;
  }

  .brand small {
    display: none;
  }

  .game-grid {
    grid-template-columns: minmax(260px, 0.85fr) minmax(380px, 1.3fr);
  }

  .shop-panel {
    grid-column: 1 / -1;
    min-height: 520px;
  }

  .shop-list {
    display: none;
  }

  .shop-list.active {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    gap: 0.55rem;
  }

  .shop-era-label {
    grid-column: 1 / -1;
  }

  .shop-item {
    margin-bottom: 0;
  }
}

@media (max-width: 820px) {
  .topbar {
    position: static;
    grid-template-columns: 1fr auto;
  }

  .resource-strip {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

  .capture-panel,
  .center-panel,
  .shop-panel {
    min-height: auto;
  }

  .camera-stage {
    min-height: 360px;
  }

  .center-panel {
    min-height: 620px;
  }

  .shop-list.active {
    grid-template-columns: 1fr;
  }

  .shop-era-label {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 0.75rem;
  }

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

  .resource:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .resource:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .game-grid {
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .panel {
    border-radius: 14px;
  }

  .panel-heading {
    padding: 1rem;
  }

  .camera-stage {
    min-height: 330px;
  }

  .capture-button {
    width: min(235px, 85%);
  }

  .capture-metrics {
    grid-template-columns: 1fr;
  }

  .capture-metrics > div {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    border-left: 0;
    text-align: left;
  }

  .capture-metrics > div:first-child {
    border-top: 0;
  }

  .capture-metrics strong {
    margin-top: 0;
  }

  .tabs {
    overflow-x: auto;
    align-items: stretch;
  }

  .tab-button {
    flex: 0 0 auto;
  }

  .section-intro {
    flex-direction: column;
  }

  .section-stat {
    width: 100%;
    text-align: left;
  }

  .timeline-card {
    grid-template-columns: 34px 1fr;
  }

  .timeline-meta {
    grid-column: 2;
    text-align: left;
  }

  .recipe-grid,
  .museum-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .shop-item {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .shop-purchase {
    grid-column: 1 / -1;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    flex-direction: row;
  }

  .shop-buy-button {
    min-width: 110px;
  }

  .footer {
    padding: 0.2rem 1rem 0.8rem;
    flex-direction: column;
    gap: 0.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.camera-stage.era-analog {
  background:
    radial-gradient(circle at 50% 48%, rgba(220, 220, 210, 0.12), transparent 34%),
    linear-gradient(155deg, #252527 0%, #0c0c0e 76%);
}

.camera-stage.era-analog .camera-body {
  border-color: #aaa69c;
  background: linear-gradient(145deg, #4b4b50, #171719 62%);
}

.camera-stage.era-analog .camera-top,
.camera-stage.era-analog .camera-lens {
  border-color: #aaa69c;
}

.camera-stage.era-analog .camera-bellows {
  opacity: 0.25;
  background: repeating-linear-gradient(90deg, #aaa69c 0 3px, #28282c 3px 6px);
}

.camera-stage.era-digital {
  background:
    radial-gradient(circle at 50% 48%, rgba(112, 153, 200, 0.18), transparent 35%),
    linear-gradient(155deg, #17202a 0%, #090b0e 78%);
}

.camera-stage.era-digital::before {
  border-color: rgba(112, 153, 200, 0.18);
}

.camera-stage.era-digital .capture-button {
  border-color: rgba(112, 153, 200, 0.55);
  box-shadow:
    inset 0 0 0 8px rgba(0, 0, 0, 0.28),
    inset 0 0 0 10px rgba(112, 153, 200, 0.15),
    0 22px 45px rgba(0, 0, 0, 0.4);
}

.camera-stage.era-digital .capture-button-ring {
  border-color: rgba(112, 153, 200, 0.28);
}

.camera-stage.era-digital .camera-body {
  border-color: #7099c8;
  background: linear-gradient(145deg, #344252, #12151a 62%);
}

.camera-stage.era-digital .camera-top,
.camera-stage.era-digital .camera-lens {
  border-color: #7099c8;
}

.camera-stage.era-digital .camera-bellows {
  opacity: 0;
}

@media (min-width: 1181px) {
  .game-grid {
    height: calc(100vh - 102px);
    min-height: 680px;
    max-height: calc(100vh - 102px);
    grid-template-rows: minmax(0, 1fr);
    flex: 0 0 auto;
  }

  .game-grid > .panel {
    height: 100%;
    min-height: 0;
  }
}

/* Chronoclic 1.1 — progression masquée et laboratoire avancé */

.buffs {
  flex-wrap: wrap;
  align-content: center;
  overflow-x: hidden;
}

.buff-chip.lab-effect {
  border-color: rgba(215, 101, 86, 0.48);
  color: #ffd0c7;
  background: linear-gradient(135deg, rgba(138, 32, 28, 0.28), rgba(75, 24, 22, 0.22));
  box-shadow: inset 0 0 0 1px rgba(255, 200, 190, 0.04);
}

.buff-chip.artifact-effect {
  border-color: rgba(172, 118, 205, 0.55);
  color: #ead2f7;
  background: linear-gradient(135deg, rgba(91, 49, 113, 0.34), rgba(46, 30, 57, 0.24));
}

.buff-chip.malus {
  border-style: dashed;
  border-color: rgba(236, 104, 85, 0.78);
  color: #ffc3b8;
  background: repeating-linear-gradient(-45deg, rgba(136, 35, 27, 0.3) 0 7px, rgba(78, 24, 22, 0.3) 7px 14px);
}

.buff-chip.instant-effect {
  border-color: rgba(112, 153, 200, 0.55);
  color: #c9e1ff;
  background: rgba(52, 91, 133, 0.23);
}

.process-chip {
  position: relative;
  display: grid;
  width: 100%;
  min-width: 0;
  padding: 0.42rem 0.55rem 0.42rem 1.7rem;
  overflow: hidden;
  border: 1px dashed rgba(212, 175, 55, 0.58);
  border-radius: 7px;
  color: var(--muted);
  background:
    repeating-linear-gradient(-45deg, rgba(212, 175, 55, 0.075) 0 8px, transparent 8px 16px),
    rgba(17, 16, 13, 0.82);
  font-size: 0.66rem;
  line-height: 1.25;
  white-space: normal;
}

.process-chip strong {
  color: var(--gold-light);
  font-size: 0.67rem;
  letter-spacing: 0.02em;
}

.process-chip > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.process-chip-dot {
  position: absolute;
  top: 50%;
  left: 0.6rem;
  width: 9px;
  height: 9px;
  margin-top: -5px;
  border: 2px solid rgba(212, 175, 55, 0.28);
  border-top-color: var(--gold-light);
  border-radius: 50%;
  animation: lab-process-spin 0.9s linear infinite;
}

@keyframes lab-process-spin {
  to { transform: rotate(360deg); }
}

.unknown-era {
  border-style: dashed;
  opacity: 0.68;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.018), rgba(0, 0, 0, 0.08));
}

.unknown-era .timeline-node {
  border-style: dashed;
  color: var(--muted-2);
}

.unknown-era h3,
.unknown-era strong {
  color: var(--muted);
}

.lab-counters {
  display: grid;
  min-width: 126px;
  gap: 0.15rem;
}

.lab-counters span {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.lab-counters strong {
  color: var(--gold-light);
}

.lab-bays {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.lab-bay {
  min-height: 126px;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.018);
}

.lab-bay.processing {
  border-color: rgba(212, 175, 55, 0.55);
  background:
    linear-gradient(135deg, rgba(212, 175, 55, 0.075), transparent 58%),
    rgba(255, 255, 255, 0.018);
}

.lab-bay.idle {
  border-style: dashed;
  opacity: 0.75;
}

.lab-bay-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
}

.lab-bay-top strong {
  color: var(--gold-light);
  font-variant-numeric: tabular-nums;
}

.lab-bay h3 {
  margin: 0 0 0.55rem;
  font-family: var(--serif);
  font-size: 0.95rem;
}

.lab-bay p {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.subsection-heading {
  display: flex;
  margin: 1.15rem 0 0.55rem;
  padding-bottom: 0.45rem;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
}

.subsection-heading h3 {
  margin: 0.08rem 0 0;
  font-family: var(--serif);
  font-size: 1.03rem;
}

.subsection-heading small {
  max-width: 210px;
  color: var(--muted-2);
  font-size: 0.65rem;
  line-height: 1.4;
  text-align: right;
}

.recipe-card.unavailable {
  opacity: 0.78;
}

.recipe-metrics {
  display: flex;
  margin-top: 0.45rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.68rem;
}

.recipe-metrics strong {
  padding: 0.2rem 0.38rem;
  border: 1px solid rgba(236, 104, 85, 0.35);
  border-radius: 999px;
  color: #efac9f;
  background: rgba(138, 32, 28, 0.12);
  font-size: 0.63rem;
}

.lab-upgrade-grid {
  display: grid;
  gap: 0.6rem;
}

.lab-upgrade-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 0.7rem;
  padding: 0.75rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.018);
}

.lab-upgrade-card.maxed {
  border-color: rgba(101, 169, 121, 0.28);
}

.lab-upgrade-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(212, 175, 55, 0.32);
  border-radius: 10px;
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.06);
  font-family: var(--serif);
  font-weight: 800;
}

.lab-upgrade-card h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 0.9rem;
}

.lab-upgrade-card p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.69rem;
  line-height: 1.4;
}

.lab-upgrade-action {
  display: grid;
  justify-items: end;
  gap: 0.35rem;
}

.lab-upgrade-action strong {
  color: var(--gold-light);
  font-size: 0.72rem;
}

.mystery-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 0.7rem;
  margin: 0.2rem 0;
  padding: 0.85rem;
  align-items: center;
  overflow: hidden;
  border: 1px dashed rgba(212, 175, 55, 0.22);
  border-radius: 11px;
  background:
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.018) 0 9px, transparent 9px 18px),
    rgba(255, 255, 255, 0.012);
}

.mystery-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  color: var(--muted-2);
  font-family: var(--serif);
  font-size: 1.1rem;
}

.mystery-card h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 0.92rem;
}

.mystery-card p {
  margin: 0.18rem 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.69rem;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mystery-card strong {
  color: var(--gold);
  font-size: 0.64rem;
}

.shop-mystery-note {
  margin: 0.75rem 0.2rem 0.2rem;
  padding: 0.65rem;
  border: 1px dashed var(--line);
  border-radius: 9px;
  color: var(--muted-2);
  font-size: 0.65rem;
  line-height: 1.45;
  text-align: center;
}

.artifact-label {
  color: #d9b7ec;
}

.artifact-item {
  border-color: rgba(130, 83, 154, 0.3);
  background:
    linear-gradient(135deg, rgba(102, 54, 126, 0.08), transparent 55%),
    var(--panel-2);
}

.artifact-item.owned {
  border-color: rgba(212, 175, 55, 0.42);
}

.artifact-icon {
  border-color: rgba(172, 118, 205, 0.48);
  color: #e7c9f5;
  background: rgba(82, 45, 100, 0.28);
  font-size: 0.72rem;
}

.artifact-effects-copy {
  display: grid;
  gap: 0.3rem;
  margin-top: 0.4rem;
}

.artifact-effects-copy .shop-production {
  display: block;
  padding: 0.35rem 0.42rem;
  border: 1px solid rgba(172, 118, 205, 0.22);
  border-radius: 7px;
  color: #d8c5df;
  background: rgba(82, 45, 100, 0.12);
  line-height: 1.35;
}

.artifact-effects-copy strong {
  color: #e7c9f5;
  font-size: 0.6rem;
  text-transform: uppercase;
}

.artifact-passive-copy {
  border-color: rgba(212, 175, 55, 0.25) !important;
  color: #eadb9c !important;
  background: rgba(212, 175, 55, 0.06) !important;
}

.artifact-button:not(:disabled):hover {
  border-color: rgba(172, 118, 205, 0.7);
  color: #f1ddfa;
}

.artifact-empty {
  min-height: 150px;
  display: grid;
  place-items: center;
  text-align: center;
}

@media (max-width: 820px) {
  .lab-bays {
    grid-template-columns: 1fr;
  }

  .lab-upgrade-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .lab-upgrade-action {
    grid-column: 1 / -1;
    width: 100%;
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .subsection-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .subsection-heading small {
    max-width: none;
    text-align: left;
  }
}

@media (max-width: 560px) {
  .process-chip > span:last-child {
    white-space: normal;
  }

  .mystery-card p {
    white-space: normal;
  }

  .artifact-effects-copy {
    grid-column: 1 / -1;
  }
}

/* ========================================================================== */
/* Chronoclic 1.2 — direction artistique évolutive                           */
/* ========================================================================== */

:root {
  --font-display: "Rye", "Playfair Display", Georgia, serif;
  --font-body: "Playfair Display", Georgia, serif;
  --font-ui: Inter, system-ui, sans-serif;
  --era-accent: #d4af37;
  --era-accent-soft: rgba(212, 175, 55, 0.16);
  --era-accent-line: rgba(212, 175, 55, 0.42);
  --era-ink: #f2ead8;
  --era-muted: #b9ad97;
  --era-panel: #241d16;
  --era-panel-deep: #15110d;
  --era-panel-raised: #30261c;
  --era-shadow: rgba(0, 0, 0, 0.55);
  --era-radius: 12px;
  --era-label-transform: uppercase;
}

html[data-era="pioneers"] {
  --font-display: "Rye", "Playfair Display", Georgia, serif;
  --font-body: "Playfair Display", Georgia, serif;
  --font-ui: Inter, system-ui, sans-serif;
  --era-accent: #d0a653;
  --era-accent-soft: rgba(208, 166, 83, 0.16);
  --era-accent-line: rgba(208, 166, 83, 0.48);
  --era-ink: #f1e4c8;
  --era-muted: #bcae91;
  --era-panel: #2b2118;
  --era-panel-deep: #17110d;
  --era-panel-raised: #38291b;
  --era-shadow: rgba(26, 13, 5, 0.68);
  --era-radius: 11px;
}

html[data-era="analog"] {
  --font-display: "Special Elite", "Courier Prime", monospace;
  --font-body: "Courier Prime", monospace;
  --font-ui: "Courier Prime", monospace;
  --era-accent: #d8584d;
  --era-accent-soft: rgba(216, 88, 77, 0.15);
  --era-accent-line: rgba(216, 88, 77, 0.48);
  --era-ink: #f2eee7;
  --era-muted: #b8aaa5;
  --era-panel: #211a1a;
  --era-panel-deep: #0f0b0c;
  --era-panel-raised: #312323;
  --era-shadow: rgba(0, 0, 0, 0.7);
  --era-radius: 5px;
}

html[data-era="digital"] {
  --font-display: "Space Grotesk", Inter, system-ui, sans-serif;
  --font-body: Inter, system-ui, sans-serif;
  --font-ui: "Space Grotesk", Inter, system-ui, sans-serif;
  --era-accent: #52c9f5;
  --era-accent-soft: rgba(82, 201, 245, 0.14);
  --era-accent-line: rgba(82, 201, 245, 0.45);
  --era-ink: #ecf8ff;
  --era-muted: #94adba;
  --era-panel: #11202a;
  --era-panel-deep: #071017;
  --era-panel-raised: #172d3a;
  --era-shadow: rgba(0, 8, 15, 0.68);
  --era-radius: 14px;
}

html,
body {
  background-color: var(--era-panel-deep);
}

body {
  position: relative;
  color: var(--era-ink);
  font-family: var(--font-body);
  transition: color 600ms ease, background 600ms ease;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -3;
  inset: 0;
  pointer-events: none;
  transition: opacity 700ms ease, background 700ms ease;
}

html[data-era="pioneers"] body {
  background:
    radial-gradient(circle at 18% 8%, rgba(186, 119, 54, 0.22), transparent 34rem),
    radial-gradient(circle at 82% 94%, rgba(92, 48, 22, 0.2), transparent 36rem),
    linear-gradient(135deg, #1c140e 0%, #100c09 55%, #1b120c 100%);
}

html[data-era="pioneers"] body::before {
  opacity: 0.33;
  background:
    repeating-linear-gradient(88deg, rgba(255, 235, 196, 0.018) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(0deg, rgba(56, 26, 9, 0.08) 0 2px, transparent 2px 7px);
  mix-blend-mode: screen;
}

html[data-era="analog"] body {
  background:
    radial-gradient(circle at 14% 15%, rgba(129, 19, 17, 0.28), transparent 31rem),
    radial-gradient(circle at 86% 80%, rgba(71, 11, 14, 0.26), transparent 34rem),
    linear-gradient(145deg, #14090b 0%, #080708 58%, #17090b 100%);
}

html[data-era="analog"] body::before {
  opacity: 0.32;
  background-image:
    linear-gradient(90deg, transparent 0 48%, rgba(255, 255, 255, 0.025) 49% 51%, transparent 52%),
    repeating-linear-gradient(0deg, transparent 0 34px, rgba(202, 57, 48, 0.06) 35px 36px);
  background-size: 80px 100%, 100% 36px;
}

html[data-era="digital"] body {
  background:
    radial-gradient(circle at 17% 4%, rgba(32, 150, 200, 0.22), transparent 34rem),
    radial-gradient(circle at 88% 94%, rgba(28, 86, 126, 0.22), transparent 35rem),
    linear-gradient(145deg, #07131b 0%, #050a0f 55%, #0a1721 100%);
}

html[data-era="digital"] body::before {
  opacity: 0.45;
  background-image:
    linear-gradient(rgba(82, 201, 245, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(82, 201, 245, 0.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

.era-atmosphere {
  position: fixed;
  z-index: -2;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.atmosphere-frame,
.atmosphere-grain,
.atmosphere-grid {
  position: absolute;
  inset: 0;
  transition: opacity 700ms ease, transform 700ms ease;
}

.atmosphere-grain {
  opacity: 0.09;
  background-image: url("../assets/grain.svg");
  background-size: 170px;
  mix-blend-mode: soft-light;
}

html[data-era="pioneers"] .atmosphere-frame {
  inset: 13px;
  border: 1px solid rgba(208, 166, 83, 0.18);
  outline: 5px double rgba(208, 166, 83, 0.055);
  outline-offset: -10px;
  border-radius: 4px;
}

html[data-era="pioneers"] .atmosphere-frame::before,
html[data-era="pioneers"] .atmosphere-frame::after {
  content: "✦";
  position: absolute;
  color: rgba(208, 166, 83, 0.32);
  font-size: 1rem;
}

html[data-era="pioneers"] .atmosphere-frame::before { top: 8px; left: 10px; }
html[data-era="pioneers"] .atmosphere-frame::after { right: 10px; bottom: 8px; }

html[data-era="analog"] .atmosphere-frame {
  top: 0;
  right: 8px;
  bottom: 0;
  left: 8px;
  border-right: 8px dotted rgba(216, 88, 77, 0.1);
  border-left: 8px dotted rgba(216, 88, 77, 0.1);
}

html[data-era="digital"] .atmosphere-grid {
  opacity: 0.55;
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(82, 201, 245, 0.06) 50%, transparent calc(50% + 1px)),
    linear-gradient(transparent calc(50% - 1px), rgba(82, 201, 245, 0.06) 50%, transparent calc(50% + 1px));
}

h1,
h2,
h3,
.brand strong,
.panel-heading h1,
.panel-heading h2,
.camera-name,
.timeline-card h3,
.shop-copy h3,
.recipe-card h3,
.museum-card h3 {
  font-family: var(--font-display);
  letter-spacing: normal;
}

button,
input,
.resource-label,
.eyebrow,
.era-chip,
.tab-button,
.shop-tab,
.buy-mode,
.shop-buy-button,
.button,
.footer,
.shop-era-label {
  font-family: var(--font-ui);
}

.app {
  position: relative;
  z-index: 0;
}

.topbar {
  min-height: 82px;
  border-bottom: 1px solid var(--era-accent-line);
  background: color-mix(in srgb, var(--era-panel-deep) 91%, transparent);
  box-shadow: 0 10px 32px var(--era-shadow);
  backdrop-filter: blur(20px) saturate(1.1);
  transition: background 600ms ease, border-color 600ms ease;
}

html[data-era="pioneers"] .topbar {
  border-bottom: 3px double rgba(208, 166, 83, 0.38);
  background: rgba(27, 19, 13, 0.94);
}

html[data-era="analog"] .topbar {
  border-bottom: 2px solid rgba(216, 88, 77, 0.5);
  background:
    linear-gradient(90deg, rgba(104, 16, 18, 0.14), transparent 35%),
    rgba(12, 9, 10, 0.95);
}

html[data-era="digital"] .topbar {
  border-bottom: 1px solid rgba(82, 201, 245, 0.34);
  background: rgba(6, 15, 22, 0.86);
}

.brand strong {
  color: var(--era-accent);
  font-size: 1.2rem;
  text-shadow: 0 1px 16px var(--era-accent-soft);
}

html[data-era="pioneers"] .brand strong {
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.brand small,
.resource-label,
.eyebrow,
.shop-era-label {
  color: var(--era-muted);
}

.brand-mark {
  border-color: var(--era-accent-line);
  border-radius: calc(var(--era-radius) * 0.7);
  background: linear-gradient(145deg, var(--era-panel-raised), var(--era-panel-deep));
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.025), 0 5px 16px var(--era-shadow);
}

.brand-lens {
  border-color: var(--era-accent);
}

.resource-strip {
  border-color: color-mix(in srgb, var(--era-accent) 22%, transparent);
  border-radius: var(--era-radius);
  background: color-mix(in srgb, var(--era-panel-raised) 58%, transparent);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.03);
}

.resource {
  display: flex;
  min-height: 52px;
  padding: 0.5rem 0.75rem;
  align-items: center;
  gap: 0.62rem;
  border-left-color: color-mix(in srgb, var(--era-accent) 18%, transparent);
}

.resource > iconify-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 auto;
  color: var(--era-accent);
  font-size: 1.25rem;
  opacity: 0.9;
}

.resource-copy {
  min-width: 0;
}

.resource strong,
.resource-main strong {
  color: var(--era-ink);
}

.resource-main strong {
  color: var(--era-accent);
}

.icon-button {
  display: grid;
  border-color: color-mix(in srgb, var(--era-accent) 25%, transparent);
  border-radius: calc(var(--era-radius) * 0.8);
  color: var(--era-muted);
  background: var(--era-panel);
  place-items: center;
}

.icon-button:hover {
  border-color: var(--era-accent);
  color: var(--era-accent);
}

.static-icon-pair {
  position: relative;
  display: grid;
  width: 1.3rem;
  height: 1.3rem;
  place-items: center;
}

.static-icon-pair iconify-icon,
.static-icon-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.static-icon-pair iconify-icon {
  font-size: 1.25rem;
}

.icons-ready .static-icon-fallback {
  opacity: 0;
}

.game-grid {
  gap: clamp(0.75rem, 1.25vw, 1.2rem);
  width: min(1780px, 100%);
  padding-top: 1.2rem;
}

.panel {
  position: relative;
  border: 1px solid var(--era-accent-line);
  border-radius: var(--era-radius);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--era-panel-raised) 90%, black), var(--era-panel));
  box-shadow:
    0 24px 65px var(--era-shadow),
    inset 0 1px rgba(255, 255, 255, 0.035);
  transition: border-color 600ms ease, border-radius 600ms ease, background 600ms ease, box-shadow 600ms ease;
}

.panel::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 5px;
  border: 1px solid color-mix(in srgb, var(--era-accent) 9%, transparent);
  border-radius: calc(var(--era-radius) - 4px);
  pointer-events: none;
}

html[data-era="pioneers"] .panel {
  border: 3px double rgba(208, 166, 83, 0.48);
  background:
    linear-gradient(135deg, rgba(255, 239, 203, 0.022), transparent 24%),
    linear-gradient(180deg, #35271b, #211810 62%, #1b140e);
}

html[data-era="pioneers"] .panel::after {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  opacity: 0.1;
  background: repeating-linear-gradient(93deg, transparent 0 18px, rgba(208, 166, 83, 0.12) 19px, transparent 20px 48px);
  pointer-events: none;
}

html[data-era="analog"] .panel {
  border-color: rgba(216, 88, 77, 0.34);
  background:
    linear-gradient(180deg, rgba(55, 31, 31, 0.94), rgba(20, 14, 15, 0.98));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.62), inset 0 0 35px rgba(117, 17, 20, 0.06);
}

html[data-era="analog"] .panel::before {
  border-style: dashed;
  border-color: rgba(216, 88, 77, 0.12);
}

html[data-era="digital"] .panel {
  border-color: rgba(82, 201, 245, 0.29);
  background:
    linear-gradient(145deg, rgba(24, 51, 66, 0.88), rgba(8, 19, 27, 0.96));
  box-shadow: 0 25px 70px rgba(0, 7, 13, 0.62), inset 0 1px rgba(173, 233, 255, 0.05);
  backdrop-filter: blur(14px);
}

.panel > * {
  position: relative;
  z-index: 2;
}

.panel-heading {
  min-height: 88px;
  padding: 1.25rem 1.35rem 1.1rem;
  border-bottom-color: color-mix(in srgb, var(--era-accent) 22%, transparent);
}

.panel-heading h1,
.panel-heading h2 {
  color: var(--era-ink);
}

.eyebrow {
  color: var(--era-accent);
  letter-spacing: 0.14em;
}

.era-chip {
  border-color: var(--era-accent-line);
  border-radius: calc(var(--era-radius) * 0.8);
  color: var(--era-accent);
  background: var(--era-accent-soft);
}

html[data-era="pioneers"] .era-chip {
  border-style: double;
  border-width: 3px;
}

html[data-era="analog"] .era-chip {
  transform: rotate(-1deg);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.32);
}

html[data-era="digital"] .era-chip {
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}

.camera-stage {
  min-height: 420px;
  border-bottom: 1px solid color-mix(in srgb, var(--era-accent) 20%, transparent);
  background:
    radial-gradient(circle at 50% 48%, var(--era-accent-soft), transparent 33%),
    linear-gradient(160deg, var(--era-panel-raised), var(--era-panel-deep) 76%);
  transition: background 600ms ease;
}

html[data-era="pioneers"] .camera-stage {
  background:
    radial-gradient(ellipse at 50% 46%, rgba(208, 166, 83, 0.24), transparent 31%),
    linear-gradient(90deg, rgba(82, 44, 20, 0.18), transparent 18% 82%, rgba(82, 44, 20, 0.18)),
    linear-gradient(160deg, #2e2015, #100b08 76%);
}

html[data-era="pioneers"] .camera-stage::before {
  inset: 1.4rem;
  border: 3px double rgba(208, 166, 83, 0.2);
  border-radius: 48% 48% 38% 38%;
}

html[data-era="analog"] .camera-stage {
  background:
    radial-gradient(circle at 50% 48%, rgba(202, 43, 40, 0.23), transparent 30%),
    linear-gradient(90deg, transparent 0 6%, rgba(216, 88, 77, 0.07) 6% 7%, transparent 7% 93%, rgba(216, 88, 77, 0.07) 93% 94%, transparent 94%),
    linear-gradient(160deg, #241416, #090708 76%);
}

html[data-era="digital"] .camera-stage {
  background:
    linear-gradient(rgba(82, 201, 245, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(82, 201, 245, 0.055) 1px, transparent 1px),
    radial-gradient(circle at 50% 48%, rgba(82, 201, 245, 0.2), transparent 32%),
    linear-gradient(160deg, #153040, #061019 78%);
  background-size: 24px 24px, 24px 24px, auto, auto;
}

.camera-name {
  color: var(--era-muted);
  font-style: normal;
}

html[data-era="pioneers"] .camera-name {
  padding: 0.32rem 0.6rem;
  border: 1px solid rgba(208, 166, 83, 0.24);
  background: rgba(24, 15, 9, 0.54);
  transform: rotate(-0.7deg);
}

html[data-era="analog"] .camera-name {
  color: #dec5c1;
  font-family: "Special Elite", monospace;
  text-transform: uppercase;
}

html[data-era="digital"] .camera-name {
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.capture-button {
  border-color: var(--era-accent-line);
  color: var(--era-ink);
  background: radial-gradient(circle at 48% 40%, var(--era-panel-raised), var(--era-panel) 48%, var(--era-panel-deep));
  box-shadow:
    inset 0 0 0 8px rgba(0, 0, 0, 0.28),
    inset 0 0 0 10px var(--era-accent-soft),
    0 22px 45px var(--era-shadow);
}

.capture-button:hover {
  border-color: var(--era-accent);
  box-shadow:
    inset 0 0 0 8px rgba(0, 0, 0, 0.24),
    inset 0 0 0 10px var(--era-accent-soft),
    0 26px 62px var(--era-shadow),
    0 0 38px var(--era-accent-soft);
}

.capture-button-ring {
  border-color: color-mix(in srgb, var(--era-accent) 32%, transparent);
}

.capture-action {
  color: var(--era-accent);
  font-family: var(--font-ui);
}

.camera-body,
.camera-top {
  border-color: var(--era-accent);
}

.camera-lens {
  border-color: var(--era-accent);
}

html[data-era="analog"] .capture-button {
  border-radius: 12px;
  transform: rotate(-0.6deg);
}

html[data-era="analog"] .capture-button-ring {
  border-radius: 8px;
  animation: none;
}

html[data-era="digital"] .capture-button {
  border-radius: 28px;
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 14px, 100% calc(100% - 14px), calc(100% - 14px) 100%, 14px 100%, 0 calc(100% - 14px), 0 14px);
}

.capture-metrics {
  background: color-mix(in srgb, var(--era-panel-deep) 52%, transparent);
}

.capture-metrics > div {
  position: relative;
  border-left-color: color-mix(in srgb, var(--era-accent) 20%, transparent);
}

.capture-metrics iconify-icon {
  display: block;
  margin: 0 auto 0.25rem;
  color: var(--era-accent);
  font-size: 1.1rem;
}

.capture-metrics span,
.capture-metrics strong {
  color: var(--era-muted);
}

.capture-metrics strong {
  color: var(--era-ink);
}

.buffs {
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  border-top: 1px solid color-mix(in srgb, var(--era-accent) 16%, transparent);
}

.process-chip {
  border: 1px solid rgba(234, 223, 196, 0.3);
  border-radius: 3px;
  color: #f5edda;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.055) 0 7px, rgba(0, 0, 0, 0.12) 7px 14px),
    #292621;
  box-shadow: inset 4px 0 0 #e0c99a;
}

.process-chip strong {
  color: #f2dfb9;
  font-family: var(--font-ui);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.process-chip-dot {
  border-radius: 2px;
  background: #eee2c8;
  box-shadow: none;
  animation: process-pulse 1.1s steps(2, end) infinite;
}

.buff-chip {
  border-radius: 999px;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.2);
}

.buff-chip.lab-effect {
  border-color: rgba(204, 68, 62, 0.58);
  color: #ffd6d2;
  background: radial-gradient(circle at 15% 50%, rgba(215, 70, 63, 0.22), transparent 55%), rgba(80, 18, 20, 0.5);
}

.buff-chip.artifact-effect {
  border-color: rgba(151, 116, 220, 0.56);
  color: #e5d8ff;
  background: rgba(72, 45, 112, 0.35);
}

.buff-chip.instant-effect {
  border-color: rgba(232, 190, 67, 0.62);
  color: #ffedb1;
  background: rgba(117, 85, 12, 0.34);
}

.buff-chip.malus {
  border-radius: 4px;
  border-color: rgba(236, 87, 79, 0.72);
  color: #ffd5d2;
  background: repeating-linear-gradient(135deg, rgba(205, 43, 38, 0.32) 0 6px, rgba(80, 13, 14, 0.46) 6px 12px);
}

.era-progress-block {
  border-top-color: color-mix(in srgb, var(--era-accent) 18%, transparent);
}

.progress-track,
.lab-progress {
  background: color-mix(in srgb, var(--era-panel-deep) 72%, black);
}

.progress-track > span,
.progress-track span,
.lab-progress span {
  background: linear-gradient(90deg, color-mix(in srgb, var(--era-accent) 68%, black), var(--era-accent));
  box-shadow: 0 0 16px var(--era-accent-soft);
}

.tabs,
.shop-tabs {
  border-bottom-color: color-mix(in srgb, var(--era-accent) 22%, transparent);
  background: color-mix(in srgb, var(--era-panel-deep) 60%, transparent);
}

.tab-button,
.shop-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  color: var(--era-muted);
  background: transparent;
}

.tab-button iconify-icon,
.shop-tab iconify-icon {
  font-size: 1.05rem;
}

.tab-button.active,
.shop-tab.active {
  color: var(--era-accent);
  background: var(--era-accent-soft);
  box-shadow: inset 0 -2px var(--era-accent);
}

html[data-era="pioneers"] .tab-button.active,
html[data-era="pioneers"] .shop-tab.active {
  box-shadow: inset 0 -3px double var(--era-accent);
}

html[data-era="analog"] .tab-button,
html[data-era="analog"] .shop-tab {
  text-transform: uppercase;
}

html[data-era="digital"] .tab-button,
html[data-era="digital"] .shop-tab {
  letter-spacing: 0.02em;
}

.tab-content {
  color: var(--era-ink);
}

.section-intro h2,
.section-intro h3,
.history-note h3,
.prestige-card h2,
.save-tools h3 {
  color: var(--era-ink);
}

.section-intro p,
.history-note p,
.timeline-card p,
.prestige-card p,
.save-tools p,
.museum-card p,
.recipe-card p,
.lab-upgrade-card p {
  color: var(--era-muted);
}

.section-stat,
.history-note,
.timeline-card,
.recipe-card,
.museum-card,
.prestige-card,
.stat-card,
.save-tools,
.lab-status,
.lab-bay,
.lab-upgrade-card {
  border-color: color-mix(in srgb, var(--era-accent) 22%, transparent);
  border-radius: calc(var(--era-radius) * 0.9);
  background: color-mix(in srgb, var(--era-panel-raised) 62%, transparent);
}

.timeline-card.current {
  border-color: var(--era-accent-line);
  background: linear-gradient(90deg, var(--era-accent-soft), color-mix(in srgb, var(--era-panel-raised) 62%, transparent));
}

.timeline-node {
  border-color: var(--era-accent-line);
  color: var(--era-accent);
  background: var(--era-panel-deep);
}

.timeline-node .icon-shell {
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}

.timeline-node .icon-shell iconify-icon {
  font-size: 1.25rem;
}

.unknown-era .timeline-node {
  color: var(--era-muted);
}

.recipe-card-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: start;
  gap: 0.75rem;
}

.recipe-icon {
  width: 42px;
  height: 42px;
}

.lab-bay.processing {
  border: 1px dashed rgba(235, 223, 194, 0.42);
  border-radius: 4px;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 8px, rgba(0, 0, 0, 0.08) 8px 16px),
    #292420;
  box-shadow: inset 5px 0 0 #d9c49a;
}

.lab-bay.processing h3,
.lab-bay.processing .lab-bay-top strong {
  color: #f1dfbd;
}

.recipe-metrics {
  border-top-color: color-mix(in srgb, var(--era-accent) 18%, transparent);
  border-bottom-color: color-mix(in srgb, var(--era-accent) 18%, transparent);
}

.recipe-metrics strong {
  color: #e78b80;
}

.buy-modes {
  border-color: color-mix(in srgb, var(--era-accent) 22%, transparent);
  border-radius: calc(var(--era-radius) * 0.7);
  background: var(--era-panel-deep);
}

.buy-mode {
  color: var(--era-muted);
}

.buy-mode.active {
  color: var(--era-panel-deep);
  background: var(--era-accent);
}

.shop-era-label {
  color: var(--era-accent);
}

.shop-era-label::after {
  background: color-mix(in srgb, var(--era-accent) 24%, transparent);
}

.shop-item {
  border-color: color-mix(in srgb, var(--era-accent) 19%, transparent);
  border-radius: calc(var(--era-radius) * 0.8);
  background: color-mix(in srgb, var(--era-panel-raised) 58%, transparent);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

.shop-item:hover {
  border-color: var(--era-accent-line);
  background: color-mix(in srgb, var(--era-accent) 6%, var(--era-panel-raised));
}

.shop-item.affordable {
  border-color: var(--era-accent-line);
  box-shadow: inset 3px 0 var(--era-accent), inset 0 1px rgba(255, 255, 255, 0.03);
}

html[data-era="pioneers"] .shop-item {
  border-style: double;
  border-width: 3px;
  background:
    linear-gradient(135deg, rgba(239, 215, 172, 0.025), transparent 40%),
    rgba(54, 39, 25, 0.72);
}

html[data-era="analog"] .shop-item {
  border-color: rgba(230, 223, 213, 0.22);
  background:
    linear-gradient(90deg, rgba(216, 88, 77, 0.07), transparent 28%),
    rgba(20, 17, 17, 0.82);
  box-shadow: inset 5px 0 rgba(216, 88, 77, 0.12);
}

html[data-era="digital"] .shop-item {
  background: rgba(16, 39, 52, 0.72);
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}

.shop-copy h3 {
  color: var(--era-ink);
}

.shop-copy p,
.shop-owned {
  color: var(--era-muted);
}

.shop-production,
.shop-item.affordable .shop-cost {
  color: var(--era-accent);
}

.shop-cost {
  color: var(--era-ink);
}

.shop-buy-button,
.button {
  border-color: color-mix(in srgb, var(--era-accent) 24%, transparent);
  border-radius: calc(var(--era-radius) * 0.62);
  color: var(--era-muted);
  background: var(--era-panel-deep);
}

.shop-buy-button:not(:disabled):hover,
.button-primary,
.button-secondary:hover:not(:disabled) {
  border-color: var(--era-accent);
  color: var(--era-panel-deep);
  background: var(--era-accent);
}

.button-primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

.button-secondary {
  color: var(--era-accent);
  background: var(--era-accent-soft);
}

.button-ghost {
  color: var(--era-muted);
  background: transparent;
}

.icon-shell {
  position: relative;
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--era-accent) 28%, transparent);
  border-radius: calc(var(--era-radius) * 0.72);
  color: var(--era-accent);
  background: linear-gradient(145deg, var(--era-panel-raised), var(--era-panel-deep));
}

.icon-shell iconify-icon,
.icon-shell .icon-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
}

.icon-shell iconify-icon {
  z-index: 2;
  font-size: 1.55rem;
}

.icon-shell .icon-fallback {
  z-index: 1;
  color: var(--era-accent);
  font-family: var(--font-ui);
  font-size: 0.83rem;
  font-weight: 800;
}

.icons-ready .icon-shell .icon-fallback {
  opacity: 0;
}

html[data-era="pioneers"] .icon-shell {
  border-style: double;
  border-width: 3px;
}

html[data-era="analog"] .icon-shell {
  border-radius: 2px;
  transform: rotate(-0.6deg);
}

html[data-era="digital"] .icon-shell {
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}

/* Upgrade workbench -------------------------------------------------------- */

#upgradeShop.shop-list.active {
  display: block;
}

.upgrade-workbench {
  position: sticky;
  z-index: 8;
  top: -0.7rem;
  margin: -0.7rem -0.7rem 0.75rem;
  padding: 0.85rem;
  border-bottom: 1px solid color-mix(in srgb, var(--era-accent) 28%, transparent);
  background: color-mix(in srgb, var(--era-panel-deep) 93%, transparent);
  backdrop-filter: blur(14px);
}

.upgrade-workbench-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
}

.upgrade-workbench-head h3 {
  margin: 0.12rem 0 0;
  color: var(--era-ink);
  font-size: 1.05rem;
}

.upgrade-workbench-head > span {
  color: var(--era-accent);
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 700;
}

.upgrade-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.38rem;
}

.upgrade-filter-button {
  display: flex;
  min-width: 0;
  padding: 0.48rem 0.55rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  border: 1px solid color-mix(in srgb, var(--era-accent) 18%, transparent);
  border-radius: calc(var(--era-radius) * 0.62);
  color: var(--era-muted);
  background: var(--era-panel);
  font-family: var(--font-ui);
  font-size: 0.66rem;
  cursor: pointer;
}

.upgrade-filter-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upgrade-filter-button strong {
  display: grid;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.25rem;
  place-items: center;
  border-radius: 999px;
  color: var(--era-ink);
  background: color-mix(in srgb, var(--era-panel-raised) 84%, black);
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
}

.upgrade-filter-button.active {
  border-color: var(--era-accent-line);
  color: var(--era-accent);
  background: var(--era-accent-soft);
  box-shadow: inset 0 -2px var(--era-accent);
}

.upgrade-filter-button.active strong {
  color: var(--era-panel-deep);
  background: var(--era-accent);
}

.upgrade-era-group + .upgrade-era-group {
  margin-top: 0.8rem;
}

.upgrade-card-list {
  display: grid;
  gap: 0.55rem;
}

.upgrade-card {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--era-accent) 20%, transparent);
  border-radius: calc(var(--era-radius) * 0.8);
  background: color-mix(in srgb, var(--era-panel-raised) 58%, transparent);
  transition: border-color var(--transition), transform var(--transition), background var(--transition);
}

.upgrade-card:hover {
  border-color: var(--era-accent-line);
  transform: translateY(-1px);
}

.upgrade-card.affordable {
  border-color: var(--era-accent-line);
  box-shadow: inset 4px 0 var(--era-accent);
}

.upgrade-card.purchased {
  border-color: rgba(108, 176, 124, 0.34);
  background: rgba(75, 117, 84, 0.08);
}

.upgrade-card-main {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 0.72rem;
  padding: 0.78rem;
  align-items: start;
}

.upgrade-icon {
  width: 48px;
  height: 48px;
}

.upgrade-card-copy {
  min-width: 0;
}

.upgrade-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.55rem;
}

.upgrade-title-row h3 {
  min-width: 0;
  margin: 0;
  color: var(--era-ink);
  font-size: 0.88rem;
  line-height: 1.2;
}

.upgrade-kind {
  flex: 0 0 auto;
  padding: 0.18rem 0.38rem;
  border: 1px solid color-mix(in srgb, var(--era-accent) 24%, transparent);
  border-radius: 999px;
  color: var(--era-accent);
  font-family: var(--font-ui);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.upgrade-card-copy p {
  margin: 0.3rem 0 0;
  color: var(--era-muted);
  font-size: 0.68rem;
  line-height: 1.42;
}

.upgrade-card-action {
  display: flex;
  min-height: 54px;
  padding: 0.55rem 0.72rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  border-top: 1px solid color-mix(in srgb, var(--era-accent) 16%, transparent);
  background: color-mix(in srgb, var(--era-panel-deep) 48%, transparent);
}

.upgrade-card-action > div {
  min-width: 0;
}

.upgrade-card-action span,
.upgrade-card-action strong {
  display: block;
  font-family: var(--font-ui);
}

.upgrade-card-action span {
  color: var(--era-muted);
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.upgrade-card-action strong {
  margin-top: 0.1rem;
  color: var(--era-accent);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.upgrade-card-action .shop-buy-button {
  min-width: 112px;
}

.mastery-track {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.62rem;
}

.mastery-track > strong {
  color: var(--era-accent);
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-variant-numeric: tabular-nums;
}

.mastery-pips {
  display: grid;
  grid-template-columns: repeat(6, minmax(10px, 1fr));
  gap: 0.25rem;
}

.mastery-pip {
  height: 7px;
  border: 1px solid color-mix(in srgb, var(--era-muted) 28%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--era-panel-deep) 78%, black);
}

.mastery-pip.acquired {
  border-color: var(--era-accent);
  background: var(--era-accent);
  box-shadow: 0 0 8px var(--era-accent-soft);
}

.mastery-pip.ready {
  border-color: var(--era-accent);
  background: var(--era-accent-soft);
  animation: mastery-ready 1.3s ease-in-out infinite alternate;
}

@keyframes mastery-ready {
  to { box-shadow: 0 0 12px var(--era-accent); }
}

/* Archive index ----------------------------------------------------------- */

.upgrade-archive {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid color-mix(in srgb, var(--era-accent) 24%, transparent);
  border-radius: calc(var(--era-radius) * 0.9);
  background: color-mix(in srgb, var(--era-panel-deep) 46%, transparent);
}

.upgrade-archive-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.upgrade-archive-head h3 {
  margin: 0.15rem 0 0;
  color: var(--era-ink);
  font-size: 1.05rem;
}

.upgrade-archive-head > strong {
  color: var(--era-accent);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.upgrade-archive-grid {
  display: grid;
  grid-template-columns: repeat(20, minmax(0, 1fr));
  gap: 0.28rem;
}

.upgrade-index {
  display: grid;
  min-width: 0;
  aspect-ratio: 1.1 / 1;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(150, 150, 150, 0.15);
  border-radius: 4px;
  color: #777a7c;
  background: rgba(105, 109, 111, 0.08);
  font-family: var(--font-ui);
  font-size: clamp(0.48rem, 0.62vw, 0.68rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.upgrade-index.acquired {
  border-color: rgba(212, 175, 55, 0.58);
  color: #ffe789;
  background: rgba(212, 175, 55, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 230, 132, 0.08), 0 0 9px rgba(212, 175, 55, 0.08);
}

/* Pieces photographiques -------------------------------------------------- */

.artifact-label {
  color: #c7a6ff;
}

.artifact-item {
  border-color: rgba(151, 116, 220, 0.26);
}

.artifact-item.owned {
  border-color: rgba(151, 116, 220, 0.48);
  background: rgba(92, 58, 139, 0.12);
}

.artifact-icon {
  color: #d5bcff;
  border-color: rgba(151, 116, 220, 0.42);
  background: linear-gradient(145deg, rgba(106, 73, 155, 0.55), var(--era-panel-deep));
}

.artifact-effects-copy .shop-production {
  color: var(--era-muted);
}

.artifact-effects-copy strong {
  color: #d5bcff;
}

.modal-card,
.toast {
  border-color: var(--era-accent-line);
  border-radius: var(--era-radius);
  background: linear-gradient(160deg, var(--era-panel-raised), var(--era-panel-deep));
  color: var(--era-ink);
}

.footer {
  color: var(--era-muted);
  font-family: var(--font-ui);
}

@media (max-width: 1480px) {
  .upgrade-archive-grid {
    grid-template-columns: repeat(16, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .game-grid {
    grid-template-columns: minmax(270px, 0.88fr) minmax(390px, 1.3fr);
  }

  .shop-panel {
    min-height: 560px;
  }

  #upgradeShop.shop-list.active {
    display: block;
  }

  .upgrade-card-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .upgrade-archive-grid {
    grid-template-columns: repeat(18, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .topbar {
    min-height: auto;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

  .upgrade-card-list {
    grid-template-columns: 1fr;
  }

  .upgrade-workbench {
    top: 0;
  }

  .upgrade-archive-grid {
    grid-template-columns: repeat(14, minmax(0, 1fr));
  }

  .tab-button span,
  .shop-tab span {
    display: inline;
  }
}

@media (max-width: 560px) {
  .resource {
    min-height: 48px;
    gap: 0.48rem;
  }

  .resource > iconify-icon {
    font-size: 1.05rem;
  }

  .panel-heading {
    min-height: 78px;
  }

  .camera-stage {
    min-height: 350px;
  }

  .capture-metrics > div {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    align-items: center;
    gap: 0.35rem;
  }

  .capture-metrics iconify-icon {
    margin: 0;
  }

  .upgrade-filters {
    grid-template-columns: 1fr;
  }

  .upgrade-filter-button {
    min-height: 40px;
  }

  .upgrade-title-row {
    display: block;
  }

  .upgrade-kind {
    display: inline-flex;
    margin-top: 0.32rem;
  }

  .upgrade-card-main {
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 0.7rem;
  }

  .upgrade-icon {
    width: 42px;
    height: 42px;
  }

  .upgrade-card-action {
    align-items: stretch;
    flex-direction: column;
  }

  .upgrade-card-action .shop-buy-button {
    width: 100%;
  }

  .upgrade-archive {
    padding: 0.75rem;
  }

  .upgrade-archive-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
  }

  .upgrade-archive-grid {
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 0.22rem;
  }

  .upgrade-index {
    border-radius: 3px;
    font-size: 0.48rem;
  }

  .tab-button,
  .shop-tab {
    gap: 0.3rem;
  }

  .tab-button iconify-icon,
  .shop-tab iconify-icon {
    font-size: 0.95rem;
  }
}
