:root {
  --ink: #20150f;
  --paper: #ffe0ab;
  --frame-edge: #74634c;
  --frame-shadow: #090d15;
  --plate: #313441;
}
body {
  background: linear-gradient(#202a40 0, var(--page) 500px);
}
.site-header { background: #151b28; border-bottom: 2px solid var(--frame-edge); }
.wiki-masthead { grid-template-columns: max-content minmax(0,1fr) max-content; }
.wiki-masthead .brand strong { font: 400 1.13rem var(--pixel-font); letter-spacing: -.015em; }
.wiki-masthead .brand-icon {
  border: 1px solid #a87848;
  border-radius: var(--radius-control);
  background: linear-gradient(#524230,#2f2c2a);
  box-shadow: inset 0 1px #efb6725c, 0 3px 5px #08050985;
}
.wiki-masthead .brand-icon img { width: 25px; height: 25px; object-fit: contain; image-rendering: pixelated; }
.navigation.game-nav { gap: 4px; justify-content: center; }
.navigation.game-nav a {
  gap: 6px;
  align-self: center;
  padding: 0 clamp(5px,.75vw,11px);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  min-height: 40px;
  color: #e3ccae;
  white-space: nowrap;
}
.navigation.game-nav a img { object-fit: contain; image-rendering: pixelated; }
.navigation.game-nav a:hover, .navigation.game-nav .active-tab {
  background: var(--plate);
  color: var(--paper);
  border-color: #745537;
  box-shadow: inset 0 1px #cca35e40;
}
.navigation.game-nav a[aria-current]::after { display:none; }
.game-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 7px;
  margin: 0 0 17px;
  padding: 4px 6px;
  border-block: 1px solid var(--hairline);
  background: #191e2c;
}
.game-subnav a { min-height: 36px; padding: 7px 10px; display: flex; align-items:center; color: #dfcbb1; font-size:.875rem; }
.game-subnav a:hover, .game-subnav a[aria-current] { color: var(--accent); }
.game-subnav a[aria-current] { box-shadow: inset 0 -2px var(--accent); }
.section-heading h1 { font: 400 clamp(1.7rem,3vw,2.55rem)/1.2 var(--pixel-font); color: #ffedcd; }
.content-panel, .calc-advanced[open], .builder-lineup fieldset {
  box-shadow: inset 0 1px #e8b56911, 0 4px 18px #07050a33;
}
.hero.field-landing {
  isolation: isolate;
  min-height: clamp(310px,28vw,405px);
  margin-block: 6px 16px;
  border: 1px solid var(--frame-edge);
  border-radius: var(--radius-panel);
  background: #243351;
  box-shadow: 0 12px 32px #06040965, inset 0 0 0 3px #1a151a88;
}
.field-landing .hero-scene { border-radius: inherit; }
.field-landing .hero-scene::before {
  background-image: url("images/field-1.png");
  background-size: cover;
  background-position: center 58%;
  image-rendering: pixelated;
  filter: saturate(.83);
}
.field-landing .scene-mountains { width: 100%; opacity: .74; background-size: auto 100%; }
.field-landing .scene-ground {
  inset: auto 0 0; height: 18%; opacity: .94;
  background-size: auto clamp(110px,18vw,185px); background-position: center bottom;
}
.field-landing .scene-nature { bottom: 31px; width:clamp(132px,19vw,250px); right: 17%; }
.field-landing .scene-light { right: 29%; bottom: 43%; }
.field-landing .scene-fire { right: 4%; bottom: 38px; }
.field-landing::after {
  background: linear-gradient(90deg, #111b30 0%, #192237ed 26%, #18223592 51%, #16264320 78%, #172a4712 100%);
}
.field-landing .hero-copy { width: min(650px,62%); padding: clamp(22px,5vw,66px); }
.field-landing h1 {
  max-width: 18ch;
  color: #ffe5af;
  font-size: clamp(2.5rem,4.65vw,4.5rem);
  line-height: 1.02;
  text-shadow: 0 5px 0 #131a2c, 0 8px 20px #080c16a0;
}
.field-landing .hero-copy p { margin-top: 15px; font-size: clamp(1rem,1.4vw,1.2rem); color: #fff0d2; }
.field-landing .hero-links { margin-top: 12px; align-items: center; gap: 4px 18px; }
.field-landing .hero-search {
  margin-top: 20px;
  max-width: 390px;
  border-color: #997451;
  background: #171d2cf2;
  box-shadow: 0 2px 6px #0b0810a0;
}
.field-landing .hero-search button { background: #303746; color: var(--paper); border: 1px solid #7e5d44; }
.field-landing .hero-search button:hover { border-color: var(--accent); }
.field-button, .field-link {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:44px;
  font-weight:700;
  line-height:1.25;
}
.field-button {
  padding: 0 14px; border: 1px solid #ffc080; border-radius: 5px;
  background: linear-gradient(#ffb956,#f18a39); color: var(--ink);
  box-shadow: inset 0 1px #fff4cb91, 0 3px 8px #0e071477;
}
.field-button:hover { background: #ffcd82; }
.field-link { color: var(--accent); }
.field-link:hover { color: var(--paper); text-decoration: underline; text-underline-offset: 3px; }
.quest-board {
  display:grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap:6px;
  padding:8px;
  border:1px solid #685440;
  border-radius:var(--radius-panel);
  background:#192031;
  box-shadow: 0 5px 14px #09060c77, inset 0 1px #9d764b40;
}
.quest-board a {
  display:grid;
  grid-template-columns:38px minmax(0,1fr) 12px;
  align-items:center;
  gap:9px;
  padding:7px 12px;
  border:1px solid #60483b;
  border-radius:var(--radius-control);
  background:linear-gradient(105deg,#353846,#272c38);
  color:#ffeac8;
  min-height:57px;
  overflow-wrap:anywhere;
}
.quest-board a:hover { border-color:var(--accent); background:linear-gradient(105deg,#414153,#303644); }
.quest-board a strong { font-weight: 650; }
.quest-board a img { object-fit:contain; image-rendering:pixelated; }
.quest-board a > span { color:var(--accent); font-size:1.15rem; }
.compact-board { margin:0 0 14px; }
.home-quests { margin-bottom:27px; }
.home-monsters li a { border-color:#664b3f; background:linear-gradient(#283345,#202534); }
.home-monsters li a img { filter:drop-shadow(0 5px 0 #0a0710b0); }
.field-guide { padding-bottom:8px; }
.field-guide > .section-heading { margin-bottom:17px; }
.field-guide > p, .field-panel > p { color:var(--muted); margin-block:9px; max-width:72ch; }
.field-panel { margin: 14px 0; padding:16px; }
.field-panel h2 { margin: 0 0 10px; color:var(--paper); font-size:1.05rem; }
.guide-table { min-width:0; overflow:auto; }
.guide-table .stat-table { width:100%; }
.guide-table th, .guide-table td { text-align:left; }
.guide-table a { color:var(--accent); text-underline-offset:3px; }
.guide-table a:hover { text-decoration:underline; }
.egg-display { display:grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap:6px; }
.egg-display figure { padding:12px 5px; margin:0; border:1px solid #65513f; background:#252c3c; border-radius:5px; text-align:center; color:var(--paper); }
.egg-display img, .special-egg img, .enemy-profile img, .builder-portrait img { image-rendering:pixelated; object-fit:contain; }
.egg-display figcaption { overflow-wrap:anywhere; }
.special-egg { display:flex; align-items:center; gap:12px; }
.special-egg p + p { margin-top:7px; }
.special-egg a { color:var(--accent); }
.milestone-strip { display:grid; grid-template-columns:repeat(11,minmax(0,1fr)); gap:6px; padding:0; margin:0; list-style:none; }
.milestone-strip li { padding:8px 4px; text-align:center; border:1px solid var(--border); border-radius:5px; }
.milestone-strip strong, .milestone-strip span { display:block; }
.milestone-strip span { color:var(--accent); font-size:.85rem; }
.field-form { display:grid; gap:12px; }
.tool-controls { display:grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap:8px; align-items:end; }
.tool-controls label, .builder-lineup label { min-width:0; }
.tool-controls input, .tool-controls select, .builder-lineup input, .builder-lineup select {
  appearance:auto; box-sizing:border-box; display:block; width:100%; min-height:44px; padding:7px 10px;
  background:#181e2b; color:var(--text); border:1px solid #795840; border-radius:5px;
}
.tool-metrics { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,140px),1fr)); gap:6px; margin:0; padding:6px; border:1px solid #4d3b36; border-radius:7px; background:#171d2a; }
.tool-metrics div { min-width:0; padding:10px; background:#2b303e; border-radius:4px; }
.tool-metrics dt { font-size:.875rem; color:#e3c7ab; }
.tool-metrics dd { color:var(--paper); font-size:1.35rem; font-weight:700; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.builder-lineup { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.builder-lineup fieldset, .trait-row { min-width:0; margin:0; border:1px solid #7a5941; border-radius:5px; }
.builder-lineup fieldset { padding:8px; background:#242b3b; }
.builder-lineup legend, .trait-row legend { padding-inline:6px; color:var(--paper); font-weight:650; }
.builder-lineup label + label { margin-top:7px; }
.builder-portrait { display:grid; place-items:center; height:104px; border-radius:4px; margin-bottom:8px; background:linear-gradient(#1d2a4ab9,#171e31ef),url("images/field-1.png") center 70% / cover; }
.builder-portrait img { width:98px; height:96px; filter:drop-shadow(0 4px 0 #17121b); }
.tool-effect-list { list-style:none; margin:7px 0 0; padding:0; display:flex; flex-wrap:wrap; gap:6px; }
.tool-effect-list li { border:1px solid var(--hairline); padding:7px 9px; border-radius:5px; color:var(--muted); }
.tool-effect-list.active-synergy li { color:var(--paper); border-color:#6d5038; background:#303746; }
.trait-options { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.trait-row { display:grid; gap:3px; padding:5px 8px 8px; background:#252c3b; }
.trait-row:disabled { border-color:#4d4146; color:#c2adaa; background:#191f2b; }
.trait-row label { display:flex; gap:7px; align-items:center; min-height:35px; }
.trait-row input { accent-color:var(--accent); }
.enemy-profile { display:flex; align-items:center; flex-wrap:wrap; gap:15px; padding:14px; background:#242b3a; border:1px solid #654c3d; border-radius:6px; }
.enemy-profile > div { min-width:0; flex:1 1 400px; }
.enemy-profile .guide-table { margin-top:9px; }
.field-timeline { display:grid; gap:8px; }
.field-timeline article { border:1px solid #5e4a3f; border-radius:5px; padding:14px; background:#242b3a; }
.field-timeline time { color:var(--muted); font-size:.85rem; }
.field-timeline article h2 { margin-top:3px; color:var(--paper); font-size:1.14rem; }
.source-formula { font-variant-numeric:tabular-nums; font-weight:700; }
@media(max-width:1150px) {
  .navigation.game-nav { justify-content:space-between; }
  .navigation.game-nav a { white-space:normal; }
}
@media(max-width:1040px) {
  .wiki-masthead { grid-template-columns: minmax(0,1fr) auto; }
  .wiki-masthead .language-menu { justify-self: end; }
}
@media(max-width:760px) {
  .navigation.game-nav { flex-wrap:wrap; justify-content:flex-start; padding-block:3px; }
  .navigation.game-nav a { min-height:37px; padding:0 7px; }
  .game-subnav { margin-bottom:12px; }
  .field-landing .hero-copy { width:100%; max-width:480px; padding:20px 16px; }
  .field-landing .hero-scene::before { background-position:66% 60%; }
  .field-landing::after { background:linear-gradient(90deg,#10192cf7 0%,#162136e8 32%,#1a294672 74%,#19294145); }
  .hero.field-landing { min-height:285px; }
  .field-landing .scene-nature { right:5%; bottom:19px; width:120px; }
  .field-landing .scene-light { right:18%; bottom:45%; }
  .field-landing .scene-fire { right:2%; bottom:24px; width:70px; }
  .quest-board { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .quest-board a { padding:6px; gap:5px; grid-template-columns:28px minmax(0,1fr) 8px; min-height:53px; font-size:.84rem; }
  .quest-board a img { width:28px; height:28px; }
  .tool-controls { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .egg-display { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .milestone-strip { grid-template-columns:repeat(4,minmax(0,1fr)); }
}
@media(max-width:470px) {
  .wiki-masthead .brand strong { font-size:.875rem; }
  .navigation.game-nav a { padding:0 6px; font-size:.79rem; }
  .navigation.game-nav a img { width:15px; height:15px; }
  .game-subnav a { padding-inline:5px; font-size:.79rem; }
  .field-landing .hero-search { max-width:285px; }
  .builder-lineup, .trait-options { grid-template-columns:minmax(0,1fr); }
  .builder-lineup fieldset { display:grid; grid-template-columns:62px minmax(0,1fr); gap:4px 7px; }
  .builder-portrait { grid-row:span 2; height:100%; margin:0; min-height:74px; }
  .builder-portrait img { width:55px; height:65px; }
  .builder-lineup fieldset label + label { margin:0; }
  .field-panel { padding:10px; }
}

/* Shared game chrome. Content-specific grids are defined by their own pages. */
:root { scrollbar-color: #867151 #191f2c; }
#view :is(.section-heading > h1, .detail-heading > h2) {
  display: flex; align-items: center; gap: 11px; letter-spacing: 0; overflow-wrap: anywhere;
}
#view .page-title-icon {
  flex: none; width: clamp(24px, 3vw, 38px); height: clamp(24px, 3vw, 38px);
  object-fit: contain; image-rendering: pixelated;
}
:is(.panel, .field-panel, .calc-encounter.panel, .save-location, .atlas-region, .atlas-arena, .builder-lineup fieldset, .quest-board) {
  border-color: var(--frame-edge); border-radius: var(--radius-panel);
  box-shadow: inset 0 0 0 1px var(--frame-shadow), 0 4px 9px #070a13a0;
}
:is(.content-panel, .filters, .calc-encounter, .atlas-region, .atlas-arena, .quest-board) { position: relative; }
.field-panel { border: 1px solid var(--frame-edge); background: #252832; }
:is(.content-panel, .filters, .calc-encounter, .atlas-region, .atlas-arena, .quest-board)::after {
  content: ""; pointer-events: none; position: absolute; inset: -2px;
  background: url("images/frame-bracket-tl.png") left top / 13px 13px no-repeat,
    url("images/frame-bracket-tr.png") right top / 13px 13px no-repeat,
    url("images/frame-bracket-bl.png") left bottom / 13px 13px no-repeat,
    url("images/frame-bracket-br.png") right bottom / 13px 13px no-repeat;
  image-rendering: pixelated;
}
.field-panel > h2 {
  width: fit-content; min-height: 32px; display: grid; align-items: center;
  margin: 0 0 13px; padding: 5px 17px; border: solid transparent; border-width: 4px 8px;
  border-image: url("images/frame-titlebar.png") 9 fill stretch;
  color: #ffe5b5; font-size: 18px; font-weight: 400; line-height: 1.18;
  image-rendering: pixelated;
}
:is(.section-heading, .calc-intro) p, .source-panel p { max-width: 72ch; }
.source-panel { max-width: none; }
:is(select, .tool-controls input, .builder-lineup input, .calc-settings input[type="number"], #mastery-rows input) {
  color: var(--text); background-color: #151b28; border: 1px solid var(--frame-edge);
  border-radius: var(--radius-control);
  box-shadow: inset 0 1px 2px #080c15a0;
}
:is(.field-button, .calc-primary, .save-picker):not(:disabled) {
  border: 1px solid #df9c52; border-bottom-color: #9c531f; border-radius: var(--radius-control);
  box-shadow: inset 0 1px #fff0bd70, 0 2px 4px #11101b88;
}
:is(.field-button, .calc-primary, .save-picker):not(.has-save *) {
  color: var(--ink); background: linear-gradient(#ffca80, #eda45c);
}
:is(.field-button, .calc-primary, .save-picker):not(.has-save *):hover:not(:disabled) { background: #ffda9d; }
.stat-table :is(th,td), .ranked-table :is(th,td) { border-color: #535058; }
.stat-table thead th, .ranked-table thead th { color: var(--paper); background: #333035; }
.stat-table tbody tr:nth-child(odd), .ranked-table tbody tr:nth-child(odd) { background-color: #1c212d; }
.stat-table tbody tr:nth-child(even), .ranked-table tbody tr:nth-child(even) { background-color: #252b37; }
.stat-table tbody tr:hover, .ranked-table tbody tr:hover { background-color: #343647; }
:is(.stat-table,.ranked-table,.tool-metrics) { font-variant-numeric: tabular-nums; }
.monster-card, .skill-row, .home-monsters li a {
  border-radius: var(--radius-panel); border-color: #75634e;
  box-shadow: inset 0 0 0 1px var(--frame-shadow), 0 3px 7px #070a13a0;
}
.monster-art, .detail-art { background-color: #293243; }
.monster-card:hover, .skill-row:hover, .home-monsters li a:hover { border-color: var(--accent); }
.element-option i, .chip i, .squad-element i { border-radius: 0; transform: rotate(45deg); }
.element-option { min-height: 40px; background: #252c3c; }
.calc-squad-slots { border-radius: var(--radius-panel); }
:is(.reward-card,.squad-member,.tool-metrics,.tool-metrics div,.quest-board a,.language-menu summary) {
  border-radius: var(--radius-control);
}
:lang(zh-CN) :is(.filter-caption,.select-field,.sort-field,.navigation,.game-subnav,.stat-table,.ranked-table) { font-size: 14px; }
@media (min-width: 1240px) {
  .directory-layout .monster-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  #view :is(.section-heading > h1,.detail-heading > h2) { gap: 8px; }
  .field-panel > h2 { font-size: 16px; }
}
