:root {
  color-scheme: light;
  --ink: #181817;
  --paper: #f4f0e7;
  --paper-2: #e7e1d5;
  --line: #c8c0b1;
  --muted: #69665f;
  --red: #a33a2f;
  --red-dark: #75271f;
  --green: #52614c;
  --green-bright: #6c7e64;
  --orange: #bb6e2d;
  --white: #fffdf7;
  --shadow: 0 18px 45px rgba(30, 27, 22, .12);
  --radius: 4px;
  --control-height: 36px;
  --control-radius: 3px;
  --panel-padding: 14px;
  --header-height: 68px;
  --editor-toolbar-height: 66px;
  font-family: "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 145px; }
body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper-2);
  background-image:
    linear-gradient(rgba(24, 24, 23, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 24, 23, .035) 1px, transparent 1px),
    radial-gradient(circle at 12% 18%, rgba(255,255,255,.6), transparent 33%);
  background-size: 32px 32px, 32px 32px, auto;
  min-width: 320px;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--green); }
input:not([type="checkbox"]):not([type="radio"]):hover, select:hover, textarea:hover { border-color: #91897c; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [role="button"]:focus-visible { outline: 3px solid rgba(163,58,47,.17); outline-offset: 1px; }
input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.skip-link { position: fixed; left: 12px; top: -100px; z-index: 1000; padding: 10px 14px; color: #fff; background: #111; }
.skip-link:focus { top: 12px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 clamp(18px, 4vw, 58px);
  color: #f8f3e8;
  background: #151514;
  border-bottom: 4px solid var(--red);
  box-shadow: 0 10px 30px rgba(0,0,0,.16);
}
.brand { display: inline-flex; align-items: center; gap: 13px; padding: 0; border: 0; color: inherit; background: transparent; text-align: left; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 49px; height: 49px; border: 2px solid currentColor; font: 900 17px/1 Arial, sans-serif; letter-spacing: -.04em; transform: rotate(-2deg); }
.brand strong { display: block; font: 800 15px/1.2 Arial, sans-serif; letter-spacing: .15em; }
.brand small { display: block; margin-top: 5px; color: #bdb7ad; font-size: 11px; letter-spacing: .07em; }
.header-links { display: flex; align-items: center; justify-content: center; gap: 4px; margin-left: auto; }
.header-links a { padding: 8px 10px; color: #c8c2b7; border-bottom: 2px solid transparent; font-size: 10px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.header-links a:hover, .header-links a:focus-visible { color: #fff; border-bottom-color: var(--red); }
.header-actions { display: flex; align-items: center; gap: 16px; }
.system-light { display: inline-flex; align-items: center; gap: 8px; color: #bdb7ad; font: 700 10px/1 Arial, sans-serif; letter-spacing: .13em; }
.system-light i, .save-state i { width: 8px; height: 8px; border-radius: 50%; background: #86a276; box-shadow: 0 0 0 3px rgba(134,162,118,.16); }

.view { max-width: 1640px; margin: 0 auto; }
.home-view { padding: clamp(28px, 5vw, 72px) clamp(16px, 4vw, 58px) 90px; }
.hero {
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(310px, .55fr);
  gap: clamp(24px, 5vw, 76px);
  align-items: center;
  padding: clamp(40px, 6vw, 88px);
  overflow: hidden;
  position: relative;
  color: #f8f4ea;
  background:
    linear-gradient(115deg, rgba(19,19,18,.98) 0 58%, rgba(19,19,18,.82)),
    repeating-linear-gradient(135deg, transparent 0 8px, rgba(255,255,255,.025) 8px 9px);
  border: 1px solid #35332e;
  box-shadow: var(--shadow);
}
.hero::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 9px; background: var(--red); }
.hero::after { content: "ARCHIVE  //  RESTRICTED"; position: absolute; right: -98px; top: 86px; color: rgba(255,255,255,.055); font: 900 47px/1 Arial, sans-serif; letter-spacing: .12em; transform: rotate(90deg); }
.hero-copy { position: relative; z-index: 1; }
.eyebrow { margin: 0 0 8px; color: var(--red); font: 800 10px/1.35 Arial, sans-serif; letter-spacing: .17em; text-transform: uppercase; }
.hero .eyebrow, .editor-toolbar .eyebrow { color: #d26b5f; }
.hero h1 { max-width: 820px; margin: 0; font-size: clamp(42px, 6.5vw, 92px); line-height: .98; letter-spacing: -.045em; }
.hero h1 em { color: #c96b47; font-style: normal; }
.hero-lead { max-width: 670px; margin: 28px 0 0; color: #cac5bb; font-size: clamp(15px, 1.4vw, 19px); line-height: 1.9; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.hero-panel { position: relative; z-index: 1; display: grid; gap: 16px; }
.radar-card { min-height: 330px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: #242421; border: 1px solid #3c3c37; box-shadow: inset 0 0 70px rgba(0,0,0,.22); }
.radar-ring { width: 150px; height: 150px; display: grid; place-items: center; border: 1px solid #676b5e; border-radius: 50%; background: repeating-radial-gradient(circle, transparent 0 23px, rgba(108,126,100,.16) 24px 25px); position: relative; }
.radar-ring::before, .radar-ring::after { content: ""; position: absolute; background: #545a4f; opacity: .55; }
.radar-ring::before { width: 1px; height: 100%; }
.radar-ring::after { width: 100%; height: 1px; }
.radar-ring span { display: grid; place-items: center; width: 56px; height: 56px; z-index: 1; color: #dae0d5; border: 1px solid #7e8b75; font: 900 17px/1 Arial; background: #242421; transform: rotate(-4deg); }
.radar-card p { margin: 25px 0 5px; color: #77746e; font: 700 9px/1 Arial; letter-spacing: .18em; }
.radar-card strong { font: 800 12px/1.2 Arial; letter-spacing: .12em; }
.radar-card b { margin-top: 6px; color: #d56e55; font: 900 40px/1 Arial; }
.warning-card { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 16px; color: #bdb9b0; background: #1d1d1b; border-left: 3px solid var(--orange); }
.warning-card span { align-self: start; padding: 5px 7px; color: #181817; background: var(--orange); font: 900 9px/1 Arial; }
.warning-card p { margin: 0; font-size: 11px; line-height: 1.7; }

.home-features {
  max-width: 1510px;
  margin: 30px auto 0;
  padding: clamp(20px, 3vw, 32px);
  background: rgba(244,240,231,.92);
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(28,25,21,.07);
}
.feature-intro { display: grid; grid-template-columns: minmax(260px,.72fr) minmax(360px,1.28fr); gap: 28px; align-items: end; margin-bottom: 20px; }
.feature-intro h2 { margin: 0; font-size: clamp(26px,3vw,40px); line-height: 1; letter-spacing: -.025em; }
.feature-intro > p { max-width: 680px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.75; }
.feature-guide-link { display: inline-block; margin-left: 7px; color: var(--red); font-weight: 900; text-decoration: none; white-space: nowrap; }
.feature-guide-link:hover { color: var(--red-dark); text-decoration: underline; }
.feature-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.feature-card {
  --feature-accent: var(--ink);
  position: relative;
  min-width: 0;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  padding: 17px;
  overflow: hidden;
  background: rgba(255,253,247,.88);
  border: 1px solid #c8c0b1;
  border-top: 3px solid var(--feature-accent);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.feature-card:hover { transform: translateY(-2px); border-color: #aaa194; box-shadow: 0 12px 22px rgba(28,25,21,.09); }
.feature-card.red { --feature-accent: var(--red); }
.feature-card.green { --feature-accent: var(--green); }
.feature-card.orange { --feature-accent: var(--orange); }
.feature-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.feature-code { color: #b8b0a3; font: 900 21px/1 Arial,sans-serif; letter-spacing: -.04em; }
.feature-kicker { padding: 5px 7px; color: var(--feature-accent); background: #ece6db; font: 900 8px/1 Arial,sans-serif; letter-spacing: .12em; }
.feature-card h3 { margin: 17px 0 7px; font-size: 17px; line-height: 1.35; }
.feature-card p { flex: 1; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.feature-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 15px; }
.feature-tags span { padding: 4px 6px; color: #625d55; background: #e9e3d8; border: 1px solid #d1c9bc; font-size: 8px; font-weight: 800; }

.button, .icon-button, .text-button { border: 0; transition: .18s ease; }
.button { min-height: var(--control-height); display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 12px; border: 1px solid transparent; border-radius: var(--control-radius); font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.button-large { min-height: 44px; padding-inline: 20px; }
.button-primary { color: #fff; background: var(--red); border-color: var(--red); box-shadow: 0 8px 20px rgba(163,58,47,.16); }
.button-primary:hover { background: #b54337; }
.button-ghost { color: inherit; background: transparent; border-color: currentColor; opacity: .84; }
.button-ghost:hover { opacity: 1; }
.button-danger { color: #fff; background: #282725; border-color: #5f302c; }
.button-danger:hover { background: #662e29; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; color: #fff; background: #2c2b28; border: 1px solid #494741; border-radius: var(--control-radius); font-size: 18px; }
.text-button { padding: 5px 0; color: var(--red); background: transparent; font-size: 11px; font-weight: 800; }
.text-button:hover { color: var(--red-dark); }

.archive-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 48px 0 22px; }
.archive-toolbar h2 { margin: 0; font-size: clamp(25px, 3vw, 42px); }
.search-box { width: min(420px, 100%); display: flex; align-items: center; gap: 10px; padding: 0 14px; background: rgba(255,253,247,.65); border-bottom: 2px solid var(--ink); }
.search-box span { color: var(--muted); font-size: 11px; font-weight: 800; }
.search-box input { width: 100%; min-height: 45px; padding: 0; border: 0; outline: 0; background: transparent; }
.character-list { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.character-card { min-width: 0; display: grid; grid-template-columns: 78px minmax(0,1fr); gap: 17px; padding: 18px; text-align: left; background: rgba(255,253,247,.82); border: 1px solid var(--line); border-top: 4px solid var(--ink); box-shadow: 0 8px 20px rgba(28,25,21,.05); }
.character-card:hover { border-top-color: var(--red); transform: translateY(-2px); box-shadow: 0 16px 32px rgba(28,25,21,.1); }
.character-avatar { width: 78px; height: 92px; display: grid; place-items: center; overflow: hidden; color: #e9e4da; background: #292824; font: 900 25px/1 Arial; }
.character-avatar img { width: 100%; height: 100%; object-fit: cover; }
.character-card .meta { min-width: 0; }
.character-card h3 { overflow: hidden; margin: 3px 0 7px; font-size: 19px; text-overflow: ellipsis; white-space: nowrap; }
.character-card p { overflow: hidden; margin: 0; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.character-card footer { display: flex; justify-content: space-between; gap: 8px; margin-top: 18px; color: #918b80; font: 700 9px/1.2 Arial; letter-spacing: .08em; }
.home-contact { margin-top: 22px; padding: 14px 16px; color: var(--muted); background: rgba(255,253,247,.55); border-top: 1px solid var(--line); font-size: 10px; text-align: center; }
.home-contact a { color: var(--red); font-weight: 900; text-decoration: none; }
.home-contact a:hover { text-decoration: underline; }
.empty-state { grid-column: 1/-1; padding: 70px 24px; text-align: center; color: var(--muted); background: rgba(255,253,247,.55); border: 1px dashed #aaa294; }
.empty-state b { display: block; margin-bottom: 10px; color: var(--ink); font-size: 20px; }

.editor-view { max-width: none; background: var(--paper); }
.editor-toolbar {
  position: sticky;
  top: var(--header-height);
  z-index: 70;
  min-height: var(--editor-toolbar-height);
  display: grid;
  grid-template-columns: auto minmax(170px,1fr) auto auto auto;
  align-items: center;
  gap: 11px;
  padding: 8px clamp(14px, 2.5vw, 34px);
  color: #f8f4ea;
  background: rgba(26,26,24,.975);
  border-bottom: 1px solid #3b3934;
  backdrop-filter: blur(12px);
}
.editor-title { min-width: 0; }
.editor-title .eyebrow { margin-bottom: 2px; }
.editor-title-line { min-width: 0; display: flex; align-items: center; gap: 13px; }
.editor-title h1 { min-width: 0; overflow: hidden; margin: 0; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.toolbar-experience { min-width: 112px; display: grid; gap: 3px; padding: 6px 10px; color: #eee9df; background: #242421; border-left: 3px solid var(--green); white-space: nowrap; }
.toolbar-experience span { color: #aaa49a; font-size: 8px; font-weight: 800; }
.toolbar-experience strong { font: 900 14px/1 Arial,sans-serif; }
.toolbar-experience.over { background: #3a211f; border-left-color: var(--red); }
.save-state { display: flex; align-items: center; gap: 8px; color: #bdb7ad; font-size: 11px; font-weight: 700; }
.save-state.dirty i { background: var(--orange); box-shadow: 0 0 0 3px rgba(187,110,45,.16); }
.save-state.error i { background: #d45a4e; }
.live-refresh-state { display: inline-flex; align-items: center; gap: 8px; padding: 7px 9px; color: #c8c2b7; background: #242421; border: 1px solid #48453f; font-size: 10px; font-weight: 800; white-space: nowrap; }
.live-refresh-state i { width: 8px; height: 8px; border-radius: 50%; background: #86a276; box-shadow: 0 0 0 3px rgba(134,162,118,.14); }
.live-refresh-state.stopped { color: #f0d3c5; border-color: #754238; }
.live-refresh-state.stopped i { background: var(--orange); box-shadow: 0 0 0 3px rgba(187,110,45,.15); }
.toolbar-buttons { display: flex; flex-wrap: wrap; justify-content: end; gap: 7px; }
.toolbar-buttons .button { min-height: 34px; padding: 6px 10px; }
.section-nav { position: sticky; top: calc(var(--header-height) + var(--editor-toolbar-height)); z-index: 65; display: flex; overflow-x: auto; padding: 0 clamp(14px, 2.5vw, 34px); background: #f0ece3; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.section-nav a { flex: 0 0 auto; padding: 10px 15px; color: #5c5953; border-bottom: 3px solid transparent; font-size: 10px; font-weight: 800; text-decoration: none; }
.section-nav a:hover { color: var(--red); border-bottom-color: var(--red); }
.section-nav-actions { position: sticky; right: 0; flex: 0 0 auto; display: flex; align-items: stretch; margin-left: auto; padding-left: 12px; background: linear-gradient(90deg, transparent, #f0ece3 12px); }
.section-nav-actions button { padding: 0 12px; color: #58544e; background: #e2dcd1; border: 0; border-left: 1px solid #c8c0b1; font-size: 10px; font-weight: 800; white-space: nowrap; }
.section-nav-actions button:hover { color: #fff; background: var(--red); }
.editor-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.editor-fieldset[disabled] { opacity: .96; }
.editor-fieldset[disabled] input, .editor-fieldset[disabled] select, .editor-fieldset[disabled] textarea { color: #363430; -webkit-text-fill-color: #363430; opacity: 1; }
.sheet-section { padding: clamp(24px, 3vw, 38px) clamp(14px, 2.5vw, 36px); border-bottom: 1px solid var(--line); scroll-margin-top: 142px; }
.sheet-section:nth-of-type(even) { background: #ece7dc; }
.section-heading { position: relative; max-width: 1510px; display: flex; align-items: end; justify-content: space-between; gap: 14px; margin: 0 auto 16px; padding-right: 44px; }
.section-heading-toggle { cursor: pointer; border-radius: var(--control-radius); transition: background-color .18s ease; }
.section-heading-toggle:hover { background: rgba(163,58,47,.055); }
.integration-section .section-heading-toggle:hover { background: rgba(255,255,255,.045); }
.section-heading > div:first-child { position: relative; padding-left: 52px; }
.section-number { position: absolute; left: 0; bottom: 1px; color: #a9a296; font: 900 27px/1 Arial; letter-spacing: -.04em; }
.section-heading h2 { margin: 0; font-size: clamp(26px, 3vw, 38px); line-height: 1; letter-spacing: -.025em; }
.section-body { min-width: 0; }
.sheet-section.is-collapsed { padding-top: 25px; padding-bottom: 25px; }
.sheet-section.is-collapsed .section-heading { margin-bottom: 0; }
.sheet-section.is-collapsed .section-body { display: none; }
.section-toggle { position: absolute; right: 0; bottom: 0; width: 36px; height: 36px; display: grid; place-items: center; color: var(--ink); background: rgba(255,253,247,.56); border: 1px solid #afa799; border-radius: var(--control-radius); font: 900 18px/1 Arial; cursor: pointer; user-select: none; transition: .18s ease; }
.section-toggle:hover { color: #fff; background: var(--red); border-color: var(--red); }
.sheet-section.is-collapsed .section-toggle { transform: rotate(180deg); }
.integration-section .section-toggle { color: #fff; background: #292925; border-color: #555149; }
.formula-note { color: var(--muted); font-size: 11px; }
.section-note { max-width: 1510px; margin: -8px auto 20px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.visibility-control { display: grid; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 800; }
.visibility-control select { min-width: 180px; padding: 9px 34px 9px 10px; background: #fffdf7; border: 1px solid var(--line); }

.profile-grid { max-width: 1510px; display: grid; grid-template-columns: 210px minmax(0,1fr) minmax(310px,.78fr); gap: 11px; margin: 0 auto; align-items: stretch; }
.portrait-card { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 11px; background: #1d1d1b; border-top: 4px solid var(--red); }
.portrait-button { width: 100%; min-height: 270px; display: grid; place-items: center; overflow: hidden; padding: 0; color: #8f8b82; background: #292825; border: 1px dashed #5c5952; }
.portrait-button:hover { color: #fff; border-color: #968f82; }
.portrait-button img { width: 100%; height: 100%; min-height: 270px; object-fit: cover; }
.portrait-button b { display: block; margin-bottom: 7px; color: #d16c5c; font-size: 34px; }
.portrait-button small { font-size: 10px; }
.portrait-note { color: #918b81; font-size: 9px; line-height: 1.3; }
.portrait-card .text-button { color: #c5beb1; }
.form-panel { padding: var(--panel-padding); background: rgba(255,253,247,.76); border: 1px solid var(--line); border-top: 3px solid var(--ink); }
.field-grid { display: grid; gap: 9px; }
.field-grid.cols-2 { grid-template-columns: repeat(2,minmax(0,1fr)); }
.field-grid.cols-4 { grid-template-columns: repeat(4,minmax(0,1fr)); }
.field-wide { grid-column: span 2; }
.profile-fields { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 9px; }
.profile-fields .profile-name { flex: 2 1 310px; }
.profile-fields .profile-player { flex: 1 1 170px; }
.profile-fields .profile-timeline { flex: 0 0 150px; }
.profile-fields .profile-occupation { flex: 0 1 235px; }
.profile-fields .profile-former { flex: 0 1 220px; }
.profile-fields .profile-age { flex: 0 0 72px; }
.profile-fields .profile-gender { flex: 0 0 92px; }
.profile-fields .profile-physique { flex: 0 0 138px; }
.profile-fields .profile-weight { flex: 0 0 205px; }
.field { min-width: 0; display: grid; align-content: start; gap: 4px; color: #5f5b54; font-size: 9px; font-weight: 800; letter-spacing: .02em; }
.field > span b { margin-left: 6px; color: #9b9488; font: 700 9px/1 Arial; }
.field input, .field select, .field textarea, .field output {
  width: 100%;
  min-height: var(--control-height);
  padding: 6px 9px;
  color: var(--ink);
  background: rgba(255,255,255,.66);
  border: 1px solid #beb7a9;
  border-radius: var(--control-radius);
  outline: none;
  font-size: 12px;
  font-weight: 500;
}
.field select { width: auto; min-width: 68px; max-width: 100%; padding-right: 28px; field-sizing: content; }
.profile-occupation select, .profile-former select { min-width: 12.5em; }
.field textarea { min-height: 74px; resize: vertical; line-height: 1.55; }
.field output { display: flex; align-items: center; background: #e8e3d9; }
.fixed-value { min-height: var(--control-height); display: flex; align-items: center; padding: 6px 9px; color: var(--ink); background: #e8e3d9; border: 1px solid #beb7a9; border-radius: var(--control-radius); font-size: 12px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(163,58,47,.1); }
.field-with-button { display: grid; grid-template-columns: 1fr auto; }
.field-with-button button { border: 1px solid #aaa295; border-left: 0; background: #ded8cc; font-size: 10px; font-weight: 800; }
.identity-panel > .field { margin-top: 14px; }
.panel-title { display: flex; align-items: start; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.panel-title h3, .subsection-header h3 { margin: 0; font-size: 17px; }
.background-fields { display: grid; gap: 11px; }
.background-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.background-row .field { grid-column: 1; }
.background-row button { grid-column: 2; grid-row: 1; min-height: var(--control-height); padding: 0 9px; color: #fff; background: var(--green); border: 0; border-radius: var(--control-radius); font-size: 10px; font-weight: 800; }
.background-row.is-disabled { opacity: .55; }
.background-row.is-disabled .field > span { color: #77716a; }
.background-row.is-disabled select { color: #7d776e; background: #ddd7cc; cursor: not-allowed; }
.background-row button:disabled { color: #777168; background: #d7d0c4; border: 1px solid #c1b9ac; cursor: not-allowed; }
.background-row.is-disabled .background-description { color: #777168; background: #ddd7cc; border-left-color: #aaa296; }
.background-description { grid-column: 1/-1; margin: -2px 0 4px; padding: 8px 10px; color: var(--muted); background: #e9e4d9; border-left: 3px solid var(--green); font-size: 11px; line-height: 1.55; }

.status-layout { max-width: 1510px; display: grid; grid-template-columns: minmax(620px,1.2fr) minmax(360px,.8fr); gap: 20px; margin: 0 auto; }
.status-table-panel { min-width: 0; }
.status-table-tools { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0 6px 10px; }
.status-table-tools p { margin: 0; color: var(--muted); font-size: 11px; }
.status-table-tools .budget-chip { flex: 0 0 auto; }
.table-wrap { overflow-x: auto; background: rgba(255,253,247,.72); border: 1px solid var(--line); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 9px 7px; color: #f3eee3; background: var(--ink); border-right: 1px solid #3a3936; font-size: 9px; letter-spacing: .05em; }
.data-table td { padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table select { width: 72px; min-height: 36px; padding: 5px 22px 5px 8px; border: 1px solid #aaa294; border-radius: var(--control-radius); text-align: center; background: #fffdf8; font-size: 13px; font-weight: 800; }
.data-table select:focus { outline: 3px solid rgba(163,58,47,.16); border-color: var(--red); }
.stat-label { text-align: left !important; background: #d9d3c8; }
.stat-label strong { display: block; font: 900 17px/1 Arial; }
.stat-label small { color: var(--muted); font-size: 9px; }
.job-value { color: #f7f2e7; background: var(--green); font: 900 17px/1 Arial; }
.current-value { color: #fff; background: var(--red); font: 900 20px/1 Arial; }
.row-warning { box-shadow: inset 4px 0 var(--orange); }
.derived-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; align-content: start; }
.derived-card { min-height: 96px; display: flex; flex-direction: column; justify-content: space-between; gap: 4px; padding: 12px; background: #262522; border-top: 3px solid #59564f; color: #eee9df; }
.derived-card.has-bottom-bonuses { min-height: 116px; }
.derived-card.accent { border-top-color: var(--red); }
.derived-card.green { border-top-color: var(--green-bright); }
.derived-card.orange { border-top-color: var(--orange); }
.derived-card span { color: #9f9b92; font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.derived-card-value { min-height: 32px; display: flex; align-items: end; gap: 12px; }
.derived-card strong { font: 900 25px/1 Arial; }
.derived-card small { color: #77736b; font-size: 9px; }
.derived-bonus-controls { display: grid; grid-template-columns: repeat(auto-fit,minmax(0,1fr)); gap: 5px; margin-top: 2px; }
.derived-bonus-control { min-width: 0; display: grid; grid-template-columns: auto minmax(42px,54px); gap: 5px; align-items: center; color: #aaa59c; font-size: 9px; font-weight: 800; }
.derived-card .derived-bonus-control span { color: #aaa59c; font-size: 9px; letter-spacing: 0; }
.derived-bonus-control input { width: 100%; min-height: 29px; padding: 4px 6px; color: #fff; background: #171715; border: 1px solid #68645d; font: 800 14px/1 Arial; text-align: center; }
.derived-bonus-control input:focus { border-color: var(--orange); outline: 1px solid var(--orange); }
.derived-card.has-inline-bonus .derived-bonus-controls { width: 70px; display: block; margin: 0 0 0 auto; }
.derived-card.has-inline-bonus .derived-bonus-control { grid-template-columns: 1fr; gap: 3px; }
.derived-card.has-inline-bonus .derived-bonus-control input { min-height: 32px; }
.budget-stack { display: flex; gap: 8px; flex-wrap: wrap; justify-content: end; }
.budget-chip { min-width: 118px; padding: 9px 13px; color: #ebe7dd; background: var(--ink); border-left: 4px solid var(--green); text-align: right; }
.budget-chip span { display: block; color: #99958d; font-size: 9px; font-weight: 800; }
.budget-chip strong { font: 900 17px/1 Arial; }
.budget-chip.over { border-left-color: var(--red); background: #3a211f; }
.validation-summary { max-width: 1510px; margin: 16px auto 0; padding: 13px 16px; color: #6d2721; background: #f2d9d4; border-left: 4px solid var(--red); font-size: 12px; line-height: 1.7; }

.skills-grid { max-width: 1510px; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 11px; margin: 0 auto; }
.skill-card { overflow: hidden; background: rgba(255,253,247,.8); border: 1px solid var(--line); }
.skill-card header { display: flex; justify-content: space-between; align-items: center; padding: 9px 11px; color: #f6f1e7; background: var(--ink); }
.skill-card header h3 { margin: 0; font-size: 14px; }
.damage-bonus { color: #d8a076; font-size: 10px; font-weight: 800; }
.skill-row { display: grid; grid-template-columns: 38px minmax(122px,1fr) 68px 68px 56px; align-items: center; border-bottom: 1px solid #d3ccbf; }
.skill-row:last-child { border-bottom: 0; }
.skill-row > * { min-width: 0; }
.skill-row .favored-cell { display: grid; place-items: center; height: 100%; background: #e4dfd5; }
.favored-cell input { width: 22px; height: 22px; accent-color: var(--green); }
.favored-cell input:disabled { opacity: .2; }
.skill-name { display: grid; gap: 4px; padding: 7px 8px; font-size: 10px; font-weight: 700; }
.skill-detail-input { width: 100%; min-height: 35px; padding: 6px 8px; background: #fff; border: 1px solid #bdb5a8; font-size: 11px; }
.skill-detail-input:focus { outline: 3px solid rgba(163,58,47,.12); border-color: var(--red); }
.skill-row label { display: grid; gap: 3px; padding: 5px; color: #888279; font-size: 8px; text-align: center; }
.skill-row select { width: 100%; min-height: 36px; padding: 5px 20px 5px 7px; border: 1px solid #aaa294; border-radius: var(--control-radius); text-align: center; background: #fff; font-size: 12px; font-weight: 800; }
.skill-current { display: grid; place-items: center; align-self: stretch; color: #fff; background: var(--red); font: 900 17px/1 Arial; }
.subsection-header { max-width: 1510px; display: flex; align-items: end; justify-content: space-between; gap: 10px; margin: 22px auto 9px; padding-top: 12px; border-top: 1px solid var(--line); }
.subsection-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.compact-list, .stack-list, .equipment-list { max-width: 1510px; display: grid; gap: 7px; margin: 0 auto; }
.compact-row { display: grid; grid-template-columns: repeat(12,minmax(0,1fr)) auto; gap: 7px; align-items: end; padding: 9px; background: rgba(255,253,247,.76); border: 1px solid var(--line); }
.compact-row .field { grid-column: span 2; }
.compact-row .field.field-grow { grid-column: span 4; }
.custom-skill-row { grid-template-columns: 42px 104px minmax(140px,240px) 78px 78px 78px auto; justify-content: start; }
.custom-skill-row .field, .custom-skill-row .field.field-grow { grid-column: auto; }
.custom-skill-row .custom-favored { align-self: stretch; display: grid; place-items: center; gap: 3px; color: var(--muted); background: #e4dfd5; font-size: 8px; font-weight: 800; }
.custom-skill-row .custom-favored input { width: 22px; height: 22px; accent-color: var(--green); }
.row-delete { width: 36px; height: 36px; display: grid; place-items: center; align-self: end; color: #7a7069; background: #e5dfd4; border: 1px solid #c6bfb2; border-radius: var(--control-radius); font-size: 16px; font-weight: 900; }
.row-delete:hover { color: #fff; background: var(--red); border-color: var(--red); }

.gift-row { display: grid; grid-template-columns: 205px minmax(160px,.75fr) 132px minmax(250px,1.5fr); gap: 8px; padding: 10px; background: rgba(255,253,247,.75); border: 1px solid var(--line); border-left: 4px solid #aba397; }
.gift-row.available { border-left-color: var(--green); }
.gift-condition { display: flex; flex-direction: column; justify-content: center; gap: 5px; }
.gift-condition strong { font-size: 12px; }
.gift-condition span { color: var(--muted); font-size: 10px; }
.gift-condition label { display: flex; align-items: center; gap: 7px; margin-top: 4px; color: var(--orange); font-size: 9px; font-weight: 800; }
.gift-condition .gift-unlock-control.is-int-unlocked { color: #8d887f; cursor: not-allowed; }
.gift-condition .gift-unlock-control input:disabled { filter: grayscale(1); opacity: .55; }
.gift-condition .gift-unlock-control.is-int-unlocked span { color: #8d887f; }
.gift-effect-field, .gift-extra-skill { display: grid !important; gap: 3px !important; margin-top: 5px !important; color: var(--ink) !important; }
.gift-effect-field select, .gift-extra-skill select { min-height: 31px; padding: 5px 25px 5px 8px; border: 1px solid #bcb4a7; background: #fffdf8; font-size: 12px; font-weight: 800; }
.gift-effect-summary { margin: 0; color: #6c655c; font-size: 10px; line-height: 1.45; }
.gift-skill-tag { display: block; margin-top: 2px; color: var(--orange); font-size: 9px; font-weight: 900; line-height: 1.2; }
.gift-cost-field { min-width: 140px; }
.gift-fixed-value { white-space: nowrap; font-size: 12px; letter-spacing: -.01em; }

.equipment-row { display: grid; gap: 7px; padding: 10px; background: rgba(255,253,247,.82); border: 1px solid var(--line); border-left: 3px solid var(--ink); }
.equipment-card { min-width: 0; }
.equipment-line { min-width: 0; display: grid; gap: 7px; align-items: end; }
.equipment-row .field-wide { grid-column: auto; }
.weapon-line-primary { grid-template-columns: 50px minmax(260px,1.7fr) 68px minmax(120px,1fr) 64px 96px 88px; }
.weapon-line-secondary { grid-template-columns: 82px 76px 82px 76px minmax(320px,1fr); padding-top: 8px; border-top: 1px dashed #c7bfb1; }
.equipment-row.armor { grid-template-columns: 78px minmax(240px,1fr) 72px 82px 76px minmax(280px,2.2fr); }
.equipment-row.accessory { grid-template-columns: 112px minmax(240px,1fr) minmax(320px,2.8fr) 36px; }
.vehicle-line-primary { grid-template-columns: 96px minmax(210px,1fr) 74px 74px 64px 64px 36px; }
.vehicle-line-secondary { grid-template-columns: 1fr; padding-top: 8px; border-top: 1px dashed #c7bfb1; }
.item-line-single { grid-template-columns: 36px 44px 96px minmax(150px,1fr) 60px 54px 58px 138px 78px minmax(230px,280px) 36px; }
.equipment-row .field input, .equipment-row .field select { min-height: var(--control-height); }
.equipment-row .field { align-self: end; font-size: 9px; }
.equipment-row .field textarea { min-height: var(--control-height); height: var(--control-height); padding-block: 7px; resize: vertical; line-height: 1.35; }
.field-check input { width: 25px !important; height: 25px; min-height: 25px !important; accent-color: var(--green); }
.fixed-slot { min-height: 52px; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 7px 9px; color: #fff; background: var(--ink); }
.fixed-slot small { color: #aaa49a; font-size: 9px; font-weight: 800; }
.fixed-slot strong { font-size: 16px; }
.computed-field { min-height: 38px; display: flex; align-items: center; justify-content: center; color: #fff; background: var(--green); font-size: 13px; font-weight: 900; }
.weapon-db-field .computed-field { white-space: nowrap; font-size: 12px; }
.equipment-picker select { width: 100%; }
.equipment-display { min-width: 0; display: grid; align-content: end; gap: 4px; color: #5f5b54; font-size: 9px; font-weight: 800; }
.equipment-display > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.equipment-display > strong, .equipment-display > p { min-height: var(--control-height); display: flex; align-items: center; overflow: hidden; margin: 0; padding: 6px 9px; color: var(--ink); background: #e8e3d9; border-left: 3px solid #b7afa2; border-radius: var(--control-radius); font-size: 12px; line-height: 1.35; }
.equipment-display > strong { text-overflow: ellipsis; white-space: nowrap; }
.equipment-effect > p { min-height: var(--control-height); max-height: 52px; overflow: auto; white-space: pre-wrap; }
.equipment-current-field input { font-weight: 900; text-align: center; }
.equipment-empty .equipment-display > strong, .equipment-empty .equipment-display > p { color: #938d84; background: #eee9df; border-left-color: #d2cabd; }
.equipment-scroll { overflow-x: auto; }
.item-price-box { align-self: end; min-height: 52px; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border: 1px solid #a9a092; border-radius: var(--control-radius); }
.item-price-box span { display: grid; place-items: center; gap: 3px; padding: 6px; color: #615c54; background: #e7e1d6; font-size: 9px; font-weight: 900; }
.item-price-box span + span { border-left: 1px solid #b9b1a4; }
.item-price-box strong { color: var(--ink); font: 900 16px/1 Arial; }
.item-actions { align-self: stretch; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; }
.item-action { min-height: 52px; padding: 6px 8px; color: #fff; border: 0; border-radius: var(--control-radius); font-size: 11px; font-weight: 900; }
.item-action.buy { background: var(--red); }
.item-action.sell { background: var(--orange); }
.item-action.acquire { background: var(--green); }
.item-action.discard { background: #34322e; }
.item-action:hover { filter: brightness(1.12); }
.drag-handle { width: 36px; min-height: 36px; align-self: end; color: #fff; background: #4a4843; border: 0; border-radius: var(--control-radius); font-size: 17px; font-weight: 900; cursor: grab; }
.drag-handle:active { cursor: grabbing; }
.item-detail-toggle { width: 44px; min-height: 36px; align-self: end; padding: 4px; color: #fff; background: var(--green); border: 0; border-radius: var(--control-radius); font-size: 9px; font-weight: 900; }
.item-detail-toggle[aria-expanded="true"] { background: var(--orange); }
.transaction-item.is-dragging { opacity: .42; }
.transaction-item.drag-over { outline: 3px solid var(--orange); outline-offset: -3px; }
.item-owned-count output { justify-content: center; font-weight: 900; white-space: nowrap; }
.item-details { min-width: 0; border-top: 1px dashed #c7bfb1; }
.item-details-hidden { display: none; }
.item-details-grid { display: grid; gap: 7px; align-items: end; padding: 9px 4px 2px; }
.item-details-weapon { grid-template-columns: 76px minmax(145px,1fr) 70px 100px repeat(4,72px); }
.item-details-armor { grid-template-columns: 72px 76px 76px minmax(280px,1fr); }
.item-details-accessory { grid-template-columns: 116px minmax(320px,1fr); }
.item-details-general { grid-template-columns: 1fr; }
.item-details-weapon .item-effect-field { grid-column: 1/-1; }
.item-effect-field textarea { min-height: var(--control-height) !important; height: var(--control-height); resize: vertical; }

.weight-meter { min-width: 260px; text-align: right; }
.weight-meter span { font: 900 18px/1 Arial; }
.weight-meter i { width: 260px; height: 8px; display: block; overflow: hidden; margin-top: 7px; background: #cfc8bb; }
.weight-meter em { width: 0; height: 100%; display: block; background: var(--green); transition: width .25s ease; }
.weight-meter.over em { background: var(--red); }
.weight-meter small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; font-style: normal; }
.weight-meter.over small { color: var(--red); font-weight: 800; }
.resource-grid { max-width: 1510px; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; margin: 0 auto 15px; padding: 12px; background: #dcd6ca; border: 1px solid #c3bbad; }
.inventory-market { max-width: 1510px; display: grid; grid-template-columns: minmax(330px,1fr) minmax(250px,.65fr) 170px; gap: 13px; align-items: end; margin: 0 auto; padding: 15px; color: #eee9df; background: #262522; border-left: 4px solid var(--orange); }
.inventory-market h3 { margin: 0; font-size: 22px; }
.inventory-market p:not(.eyebrow) { margin: 8px 0 0; color: #9f9b92; font-size: 11px; line-height: 1.6; }
.inventory-market .field { color: #bdb7ad; }
.inventory-market .field select { min-height: 38px; color: var(--ink); background: #fffdf7; font-weight: 800; }
.market-rate-summary { min-height: 19px; color: #d8ba9f !important; font-weight: 800; }
.market-table-field { gap: 8px; }
.market-customize-button { min-height: 40px; color: #fff; background: var(--orange); border: 0; font-size: 11px; font-weight: 900; }
.market-customize-button:hover { filter: brightness(1.12); }
.procurement-balance { min-height: 60px; display: flex; flex-direction: column; justify-content: center; padding: 8px 12px; color: #e6ded2; background: #171716; border-top: 3px solid var(--orange); }
.procurement-balance span { color: #969188; font-size: 9px; font-weight: 800; }
.procurement-balance strong { margin-top: 5px; font: 900 27px/1 Arial; }
.transaction-log { max-width: 1510px; display: grid; gap: 6px; margin: 0 auto; }
.transaction-entry { display: grid; grid-template-columns: 96px 66px minmax(150px,1fr) 110px 88px; gap: 8px; align-items: center; padding: 8px 10px; background: rgba(255,253,247,.72); border: 1px solid var(--line); border-left: 3px solid var(--green); font-size: 10px; }
.transaction-entry.sell { border-left-color: var(--orange); }
.transaction-entry.discard { border-left-color: #55524c; }
.transaction-entry.buy { border-left-color: var(--red); }
.transaction-entry.remove { border-left-color: #4d6c78; }
.transaction-entry time, .transaction-entry small { color: var(--muted); font-size: 9px; }
.transaction-entry b { font-size: 12px; }
.transaction-entry .points { text-align: right; font: 900 13px/1 Arial; }
.transaction-entry .points.plus { color: #3f6843; }
.transaction-entry .points.minus { color: var(--red); }
.transaction-overflow { margin-top: 3px; border: 1px solid #afa799; background: rgba(255,253,247,.42); }
.transaction-overflow summary { padding: 13px 15px; color: var(--red); cursor: pointer; font-size: 11px; font-weight: 900; }
.transaction-overflow[open] summary { border-bottom: 1px solid var(--line); }
.transaction-older-list { display: grid; gap: 6px; padding: 8px; }

.session-layout { max-width: 1510px; display: grid; grid-template-columns: .7fr 1.3fr; gap: 11px; margin: 0 auto; }
.bad-status-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.bad-status-item { display: grid; grid-template-columns: auto 1fr 58px; gap: 7px; align-items: center; padding: 7px; background: #e9e4d9; }
.bad-status-item input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--red); }
.bad-status-item span { font-size: 11px; font-weight: 700; }
.bad-status-item input[type="number"] { width: 100%; min-height: 30px; border: 1px solid #bdb5a8; border-radius: var(--control-radius); text-align: center; }
.notes-field { max-width: 1510px; margin: 25px auto 0; }
.notes-field textarea { background: rgba(255,253,247,.78); }

.integration-section { color: #efebe1; background: #1a1a18 !important; }
.integration-section .section-number { color: #595750; }
.integration-section .section-heading h2 { color: #fff; }
.integration-grid { max-width: 1510px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin: 0 auto; }
.export-card { padding: clamp(20px, 3vw, 35px); background: #242421; border: 1px solid #3b3934; }
.export-card h3 { margin: 16px 0 8px; font-size: 24px; }
.export-card p { max-width: 650px; min-height: 48px; color: #9e9b93; font-size: 12px; line-height: 1.7; }
.export-card textarea { width: 100%; margin-top: 17px; padding: 13px; color: #d8d8d1; background: #111; border: 1px solid #403f3a; resize: vertical; font: 11px/1.6 Consolas, monospace; }
.export-tag { display: inline-block; padding: 5px 8px; color: #fff; font: 900 9px/1 Arial; letter-spacing: .1em; }
.export-tag.green { background: var(--green); }
.export-tag.orange { background: var(--orange); }

.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; gap: 9px; pointer-events: none; }
.toast { min-width: 260px; max-width: min(420px, calc(100vw - 36px)); padding: 13px 15px; color: #fff; background: #22211f; border-left: 4px solid var(--green-bright); box-shadow: 0 12px 30px rgba(0,0,0,.22); font-size: 12px; animation: toastIn .2s ease; }
.toast.error { border-left-color: var(--red); }
.toast.info { border-left-color: var(--orange); }
@keyframes toastIn { from { opacity: 0; transform: translateY(7px); } }
.confirm-dialog { width: min(480px, calc(100vw - 30px)); padding: 0; color: var(--ink); background: var(--paper); border: 1px solid #6e675d; box-shadow: 0 25px 80px rgba(0,0,0,.35); }
.confirm-dialog::backdrop { background: rgba(17,17,16,.72); backdrop-filter: blur(3px); }
.confirm-dialog form { padding: 26px; }
.confirm-dialog h2 { margin: 0 0 12px; }
.confirm-dialog p:not(.eyebrow) { color: var(--muted); line-height: 1.7; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 24px; }
.password-dialog form { display: grid; gap: 14px; }
.password-dialog h2, .password-dialog p { margin: 0; }
.password-remember { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.password-remember input { width: 18px; height: 18px; accent-color: var(--green); }
.password-error { padding: 9px 11px; color: #762c25 !important; background: #f2d9d4; border-left: 3px solid var(--red); font-size: 11px; }
.market-dialog { width: min(720px, calc(100vw - 28px)); max-height: 86vh; padding: 0; color: var(--ink); background: var(--paper); border: 1px solid #625c53; box-shadow: 0 25px 90px rgba(0,0,0,.42); }
.market-dialog::backdrop { background: rgba(17,17,16,.74); backdrop-filter: blur(3px); }
.market-dialog form { display: grid; gap: 14px; padding: clamp(20px,4vw,34px); }
.market-dialog h2, .market-dialog p { margin: 0; }
.market-dialog form > p:not(.eyebrow) { color: var(--muted); font-size: 11px; line-height: 1.7; }
.irregular-market-rows { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; overflow-y: auto; max-height: 48vh; }
.irregular-market-row { min-height: 55px; display: grid; grid-template-columns: minmax(95px,1fr) minmax(125px,1fr); align-items: center; gap: 9px; padding: 8px 10px; background: #e6e0d5; border: 1px solid #c4bcaf; }
.irregular-market-row strong { font-size: 11px; }
.irregular-market-row select { min-height: 38px; padding: 7px 28px 7px 9px; background: #fff; border: 1px solid #aaa194; font-size: 11px; font-weight: 800; }
.irregular-market-row.fixed span { color: var(--muted); font-size: 11px; font-weight: 800; }

@media (max-width: 1280px) {
  .profile-grid { grid-template-columns: 200px 1fr; }
  .backgrounds-panel { grid-column: 1/-1; }
  .background-fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .status-layout { grid-template-columns: 1fr; }
  .derived-cards { grid-template-columns: repeat(6,minmax(0,1fr)); }
  .character-list, .skills-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .equipment-list { overflow-x: auto; }
  .equipment-row { min-width: 930px; }
  .equipment-row.armor { min-width: 820px; }
  .equipment-row.accessory { min-width: 720px; }
  .equipment-row.item { min-width: 1130px; }
  .session-layout { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .consumables-panel { grid-column: 1/-1; }
  .inventory-market { grid-template-columns: 1fr 1fr; }
  .inventory-market > div:first-child { grid-column: 1/-1; }
}

@media (max-width: 980px) {
  :root { --header-height: 66px; }
  .site-header { padding-inline: 16px; }
  .header-links a { padding-inline: 7px; }
  .system-light { display: none; }
  .header-actions .button { padding-inline: 11px; }
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .hero-panel { grid-template-columns: 1fr 1fr; }
  .radar-card { min-height: 240px; }
  .feature-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .editor-toolbar { grid-template-columns: auto minmax(140px,1fr) auto; }
  .save-state { display: none; }
  .toolbar-buttons { grid-column: 1/-1; justify-content: stretch; }
  .toolbar-buttons .button { flex: 1; }
  .section-nav { top: calc(var(--header-height) + 128px); }
  .profile-grid { grid-template-columns: 190px 1fr; }
  .derived-cards { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .resource-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .inventory-market { grid-template-columns: 1fr 1fr; }
  .procurement-balance { grid-column: 1/-1; }
  .gift-row { grid-template-columns: 1fr 1fr; }
  .integration-grid { grid-template-columns: 1fr; }
  .irregular-market-rows { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .site-header { position: relative; height: auto; min-height: var(--header-height); flex-wrap: wrap; gap: 0 10px; padding: 8px 12px 0; }
  .brand small { display: none; }
  .brand strong { font-size: 12px; }
  .header-links { order: 3; width: calc(100% + 24px); margin: 8px -12px 0; background: #242320; border-top: 1px solid #393733; }
  .header-links a { flex: 1; padding: 9px 8px; text-align: center; }
  .header-actions .button { min-height: 38px; font-size: 10px; }
  .home-view { padding-top: 16px; }
  .hero { padding: 40px 24px; }
  .hero::after { display: none; }
  .hero h1 { font-size: clamp(40px, 13vw, 62px); }
  .hero-panel { grid-template-columns: 1fr; }
  .warning-card { display: none; }
  .home-features { margin-top: 16px; padding: 18px 14px; }
  .feature-intro { grid-template-columns: 1fr; gap: 10px; margin-bottom: 15px; }
  .feature-intro > p { font-size: 11px; }
  .feature-grid { grid-template-columns: 1fr; gap: 8px; }
  .feature-card { min-height: 0; padding: 15px; }
  .feature-card h3 { margin-top: 13px; }
  .archive-toolbar { align-items: stretch; flex-direction: column; }
  .character-list, .skills-grid { grid-template-columns: 1fr; }
  .editor-toolbar { position: sticky; top: 0; min-height: 0; padding: 9px; grid-template-columns: auto minmax(0,1fr) auto; }
  .editor-title h1 { font-size: 15px; }
  .editor-title-line { gap: 7px; }
  .toolbar-experience { min-width: 0; padding: 5px 7px; }
  .toolbar-experience span { font-size: 7px; }
  .toolbar-experience strong { font-size: 12px; }
  .toolbar-buttons { display: grid; grid-template-columns: repeat(4,1fr); overflow-x: auto; }
  .toolbar-buttons .button { padding-inline: 7px; font-size: 9px; white-space: nowrap; }
  #cloneButton { display: none; }
  .section-nav { position: sticky; top: 112px; padding-inline: 0; }
  .section-nav a { padding: 11px 14px; }
  .section-nav-actions button { padding-inline: 9px; font-size: 9px; }
  .sheet-section { padding: 22px 10px; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .section-heading > div:first-child { padding-left: 50px; }
  .section-number { font-size: 28px; }
  .section-heading h2 { font-size: 28px; }
  .visibility-control select { width: 100%; }
  .profile-grid { grid-template-columns: 1fr; }
  .portrait-card { max-width: 360px; width: 100%; margin-inline: auto; }
  .backgrounds-panel { grid-column: auto; }
  .background-fields { grid-template-columns: 1fr; }
  .profile-fields .profile-name, .profile-fields .profile-player { flex-basis: 100%; }
  .profile-fields .profile-occupation, .profile-fields .profile-former { flex: 1 1 210px; }
  .field-grid.cols-2, .field-grid.cols-4 { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .status-layout { display: block; }
  .status-table-tools { padding-left: 0; }
  .derived-cards { grid-template-columns: repeat(2,minmax(0,1fr)); margin-top: 13px; }
  .budget-stack { justify-content: stretch; }
  .budget-chip { flex: 1; }
  .compact-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .compact-row .field, .compact-row .field.field-grow { grid-column: auto; }
  .compact-row .field-grow { grid-column: 1/-1 !important; }
  .compact-row > .row-delete { grid-column: 2; justify-self: end; }
  .gift-row { grid-template-columns: 1fr; }
  .resource-grid, .session-layout { grid-template-columns: 1fr; }
  .inventory-market { grid-template-columns: 1fr; }
  .inventory-market > div:first-child, .procurement-balance { grid-column: auto; }
  .transaction-entry { grid-template-columns: 76px 60px 1fr auto; }
  .transaction-entry small { grid-column: 3; }
  .transaction-entry .points { grid-column: 4; grid-row: 1/3; }
  .consumables-panel { grid-column: auto; }
  .weight-meter { min-width: 0; width: 100%; text-align: left; }
  .weight-meter i { width: 100%; }
  .integration-section { padding-bottom: 70px; }
  .live-refresh-state { max-width: 42vw; overflow: hidden; }
  .live-refresh-state span { overflow: hidden; text-overflow: ellipsis; }
}

@media print {
  body { background: #fff; }
  .site-header, .editor-toolbar, .section-nav, .toolbar-buttons, .button, .text-button, .row-delete, .integration-section { display: none !important; }
  .editor-view, .sheet-section, .sheet-section:nth-of-type(even) { background: #fff !important; }
  .sheet-section { padding: 18px 0; break-inside: avoid; }
  .sheet-section.is-collapsed .section-body { display: block; }
  .form-panel, .character-card, .skill-card, .equipment-row, .gift-row { box-shadow: none; }
  .portrait-card { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
