:root {
  --parchment-50: #faf5e8;
  --parchment-100: #f4edd9;
  --parchment-200: #ebe0c6;
  --parchment-300: #ddd0ae;
  --ink-950: #0b0d12;
  --ink-900: #14171e;
  --ink-800: #1e222c;
  --ink-700: #2a2f3b;
  --ink-600: #3f4452;
  --ink-500: #555b6a;
  --brass-700: #7a5a28;
  --brass-500: #b08840;
  --brass-300: #d9bc80;
  --brass-100: #f0dba8;
  --moon-700: #1f3d44;
  --moon-500: #335e66;
  --moon-300: #62aeba;
  --verdigris: #4b7569;
  --burgundy: #7e2724;
  --oxblood: #4e1717;
  --glass: rgba(10, 13, 18, 0.72);
  --glass-strong: rgba(10, 13, 18, 0.88);
  --vellum: rgba(250, 245, 232, 0.88);
  --vellum-strong: rgba(255, 250, 236, 0.95);
  --ok: #4f7a50;
  --warn: #a87538;
  --err: #98403a;
  --serif: "EB Garamond", "Garamond", "Iowan Old Style", Georgia, serif;
  --sans: "IBM Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", Menlo, Consolas, monospace;
  --content: 1240px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--ink-950);
  color: var(--parchment-50);
  font-family: var(--sans);
  letter-spacing: 0;
  scroll-behavior: auto;
}

body {
  position: relative;
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--parchment-50);
  isolation: isolate;
  background:
    radial-gradient(ellipse at 67% 26%, rgba(62, 174, 186, 0.2), transparent 24%),
    linear-gradient(90deg, rgba(5, 7, 10, 0.78), rgba(7, 9, 12, 0.26) 45%, rgba(5, 7, 10, 0.6)),
    #080a0d;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(7, 8, 11, 0.18), rgba(7, 8, 11, 0.82)),
    image-set(
      url("assets/portal/bg-hall-desktop.avif") type("image/avif"),
      url("assets/portal/bg-hall-desktop.webp") type("image/webp")
    );
  background-position: center;
  background-size: cover;
}

@media (max-width: 768px) {
  body::before {
    background:
      linear-gradient(180deg, rgba(7, 8, 11, 0.18), rgba(7, 8, 11, 0.82)),
      image-set(
        url("assets/portal/bg-hall-mobile.avif") type("image/avif"),
        url("assets/portal/bg-hall-mobile.webp") type("image/webp")
      );
    background-position: center top;
    background-size: cover;
  }
}

body::after {
  z-index: 0;
  opacity: 0.76;
  background:
    radial-gradient(ellipse at 65% 31%, rgba(82, 207, 219, 0.24), transparent 18%),
    linear-gradient(115deg, transparent 0%, rgba(240, 219, 168, 0.06) 47%, transparent 57%),
    linear-gradient(180deg, rgba(7, 8, 11, 0), rgba(7, 8, 11, 0.6));
  animation: portal-breathe 9s ease-in-out infinite;
}

a {
  color: inherit;
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
}

h1 {
  font-size: clamp(2rem, 4vw, 4.6rem);
  line-height: 0.96;
}

h2 {
  font-size: clamp(1.8rem, 3vw, 3.2rem);
  line-height: 1;
}

h3 {
  font-size: 1.22rem;
}

p {
  line-height: 1.58;
}

.portal-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 308px minmax(0, 1fr);
}

.portal-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 20px;
  overflow-y: auto;
  color: var(--parchment-50);
  background:
    linear-gradient(180deg, rgba(8, 10, 14, 0.94), rgba(12, 16, 22, 0.78)),
    linear-gradient(90deg, rgba(217, 188, 128, 0.09), transparent 28%),
    var(--ink-950);
  border-right: 1px solid rgba(217, 188, 128, 0.28);
  box-shadow:
    inset -1px 0 0 rgba(12, 220, 230, 0.1),
    18px 0 50px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--parchment-50);
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.42rem;
  font-weight: 700;
  text-shadow: 0 2px 18px rgba(98, 174, 186, 0.28);
}

.brand img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 0 9px rgba(98, 174, 186, 0.26));
}

.sidebar-deck {
  margin: -8px 0 0;
  color: rgba(250, 245, 232, 0.68);
  font-size: 0.92rem;
}

.portal-nav,
.mobile-nav {
  display: grid;
  gap: 6px;
}

.portal-nav a,
.mobile-nav a {
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid rgba(217, 188, 128, 0.1);
  border-radius: 8px;
  color: rgba(250, 245, 232, 0.78);
  text-decoration: none;
  font-weight: 700;
  background:
    linear-gradient(180deg, rgba(250, 245, 232, 0.035), rgba(250, 245, 232, 0.015)),
    rgba(11, 13, 18, 0.18);
  box-shadow: inset 0 0 0 1px rgba(7, 8, 11, 0.28);
}

.portal-nav a::before,
.mobile-nav a::before {
  content: "";
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border: 1px solid rgba(217, 188, 128, 0.5);
  background: rgba(98, 174, 186, 0.22);
  transform: rotate(45deg);
  box-shadow: 0 0 10px rgba(98, 174, 186, 0.16);
}

.portal-nav a:hover,
.portal-nav a.is-active,
.mobile-nav a.is-active {
  color: var(--parchment-50);
  background:
    linear-gradient(180deg, rgba(217, 188, 128, 0.18), rgba(98, 174, 186, 0.08)),
    rgba(16, 21, 28, 0.64);
  border-color: rgba(217, 188, 128, 0.44);
  box-shadow:
    inset 0 0 0 1px rgba(255, 250, 236, 0.06),
    0 0 18px rgba(98, 174, 186, 0.12);
}

.sidebar-status {
  display: grid;
  gap: 1px;
  margin-top: auto;
  border: 1px solid rgba(217, 188, 128, 0.24);
  border-radius: 9px;
  overflow: hidden;
  background: rgba(217, 188, 128, 0.16);
  box-shadow: 0 0 32px rgba(0, 0, 0, 0.18);
}

.sidebar-status div {
  min-width: 0;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 4px 10px;
  padding: 12px;
  background:
    linear-gradient(90deg, rgba(98, 174, 186, 0.08), transparent),
    rgba(20, 23, 30, 0.82);
}

.sidebar-status div > span:not(.status-dot) {
  grid-column: 2;
  color: rgba(250, 245, 232, 0.62);
  font-size: 0.78rem;
}

.sidebar-status strong {
  grid-column: 2;
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 0.82rem;
}

