:root {
  color-scheme: dark;
  --bg: #101313;
  --bg-2: #171c1b;
  --panel: #1d2421;
  --panel-2: #252c29;
  --line: #39443f;
  --line-soft: #2d3632;
  --text: #eef1ea;
  --muted: #b8c1b7;
  --dim: #79867e;
  --rust: #bc713f;
  --rust-2: #d5964d;
  --green: #78aa70;
  --green-bg: #1c3528;
  --yellow: #d2bd68;
  --yellow-bg: #38341f;
  --red: #d77868;
  --red-bg: #3a2220;
  --gray: #858b86;
  --steel: #88aab1;
  --focus: #e0bd69;
  --shadow: 0 16px 44px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(16, 19, 19, 0.82), rgba(16, 19, 19, 0.97)),
    radial-gradient(circle at 18% 0%, rgba(136, 170, 177, 0.13), transparent 34rem),
    radial-gradient(circle at 92% 20%, rgba(120, 170, 112, 0.11), transparent 28rem),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="search"],
input[type="number"],
input[type="text"] {
  color: var(--text);
  background: #181712;
  border: 1px solid var(--line);
  border-radius: 6px;
}

button,
select {
  min-height: 36px;
}

button {
  padding: 0 12px;
  cursor: pointer;
}

button:hover,
button:focus-visible,
select:focus-visible,
input:focus-visible {
  border-color: var(--focus);
  outline: 2px solid rgba(224, 177, 90, 0.18);
  outline-offset: 1px;
}

button:disabled {
  cursor: not-allowed;
  color: var(--dim);
}

input[type="search"],
input[type="number"],
input[type="text"] {
  min-height: 36px;
  padding: 0 10px;
}

input[type="range"] {
  accent-color: var(--rust-2);
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: rgba(27, 26, 21, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand-block,
.top-actions,
.profession-head,
.item-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-block strong,
.brand-block small,
.profession-select span,
.language-select span,
.skill-control span,
.xp-controls span {
  display: block;
}

.brand-block small,
.profession-select span,
.xp-controls span,
.module-strip strong,
.panel-title span,
.entry-row small,
.goal-meta,
.empty-line,
.wiki-card .unlock-list {
  color: var(--muted);
}

.brand-mark,
.profession-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--rust);
  border-radius: 6px;
  color: #f8d9a8;
  background: #2b1b13;
  font-weight: 800;
}

.top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.profession-select,
.language-select {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profession-select span,
.language-select span {
  font-size: 12px;
  text-transform: uppercase;
}

.app-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: calc(100vh - 60px);
}

.side-nav {
  position: sticky;
  top: 59px;
  align-self: start;
  height: calc(100vh - 59px);
  overflow: auto;
  padding: 14px 10px;
  background: #171611;
  border-right: 1px solid var(--line);
}

.side-nav button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  margin-bottom: 6px;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  text-align: left;
}

.side-nav button:hover,
.side-nav button.active {
  color: var(--text);
  background: var(--panel);
  border-color: var(--line);
}

.side-nav button.active {
  box-shadow: inset 3px 0 0 var(--rust-2);
}

.main-content {
  min-width: 0;
  padding: 16px;
}

.module-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(34, 32, 25, 0.82);
}

.module-strip span {
  display: block;
  color: var(--rust-2);
  font-weight: 700;
}

.module-strip strong {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  font-weight: 500;
}

.hero-panel {
  position: relative;
  min-height: 260px;
  display: flex;
  align-items: flex-end;
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(9, 9, 7, 0.92) 0%, rgba(9, 9, 7, 0.68) 44%, rgba(9, 9, 7, 0.18) 100%),
    url("../assets/blacksmith-workshop.png") center / cover no-repeat;
  box-shadow: var(--shadow);
}

.hero-copy {
  max-width: 740px;
  padding: 28px;
}

.eyebrow {
  color: var(--rust-2);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(32px, 4vw, 54px);
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 3px;
  font-size: 16px;
  letter-spacing: 0;
}

