:root {
  --bg: #071018;
  --ink: #e8f2f4;
  --muted: #7f97a3;
  --line: rgba(94, 214, 198, 0.22);
  --cyan: #5ed6c6;
  --brass: #e0b35a;
  --panel: rgba(10, 24, 32, 0.86);
  --sheet: #0a1218;
  --font: "Syne", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
  overflow-x: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, #000 25%, transparent 72%);
  pointer-events: none;
}

.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.28;
  pointer-events: none;
  z-index: 0;
}
.orb-a {
  width: 360px;
  height: 360px;
  left: -80px;
  top: -60px;
  background: #0f6f66;
}
.orb-b {
  width: 300px;
  height: 300px;
  right: -50px;
  top: 10vh;
  background: #1b4d7a;
}

.top, .status, .forge, .foot { position: relative; z-index: 1; }

.top {
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 8px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  background: linear-gradient(120deg, #f4fffc 10%, var(--cyan) 55%, #9ad7ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tag {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status {
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto 10px;
  min-height: 1.2em;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 12px;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 16px;
  font: 700 13px/1 var(--font);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn.primary { background: var(--cyan); color: #04141a; }
.btn.primary:hover { background: #7fe6d7; }
.btn.brass { background: var(--brass); color: #1a1408; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: rgba(232, 242, 244, 0.28);
}
.btn.ghost:hover { border-color: var(--cyan); color: var(--cyan); }
.btn.wide { width: 100%; padding: 14px 16px; }
.btn kbd {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(4, 20, 26, 0.18);
}

.chip {
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(94, 214, 198, 0.35);
  color: var(--cyan);
  background: rgba(94, 214, 198, 0.08);
  white-space: nowrap;
}
.chip.dim {
  color: var(--muted);
  border-color: rgba(127, 151, 163, 0.35);
  background: transparent;
}

.forge {
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto 40px;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 14px;
  align-items: start;
}
@media (max-width: 900px) {
  .forge { grid-template-columns: 1fr; }
  .top { flex-direction: column; align-items: stretch; }
  .top-actions { justify-content: flex-start; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  backdrop-filter: blur(10px);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.panel-head.tight { margin-top: 14px; }
.panel-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cyan);
}

.presets, .tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.preset, .tool {
  appearance: none;
  border: 1px solid rgba(94, 214, 198, 0.22);
  background: rgba(4, 14, 20, 0.55);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  font: 650 12px/1 var(--font);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.preset:hover, .tool:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}
.preset.on, .tool.on {
  background: rgba(94, 214, 198, 0.16);
  border-color: var(--cyan);
  color: var(--cyan);
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}
.field span {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; }
}

input, select, textarea {
  width: 100%;
  border: 1px solid rgba(94, 214, 198, 0.2);
  background: rgba(4, 14, 20, 0.7);
  color: var(--ink);
  border-radius: 12px;
  padding: 11px 12px;
  font: 14px/1.45 var(--font);
  outline: none;
}
textarea { resize: vertical; min-height: 84px; }
input:focus, textarea:focus, select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(94, 214, 198, 0.15);
}

.more {
  margin-top: 14px;
  border: 1px dashed rgba(94, 214, 198, 0.28);
  border-radius: 14px;
  padding: 8px 12px 10px;
}
.more summary {
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  color: var(--ink);
  padding: 6px 0;
}
.more summary::-webkit-details-marker { display: none; }
.more summary em {
  font-style: normal;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.9em;
}
.more[open] summary { color: var(--cyan); }
.more-body { padding-bottom: 4px; }

.sticky-bar {
  position: sticky;
  bottom: 10px;
  margin-top: 14px;
  padding-top: 4px;
  background: linear-gradient(180deg, transparent, rgba(7, 16, 24, 0.92) 28%);
}

.sheet {
  margin: 0;
  min-height: 320px;
  max-height: 58vh;
  overflow: auto;
  padding: 14px;
  border-radius: 14px;
  background: var(--sheet);
  border: 1px solid rgba(94, 214, 198, 0.16);
  color: #d7ebe8;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.sheet.flash { animation: sheetIn 0.4s cubic-bezier(.2,.8,.2,1); }
@keyframes sheetIn {
  from { opacity: 0.25; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.panel-actions.twin {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.foot {
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto 32px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 12px;
}
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--cyan); }

@media (prefers-reduced-motion: reduce) {
  .sheet.flash { animation: none !important; }
}