.sidebar-actions,
.top-actions,
.download-panel,
.community-actions,
.reference-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.portal-main {
  position: relative;
  min-width: 0;
}

.portal-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  min-height: 124px;
  padding: 22px clamp(18px, 3vw, 38px);
  background:
    linear-gradient(180deg, rgba(8, 10, 14, 0.9), rgba(8, 10, 14, 0.72)),
    linear-gradient(90deg, rgba(98, 174, 186, 0.1), transparent 64%);
  border-bottom: 1px solid rgba(217, 188, 128, 0.22);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(16px);
}

.route-heading {
  min-width: 0;
}

.route-heading p:not(.eyebrow) {
  max-width: 780px;
  margin: 10px 0 0;
  color: rgba(250, 245, 232, 0.68);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brass-300);
  font-family: var(--mono);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.mobile-nav {
  display: none;
}

.portal-view {
  width: min(var(--content), calc(100% - 36px));
  min-height: calc(100vh - 178px);
  margin: 0 auto;
  padding: 32px 0 54px;
}

.portal-view[hidden] {
  display: none !important;
}

.portal-section {
  margin-top: 26px;
}

.portal-section:first-child {
  margin-top: 0;
}

.section-heading {
  max-width: 820px;
}

.section-heading.compact {
  max-width: none;
}

.section-heading p:not(.eyebrow) {
  margin: 18px 0 0;
  color: rgba(250, 245, 232, 0.72);
  font-size: 1.04rem;
}

.world-banner {
  position: relative;
  min-height: clamp(390px, 56vh, 620px);
  display: flex;
  align-items: end;
  padding: clamp(24px, 4vw, 42px);
  overflow: hidden;
  color: var(--parchment-50);
  background:
    radial-gradient(ellipse at 66% 32%, rgba(98, 174, 186, 0.28), transparent 28%),
    linear-gradient(90deg, rgba(5, 7, 10, 0.96), rgba(8, 10, 14, 0.5) 58%, rgba(8, 10, 14, 0.16)),
    linear-gradient(0deg, rgba(8, 10, 14, 0.94), rgba(8, 10, 14, 0.08) 62%),
    image-set(
      url("assets/portal/bg-hall-desktop.avif") type("image/avif"),
      url("assets/portal/bg-hall-desktop.webp") type("image/webp")
    );
  background-position: center;
  background-size: cover;
  border: 1px solid rgba(217, 188, 128, 0.28);
  border-radius: 10px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 250, 236, 0.06),
    inset 0 -80px 130px rgba(7, 8, 11, 0.62),
    0 28px 90px rgba(0, 0, 0, 0.26);
}

.world-banner::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(217, 188, 128, 0.16);
  border-radius: 8px;
  pointer-events: none;
}

.world-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.72;
  background:
    linear-gradient(115deg, transparent 0%, rgba(217, 188, 128, 0.08) 46%, transparent 56%),
    radial-gradient(ellipse at 67% 30%, rgba(82, 207, 219, 0.22), transparent 20%);
  pointer-events: none;
  animation: portal-glint 12s ease-in-out infinite;
}

.world-banner > div {
  position: relative;
  z-index: 1;
  max-width: 760px;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.62);
}

.world-banner p:not(.eyebrow) {
  max-width: 720px;
  margin: 18px 0 0;
  color: rgba(250, 245, 232, 0.82);
  font-family: var(--serif);
  font-size: clamp(1.12rem, 2vw, 1.48rem);
}

.status-grid,
.flow,
.feature-grid,
.metric-strip,
.craft-grid,
.mcp-grid,
.feed {
  display: grid;
  gap: 14px;
}

.status-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.status-tile,
.flow article,
.feature-grid article,
.metric,
.craft-grid article,
.craft-card,
.mcp-grid article,
.feed article {
  position: relative;
  min-width: 0;
  border: 1px solid rgba(217, 188, 128, 0.3);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 250, 236, 0.94), rgba(235, 224, 198, 0.88)),
    url("assets/launcher/parchment-tile.png");
  background-size: auto, 420px 420px;
  box-shadow:
    inset 0 0 0 1px rgba(122, 90, 40, 0.08),
    0 12px 34px rgba(0, 0, 0, 0.16);
}

.status-tile {
  min-height: 104px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  color: var(--ink-900);
}

.status-tile p {
  margin: 0 0 6px;
  color: var(--ink-500);
  font-size: 0.82rem;
}

.status-tile strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 0.92rem;
}

.status-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  align-self: center;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 5px rgba(168, 117, 56, 0.16);
}

.status-dot.ok {
  background: var(--ok);
  box-shadow: 0 0 0 5px rgba(79, 122, 80, 0.18);
}

.status-dot.err {
  background: var(--err);
  box-shadow: 0 0 0 5px rgba(152, 64, 58, 0.18);
}

.metric-strip {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.metric {
  min-height: 108px;
  padding: 18px;
  color: var(--ink-900);
}

.metric strong,
.feature-grid strong,
.craft-grid strong,
.mcp-grid strong {
  display: block;
  color: var(--ink-700);
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.metric span {
  display: block;
  margin-top: 12px;
  font-family: var(--serif);
  font-size: clamp(1.9rem, 3vw, 3.1rem);
  line-height: 0.92;
}

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

.feature-grid article,
.craft-grid article,
.craft-card,
.mcp-grid article,
.feed article {
  padding: 20px;
  color: var(--ink-900);
}

.feature-grid p,
.craft-grid p,
.mcp-grid p,
.flow p,
.feed p {
  margin: 10px 0 0;
  color: var(--ink-600);
  line-height: 1.52;
}

.intro-band,
.community-panel,
.assistant-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.52fr);
  gap: 28px;
  align-items: start;
  padding: clamp(24px, 3vw, 36px);
  color: var(--parchment-50);
  background:
    radial-gradient(ellipse at 78% 22%, rgba(98, 174, 186, 0.18), transparent 32%),
    linear-gradient(90deg, rgba(8, 10, 14, 0.95), rgba(8, 10, 14, 0.62) 66%, rgba(8, 10, 14, 0.38)),
    var(--ink-900);
  border-radius: 10px;
}

.media-band,
.news-surface {
  padding: clamp(24px, 3vw, 36px);
  color: var(--parchment-50);
  background:
    radial-gradient(ellipse at 78% 22%, rgba(98, 174, 186, 0.18), transparent 32%),
    linear-gradient(90deg, rgba(8, 10, 14, 0.95), rgba(8, 10, 14, 0.62) 66%, rgba(8, 10, 14, 0.38)),
    var(--ink-900);
  border-radius: 10px;
}