h4 {
  margin-bottom: 8px;
  color: var(--rust-2);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.entry-group h3,
.minor-heading {
  margin-bottom: 8px;
  color: var(--rust-2);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0;
}

p {
  color: var(--muted);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(34, 32, 25, 0.94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.panel,
.profession-card {
  padding: 14px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.view-grid,
.overview-grid,
.chain-layout,
.two-col,
.resource-grid {
  display: grid;
  gap: 14px;
}

.overview-grid {
  grid-template-columns: minmax(0, 1fr) 310px;
  margin-bottom: 14px;
}

.main-panel {
  min-width: 0;
}

.recommendation-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.recommendation.full {
  padding-right: 8px;
}

.recommendation {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #1b1a15;
}

.recommendation p {
  margin: 4px 0 8px;
}

.recommendation.critical {
  border-color: rgba(213, 106, 92, 0.65);
  background: var(--red-bg);
}

.recommendation.available {
  border-color: rgba(111, 168, 111, 0.55);
  background: var(--green-bg);
}

.recommendation.soon,
.recommendation.warning {
  border-color: rgba(208, 180, 90, 0.55);
  background: var(--yellow-bg);
}

.rec-index {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  color: #14130f;
  background: var(--rust-2);
  font-weight: 800;
}

.stat-stack,
.xp-result,
.entry-list,
.resource-list,
.phase-goals {
  display: grid;
  gap: 8px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}

.stat-row:last-child {
  border-bottom: 0;
}

.stat-row span {
  color: var(--muted);
}

.stat-row strong {
  color: var(--text);
}

.phase-mini {
  margin-top: 14px;
}

.progress-bar {
  height: 9px;
  margin: 10px 0 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #11100d;
  border: 1px solid var(--line-soft);
}

.progress-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--rust-2));
}

.goal-grid,
.profession-grid,
.skills-grid,
.station-grid,
.recipe-list,
.tool-grid,
.book-grid,
.magazine-grid,
.wiki-grid {
  display: grid;
  gap: 12px;
}

.goal-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.profession-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.profession-card {
  display: grid;
  align-content: start;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(34, 32, 25, 0.94);
}

.profession-card p {
  margin: 0;
}

.profession-card.planned {
  opacity: 0.9;
}

.profession-card.next {
  border-color: rgba(208, 180, 90, 0.55);
  background: rgba(48, 43, 28, 0.78);
}

.profession-card button {
  width: fit-content;
}

.profession-source {
  display: block;
  color: var(--muted);
}

.profession-section {
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.profession-section h4 {
  margin: 0 0 6px;
  color: var(--rust-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.profession-section ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.profession-related {
  display: grid;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.profession-related > span {
  color: var(--dim);
  font-size: 12px;
  text-transform: uppercase;
}

.profession-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.profession-tags span {
  padding: 3px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
  background: #191813;
  font-size: 12px;
}

.profession-tags.compact span {
  color: #d8e3d8;
  background: #16231b;
}

.concept-layout {
  display: grid;
  gap: 14px;
}

.concept-lead p {
  max-width: 980px;
  margin-bottom: 14px;
  color: var(--text);
  font-size: 17px;
}

.concept-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.concept-kpis div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #151a18;
}

.concept-kpis span,
.roadmap-row small {
  display: block;
  color: var(--muted);
}

.concept-kpis strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.concept-list,
.roadmap-list,
.completion-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.concept-list,
.roadmap-list {
  padding: 0;
}

.concept-row,
.roadmap-row,
.principle-row {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #151a18;
}

.concept-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.concept-row p,
.roadmap-row p,
.principle-row p {
  margin: 4px 0 0;
}

.roadmap-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
}

.roadmap-index {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  color: #101313;
  background: var(--steel);
  font-weight: 800;
}

.roadmap-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.roadmap-row small {
  margin-top: 6px;
}

.principle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.completion-list {
  padding-left: 22px;
  color: var(--muted);
}

.occupation-layout {
  display: grid;
  gap: 14px;
}

.occupation-lead p {
  max-width: 1060px;
  color: var(--text);
}

.source-link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.source-link-list a {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: #151a18;
  text-decoration: none;
}

.source-link-list a:hover,
.source-link-list a:focus-visible {
  border-color: var(--focus);
  outline: 2px solid rgba(224, 177, 90, 0.18);
  outline-offset: 1px;
}

.occupation-filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(150px, 1fr));
  gap: 8px;
}

.occupation-filter-bar input,
.occupation-filter-bar select {
  width: 100%;
}

.occupation-insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.insight-list,
.role-lens-list,
.skill-boost-list,
.trait-list,
.family-list {
  display: grid;
  gap: 8px;
}

.insight-list div,
.role-lens-list div,
.trait-list div {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #151a18;
}

.insight-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.insight-list span,
.role-lens-list span,
.trait-list small {
  color: var(--muted);
}

.insight-list strong,
.role-lens-list strong,
.trait-list strong {
  overflow-wrap: anywhere;
}

.role-lens-list strong,
.role-lens-list span,
.trait-list strong,
.trait-list small {
  display: block;
}

.role-lens-list span,
.trait-list small {
  margin-top: 3px;
}

.occupation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
}

