:root {
  color-scheme: dark;
  --bg: #080504;
  --bg-soft: #110806;
  --panel: rgba(15, 9, 7, 0.95);
  --panel-2: rgba(25, 11, 8, 0.95);
  --line: #7d351c;
  --line-soft: #3d1c12;
  --gold: #f2d45c;
  --gold-2: #ffb734;
  --red: #7f1e14;
  --red-2: #b43c24;
  --text: #f5ead2;
  --muted: #bfae95;
  --cyan: #62dcff;
  --success: #80d48c;
  --danger: #ff8f76;
  --shadow: 0 18px 50px rgba(0,0,0,.45);
  --radius: 10px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #070403; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    linear-gradient(rgba(4,2,1,.78), rgba(4,2,1,.9)),
    url('/static/assets/awakening_background.jpg') center / cover fixed;
}
button, input, select { font: inherit; }
button, select, input, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.mobile-only { display: none !important; }
.muted { color: var(--muted); }
.full { width: 100%; }

.app-shell {
  min-height: 100vh;
  max-width: 1720px;
  margin: 0 auto;
  background: rgba(5, 3, 2, .72);
  border-inline: 1px solid rgba(125,53,28,.35);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 74px;
  padding: 10px 20px;
  background: linear-gradient(180deg, rgba(20,8,5,.98), rgba(8,4,3,.96));
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
}
.brand { display: flex; align-items: center; min-width: 0; }
.brand h1 { margin: 0; color: var(--gold); font-size: clamp(1rem, 1.5vw, 1.45rem); text-transform: uppercase; letter-spacing: .04em; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: .78rem; }
.top-actions { display: flex; align-items: end; gap: 10px; }
.profile-control { min-width: 230px; }
.profile-control span { display: block; margin-bottom: 4px; font-size: .75rem; color: var(--muted); }

.tabs {
  position: sticky;
  top: 74px;
  z-index: 25;
  display: flex;
  overflow-x: auto;
  background: rgba(10,5,3,.97);
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}
.tab {
  min-width: 160px;
  padding: 12px 20px;
  border: 0;
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(#1a110d, #0e0907);
  color: var(--text);
  font-weight: 700;
}
.tab:hover { color: var(--gold); }
.tab.active {
  color: var(--gold);
  background: linear-gradient(#6a1d13, #35100b);
  box-shadow: inset 0 -2px 0 var(--gold-2);
}

main { padding: 12px 14px 50px; }
.view { display: none; }
.view.active { display: block; }
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin: 4px 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(72,15,10,.95), rgba(28,8,5,.9));
}
.section-heading h2 { margin: 2px 0 4px; color: var(--gold); font-size: clamp(1.25rem, 2vw, 1.85rem); }
.section-heading p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--gold-2); font-size: .72rem; font-weight: 700; letter-spacing: .14em; }

.panel, .filter-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(rgba(13,8,6,.96), rgba(7,5,4,.98)),
    url('/static/assets/panel_texture.png') center / cover;
  box-shadow: var(--shadow);
}
.panel { padding: 14px; }
.filter-panel { padding: 14px; align-self: start; position: sticky; top: 132px; }
.filter-panel h3, .panel h3 { margin: 0 0 12px; color: var(--gold); }

.content-grid.inventory-layout { display: grid; grid-template-columns: 245px minmax(0, 1fr); gap: 12px; }
.planner-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: 12px; }
.encyclopedia-grid { display: grid; grid-template-columns: minmax(420px, 1.15fr) minmax(390px, .85fr); gap: 12px; }