.section-art {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(6, 8, 11, 0.94), rgba(6, 8, 11, 0.66) 58%, rgba(6, 8, 11, 0.34)),
    linear-gradient(0deg, rgba(6, 8, 11, 0.82), rgba(6, 8, 11, 0.1)),
    var(--section-art-image),
    var(--ink-900);
  background-position: center;
  background-size: cover;
  border: 1px solid rgba(217, 188, 128, 0.28);
  box-shadow:
    inset 0 0 0 1px rgba(255, 250, 236, 0.05),
    0 18px 56px rgba(0, 0, 0, 0.2);
}

.section-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, transparent, rgba(240, 219, 168, 0.05) 48%, transparent 58%),
    radial-gradient(ellipse at 82% 18%, rgba(98, 174, 186, 0.16), transparent 28%);
  pointer-events: none;
  animation: candle-shift 15s ease-in-out infinite;
}

.section-art > * {
  position: relative;
  z-index: 1;
}

.section-art-play {
  --section-art-image: image-set(
    url("assets/portal/bg-play.avif") type("image/avif"),
    url("assets/portal/bg-play.webp") type("image/webp")
  );
  background-position: 55% center;
}

.section-art-atlas {
  --section-art-image: image-set(
    url("assets/portal/bg-atlas.avif") type("image/avif"),
    url("assets/portal/bg-atlas.webp") type("image/webp")
  );
  background-position: 58% center;
}

.section-art-crafting {
  --section-art-image: image-set(
    url("assets/portal/bg-crafting.avif") type("image/avif"),
    url("assets/portal/bg-crafting.webp") type("image/webp")
  );
  background-position: 62% center;
}

.section-art-assistant {
  --section-art-image: image-set(
    url("assets/portal/bg-assistant.avif") type("image/avif"),
    url("assets/portal/bg-assistant.webp") type("image/webp")
  );
  background-position: 60% center;
}

.section-art-news {
  --section-art-image: image-set(
    url("assets/portal/bg-news.avif") type("image/avif"),
    url("assets/portal/bg-news.webp") type("image/webp")
  );
  background-position: 56% center;
}

.section-art-community {
  --section-art-image: image-set(
    url("assets/portal/bg-community.avif") type("image/avif"),
    url("assets/portal/bg-community.webp") type("image/webp")
  );
  background-position: 60% center;
}

.intro-band .section-heading p:not(.eyebrow),
.media-band .section-heading p:not(.eyebrow),
.news-surface .section-heading p:not(.eyebrow),
.community-panel p:not(.eyebrow),
.assistant-layout .section-heading p:not(.eyebrow) {
  color: rgba(250, 245, 232, 0.72);
}

.intro-band h2,
.media-band h2,
.news-surface h2,
.community-panel h2,
.assistant-layout h2 {
  color: var(--parchment-50);
}

.download-panel,
.community-actions {
  justify-content: flex-end;
  align-self: center;
}

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

.flow article {
  padding: 22px;
  color: var(--ink-900);
}

.flow span {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  border-radius: 50%;
  color: var(--parchment-50);
  background:
    radial-gradient(circle at 35% 28%, rgba(240, 219, 168, 0.42), transparent 34%),
    var(--burgundy);
  font-family: var(--mono);
  font-size: 0.88rem;
  box-shadow: 0 0 0 5px rgba(126, 39, 36, 0.14);
}

.atlas-workbench {
  width: min(100%, 1360px);
}

.atlas-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid rgba(217, 188, 128, 0.24);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(12, 15, 20, 0.82), rgba(12, 15, 20, 0.58)),
    rgba(217, 188, 128, 0.08);
  box-shadow:
    inset 0 0 0 1px rgba(255, 250, 236, 0.04),
    0 14px 34px rgba(0, 0, 0, 0.14);
}

.segmented,
.news-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(217, 188, 128, 0.28);
  border-radius: 9px;
  background:
    linear-gradient(180deg, rgba(250, 245, 232, 0.12), rgba(12, 15, 20, 0.3)),
    rgba(11, 13, 18, 0.44);
  box-shadow: inset 0 0 0 1px rgba(7, 8, 11, 0.26);
}

.segmented button,
.news-tabs button {
  min-height: 36px;
  padding: 0 13px;
  border: 0;
  border-radius: 6px;
  color: rgba(250, 245, 232, 0.78);
  background: transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.2);
}

.segmented button[aria-selected="true"],
.news-tabs button[aria-selected="true"] {
  color: #20160a;
  background: linear-gradient(180deg, #f0dba8, #b98d3f);
  box-shadow:
    inset 0 0 0 1px rgba(255, 250, 236, 0.28),
    0 0 20px rgba(217, 188, 128, 0.16);
}

.search-box {
  display: grid;
  gap: 7px;
  min-width: min(440px, 100%);
  color: rgba(250, 245, 232, 0.7);
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.search-box input {
  min-height: 42px;
  width: 100%;
  border: 1px solid rgba(217, 188, 128, 0.34);
  border-radius: 8px;
  padding: 0 13px;
  color: var(--parchment-50);
  background:
    linear-gradient(180deg, rgba(8, 10, 14, 0.8), rgba(20, 23, 30, 0.64)),
    rgba(20, 23, 30, 0.7);
  font: 1rem var(--sans);
  box-shadow: inset 0 0 0 1px rgba(7, 8, 11, 0.36);
}

.search-box input::placeholder {
  color: rgba(250, 245, 232, 0.44);
}

.table-note {
  margin: 18px 0 10px;
  color: rgba(250, 245, 232, 0.76);
  font-size: 0.94rem;
}

.table-shell {
  overflow: auto;
  max-height: calc(100vh - 330px);
  min-height: 430px;
  border: 1px solid rgba(217, 188, 128, 0.34);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 250, 236, 0.96), rgba(242, 232, 206, 0.92)),
    url("assets/launcher/parchment-tile.png");
  background-size: auto, 420px 420px;
  box-shadow:
    inset 0 0 0 1px rgba(122, 90, 40, 0.08),
    0 22px 70px rgba(0, 0, 0, 0.24);
  scrollbar-color: rgba(176, 136, 64, 0.72) rgba(20, 23, 30, 0.2);
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(122, 90, 40, 0.18);
  vertical-align: top;
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--parchment-50);
  background:
    linear-gradient(180deg, rgba(31, 34, 44, 0.98), rgba(13, 17, 24, 0.98)),
    var(--ink-800);
  border-bottom-color: rgba(217, 188, 128, 0.34);
  font-size: 0.78rem;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.32);
}

