:root {
  --ink: #0a0908;
  --ink-2: #14110f;
  --panel: #1a1512;
  --cream: #f2e8d5;
  --cream-dim: #d9cbb3;
  --gold: #d4af37;
  --gold-hot: #f0d060;
  --flame: #e85d1c;
  --flame-2: #ffb84a;
  --line: rgba(212, 175, 55, 0.35);
  --danger: #c44b3a;
  --ok: #6a9a5b;
  --radius: 6px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --rail: 76px;
  --font-display: "Cinzel", "Times New Roman", serif;
  --font-body: "Figtree", "Helvetica Neue", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}
body {
  background:
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(232, 93, 28, 0.18), transparent 55%),
    linear-gradient(180deg, #120e0c 0%, var(--ink) 40%, #070605 100%);
}
button, input, select, textarea {
  font: inherit;
  color: inherit;
}
button { cursor: pointer; border: 0; background: none; }
img { display: block; max-width: 100%; }

#forge {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(12px + var(--safe-t)) 16px calc(var(--rail) + 18px + var(--safe-b));
  position: relative;
}

.marquee {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}
.brand img {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  box-shadow: 0 0 0 1px var(--gold), 0 8px 20px rgba(0,0,0,.45);
}
.brand span {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.brand em {
  font-style: normal;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--gold-hot);
}
.brand strong {
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--cream-dim);
  text-transform: uppercase;
}
.vault-btn {
  position: relative;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  display: grid;
  place-items: center;
}
.vault-btn img { width: 26px; height: 26px; object-fit: contain; }
.vault-btn b {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--flame);
  color: #fff;
  font-size: 0.65rem;
  display: grid;
  place-items: center;
}

.pane.off { display: none; }
.pane h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--cream);
  line-height: 1.15;
}
.eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--gold);
}
.lede {
  margin: 0 0 18px;
  color: var(--cream-dim);
  font-size: 0.95rem;
  line-height: 1.45;
}
.disclaimer {
  margin: 16px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--gold);
  background: rgba(212, 175, 55, 0.07);
  color: var(--cream-dim);
  font-size: 0.78rem;
  line-height: 1.4;
}
.meta { display: block; color: var(--cream-dim); font-size: 0.78rem; margin-top: 4px; }

.hero-panel {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  margin-bottom: 18px;
  background:
    linear-gradient(135deg, rgba(242, 232, 213, 0.08), transparent 50%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.hero-flame {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(232, 93, 28, 0.35));
  animation: ember 3.2s ease-in-out infinite;
}
@keyframes ember {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.03); }
}
.hero-panel small {
  display: block;
  text-transform: uppercase;
  font-size: 0.68rem;
  color: var(--gold);
  font-weight: 700;
}
.hero-panel b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-top: 4px;
}

.lane-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.lane {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px 12px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  clip-path: polygon(8% 0, 92% 0, 100% 12%, 100% 88%, 92% 100%, 8% 100%, 0 88%, 0 12%);
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.lane:active { transform: scale(0.97); }
.lane:hover { border-color: var(--gold); background: #1f1915; }
.lane img { width: 44px; height: 44px; object-fit: contain; }
.lane span {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--cream-dim);
}

.sheet {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--ink-2);
  outline: none;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--gold-hot);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--cream-dim);
}
.gold-btn {
  margin-top: 4px;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-weight: 700;
  text-transform: uppercase;
  color: #1a1208;
  background: linear-gradient(180deg, var(--gold-hot), var(--gold));
  box-shadow: 0 6px 18px rgba(212, 175, 55, 0.28), inset 0 1px 0 rgba(255,255,255,0.35);
}
.gold-btn:active { transform: translateY(1px); }
.ghost {
  margin-top: 14px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--cream-dim);
}
.ghost.danger { border-color: rgba(196, 75, 58, 0.5); color: #e8a098; }

.service-list { display: flex; flex-direction: column; gap: 10px; }
.service-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  animation: rise .45s ease both;
  animation-delay: calc(var(--i, 0) * 60ms);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.service-card img { width: 56px; height: 56px; object-fit: contain; }
.service-card h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--gold-hot);
}
.service-card p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--cream-dim);
  line-height: 1.35;
}

.result-panel {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(232, 93, 28, 0.12), rgba(212, 175, 55, 0.08));
}
.result-panel img { width: 64px; height: 64px; object-fit: contain; }
.result-panel small {
  display: block;
  text-transform: uppercase;
  font-size: 0.68rem;
  color: var(--gold);
  font-weight: 700;
}
.result-panel b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin-top: 4px;
}

.haul-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}
.haul-legend div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink-2);
}
.haul-legend b {
  display: block;
  font-size: 0.82rem;
  color: var(--gold-hot);
  margin-bottom: 2px;
}
.haul-legend span { font-size: 0.72rem; color: var(--cream-dim); }

.list { display: flex; flex-direction: column; gap: 10px; }
.note-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.note-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.note-card .tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #1a1208;
  background: var(--gold);
  padding: 2px 8px;
  border-radius: 3px;
}
.note-card time { font-size: 0.72rem; color: var(--cream-dim); }
.note-card h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1rem;
}
.note-card p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--cream-dim);
  line-height: 1.4;
  white-space: pre-wrap;
}
.note-card .row-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}
.note-card .row-actions button {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.78rem;
  color: var(--cream-dim);
}
.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--cream-dim);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.info-card {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.info-card img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin-bottom: 8px;
}
.info-card h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gold-hot);
}
.info-card p {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: var(--cream-dim);
  line-height: 1.45;
}
.info-card p:last-child { margin-bottom: 0; }
.info-card details {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.info-card summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--cream);
  font-size: 0.9rem;
}
.info-card details p { margin-top: 6px; }

.rail {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(480px, 100%);
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 8px 6px calc(8px + var(--safe-b));
  background: linear-gradient(180deg, rgba(10, 9, 8, 0.92), #050403);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
  z-index: 20;
}
.rail-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 2px;
  opacity: 0.55;
  transition: opacity .15s ease, transform .15s ease;
}
.rail-chip.active {
  opacity: 1;
  transform: translateY(-2px);
}
.rail-chip img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.4));
}
.rail-chip span {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--cream-dim);
}
.rail-chip.active span { color: var(--gold-hot); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--rail) + 24px + var(--safe-b));
  transform: translateX(-50%) translateY(12px);
  max-width: min(420px, calc(100% - 32px));
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--gold);
  color: #1a1208;
  font-weight: 700;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 40;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 360px) {
  .lane-grid { grid-template-columns: repeat(2, 1fr); }
  .brand em { font-size: 1.15rem; }
}