.occupation-card {
  align-self: start;
}

.occupation-head {
  align-items: flex-start;
}

.occupation-headline {
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 700;
}

.cost-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.cost-positive {
  color: #daf2d7;
  background: var(--green-bg);
  border: 1px solid rgba(111, 168, 111, 0.65);
}

.cost-neutral {
  color: #e0d9ca;
  background: #2d2b25;
  border: 1px solid var(--line);
}

.cost-negative {
  color: #ffd5cf;
  background: var(--red-bg);
  border: 1px solid rgba(213, 106, 92, 0.65);
}

.occupation-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.occupation-metrics div {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #151a18;
}

.occupation-metrics span,
.occupation-metrics strong {
  display: block;
}

.occupation-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.occupation-metrics strong {
  margin-top: 3px;
  color: var(--text);
  font-size: 20px;
}

.occupation-section {
  margin-top: 13px;
}

.occupation-section h3 {
  margin-bottom: 8px;
  color: var(--rust-2);
  font-size: 13px;
  text-transform: uppercase;
}

.skill-boost-list {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.skill-boost-list span,
.family-list span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #151a18;
}

.skill-boost-list strong,
.family-list span {
  overflow-wrap: anywhere;
}

.skill-boost-list em {
  flex: 0 0 auto;
  color: var(--yellow);
  font-style: normal;
  font-weight: 900;
}

.family-list {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.family-list strong {
  color: var(--steel);
}

.occupation-unlocks span {
  border-radius: 6px;
}

.analysis-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.analysis-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 19px;
  color: var(--muted);
}

.phase-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.phase-panel p {
  min-height: 42px;
}

.phase-goal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #1a1914;
}

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

.checkline {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  color: var(--text);
}

.checkline span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.checkline input {
  flex: 0 0 auto;
  accent-color: var(--green);
}

.status-pill,
.soft-badge,
.verify-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-available,
.status-done {
  color: #daf2d7;
  background: var(--green-bg);
  border: 1px solid rgba(111, 168, 111, 0.65);
}

.status-locked {
  color: #ffd5cf;
  background: var(--red-bg);
  border: 1px solid rgba(213, 106, 92, 0.65);
}

.status-planned,
.status-resource,
.status-fuel {
  color: #e0d9ca;
  background: #2d2b25;
  border: 1px solid var(--line);
}

.status-soon {
  color: #fff0b8;
  background: var(--yellow-bg);
  border: 1px solid rgba(208, 180, 90, 0.65);
}

.soft-badge {
  color: #d9d0bf;
  background: #302d25;
  border: 1px solid var(--line-soft);
}

.verify-badge {
  color: #ffeeb5;
  background: #3b3216;
  border: 1px solid rgba(208, 180, 90, 0.64);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.status-border-available {
  border-color: rgba(111, 168, 111, 0.55);
}

.status-border-done {
  border-color: rgba(111, 168, 111, 0.8);
}

.status-border-locked {
  border-color: rgba(213, 106, 92, 0.55);
}

.skills-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.skill-control {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(100px, 1.2fr) 66px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #1a1914;
}

.chain-panel {
  min-height: calc(100vh - 130px);
}

.chain-layout {
  grid-template-columns: minmax(0, 1fr) 310px;
  align-items: start;
}

.chain-scroll {
  overflow: auto;
  min-height: 560px;
  max-height: calc(100vh - 230px);
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #161510;
}

.chain-tree,
.chain-tree ul {
  position: relative;
  margin: 0;
  padding-left: 32px;
  list-style: none;
}

.chain-tree {
  padding-left: 0;
}

.chain-tree ul::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 14px;
  left: 13px;
  width: 1px;
  background: var(--line);
}

.chain-tree li {
  position: relative;
  margin: 9px 0;
}

.chain-tree ul li::before {
  content: "";
  position: absolute;
  top: 22px;
  left: -18px;
  width: 18px;
  height: 1px;
  background: var(--line);
}

.chain-node {
  display: inline-flex;
  align-items: center;
  max-width: min(520px, 78vw);
  min-height: 44px;
  gap: 9px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #242119;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
  cursor: default;
}