td {
  color: var(--ink-700);
  font-size: 0.92rem;
  line-height: 1.42;
}

td strong {
  color: var(--ink-900);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(122, 90, 40, 0.2);
  border-radius: 999px;
  color: var(--ink-700);
  background:
    linear-gradient(180deg, rgba(255, 250, 236, 0.72), rgba(235, 224, 198, 0.7));
  font-size: 0.78rem;
}

.source-count {
  display: block;
  margin-top: 8px;
  color: var(--ink-500);
  font-family: var(--mono);
  font-size: 0.76rem;
}

.source-list {
  display: grid;
  gap: 5px;
}

.source-list code {
  overflow-wrap: anywhere;
  color: var(--ink-600);
}

.reference-links {
  margin-top: 18px;
}

.craft-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.craft-card {
  display: grid;
  grid-template-rows: 150px minmax(128px, auto);
  width: 100%;
  min-height: 278px;
  overflow: hidden;
  padding: 0;
  color: var(--ink-900);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.craft-card:hover,
.craft-card.is-active {
  transform: translateY(-2px);
  border-color: rgba(217, 188, 128, 0.72);
  background:
    linear-gradient(180deg, rgba(255, 250, 236, 0.98), rgba(235, 224, 198, 0.94)),
    url("assets/launcher/parchment-tile.png");
}

.craft-card.is-active {
  box-shadow:
    0 0 0 3px rgba(176, 136, 64, 0.22),
    0 18px 46px rgba(0, 0, 0, 0.2);
}

.craft-card-media {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 68% 32%, rgba(98, 174, 186, 0.18), transparent 42%),
    linear-gradient(135deg, rgba(20, 23, 30, 0.95), rgba(31, 61, 68, 0.74)),
    var(--ink-900);
}

.craft-card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, rgba(11, 13, 18, 0.36), rgba(11, 13, 18, 0) 46%),
    linear-gradient(90deg, rgba(11, 13, 18, 0.16), rgba(11, 13, 18, 0) 48%, rgba(11, 13, 18, 0.24));
  box-shadow:
    inset 0 0 0 1px rgba(217, 188, 128, 0.2),
    inset 0 -18px 38px rgba(7, 8, 11, 0.36);
  pointer-events: none;
}

.craft-card-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.craft-card-copy {
  display: block;
  min-width: 0;
  padding: 18px 20px 20px;
}

.craft-card h3 {
  margin-top: 4px;
}

.craft-workbench {
  width: min(100%, 1360px);
  scroll-margin-top: 132px;
}

.craft-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  gap: 16px;
  align-items: end;
}

.craft-tabs {
  max-height: 142px;
  overflow: auto;
}

.craft-table-shell {
  max-height: calc(100vh - 300px);
}

.craft-table-shell table {
  min-width: 1320px;
  table-layout: fixed;
}

.craft-table-shell th:nth-child(1),
.craft-table-shell td:nth-child(1) {
  width: 34%;
}

.craft-table-shell th:nth-child(2),
.craft-table-shell td:nth-child(2) {
  width: 12%;
}

.craft-table-shell th:nth-child(3),
.craft-table-shell td:nth-child(3) {
  width: 18%;
}

.craft-table-shell th:nth-child(4),
.craft-table-shell td:nth-child(4) {
  width: 15%;
}

.craft-table-shell th:nth-child(5),
.craft-table-shell td:nth-child(5) {
  width: 21%;
}

.craft-item-cell {
  min-width: 0;
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.craft-item-icon {
  width: 70px;
  height: 70px;
  object-fit: contain;
  flex: none;
  padding: 7px;
  border: 1px solid rgba(122, 90, 40, 0.28);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 252, 244, 0.96), rgba(244, 237, 217, 0.94));
  box-shadow:
    inset 0 0 0 1px rgba(255, 250, 236, 0.54),
    0 4px 12px rgba(122, 90, 40, 0.08);
}

.craft-item-icon.placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brass-700);
  font-weight: 800;
}

.craft-item-copy {
  min-width: 0;
}

.craft-item-copy strong,
.craft-item-copy code {
  display: block;
  overflow-wrap: anywhere;
}

.craft-item-copy p {
  margin: 8px 0 0;
  color: var(--ink-600);
  font-size: 0.86rem;
  line-height: 1.45;
}

.craft-part-list {
  display: grid;
  gap: 6px;
}

.craft-part {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  overflow-wrap: anywhere;
}

.craft-part-icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex: none;
  padding: 3px;
  border: 1px solid rgba(122, 90, 40, 0.24);
  border-radius: 7px;
  background: rgba(255, 252, 244, 0.96);
}

.property-table-shell table {
  min-width: 1840px;
  table-layout: fixed;
}

.property-table-shell th:nth-child(1),
.property-table-shell td:nth-child(1) {
  width: 38%;
}

.property-table-shell th:nth-child(2),
.property-table-shell td:nth-child(2) {
  width: 17%;
}

.property-table-shell th:nth-child(3),
.property-table-shell td:nth-child(3) {
  width: 18%;
}

.property-table-shell th:nth-child(4),
.property-table-shell td:nth-child(4) {
  width: 17%;
}

.property-table-shell th:nth-child(5),
.property-table-shell td:nth-child(5) {
  width: 10%;
}

.property-cell {
  grid-template-columns: 78px minmax(0, 1fr);
}

.property-icon {
  width: 78px;
  height: 78px;
}

.atlas-rich-table-shell table {
  min-width: 1240px;
  table-layout: fixed;
}

.atlas-rich-table-shell th:nth-child(1),
.atlas-rich-table-shell td:nth-child(1) {
  width: 38%;
}

.atlas-rich-table-shell th:nth-child(2),
.atlas-rich-table-shell td:nth-child(2) {
  width: 18%;
}

.atlas-rich-table-shell th:nth-child(3),
.atlas-rich-table-shell td:nth-child(3) {
  width: 20%;
}

.atlas-rich-table-shell th:nth-child(4),
.atlas-rich-table-shell td:nth-child(4) {
  width: 24%;
}

.atlas-cell {
  grid-template-columns: 82px minmax(0, 1fr);
}

.atlas-icon {
  width: 82px;
  height: 82px;
}

.structure-cell {
  grid-template-columns: 250px minmax(0, 1fr);
}

.structure-preview-image {
  width: 250px;
  height: 173px;
  display: block;
  object-fit: contain;
  padding: 0;
  border: 1px solid rgba(122, 90, 40, 0.28);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 252, 244, 0.96), rgba(244, 237, 217, 0.94));
  box-shadow: inset 0 0 0 1px rgba(255, 250, 236, 0.54);
}

