/* =====================================================
   Valheim World Modifier Editor — Norse theme.
   Charred wood, iron rivets, gold and ember. Type is
   Averia Serif Libre, the face Valheim uses in its menus.
   ===================================================== */

:root {
  color-scheme: dark;
  --night:       #0b0806;
  --wood-0:      #130d09;
  --wood-1:      #1c140e;
  --wood-2:      #261b13;
  --wood-3:      #35261a;
  --bronze:      rgba(212,164,82,0.24);
  --bronze-hi:   rgba(226,178,94,0.5);
  --gold:        #dca646;
  --gold-hi:     #f4ca70;
  --gold-dim:    #a0752f;
  --gold-soft:   rgba(220,166,70,0.1);
  --ember:       #e0692c;
  --on-gold:     #211406;
  --parchment:   #ecdfc2;
  --parchment-2: #c9b898;
  --muted:       #98856b;
  --moss:        #9cc47a;
  --moss-soft:   rgba(141,184,106,0.12);
  --blood:       #e0654c;
  --blood-soft:  rgba(208,85,62,0.14);
  --container:   1100px;
  --gutter:      clamp(16px, 5vw, 80px);
  --norse:       'Averia Serif Libre', Georgia, 'Times New Roman', serif;
  --runic:       'Noto Sans Runic', 'Segoe UI Historic', sans-serif;
  --mono:        ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  /* Wood grain: horizontal streaks from stretched noise. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='640' height='320'%3E%3Cfilter id='g' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.00625 0.125' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.62 0 0 0 0 0.44 0 0 0 0 0.26 0 0 0 1.4 -0.45'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)' opacity='0.16'/%3E%3C/svg%3E");
  /* Braided knotwork line. */
  --knot: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='14' viewBox='0 0 48 14'%3E%3Cg fill='none' stroke='%23dca646' stroke-width='1.5'%3E%3Cpath d='M0 7c6-8 18-8 24 0s18 8 24 0' stroke-opacity='.7'/%3E%3Cpath d='M0 7c6 8 18 8 24 0s18-8 24 0' stroke-opacity='.4'/%3E%3C/g%3E%3C/svg%3E");
  /* Iron rivet, used in panel corners. */
  --rivet: radial-gradient(circle at 40% 35%, #f0dfae 0 0.8px, #b08a48 1.6px, #4a3518 2.8px, transparent 3.4px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  font-family: var(--norse);
  font-size: 16px;
  line-height: 1.6;
  color: var(--parchment);
  background:
    radial-gradient(ellipse 70% 40% at 50% -6%, rgba(224,105,44,0.16), transparent 70%),
    radial-gradient(ellipse 90% 60% at 50% 110%, rgba(0,0,0,0.6), transparent 70%),
    var(--night);
  overflow-x: hidden;
}
[hidden] { display: none !important; }
img, svg { display: block; }
p, li, dd { overflow-wrap: anywhere; }
code { font-family: var(--mono); font-size: 0.84em; color: var(--gold-hi); }
a { color: var(--gold); }

.container { width: min(var(--container), 100% - (var(--gutter) * 2)); margin-inline: auto; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.small { font-size: 0.86rem; }
.muted { color: var(--muted); }
.runes { font-family: var(--runic); }

/* Film grain over everything */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 9999; opacity: 0.45;
}

/* Carved plank: wood grain, a double bronze frame and a rivet in each corner. */
.panel, .where, .world-none, .stats, .steps li {
  background:
    var(--rivet) left 7px top 7px / 8px 8px no-repeat,
    var(--rivet) right 7px top 7px / 8px 8px no-repeat,
    var(--rivet) left 7px bottom 7px / 8px 8px no-repeat,
    var(--rivet) right 7px bottom 7px / 8px 8px no-repeat,
    var(--grain),
    linear-gradient(180deg, var(--wood-2), var(--wood-1));
  border: 1px solid var(--bronze-hi);
  border-radius: 6px;
  box-shadow:
    inset 0 0 0 4px rgba(0,0,0,0.3),
    inset 0 0 0 5px var(--bronze),
    0 14px 34px rgba(0,0,0,0.5);
}

.knot { height: 14px; background: var(--knot) repeat-x center / 48px 14px; opacity: 0.55; }

/* ── HEADER ── */
.ap-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--grain), linear-gradient(180deg, rgba(34,24,16,0.96), rgba(18,12,8,0.96));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bronze-hi);
  box-shadow: 0 1px 0 rgba(0,0,0,0.6), 0 8px 24px rgba(0,0,0,0.45);
}
.ap-header-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 68px;
  width: min(var(--container), 100% - (var(--gutter) * 2));
  margin-inline: auto;
}
.ap-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.ap-mark { width: 40px; height: 40px; flex-shrink: 0; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.6)); }
.ap-brand-text { display: flex; flex-direction: column; min-width: 0; }
.ap-brand-name { font-weight: 700; font-size: 1.14rem; letter-spacing: 0.03em; color: var(--parchment); line-height: 1; white-space: nowrap; }
.ap-brand-name span, .footer-brand-name span { color: var(--gold); }
.ap-brand-tagline { font-size: 0.7rem; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; margin-top: 5px; }
.ap-nav a {
  font-weight: 700; font-size: 0.86rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--parchment-2); text-decoration: none; padding: 8px 14px; border-radius: 4px; white-space: nowrap;
  min-height: 44px; display: inline-flex; align-items: center; border: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.ap-nav a:hover { color: var(--gold-hi); border-color: var(--bronze); background: var(--gold-soft); }