label { display: block; color: var(--gold); font-size: .86rem; font-weight: 700; }
label + label { margin-top: 10px; }
input, select {
  width: 100%;
  min-height: 38px;
  margin-top: 5px;
  padding: 7px 34px 7px 10px;
  border: 1px solid #7b4936;
  border-radius: 5px;
  outline: none;
  background-color: #0d0a08;
  color: var(--text);
}
select {
  appearance: none;
  background-image: url('/static/assets/combo_down_arrow.png');
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 15px 12px;
}
input:focus, select:focus { border-color: var(--gold-2); box-shadow: 0 0 0 2px rgba(255,183,52,.14); }
input::placeholder { color: #897b68; }

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 38px;
  padding: 8px 15px;
  border-radius: 7px;
  border: 1px solid #b45d21;
  color: #fff1c0;
  font-weight: 700;
  text-align: center;
  transition: transform .1s ease, filter .1s ease, opacity .1s ease;
}
.button:hover { filter: brightness(1.14); }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .55; cursor: not-allowed; }
.button-gold { background: linear-gradient(#9c5b08, #4d2603); border-color: #e59b21; }
.button-secondary { background: linear-gradient(#3d261d, #17100c); border-color: #7a4a36; }
.button-danger { background: linear-gradient(#8b2116, #3e0e09); border-color: #c64b32; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.icon-button { border: 1px solid var(--line); background: #280a06; color: var(--gold); border-radius: 6px; }

.empty-state { display: grid; place-items: center; min-height: 310px; padding: 30px; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--gold); font-size: 1.35rem; }
.empty-state p { max-width: 520px; }
.empty-state.compact { min-height: 180px; }

.table-wrap { overflow: auto; max-height: calc(100vh - 190px); border: 1px solid var(--line-soft); }
.data-table { width: 100%; border-collapse: collapse; min-width: 1050px; }
.data-table th, .data-table td { padding: 9px 8px; border-right: 1px solid #49261b; border-bottom: 1px solid #3b2017; text-align: left; }
.data-table th { position: sticky; top: 0; z-index: 2; color: var(--gold); background: #321812; }
.data-table tbody tr { background: rgba(15,10,8,.87); }
.data-table tbody tr:nth-child(even) { background: rgba(33,22,17,.87); }
.data-table tbody tr:hover { background: rgba(103,38,23,.85); }
.data-table tbody tr.selected { background: rgba(126,36,23,.95); }
.item-name { color: var(--gold); font-weight: 700; }

.form-panel h3:not(:first-child) { margin-top: 20px; }
.form-grid { display: grid; gap: 10px 12px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid label + label { margin-top: 0; }
.check-row { display: flex; align-items: center; gap: 9px; margin-top: 12px; color: var(--text); }
.check-row input { width: 18px; min-height: 18px; margin: 0; padding: 0; accent-color: #a64a22; }
.control-check { align-self: end; min-height: 38px; }
.compact-grid { margin-top: 10px; }

.status-box { padding: 11px; border: 1px solid var(--line-soft); background: #080605; color: var(--gold); min-height: 44px; }
.progress { height: 9px; overflow: hidden; margin: 10px 0; border: 1px solid #6b3b27; background: #0a0605; }
.progress span { display: block; width: 35%; height: 100%; background: linear-gradient(90deg, #8a2e18, #f0b43d); animation: progress-slide 1.1s infinite ease-in-out; }
@keyframes progress-slide { from { transform: translateX(-100%); } to { transform: translateX(330%); } }
.log-box { max-height: 360px; overflow: auto; margin-top: 10px; padding: 10px; border: 1px solid #3c241a; background: #050403; color: #b9aa92; font-family: Consolas, monospace; font-size: .78rem; white-space: pre-wrap; }
.log-line { padding: 3px 0; border-bottom: 1px dotted rgba(125,53,28,.28); }

.results-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 12px; margin-top: 12px; }
.plan-card { border: 1px solid var(--line); border-radius: 8px; background: rgba(10,6,5,.96); overflow: hidden; }
.plan-card header { padding: 10px 12px; background: linear-gradient(90deg, #4a130d, #1a0906); border-bottom: 1px solid var(--line); }
.plan-card header strong { color: var(--gold); }
.plan-card .plan-meta { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.plan-card .plan-body { padding: 12px; }
.craft-step { padding: 9px 0; border-bottom: 1px solid #352018; }
.craft-step:last-child { border-bottom: 0; }
.craft-arrow { color: var(--gold-2); font-weight: 700; }
.missing-list { color: var(--danger); }

.catalog-results { max-height: 58vh; overflow: auto; margin-top: 10px; border: 1px solid var(--line-soft); }
.catalog-row { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 9px 10px; border: 0; border-bottom: 1px solid #3d2419; background: #0b0806; color: var(--text); text-align: left; }
.catalog-row:hover, .catalog-row.selected { background: #5c1b12; }
.catalog-row strong { color: var(--gold); }
.catalog-row span { color: var(--muted); font-size: .8rem; }
.official-panel { align-self: start; position: sticky; top: 132px; }
.selected-identity { padding: 10px; border: 1px solid var(--line); background: linear-gradient(90deg, #4b120c, #140805); color: var(--gold); font-weight: 700; text-align: center; }
.official-card { margin-top: 14px; border: 1px solid var(--line); background: #050403; }
.official-images { display: grid; place-items: center; gap: 8px; padding: 14px; }
.official-main-image { max-width: min(280px, 80vw); max-height: 280px; border: 1px solid #b56a32; }
.affix-images { display: flex; gap: 8px; }
.affix-images img { width: 88px; height: 88px; object-fit: cover; border: 1px solid #b56a32; }
.official-title { text-align: center; color: var(--gold); font-size: 1.15rem; font-weight: 700; padding: 0 12px 10px; }
.stat-block { padding: 12px; border-top: 1px solid #4b261a; }
.stat-row { margin: 5px 0; line-height: 1.42; }
.stat-row strong { color: var(--gold); }
.stat-row.features { color: var(--cyan); }
.cache-badge { display: inline-block; padding: 2px 7px; border-radius: 10px; background: #203719; color: var(--success); font-size: .75rem; }

.mobile-card-list { display: none; }
.inventory-card { padding: 11px; border: 1px solid #5c311f; border-radius: 7px; background: rgba(15,9,7,.96); }
.inventory-card + .inventory-card { margin-top: 8px; }
.inventory-card h3 { margin: 0 0 6px; color: var(--gold); font-size: 1rem; }
.inventory-card dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 8px; margin: 0; font-size: .82rem; }
.inventory-card dt { color: var(--muted); }
.inventory-card dd { margin: 0; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; background: rgba(0,0,0,.78); }
.detail-modal { position: relative; width: min(980px, 96vw); max-height: 92vh; overflow: auto; border: 1px solid #b14c26; border-radius: 10px; background: #090504; box-shadow: 0 24px 80px #000; }
.close-button { position: sticky; float: right; top: 8px; right: 8px; z-index: 2; width: 38px; height: 38px; font-size: 1.45rem; }
.detail-header { padding: 16px 55px 12px 16px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, #57150e, #180805); }
.detail-header h2 { margin: 0; color: var(--gold); font-size: 1.25rem; }
.detail-body { padding: 14px; }
.detail-grid { display: grid; grid-template-columns: minmax(260px, .75fr) minmax(0, 1.25fr); gap: 14px; }
.detail-meta { border: 1px solid #3f2419; padding: 10px; background: #080605; }
.detail-meta div { padding: 5px 0; border-bottom: 1px dotted #392218; }
.detail-meta div:last-child { border-bottom: 0; }
.detail-meta strong { color: var(--gold); }

.toast { position: fixed; z-index: 150; right: 18px; bottom: 18px; max-width: min(440px, calc(100vw - 36px)); padding: 12px 15px; border: 1px solid #b95b2f; border-radius: 8px; background: #24100b; color: #fff3d2; box-shadow: var(--shadow); }
.toast.error { border-color: #df604a; background: #3c0d09; }
.toast.success { border-color: #5e9c65; background: #102a15; }

.about-panel { max-width: 1050px; margin: 20px auto; padding: 24px; }
.about-panel h2 { color: var(--gold); }
.feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.feature-grid article { padding: 14px; border: 1px solid var(--line-soft); background: #0a0705; }
.feature-grid h3 { color: var(--gold); margin: 0 0 6px; }
.feature-grid p { margin: 0; color: var(--muted); }
code { color: var(--cyan); }

.site-footer {
  padding: 15px 20px 18px;
  border-top: 1px solid var(--line-soft);
  background: rgba(6, 4, 3, .92);
  color: #978a79;
  text-align: center;
}
.site-footer p {
  max-width: 1320px;
  margin: 0 auto;
  font-family: Arial, Helvetica, sans-serif;
  font-size: .68rem;
  line-height: 1.45;
}

@media (max-width: 1100px) {
  .content-grid.inventory-layout { grid-template-columns: 210px minmax(0,1fr); }
  .encyclopedia-grid { grid-template-columns: 1fr; }
  .official-panel { position: static; }
}

@media (max-width: 820px) {
  body { background-attachment: scroll; }
  .app-shell { border: 0; }
  .topbar { position: static; align-items: stretch; flex-direction: column; gap: 9px; padding: 10px 12px; }
  .brand { justify-content: center; text-align: center; }
  .brand h1 { font-size: 1rem; }
  .top-actions { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; }
  .profile-control { min-width: 0; }
  .tabs { top: 0; }
  .tab { min-width: 125px; padding: 11px 12px; }
  main { padding: 8px 8px 88px; }
  .section-heading { align-items: center; }
  .mobile-only { display: inline-flex !important; }
  .content-grid.inventory-layout { display: block; }
  .filter-panel { display: none; position: static; margin-bottom: 10px; }
  .filter-panel.open { display: block; }
  .table-wrap { display: none !important; }
  .mobile-card-list { display: block; }
  .planner-grid { grid-template-columns: 1fr; }
  .form-grid.two { grid-template-columns: 1fr; }
  .control-check { align-self: auto; }
  .results-grid { grid-template-columns: 1fr; }
  .catalog-results { max-height: 48vh; }
  .detail-modal { width: 100%; max-height: 100vh; height: 100%; border-radius: 0; }
  .modal-backdrop { padding: 0; }
  .detail-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .tabs { position: fixed; inset: auto 0 0; z-index: 80; justify-content: stretch; border-top: 1px solid var(--line); border-bottom: 0; }
  .tab { flex: 1 1 0; min-width: 0; font-size: .78rem; padding: 12px 6px; }
  .official-panel { padding: 10px; }
  .site-footer { padding: 13px 12px 82px; }
  .site-footer p { font-size: .64rem; }
}

@media (max-width: 520px) {
  .brand { justify-content: flex-start; text-align: left; }
  .brand h1 { font-size: .86rem; }
  .top-actions { grid-template-columns: 1fr; }
  .section-heading { padding: 10px; }
  .section-heading h2 { font-size: 1.2rem; }
  .section-heading p { font-size: .82rem; }
  .panel, .filter-panel { border-radius: 7px; }
  .button-row .button { flex: 1 1 auto; }
  .official-main-image { max-width: 86vw; }
}

/* Web Beta 0.2.0 - Możliwe teraz + instrukcja */
.heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.content-grid.possible-layout { display: grid; grid-template-columns: 245px minmax(0, 1fr); gap: 12px; }
.direct-panel { min-width: 0; }
.direct-table { min-width: 1520px; }
.direct-card { cursor: pointer; }
.direct-level { color: var(--muted); font-size: .82rem; margin-bottom: 9px; }
.direct-equation { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; padding: 9px; border: 1px solid #3f2419; background: #080605; font-size: .82rem; }
.direct-equation span { min-width: 0; overflow-wrap: anywhere; }
.direct-equation strong { color: var(--gold-2); font-size: 1.2rem; }
.load-more-wrap { display: flex; justify-content: center; padding-top: 12px; }
.craft-combination { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: 10px; }
.craft-combination article { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid #4b2a1c; background: #080605; }
.craft-combination article span { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.craft-combination article strong { color: var(--gold); overflow-wrap: anywhere; }
.craft-combination article small { color: var(--muted); line-height: 1.4; }
.craft-symbol { display: grid; place-items: center; color: var(--gold-2); font-size: 1.55rem; font-weight: 700; }
.detail-note { margin-top: 12px; padding: 10px; border: 1px solid #58402a; background: #171008; color: var(--muted); }
.detail-note strong { color: var(--gold); }

.help-panel { max-width: 1050px; margin: 20px auto; padding: clamp(18px, 3vw, 34px); line-height: 1.62; }
.help-panel h2 { margin: 4px 0 24px; color: var(--gold); font-size: clamp(1.45rem, 3vw, 2.15rem); }
.help-panel h3 { margin: 28px 0 10px; padding-bottom: 7px; border-bottom: 1px solid var(--line-soft); color: var(--gold); font-size: 1.2rem; }
.help-panel p { color: #e9dcc4; }
.help-panel ul, .help-panel ol { padding-left: 1.45rem; }
.help-panel li { margin: 7px 0; }
.help-panel li::marker { color: var(--gold-2); font-weight: 700; }
.help-panel code { padding: 2px 5px; border: 1px solid #3d2419; border-radius: 4px; background: #050403; }
kbd { display: inline-block; min-width: 1.7em; padding: 2px 6px; border: 1px solid #8a5a3d; border-bottom-width: 2px; border-radius: 4px; background: #160e0a; color: var(--gold); font: 700 .82em Consolas, monospace; text-align: center; }
.help-warning { margin: 16px 0; padding: 12px 14px; border: 1px solid #a14b25; border-left-width: 4px; background: rgba(77, 21, 12, .55); color: #f5e4c2; }
.help-warning strong { color: var(--gold); }
.help-signoff { margin-top: 28px; color: var(--gold) !important; font-size: 1.15rem; font-weight: 700; text-align: center; }

@media (max-width: 820px) {
  .content-grid.possible-layout { display: block; }
  #directFilters { display: none; position: static; margin-bottom: 10px; }
  #directFilters.open { display: block; }
  .heading-actions { width: 100%; justify-content: stretch; }
  .heading-actions .button { flex: 1 1 auto; }
  .craft-combination { grid-template-columns: 1fr; }
  .craft-symbol { min-height: 24px; }
  .tabs { justify-content: flex-start; overflow-x: auto; overscroll-behavior-x: contain; }
  .tab { flex: 0 0 auto; min-width: 108px; }
}

@media (max-width: 520px) {
  .direct-equation { grid-template-columns: 1fr; }
  .direct-equation strong { text-align: center; }
  .help-panel { margin: 8px auto; padding: 16px; }
  .help-panel ul, .help-panel ol { padding-left: 1.2rem; }
}

/* Web Beta 0.2.1 - local item image pack */
.stored-image-preview {
  margin: 0.7rem 0 1rem;
  padding: 0.7rem;
  border: 1px solid rgba(183, 101, 35, 0.65);
  background: rgba(0, 0, 0, 0.35);
}

.stored-image-preview.compact {
  margin-top: 0;
}

.image-pack-note {
  margin: 0.55rem 0;
  padding: 0.55rem 0.7rem;
  border-left: 3px solid #8c4b24;
  color: #d7c9b5;
  font-size: 0.85rem;
  line-height: 1.4;
  background: rgba(35, 17, 11, 0.68);
}

.image-pack-note.success {
  border-left-color: #b8892f;
  color: #e7d9bd;
}

#officialStoredImages:empty {
  display: none;
}

@media (max-width: 720px) {
  .stored-image-preview {
    padding: 0.5rem;
  }

  .stored-image-preview .official-main-image {
    max-width: min(68vw, 250px);
  }
}

/* Web Beta 0.2.2 - uproszczona Encyklopedia i changelog */
.encyclopedia-controls-panel .catalog-results {
  max-height: 36vh;
}

.official-parameters {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.official-parameters h3 {
  margin-bottom: 10px;
}

.official-status {
  min-height: 1.4em;
  margin-top: 10px;
}

.official-display {
  min-width: 0;
}

.official-panel {
  max-height: calc(100vh - 150px);
  overflow: auto;
}

#officialStoredImages:empty {
  display: none;
}

.stored-images {
  padding: 18px 8px 14px;
}

.stored-images.compact {
  padding: 8px 0 12px;
}

.official-result {
  margin-top: 4px;
}

.official-stat-block {
  margin-top: 0;
  border: 1px solid var(--line-soft);
  background: #050403;
}

.stats-placeholder {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  background: rgba(5, 4, 3, .75);
  color: var(--muted);
  text-align: center;
}

.changelog-panel {
  max-width: 900px;
}

.changelog-entry {
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line-soft);
  background: rgba(8, 5, 4, .82);
}

.changelog-entry h3 {
  margin: 0 0 10px;
  color: var(--gold);
}

.changelog-entry ul {
  margin: 0;
  padding-left: 1.25rem;
}

.changelog-entry li {
  margin: 7px 0;
  line-height: 1.45;
}

.changelog-entry li::marker {
  color: var(--gold-2);
}

@media (max-width: 1100px) {
  .official-panel {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 820px) {
  .encyclopedia-controls-panel .catalog-results {
    max-height: 42vh;
  }

  .official-parameters .button-row .button {
    flex: 1 1 auto;
  }
}

/* Web Beta 0.4.1 - Firebase admin panel */
.footer-actions {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.admin-link-button {
  appearance: none;
  border: 0;
  padding: 3px 8px;
  background: transparent;
  color: #786c5e;
  font: 600 .62rem Arial, Helvetica, sans-serif;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.admin-link-button:hover,
.admin-link-button:focus-visible {
  color: var(--gold);
}

.admin-modal {
  position: relative;
  width: min(1050px, 96vw);
  max-height: 94vh;
  overflow: auto;
  border: 1px solid #b14c26;
  border-radius: 10px;
  background: #090504;
  box-shadow: 0 24px 80px #000;
}

.admin-header {
  padding: 18px 58px 14px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #57150e, #180805);
}

.admin-header h2 {
  margin: 3px 0 5px;
  color: var(--gold);
}

.admin-header p {
  margin: 0;
  color: var(--muted);
}

.admin-login-form,
.admin-editor,
.admin-message {
  padding: 18px;
}

.admin-login-form {
  display: grid;
  gap: 14px;
  max-width: 560px;
}

.admin-message {
  margin: 18px;
  border: 1px solid #96552f;
  background: #25130d;
}

.admin-message p {
  margin: 7px 0 0;
}

.admin-session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  background: #120a07;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: .82rem;
}

.admin-editor form {
  display: grid;
  gap: 16px;
}

.admin-editor textarea {
  resize: vertical;
  min-height: 110px;
}

.admin-editor-field {
  display: grid;
  gap: 6px;
}

.admin-editor-label {
  color: var(--gold);
  font-weight: 700;
}

.admin-editor-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-field-hint {
  margin: 0;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: .76rem;
  line-height: 1.4;
}

.changelog-block-editor {
  display: grid;
  gap: 12px;
}

.admin-changelog-block {
  padding: 13px;
  border: 1px solid #6e3b26;
  border-radius: 5px;
  background: #0d0705;
}

.admin-changelog-block-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 10px;
}

.admin-changelog-title-label {
  display: grid;
  gap: 5px;
  color: var(--gold);
  font-weight: 700;
}

.admin-changelog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.admin-changelog-body-label {
  margin-bottom: 6px;
  color: var(--gold);
  font-weight: 700;
}

.rich-editor.admin-changelog-body {
  min-height: 120px;
  max-height: 300px;
}

.rich-editor {
  min-height: 260px;
  max-height: 440px;
  overflow: auto;
  padding: 16px;
  border: 1px solid #6e3b26;
  border-radius: 4px;
  background: #060403;
  color: var(--text);
  outline: none;
}

.rich-editor:focus {
  border-color: var(--gold-2);
  box-shadow: 0 0 0 2px rgba(214, 134, 24, .18);
}

.rich-editor h2,
.rich-editor h3 {
  color: var(--gold);
}

.rich-editor .help-warning,
.rich-editor .changelog-entry {
  border: 1px solid var(--line-soft);
  padding: 12px;
  background: rgba(20, 10, 7, .72);
}

.admin-preview-toggle {
  margin: 0;
}

.admin-inline-status {
  min-height: 1.25rem;
  color: #b7cbb7;
  font-family: Arial, Helvetica, sans-serif;
  font-size: .8rem;
}

.admin-inline-status.error {
  color: #ff8e7b;
}

.button.small {
  padding: 7px 11px;
  font-size: .76rem;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 820px) {
  .admin-modal {
    width: 100vw;
    max-height: 100dvh;
    min-height: 100dvh;
    border-radius: 0;
  }

  .admin-header,
  .admin-login-form,
  .admin-editor {
    padding-left: 13px;
    padding-right: 13px;
  }

  .admin-session-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .rich-editor {
    min-height: 220px;
    max-height: 55vh;
  }

  .admin-save-row .button,
  .admin-login-form .button-row .button {
    flex: 1 1 100%;
  }

  .admin-editor-label-row,
  .admin-changelog-block-header {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .admin-editor-label-row {
    display: flex;
  }

  .admin-changelog-actions .button {
    flex: 1 1 auto;
  }
}