.structure-preview-image.placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brass-700);
  font-weight: 800;
  font-size: 1.6rem;
}

.boat-table-shell table {
  min-width: 1720px;
}

.boat-table-shell th:nth-child(1),
.boat-table-shell td:nth-child(1) {
  width: 38%;
}

.boat-table-shell th:nth-child(2),
.boat-table-shell td:nth-child(2) {
  width: 18%;
}

.boat-table-shell th:nth-child(3),
.boat-table-shell td:nth-child(3) {
  width: 17%;
}

.boat-table-shell th:nth-child(4),
.boat-table-shell td:nth-child(4) {
  width: 15%;
}

.boat-table-shell th:nth-child(5),
.boat-table-shell td:nth-child(5) {
  width: 12%;
}

.boat-cell {
  min-width: 0;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.boat-preview {
  width: 190px;
  aspect-ratio: 3 / 2;
  border: 1px solid rgba(122, 90, 40, 0.28);
  border-radius: 10px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 252, 244, 0.96), rgba(244, 237, 217, 0.94));
  box-shadow: inset 0 0 0 1px rgba(255, 250, 236, 0.54);
}

.boat-preview-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.boat-preview-image.placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brass-700);
  font-weight: 800;
  font-size: 2rem;
}

.boat-meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.boat-deed-icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
  padding: 3px;
  border: 1px solid rgba(122, 90, 40, 0.2);
  border-radius: 7px;
  background: rgba(255, 252, 244, 0.92);
}

.hue-chip {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-top: 7px;
  padding: 0 8px;
  border: 1px solid rgba(122, 90, 40, 0.2);
  border-radius: 999px;
  color: var(--brass-700);
  background: rgba(217, 188, 128, 0.2);
  font-family: var(--mono);
  font-size: 0.76rem;
}

.assistant-layout {
  grid-template-columns: minmax(0, 0.92fr) minmax(360px, 1fr);
}

.prompt-card {
  min-width: 0;
  padding: 24px;
  color: var(--parchment-50);
  background:
    linear-gradient(180deg, rgba(11, 13, 18, 0.66), rgba(31, 61, 68, 0.34)),
    rgba(11, 13, 18, 0.42);
  border: 1px solid rgba(217, 188, 128, 0.34);
  border-radius: 10px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 250, 236, 0.05),
    0 18px 42px rgba(0, 0, 0, 0.18);
}

.prompt-card p {
  margin: 0 0 12px;
  color: var(--brass-300);
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
}

blockquote {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.18rem, 2vw, 1.42rem);
  line-height: 1.36;
}

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

.news-layout {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

.news-surface .news-tabs {
  width: max-content;
  max-width: 100%;
  border-color: rgba(217, 188, 128, 0.24);
  background: rgba(11, 13, 18, 0.5);
}

.news-surface .news-tabs button {
  color: rgba(250, 245, 232, 0.82);
}

.news-surface .news-tabs button[aria-selected="true"] {
  color: #20160a;
}

.feed {
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  margin-top: 0;
}

.feed article {
  display: grid;
  grid-template-columns: minmax(320px, 0.44fr) minmax(0, 1fr);
  min-height: 306px;
  overflow: hidden;
  padding: 0;
  background:
    linear-gradient(180deg, rgba(255, 250, 236, 0.96), rgba(235, 224, 198, 0.91)),
    url("assets/launcher/parchment-tile.png");
  background-size: auto, 420px 420px;
  border-color: rgba(217, 188, 128, 0.38);
}

.feed article:first-child {
  grid-template-columns: minmax(420px, 0.52fr) minmax(0, 1fr);
  min-height: 390px;
  box-shadow:
    inset 0 0 0 1px rgba(122, 90, 40, 0.08),
    0 24px 70px rgba(0, 0, 0, 0.24);
}

.feed-empty {
  display: block !important;
}

.feed-media {
  position: relative;
  min-width: 0;
  min-height: 260px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(20, 23, 30, 0.92), rgba(31, 61, 68, 0.72)),
    var(--ink-900);
}

.feed-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(11, 13, 18, 0) 56%, rgba(11, 13, 18, 0.32)),
    linear-gradient(0deg, rgba(11, 13, 18, 0.2), rgba(11, 13, 18, 0) 50%);
  box-shadow:
    inset 0 0 0 1px rgba(217, 188, 128, 0.22),
    inset -18px 0 44px rgba(7, 8, 11, 0.22);
  pointer-events: none;
}

.feed-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.feed-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(26px, 3.5vw, 46px);
}

.feed-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.feed time {
  color: var(--brass-700);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
}

.feed h3 {
  margin-top: 14px;
  color: var(--ink-900);
  font-size: clamp(1.62rem, 2.5vw, 2.8rem);
  line-height: 1.02;
}

.feed-subtitle {
  color: var(--ink-700);
  font-weight: 700;
}

.feed-body {
  color: var(--ink-500);
  font-size: 0.96rem;
}

.feed .tag {
  color: var(--ink-800);
  background: rgba(235, 224, 198, 0.82);
}

.community-panel {
  min-height: 360px;
  align-items: center;
}