.chain-node span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.chain-profession {
  flex: 0 0 auto;
  padding: 2px 6px;
  border: 1px solid rgba(217, 177, 90, 0.45);
  border-radius: 999px;
  color: var(--yellow);
  background: rgba(217, 177, 90, 0.09);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.035em;
  line-height: 1.4;
  text-transform: uppercase;
}

.chain-node em {
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border-radius: 50%;
  color: #17130d;
  background: var(--yellow);
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}

.chain-done {
  border-color: rgba(111, 168, 111, 0.75);
  background: #203225;
}

.chain-available {
  border-color: rgba(111, 168, 111, 0.55);
}

.chain-locked {
  border-color: rgba(213, 106, 92, 0.72);
  background: #2e1c18;
}

.chain-resource,
.chain-fuel {
  border-color: rgba(127, 154, 160, 0.52);
  background: #1b2424;
}

.chain-inspector {
  position: sticky;
  top: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1a1914;
  overflow-wrap: anywhere;
}

.chain-inspector ul {
  margin-bottom: 0;
  padding-left: 18px;
  color: var(--muted);
}

.hover-card {
  position: fixed;
  z-index: 50;
  width: min(300px, calc(100vw - 28px));
  padding: 10px 12px;
  border: 1px solid var(--focus);
  border-radius: 7px;
  background: #15130f;
  box-shadow: var(--shadow);
  pointer-events: none;
}

.hover-card strong,
.hover-card small {
  display: block;
}

.hover-card small {
  margin-top: 4px;
  color: var(--muted);
}

.station-grid,
.book-grid,
.magazine-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.recipe-list {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  margin-top: 12px;
}

.recipe-card,
.station-card,
.book-card,
.magazine-card,
.wiki-card {
  align-self: start;
}

.item-head {
  align-items: flex-start;
  margin-bottom: 12px;
}

.item-head h2 {
  overflow-wrap: anywhere;
}

.icon-frame {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #12110e;
}

.icon-frame img {
  max-width: 38px;
  max-height: 38px;
  image-rendering: auto;
}

.icon-fallback {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.requirement-grid {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}

.requirement-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border-radius: 6px;
  background: #1b1a15;
}

.requirement-row small {
  color: var(--muted);
  text-align: right;
}

.requirement-row.ok .req-state {
  color: var(--green);
}

.requirement-row.missing .req-state {
  color: var(--red);
}

.entry-group {
  margin-top: 12px;
}

.entry-row {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 9px;
  padding: 7px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #1a1914;
}

.entry-row strong,
.entry-row small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.entry-row .icon-frame {
  width: 32px;
  height: 32px;
}

.entry-row .icon-frame img {
  max-width: 29px;
  max-height: 29px;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.recipe-meta {
  display: grid;
  gap: 6px;
  margin: 10px 0;
  color: var(--muted);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.filter-bar,
.xp-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(4, minmax(150px, 1fr));
  gap: 8px;
}

.filter-bar input,
.filter-bar select,
.xp-controls input,
.xp-controls select {
  width: 100%;
}

.tool-grid {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.tool-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #1a1914;
}

.book-card.current {
  border-color: var(--yellow);
}

.unlock-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.unlock-list span {
  padding: 3px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
  background: #191813;
  font-size: 12px;
}

.resource-grid,
.wiki-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.xp-controls {
  grid-template-columns: minmax(260px, 1fr) 130px 130px;
  margin-bottom: 14px;
}

.xp-controls label {
  display: grid;
  gap: 4px;
}

.small-button,
.tiny-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.tiny-button {
  min-height: 26px;
  padding: 0 8px;
  font-size: 12px;
}

.empty-line {
  padding: 8px 0;
}

.deep-hero {
  margin-bottom: 12px;
}

.deep-filter-bar {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) minmax(200px, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.deep-filter-bar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.deep-section-intro {
  margin: 20px 0 10px;
}

.deep-section-intro h2,
.deep-section-intro p {
  margin: 0 0 4px;
}

.deep-section-intro p {
  color: var(--muted);
}

.deep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 350px), 1fr));
  gap: 12px;
}

.deep-card {
  min-width: 0;
}

.deep-card dl {
  display: grid;
  gap: 0;
  margin: 12px 0;
}

.deep-card dl > div {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1.4fr);
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
}

.deep-card dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.deep-card dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.deep-nested {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
}