/* ── BUTTONS ── */
.ap-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 24px; border-radius: 4px;
  font-family: var(--norse); font-weight: 700; font-size: 0.92rem;
  letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none;
  white-space: nowrap; cursor: pointer; border: 1px solid transparent;
  transition: filter 0.2s, transform 0.15s, box-shadow 0.2s, border-color 0.2s, color 0.2s, opacity 0.2s;
}
.ap-btn--primary {
  background: linear-gradient(180deg, #f3c86e 0%, #cf9135 55%, #a76c1d 100%);
  color: var(--on-gold); border-color: #f7d58a;
  text-shadow: 0 1px 0 rgba(255,235,190,0.45);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), inset 0 -2px 0 rgba(0,0,0,0.22), 0 3px 0 #4a2f0e, 0 0 22px rgba(224,140,50,0.28);
}
.ap-btn--primary:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), inset 0 -2px 0 rgba(0,0,0,0.22), 0 4px 0 #4a2f0e, 0 0 30px rgba(224,140,50,0.45); }
.ap-btn--ghost {
  background: var(--grain), linear-gradient(180deg, var(--wood-3), var(--wood-2));
  color: var(--parchment); border-color: var(--bronze-hi);
  box-shadow: inset 0 1px 0 rgba(255,230,180,0.08), 0 3px 0 #070504;
}
.ap-btn--ghost:hover:not(:disabled) { color: var(--gold-hi); border-color: var(--gold); transform: translateY(-1px); }
.ap-btn:disabled { opacity: 0.4; cursor: not-allowed; filter: grayscale(0.4); }
.ap-btn.wide { width: 100%; }

.link-btn {
  background: none; border: none; cursor: pointer; padding: 6px 2px; min-height: 32px; white-space: nowrap;
  font-family: var(--norse); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--gold);
}
.link-btn:hover:not(:disabled) { color: var(--gold-hi); text-decoration: underline; text-underline-offset: 3px; }
.link-btn:disabled { color: var(--muted); opacity: 0.5; cursor: not-allowed; }