.community-panel p:not(.eyebrow) {
  max-width: 760px;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(20, 23, 30, 0.18);
  border-radius: 8px;
  color: inherit;
  font-weight: 700;
  text-decoration: none;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.button.primary,
.icon-button.primary {
  color: #23180b;
  background:
    linear-gradient(180deg, #f0dba8, #b88c3e);
  border-color: rgba(255, 224, 160, 0.5);
  box-shadow:
    inset 0 0 0 1px rgba(255, 250, 236, 0.18),
    0 0 22px rgba(217, 188, 128, 0.12);
}

.button.secondary,
.icon-button {
  color: var(--parchment-50);
  background:
    linear-gradient(180deg, rgba(51, 94, 102, 0.86), rgba(31, 61, 68, 0.8));
  border-color: rgba(108, 144, 153, 0.6);
}

.site-footer {
  width: min(var(--content), calc(100% - 36px));
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto;
  padding: 24px 0 32px;
  color: rgba(250, 245, 232, 0.56);
  font-size: 0.88rem;
}

.fatal-error {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 16px;
  color: white;
  background: var(--err);
}

@keyframes portal-breathe {
  0%,
  100% {
    opacity: 0.66;
    transform: scale(1);
  }

  50% {
    opacity: 0.9;
    transform: scale(1.012);
  }
}

@keyframes portal-glint {
  0%,
  100% {
    opacity: 0.42;
  }

  50% {
    opacity: 0.82;
  }
}

@keyframes candle-shift {
  0%,
  100% {
    opacity: 0.54;
  }

  50% {
    opacity: 0.78;
  }
}

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

@media (max-width: 1180px) {
  .status-grid,
  .metric-strip,
  .craft-grid,
  .mcp-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .atlas-toolbar {
    display: grid;
    align-items: start;
  }
}

@media (max-width: 900px) {
  .portal-shell {
    display: block;
  }

  .portal-sidebar {
    position: static;
    height: auto;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid rgba(217, 188, 128, 0.18);
  }

  .portal-nav,
  .sidebar-status,
  .sidebar-actions {
    display: none;
  }

  .sidebar-deck {
    max-width: 720px;
  }

  .portal-topbar {
    position: static;
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 18px 16px;
  }

  .top-actions {
    display: none;
  }

  .mobile-nav {
    position: sticky;
    top: 0;
    z-index: 9;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 10px 12px;
    color: var(--parchment-50);
    background: rgba(20, 23, 30, 0.96);
    border-bottom: 1px solid rgba(217, 188, 128, 0.18);
    scrollbar-width: none;
  }

  .mobile-nav::-webkit-scrollbar {
    display: none;
  }

  .mobile-nav a {
    flex: 0 0 auto;
    min-height: 36px;
    color: rgba(250, 245, 232, 0.78);
  }

  .portal-view,
  .site-footer {
    width: min(100% - 24px, var(--content));
  }

  .intro-band,
  .media-band,
  .news-surface,
  .community-panel,
  .assistant-layout {
    grid-template-columns: 1fr;
  }

  .craft-toolbar {
    grid-template-columns: 1fr;
  }

  .craft-workbench {
    scroll-margin-top: 72px;
  }

  .download-panel,
  .community-actions {
    justify-content: flex-start;
  }

  .feed article,
  .feed article:first-child {
    grid-template-columns: 1fr;
  }

  .feed-media {
    min-height: 230px;
  }
}

@media (max-width: 680px) {
  h1 {
    font-size: 2.2rem;
  }

  .world-banner {
    min-height: 440px;
    padding: 22px;
    background-position: 62% center;
  }

  .status-grid,
  .flow,
  .feature-grid,
  .metric-strip,
  .craft-grid,
  .mcp-grid {
    grid-template-columns: 1fr;
  }

  .intro-band,
  .media-band,
  .news-surface,
  .community-panel,
  .assistant-layout {
    padding: 22px;
  }

  .download-panel,
  .community-actions,
  .reference-links,
  .sidebar-actions {
    display: grid;
  }

  .button,
  .icon-button {
    width: 100%;
  }

  .segmented,
  .news-tabs {
    width: 100%;
  }

  .segmented button,
  .news-tabs button {
    flex: 1 1 auto;
  }

  .feed article,
  .feed article:first-child {
    min-height: auto;
  }

  .feed-media {
    min-height: 188px;
  }

  .feed-copy {
    padding: 18px;
  }

  .craft-tabs {
    max-height: none;
    overflow: visible;
  }

  .table-shell {
    min-height: 360px;
    max-height: 68vh;
  }

  .site-footer {
    display: grid;
  }
}

/* =====================================================================
   GAME-UI MATERIAL LAYER
   Wires the committed Codex asset pack (assets/ui + assets/portal) onto
   the live shell so the portal reads like an in-world command surface,
   not a themed web page. Pure presentation: no markup contract changes.
   Sprite math: background-size scales each sheet so one cell == display
   size; position steps by display size. Insets come from ui-manifest.json.
   ===================================================================== */

/* --- Replace dead assets/launcher/parchment-tile.png with real vellum/ledger --- */
.status-tile,
.flow article,
.feature-grid article,
.metric,
.craft-grid article,
.craft-card,
.mcp-grid article,
.feed article {
  background:
    linear-gradient(180deg, rgba(255, 250, 236, 0.93), rgba(235, 224, 198, 0.86)),
    url("assets/ui/tex-parchment-light.webp");
  background-size: auto, 256px 256px;
}

.table-shell {
  background:
    linear-gradient(180deg, rgba(255, 250, 236, 0.96), rgba(242, 232, 206, 0.9)),
    url("assets/ui/tex-parchment-light.webp");
  background-size: auto, 256px 256px;
}

.craft-card:hover,
.craft-card.is-active {
  background:
    linear-gradient(180deg, rgba(255, 250, 236, 0.98), rgba(235, 224, 198, 0.94)),
    url("assets/ui/tex-parchment-light.webp");
  background-size: auto, 256px 256px;
}

.feed article {
  background:
    linear-gradient(180deg, rgba(255, 250, 236, 0.96), rgba(235, 224, 198, 0.9)),
    url("assets/ui/tex-parchment-light.webp");
  background-size: auto, 256px 256px;
}

/* --- Atmosphere: candlelight, moonbeam, drifting dust (behind content) --- */
.portal-atmos {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.portal-atmos .atmos {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

.atmos-moonbeam {
  background-image: url("assets/ui/overlay-moonbeam.webp");
  opacity: 0.5;
  mix-blend-mode: screen;
}

.atmos-candle {
  background-image: url("assets/ui/overlay-candle-glow.webp");
  opacity: 0.42;
  mix-blend-mode: screen;
  animation: candle-flicker 7s ease-in-out infinite;
}

.atmos-dust {
  background-image: url("assets/ui/overlay-dust.webp");
  background-repeat: repeat;
  background-size: 512px 512px;
  opacity: 0.22;
  mix-blend-mode: screen;
  animation: dust-drift 90s linear infinite;
}

/* --- Brass client-window frame + viewport vignette (decorative, on top) --- */
.portal-frame {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  border-style: solid;
  border-width: clamp(9px, 1.5vw, 24px);
  border-image: url("assets/ui/frame-brass-9slice.webp") 96 / clamp(9px, 1.5vw, 24px) / 0 stretch;
}

.portal-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("assets/ui/overlay-vignette.webp") center / cover no-repeat;
  opacity: 0.6;
}

/* --- Sidebar: engraved stone rune-rail --- */
.portal-sidebar {
  background:
    linear-gradient(180deg, rgba(8, 10, 14, 0.92), rgba(12, 16, 22, 0.82)),
    url("assets/ui/tex-stone.webp");
  background-size: auto, 360px 360px;
  border-right: 0;
  border-style: solid;
  border-width: 30px 16px;
  border-image: url("assets/ui/frame-rune-rail.webp") 140 44 / 30px 16px / 0 stretch;
  box-shadow: 18px 0 50px rgba(0, 0, 0, 0.3);
}

/* --- Nav: brass section-rune medallions (sheet 672x96, 7 cols) --- */
.portal-nav a::before,
.mobile-nav a::before {
  content: "";
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border: 0;
  transform: none;
  border-radius: 0;
  background: url("assets/ui/runes-section.webp") no-repeat;
  background-size: 182px 26px;
  box-shadow: none;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.55));
  transition: filter 160ms ease, transform 160ms ease;
}

.portal-nav a:nth-child(1)::before, .mobile-nav a:nth-child(1)::before { background-position: 0 0; }
.portal-nav a:nth-child(2)::before, .mobile-nav a:nth-child(2)::before { background-position: -26px 0; }
.portal-nav a:nth-child(3)::before, .mobile-nav a:nth-child(3)::before { background-position: -52px 0; }
.portal-nav a:nth-child(4)::before, .mobile-nav a:nth-child(4)::before { background-position: -78px 0; }
.portal-nav a:nth-child(5)::before, .mobile-nav a:nth-child(5)::before { background-position: -104px 0; }
.portal-nav a:nth-child(6)::before, .mobile-nav a:nth-child(6)::before { background-position: -130px 0; }
.portal-nav a:nth-child(7)::before, .mobile-nav a:nth-child(7)::before { background-position: -156px 0; }

.portal-nav a:hover::before,
.portal-nav a.is-active::before,
.mobile-nav a.is-active::before {
  transform: scale(1.08);
  filter: drop-shadow(0 0 8px rgba(98, 174, 186, 0.55));
}

/* --- Status lamps (sheet 256x64, 4 cols: online/checking/offline/arcane) --- */
.status-dot {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border-radius: 0;
  background: url("assets/ui/lamps-status.webp") no-repeat;
  background-size: 64px 16px;
  background-position: -16px 0; /* checking (default/warn) */
  box-shadow: none;
}

.status-dot.ok { background: url("assets/ui/lamps-status.webp") -0px 0 / 64px 16px no-repeat; animation: lamp-breathe 4s ease-in-out infinite; }
.status-dot.err { background: url("assets/ui/lamps-status.webp") -32px 0 / 64px 16px no-repeat; }

/* --- Route nameplate plaque (1200x220, calm center fill for live title) --- */
.route-heading {
  border-style: solid;
  border-width: 16px clamp(22px, 3vw, 44px);
  border-image: url("assets/ui/plaque-route-header.webp") 54 150 fill / 16px clamp(22px, 3vw, 44px) / 0 stretch;
  padding: 8px clamp(8px, 1.5vw, 18px);
}

.route-heading .eyebrow { color: var(--brass-300); }
.route-heading h1 { text-shadow: 0 2px 14px rgba(0, 0, 0, 0.6); }

/* --- Action buttons as forged brass / iron plates (480x140, fill) --- */
.button.primary,
.button.secondary {
  border-style: solid;
  border-width: 15px 26px;
  border-image-slice: 38 72 fill;
  border-image-width: 15px 26px;
  border-image-repeat: stretch;
  border-radius: 0;
  min-height: 54px;
  padding: 4px 14px;
}

.button.primary {
  color: #23180b;
  background: linear-gradient(180deg, #f0dba8, #b88c3e);
  border-image-source: url("assets/ui/btn-primary-rest.webp");
}

.button.primary:hover {
  border-image-source: url("assets/ui/btn-primary-hover.webp");
}

.button.secondary {
  color: var(--parchment-50);
  background: linear-gradient(180deg, rgba(51, 94, 102, 0.86), rgba(31, 61, 68, 0.82));
  border-image-source: url("assets/ui/btn-secondary-rest.webp");
}

.button.secondary:hover {
  border-image-source: url("assets/ui/btn-secondary-hover.webp");
}

/* --- Search as an engraved scrying slot (640x120, fill recess) --- */
.search-box input {
  border-style: solid;
  border-width: 14px 22px;
  border-image: url("assets/ui/slot-scrying-search.webp") 32 84 fill / 14px 22px stretch;
  border-radius: 0;
  min-height: 54px;
  padding: 2px 8px;
  background: rgba(8, 10, 14, 0.72);
}

/* --- Tabs as engraved stud plates (320x120, fill) --- */
.segmented,
.news-tabs {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  gap: 8px;
}

.segmented button,
.news-tabs button {
  border-style: solid;
  border-width: 11px 16px;
  border-image: url("assets/ui/tab-plate-rest.webp") 30 50 fill / 11px 16px stretch;
  border-radius: 0;
  background: transparent;
  min-height: 46px;
  padding: 2px 10px;
  color: rgba(250, 245, 232, 0.86);
}

.segmented button[aria-selected="true"],
.news-tabs button[aria-selected="true"] {
  border-image-source: url("assets/ui/tab-plate-active.webp");
  color: #160f04;
  background: transparent;
  box-shadow: none;
  text-shadow: 0 1px 1px rgba(255, 241, 206, 0.65);
}

/* atlas tab rune marks (sheet 480x192, 5 cols x 2 rows) */
.atlas-toolbar .segmented button::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  vertical-align: -3px;
  background: url("assets/ui/runes-atlas.webp") no-repeat;
  background-size: 90px 36px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.atlas-toolbar .segmented button:nth-child(1)::before { background-position: 0 0; }
.atlas-toolbar .segmented button:nth-child(2)::before { background-position: -18px 0; }
.atlas-toolbar .segmented button:nth-child(3)::before { background-position: -36px 0; }
.atlas-toolbar .segmented button:nth-child(4)::before { background-position: -54px 0; }
.atlas-toolbar .segmented button:nth-child(5)::before { background-position: -72px 0; }
.atlas-toolbar .segmented button:nth-child(6)::before { background-position: 0 -18px; }
.atlas-toolbar .segmented button:nth-child(7)::before { background-position: -18px -18px; }
.atlas-toolbar .segmented button:nth-child(8)::before { background-position: -36px -18px; }
.atlas-toolbar .segmented button:nth-child(9)::before { background-position: -54px -18px; }
.atlas-toolbar .segmented button:nth-child(10)::before { background-position: -72px -18px; }

/* --- Inventory-slot framing on catalogue imagery (tray-cell 128, inset 24) --- */
.craft-item-icon,
.structure-preview-image,
.boat-preview {
  border: 0;
  border-radius: 0;
  border-style: solid;
  border-width: 11px;
  border-image: url("assets/ui/tray-cell.webp") 24 fill / 11px stretch;
  background: rgba(10, 13, 18, 0.55);
}

.craft-item-icon.placeholder,
.structure-preview-image.placeholder {
  color: var(--brass-100);
}

/* --- Big framed surfaces get the brass nine-slice frame --- */
.world-banner,
.section-art,
.table-shell {
  border-style: solid;
  border-width: clamp(12px, 1.4vw, 22px);
  border-image: url("assets/ui/frame-brass-9slice.webp") 96 / clamp(12px, 1.4vw, 22px) / 0 stretch;
  border-radius: 0;
}

.world-banner::before { display: none; }

/* --- Overview hero: copy in the calm-left zone, moongate in the dramatic right --- */
.world-banner {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(200px, 0.62fr);
  align-items: center;
  gap: clamp(18px, 3vw, 46px);
  min-height: clamp(420px, 60vh, 660px);
}

.world-banner-copy {
  position: relative;
  z-index: 1;
  max-width: 760px;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.62);
}

.world-banner-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.world-banner-gate {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  justify-self: center;
  text-decoration: none;
}

.world-banner-gate .moongate {
  width: clamp(180px, 22vw, 300px);
  height: auto;
  filter: drop-shadow(0 0 22px rgba(98, 174, 186, 0.45));
  animation: gate-pulse 7s ease-in-out infinite;
}

.world-banner-gate-label {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass-300);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.8);
  transition: color 160ms ease;
}