.deep-map {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.deep-map span {
  padding: 2px 5px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
}

.deep-empty {
  color: var(--muted);
  font-style: italic;
}

.deep-source {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.deep-limit {
  margin-top: 12px;
}

.source-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 10px;
}

.source-meta span {
  display: inline-flex;
  gap: 4px;
  padding: 3px 6px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  overflow-wrap: anywhere;
}

.source-meta strong {
  color: var(--text);
}

.source-meta .source-path {
  flex-basis: 100%;
}

.profile-select {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-select span,
.profile-name-field span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  max-width: 220px;
  padding: 5px 9px;
  color: var(--muted);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.2;
}

.save-status > span {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--gray);
}

.save-status-saved > span {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(120, 170, 112, 0.12);
}

.save-status-session > span {
  background: var(--yellow);
}

.save-status-error {
  color: #f1b1a5;
  border-color: rgba(215, 120, 104, 0.55);
}

.save-status-error > span {
  background: var(--red);
}

.primary-action {
  color: #17130c;
  background: var(--focus);
  border-color: var(--focus);
  font-weight: 700;
}

.storage-notice {
  position: fixed;
  z-index: 80;
  right: 18px;
  bottom: 18px;
  left: 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  width: min(920px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 18px;
  background: rgba(29, 36, 33, 0.98);
  border: 1px solid var(--focus);
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
}

.storage-notice h2,
.profile-dialog h2 {
  margin: 3px 0 8px;
}

.storage-notice p,
.profile-dialog p {
  max-width: 68ch;
  margin: 0 0 9px;
  color: var(--muted);
}

.storage-notice a,
.profile-dialog a {
  color: var(--focus);
}

.storage-warning {
  color: #f1b1a5 !important;
}

.storage-notice-actions,
.profile-dialog-actions,
.profile-dialog-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.storage-notice-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.profile-dialog {
  width: min(680px, calc(100vw - 28px));
  max-height: calc(100vh - 32px);
  padding: 22px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.72);
}

.profile-dialog::backdrop {
  background: rgba(4, 6, 6, 0.78);
  backdrop-filter: blur(3px);
}

.profile-dialog-head,
.profile-dialog-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.icon-button {
  min-width: 38px;
  padding: 0;
  font-size: 24px;
}

.profile-name-field {
  display: grid;
  gap: 6px;
  margin: 18px 0 10px;
}

.profile-name-field input {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
}

.storage-mode-card,
.profile-danger-zone {
  margin-top: 18px;
  padding: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.profile-danger-zone {
  border-color: rgba(215, 120, 104, 0.45);
}

.profile-danger-zone button {
  color: #f1b1a5;
  border-color: rgba(215, 120, 104, 0.55);
}

.profile-dialog-footer {
  align-items: center;
  margin-top: 20px;
}

@media (max-width: 1100px) {
  .overview-grid,
  .chain-layout,
  .phase-layout,
  .two-col {
    grid-template-columns: 1fr;
  }

  .chain-inspector {
    position: static;
  }

  .filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .occupation-insight-grid,
  .analysis-columns {
    grid-template-columns: 1fr;
  }

  .occupation-filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .profile-select,
  .profession-select {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
    gap: 4px;
  }

  .profile-select select,
  .profession-select select {
    width: 100%;
  }

  .save-status {
    max-width: none;
  }

  .storage-notice {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .storage-notice-actions {
    justify-content: stretch;
  }

  .storage-notice-actions button {
    flex: 1 1 220px;
  }

  .profile-dialog-actions,
  .profile-dialog-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .app-layout {
    grid-template-columns: 1fr;
  }

  .side-nav {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-nav button {
    margin: 0;
  }

  .main-content {
    padding: 10px;
  }

  .hero-panel {
    min-height: 220px;
  }

  .hero-copy {
    padding: 18px;
  }

  .phase-goal,
  .concept-row,
  .skill-control,
  .requirement-row {
    grid-template-columns: 1fr;
  }

  .requirement-row small {
    text-align: left;
  }

  .filter-bar,
  .occupation-filter-bar,
  .deep-filter-bar,
  .xp-controls {
    grid-template-columns: 1fr;
  }

  .occupation-grid,
  .deep-grid,
  .recipe-list {
    grid-template-columns: 1fr;
  }

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

  .deep-card dl > div {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .insight-list div,
  .skill-boost-list span,
  .family-list span {
    align-items: flex-start;
    flex-direction: column;
  }
}