/* ── INTRO ── */
.intro { position: relative; overflow: hidden; padding: clamp(52px, 8vw, 96px) 0 clamp(32px, 4vw, 48px); }
.intro-inner { position: relative; z-index: 1; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-weight: 700; font-size: 0.8rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--gold); margin-bottom: 14px;
}
.eyebrow .runes { font-size: 1.05rem; letter-spacing: 0.3em; color: var(--ember); text-shadow: 0 0 12px rgba(224,105,44,0.5); }
h1 {
  font-weight: 700; font-size: clamp(2.5rem, 6.4vw, 4.6rem);
  line-height: 1.02; letter-spacing: 0.005em; margin-bottom: 20px; max-width: 620px;
  background: linear-gradient(180deg, #fbe9bd 0%, #e6b45b 48%, #a86f22 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.7)) drop-shadow(0 0 26px rgba(224,140,50,0.22));
}
h1 em {
  font-style: normal;
  background: linear-gradient(180deg, #ffd690 0%, #f08a3c 60%, #c4531f 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { font-size: 1.08rem; font-weight: 300; color: var(--parchment-2); max-width: 600px; line-height: 1.7; }
.lede code { color: var(--gold-hi); }
h2 { font-weight: 700; font-size: 1.28rem; letter-spacing: 0.02em; line-height: 1.2; color: var(--gold-hi); }

.longship {
  position: absolute; z-index: 0; pointer-events: none;
  right: max(-30px, calc(50% - 620px)); top: 50%;
  width: clamp(320px, 42vw, 540px);
  opacity: 0.5;
  transform: translateY(-50%);
  animation: sail 8s ease-in-out infinite;
}
@keyframes sail {
  50% { transform: translateY(calc(-50% + 6px)) rotate(-0.8deg); }
}
.ship-line { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linecap: round; }
.ship-line.thin { stroke-width: 1.2; opacity: 0.75; }
.ship-rope { fill: none; stroke: var(--gold); stroke-width: 0.8; opacity: 0.45; }
.ship-sail { fill: rgba(220,166,70,0.08); stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; }
.ship-stripe { fill: rgba(208,85,62,0.4); }
.ship-hull { fill: #1a110b; stroke: var(--gold); stroke-width: 2.2; stroke-linejoin: round; }
.ship-post { fill: none; stroke: var(--gold); stroke-width: 4; stroke-linecap: round; }
.ship-head { fill: #1a110b; stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; }
.ship-shields circle { fill: #2a1d14; stroke: var(--gold); stroke-width: 1.6; }
.ship-shields circle.alt { fill: rgba(170,60,40,0.7); }
.ship-boss { fill: var(--gold); }
.ship-wave { fill: none; stroke: var(--gold); stroke-width: 1.4; opacity: 0.5; }
.ship-wave.faint { opacity: 0.25; }

/* ── LOAD ── */
.load { padding-bottom: 56px; position: relative; z-index: 1; }
.dropzone {
  position: relative; text-align: center;
  padding: clamp(34px, 6vw, 58px) 20px;
  background:
    radial-gradient(ellipse 60% 70% at 50% 0%, rgba(224,140,50,0.1), transparent 70%),
    var(--grain),
    linear-gradient(180deg, var(--wood-1), var(--wood-0));
  border: 2px dashed var(--bronze-hi); border-radius: 8px;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.5), 0 14px 34px rgba(0,0,0,0.5);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.dropzone.is-over { border-color: var(--gold-hi); box-shadow: inset 0 0 60px rgba(224,140,50,0.18), 0 0 30px rgba(224,140,50,0.2); }
.dropzone-icon { width: 42px; height: 42px; margin: 0 auto 14px; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 8px rgba(224,140,50,0.4)); }
.dropzone-title { font-weight: 700; font-size: 1.45rem; color: var(--parchment); margin-bottom: 4px; }
.dropzone-sub { color: var(--muted); font-size: 0.95rem; margin-bottom: 26px; }
.dropzone-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.dropzone .notice { margin: 22px auto 0; max-width: 580px; text-align: left; }
.dropzone:has(#file-input:focus-visible) label.ap-btn { outline: 2px solid var(--gold-hi); outline-offset: 3px; }

.where { margin-top: 16px; border-radius: 6px; }
.where summary { cursor: pointer; padding: 15px 22px; font-weight: 700; font-size: 1rem; letter-spacing: 0.02em; color: var(--parchment-2); }
.where summary:hover { color: var(--gold-hi); }
.where dl { padding: 0 22px 20px; display: grid; gap: 4px 20px; grid-template-columns: max-content 1fr; }
.where dt { font-weight: 700; color: var(--gold-dim); text-transform: uppercase; font-size: 0.76rem; letter-spacing: 0.12em; padding-top: 4px; }
.where dd { color: var(--parchment-2); font-size: 0.94rem; margin-bottom: 8px; }

/* ── NOTICES ── */
.notice { border-radius: 5px; padding: 12px 16px; font-size: 0.94rem; line-height: 1.55; border: 1px solid; }
.notice--error { color: #ffd2c6; background: var(--blood-soft); border-color: rgba(224,101,76,0.45); }
.notice--ok { color: #d6f0c0; background: var(--moss-soft); border-color: rgba(156,196,122,0.4); }
.notice--warn { color: #f6dfb2; background: var(--gold-soft); border-color: var(--bronze-hi); }

/* ── EDITOR ── */
.editor { padding-bottom: 56px; position: relative; z-index: 1; }
.world-info { margin-bottom: 22px; }
.world-none { color: var(--parchment-2); padding: 16px 22px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); padding: 6px; }
.stat { padding: 10px 16px; min-width: 0; border-left: 1px solid var(--bronze); }
.stat:first-child { border-left: none; }
.stat dt { font-weight: 700; font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-dim); }
.stat dd { font-weight: 700; font-size: 1.05rem; color: var(--parchment); overflow-wrap: anywhere; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 0.88rem; color: var(--moss); }
.check svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 22px; align-items: start; }
.editor-main, .editor-side { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.editor-side { position: sticky; top: 88px; }

.panel { position: relative; padding: 24px 26px; }
.panel--accent { box-shadow: inset 0 0 0 4px rgba(0,0,0,0.3), inset 0 0 0 5px var(--bronze-hi), 0 0 0 1px rgba(224,140,50,0.15), 0 14px 34px rgba(0,0,0,0.5), 0 0 40px rgba(224,140,50,0.08); }
.panel > h2, .panel-head { margin-bottom: 16px; }
.panel-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px;
  padding-bottom: 14px;
  background: var(--knot) repeat-x left bottom / 48px 14px;
}
.panel h2::before { content: 'ᛟ'; font-family: var(--runic); font-weight: 400; color: var(--ember); margin-right: 10px; text-shadow: 0 0 10px rgba(224,105,44,0.5); }

/* Modifier rows */
.modifier { border: none; border-top: 1px solid var(--bronze); padding: 4px 0 20px; min-width: 0; }
.modifier:last-child { padding-bottom: 0; }
.modifier legend {
  font-weight: 700; font-size: 0.78rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--gold-dim); margin-bottom: 8px; padding: 0 10px 0 0;
}
.segments { display: flex; flex-wrap: wrap; gap: 7px; }
.segment { position: relative; }
.segment input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segment label {
  display: inline-flex; align-items: center; min-height: 40px; padding: 8px 15px;
  border: 1px solid var(--bronze); border-radius: 4px; cursor: pointer; user-select: none;
  font-size: 0.94rem; color: var(--parchment-2);
  background: linear-gradient(180deg, #2c2016, #1c140e);
  box-shadow: inset 0 1px 0 rgba(255,230,180,0.06), 0 2px 0 rgba(0,0,0,0.45);
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s, background 0.15s;
}
.segment label:hover { border-color: var(--bronze-hi); color: var(--parchment); }
.segment input:checked + label {
  background: linear-gradient(180deg, #f3c86e 0%, #cf9135 60%, #a86e1f 100%);
  border-color: #f7d58a; color: var(--on-gold); font-weight: 700;
  text-shadow: 0 1px 0 rgba(255,235,190,0.45);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), 0 2px 0 #4a2f0e, 0 0 16px rgba(224,140,50,0.35);
}
.segment input:focus-visible + label { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.segment--custom label { border-style: dashed; font-style: italic; }
.level-text { margin-top: 11px; font-size: 0.96rem; color: var(--parchment); }
.level-keys { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.8rem; color: var(--muted); font-style: italic; }
.level-keys code { font-style: normal; font-size: 0.74rem; color: var(--parchment-2); background: rgba(0,0,0,0.3); border: 1px solid var(--bronze); border-radius: 3px; padding: 1px 7px; }

/* Toggles */
.toggles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 9px; }
.toggle {
  position: relative; display: flex; gap: 12px; align-items: flex-start; cursor: pointer;
  padding: 13px; border: 1px solid var(--bronze); border-radius: 5px; background: rgba(0,0,0,0.2);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.toggle:hover { border-color: var(--bronze-hi); }
.toggle:has(input:checked) { border-color: var(--gold-dim); background: var(--gold-soft); box-shadow: inset 0 0 22px rgba(224,140,50,0.1); }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track {
  flex-shrink: 0; width: 40px; height: 22px; border-radius: 11px; position: relative; margin-top: 1px;
  background: #0f0b08; border: 1px solid var(--bronze-hi); box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
  transition: background 0.2s;
}
.toggle-track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #d9d2c4, #7c756b 60%, #3a3631);
  box-shadow: 0 1px 2px rgba(0,0,0,0.6);
  transition: transform 0.2s, background 0.2s;
}
.toggle input:checked + .toggle-track { background: linear-gradient(180deg, #e8ae4f, #a86e1f); border-color: #f7d58a; box-shadow: 0 0 12px rgba(224,140,50,0.35); }
.toggle input:checked + .toggle-track::after { transform: translateX(18px); background: radial-gradient(circle at 38% 32%, #fff3d2, #d9a54c 55%, #6b4614); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.toggle-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.toggle-text strong { font-weight: 700; color: var(--parchment); font-size: 0.98rem; }
.toggle-text span { font-size: 0.86rem; color: var(--parchment-2); line-height: 1.5; }
.toggle-text code { font-size: 0.72rem; color: var(--muted); margin-top: 3px; }

/* Raw keys */
.raw { padding: 0; }
.raw summary { cursor: pointer; padding: 20px 26px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; list-style: none; }
.raw summary::-webkit-details-marker { display: none; }
.raw summary h2::after { content: '\25B8'; display: inline-block; margin-left: 10px; color: var(--gold-dim); font-size: 0.9em; transition: transform 0.2s; }
.raw[open] summary h2::after { transform: rotate(90deg); }
.raw-hint { font-size: 0.88rem; color: var(--muted); font-style: italic; }
.count { color: var(--muted); font-weight: 400; }
.raw-keys, .raw-form, .raw > p { margin: 0 26px; }
.raw > p { margin-bottom: 22px; margin-top: 10px; }
.raw-keys { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.raw-keys li {
  display: inline-flex; align-items: center; gap: 2px; max-width: 100%; padding-left: 11px;
  background: linear-gradient(180deg, #2a1e15, #1a130d); border: 1px solid var(--bronze-hi); border-radius: 4px;
  box-shadow: 0 2px 0 rgba(0,0,0,0.4);
}
.raw-keys li code { font-size: 0.8rem; color: var(--parchment); overflow-wrap: anywhere; }
.raw-keys li.empty { padding: 7px 11px; color: var(--muted); font-size: 0.9rem; font-style: italic; }
.chip-x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.15rem; line-height: 1; width: 32px; height: 32px; border-radius: 4px; flex-shrink: 0; }
.chip-x:hover { color: var(--blood); background: var(--blood-soft); }
.raw-form { display: flex; gap: 9px; flex-wrap: wrap; }
.raw-form input {
  flex: 1 1 220px; min-width: 0; min-height: 46px; padding: 10px 14px; border-radius: 4px;
  border: 1px solid var(--bronze-hi); background: rgba(0,0,0,0.35); color: var(--parchment);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.5);
  font-family: var(--mono); font-size: 0.86rem; outline: none;
}
.raw-form input:focus { border-color: var(--gold); box-shadow: inset 0 2px 6px rgba(0,0,0,0.5), 0 0 0 3px rgba(224,140,50,0.15); }
.raw-form input::placeholder { color: var(--muted); font-family: var(--norse); font-style: italic; }

/* Save + launch args */
.diff { list-style: none; display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; max-height: 260px; overflow: auto; }
.diff li { display: flex; gap: 8px; padding: 4px 10px; border-radius: 3px; font-size: 0.82rem; }
.diff li::before { font-family: var(--mono); font-weight: 700; }
.diff-add { background: var(--moss-soft); }
.diff-add::before { content: '+'; color: var(--moss); }
.diff-add code { color: #d6f0c0; }
.diff-del { background: var(--blood-soft); }
.diff-del::before { content: '\2212'; color: var(--blood); }
.diff-del code { color: #ffcfc4; text-decoration: line-through; text-decoration-color: rgba(224,101,76,0.55); }
.save-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.save-actions .ap-btn { width: 100%; }
#saved { margin-top: 14px; }
.args {
  margin-top: 12px; padding: 14px 16px; border-radius: 4px;
  background: #0c0907; border: 1px solid var(--bronze);
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.7);
  font-family: var(--mono); font-size: 0.82rem; line-height: 1.75; color: var(--gold-hi);
  white-space: normal; overflow-wrap: anywhere;
}
.args .arg { white-space: nowrap; }
.args--empty { color: var(--muted); font-family: var(--norse); font-style: italic; }
.notes { list-style: none; margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.notes li { font-size: 0.84rem; color: var(--muted); padding-left: 16px; position: relative; }
.notes li::before { content: '᛫'; font-family: var(--runic); position: absolute; left: 2px; color: var(--ember); }

/* ── GUIDE ── */
.guide { padding: 30px 0 68px; position: relative; z-index: 1; }
.guide::before { content: ''; display: block; height: 14px; margin-bottom: 38px; background: var(--knot) repeat-x center / 48px 14px; opacity: 0.5; }
.guide h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); margin-bottom: 22px; }
.steps { list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 22px; }
.steps li { counter-increment: step; padding: 22px 20px; font-size: 0.94rem; color: var(--parchment-2); }
.steps li::before {
  content: counter(step); display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%; margin-bottom: 14px;
  background: radial-gradient(circle at 38% 32%, #f6e3ad, #c0913f 45%, #6b4a1c);
  border: 2px solid #2a1d0e; box-shadow: 0 0 0 2px var(--bronze-hi), 0 3px 6px rgba(0,0,0,0.5);
  color: var(--on-gold); font-weight: 700; font-size: 1.05rem;
}
.steps strong { display: block; color: var(--parchment); font-weight: 700; margin-bottom: 3px; }

/* ── FOOTER ── */
.site-footer { padding: 26px 0 30px; border-top: 1px solid var(--bronze); background: linear-gradient(180deg, transparent, rgba(0,0,0,0.4)); }
.footer-runes {
  font-family: var(--runic); text-align: center; color: var(--gold-dim); opacity: 0.55;
  letter-spacing: 0.45em; font-size: 0.95rem; margin-bottom: 18px; overflow: hidden; white-space: nowrap;
}
.footer-inner { width: min(var(--container), 100% - (var(--gutter) * 2)); margin-inline: auto; display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: baseline; justify-content: space-between; }
.footer-brand-name { font-weight: 700; letter-spacing: 0.03em; }
.footer-copy { font-size: 0.8rem; color: var(--muted); }

/* ── MOTION ── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.fade-up { animation: fadeUp 0.6s ease both; }
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }

:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .editor-grid { grid-template-columns: 1fr; }
  .editor-side { position: static; }
  .longship { display: none; }
  h1 { max-width: none; }
}
@media (max-width: 560px) {
  .ap-brand-tagline, .ap-nav { display: none; }
  .where dl { grid-template-columns: 1fr; }
  .dropzone-actions .ap-btn { width: 100%; }
  .panel { padding: 20px 18px; }
  .raw summary { padding: 18px; }
  .raw-keys, .raw-form, .raw > p { margin-inline: 18px; }
  .segment label { padding: 8px 12px; font-size: 0.9rem; }
  .stat { border-left: none; border-top: 1px solid var(--bronze); }
  .stat:first-child { border-top: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