.world-banner-gate:hover .world-banner-gate-label { color: var(--brass-100); }
.world-banner-gate:hover .moongate { filter: drop-shadow(0 0 34px rgba(98, 174, 186, 0.65)); }

/* --- Treasure-gem accents on the overview ledger (gems sheet 640x80, 8 cols) --- */
.metric strong::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  vertical-align: -2px;
  background: url("assets/ui/gems-resource.webp") no-repeat;
  background-size: 128px 16px;
}

.metric:nth-child(1) strong::before { background-position: 0 0; }
.metric:nth-child(2) strong::before { background-position: -16px 0; }
.metric:nth-child(3) strong::before { background-position: -32px 0; }
.metric:nth-child(4) strong::before { background-position: -48px 0; }
.metric:nth-child(5) strong::before { background-position: -64px 0; }
.metric:nth-child(6) strong::before { background-position: -80px 0; }

/* --- Assistant surface: arcane crystal pulse behind the prompt card --- */
.assistant-layout .prompt-card {
  position: relative;
  overflow: hidden;
}

.assistant-layout .prompt-card::before {
  content: "";
  position: absolute;
  inset: -30% -30% auto auto;
  width: 320px;
  height: 320px;
  background: url("assets/ui/overlay-arcane-pulse.webp") center / contain no-repeat;
  opacity: 0.5;
  pointer-events: none;
  animation: arcane-pulse 6s ease-in-out infinite;
}

/* --- Route "page turn" reveal --- */
.portal-view.is-active {
  animation: page-reveal 460ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

/* --- Per-route room backdrop (desktop; mobile keeps the portrait hall) --- */
@media (min-width: 769px) {
  body[data-route="play"]::before {
    background-image:
      linear-gradient(180deg, rgba(7, 8, 11, 0.2), rgba(7, 8, 11, 0.84)),
      image-set(url("assets/portal/bg-play.avif") type("image/avif"), url("assets/portal/bg-play.webp") type("image/webp"));
  }
  body[data-route="atlas"]::before {
    background-image:
      linear-gradient(180deg, rgba(7, 8, 11, 0.2), rgba(7, 8, 11, 0.84)),
      image-set(url("assets/portal/bg-atlas.avif") type("image/avif"), url("assets/portal/bg-atlas.webp") type("image/webp"));
  }
  body[data-route="crafting"]::before {
    background-image:
      linear-gradient(180deg, rgba(7, 8, 11, 0.2), rgba(7, 8, 11, 0.84)),
      image-set(url("assets/portal/bg-crafting.avif") type("image/avif"), url("assets/portal/bg-crafting.webp") type("image/webp"));
  }
  body[data-route="assistant"]::before {
    background-image:
      linear-gradient(180deg, rgba(7, 8, 11, 0.2), rgba(7, 8, 11, 0.84)),
      image-set(url("assets/portal/bg-assistant.avif") type("image/avif"), url("assets/portal/bg-assistant.webp") type("image/webp"));
  }
  body[data-route="news"]::before {
    background-image:
      linear-gradient(180deg, rgba(7, 8, 11, 0.2), rgba(7, 8, 11, 0.84)),
      image-set(url("assets/portal/bg-news.avif") type("image/avif"), url("assets/portal/bg-news.webp") type("image/webp"));
  }
  body[data-route="community"]::before {
    background-image:
      linear-gradient(180deg, rgba(7, 8, 11, 0.2), rgba(7, 8, 11, 0.84)),
      image-set(url("assets/portal/bg-community.avif") type("image/avif"), url("assets/portal/bg-community.webp") type("image/webp"));
  }
}

/* --- Responsive: stack hero, soften frames on small screens --- */
@media (max-width: 860px) {
  .world-banner {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .world-banner-gate {
    order: -1;
    justify-self: start;
  }
  .world-banner-gate .moongate { width: clamp(150px, 40vw, 220px); }
}

@media (max-width: 680px) {
  .portal-sidebar { border-width: 18px 10px; }
  .route-heading { border-width: 12px 18px; }
  .world-banner,
  .section-art,
  .table-shell { border-width: 9px; }
  .portal-frame { border-width: 7px; }
}

/* --- Motion keyframes (disabled by the prefers-reduced-motion block above) --- */
@keyframes candle-flicker {
  0%, 100% { opacity: 0.34; }
  40% { opacity: 0.5; }
  70% { opacity: 0.4; }
}

@keyframes dust-drift {
  from { background-position: 0 0; }
  to { background-position: 512px 768px; }
}

@keyframes gate-pulse {
  0%, 100% { filter: drop-shadow(0 0 18px rgba(98, 174, 186, 0.35)); transform: translateY(0); }
  50% { filter: drop-shadow(0 0 34px rgba(98, 174, 186, 0.6)); transform: translateY(-5px); }
}

@keyframes lamp-breathe {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(79, 122, 80, 0.4)); }
  50% { filter: drop-shadow(0 0 8px rgba(79, 122, 80, 0.7)); }
}

@keyframes arcane-pulse {
  0%, 100% { opacity: 0.32; transform: scale(0.96); }
  50% { opacity: 0.6; transform: scale(1.06); }
}

@keyframes page-reveal {
  from { opacity: 0; transform: translateY(10px); filter: saturate(0.7); }
  to { opacity: 1; transform: translateY(0); filter: saturate(1); }
}
