:root {
  color-scheme: dark;
  --bg: #0b1110;
  --surface: #111a17;
  --surface-raised: #17231e;
  --surface-soft: #1c2b24;
  --line: #2d4035;
  --line-strong: #45604c;
  --text: #edf4ee;
  --muted: #a4b5a8;
  --accent: #a7ed65;
  --accent-deep: #6ea83a;
  --danger: #ff8580;
  --shadow: 0 24px 70px rgba(0, 0, 0, .38);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(105, 164, 69, .14), transparent 42rem),
    linear-gradient(135deg, #0a100e, #101814 55%, #0b1110);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 9px 12px;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
button:hover { border-color: var(--accent-deep); background: #24372b; }
button:active { transform: translateY(1px); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button.primary {
  border-color: #9dde59;
  background: linear-gradient(180deg, #b3f276, #8fce4e);
  color: #14200f;
  font-weight: 750;
  box-shadow: 0 5px 18px rgba(133, 192, 72, .18);
}
button.primary:hover { background: #c1fa85; }
.hidden { display: none !important; }
.brand-lockup { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border: 1px solid #6b9952; border-radius: 12px;
  background: linear-gradient(145deg, #293d2b, #17251e);
  box-shadow: inset 0 1px rgba(255,255,255,.09), 0 8px 22px rgba(0,0,0,.22);
  transform: rotate(-3deg);
}
.brand-mark span {
  color: var(--accent); font-size: 12px; font-weight: 900; letter-spacing: -.06em;
  transform: rotate(3deg);
}
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -.025em; }
.brand-name > span { color: var(--accent); }
.brand-stack { display: grid; line-height: 1.2; }
.brand-subtitle { margin-top: 4px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.landing-page { display: grid; place-items: center; padding: 30px 18px; }
.landing-wrap { width: min(100%, 720px); }
.landing-card {
  position: relative; overflow: hidden;
  padding: clamp(26px, 6vw, 58px);
  border: 1px solid rgba(148, 183, 152, .22);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(23, 35, 30, .97), rgba(14, 22, 19, .98));
  box-shadow: var(--shadow);
}
.landing-card::before {
  position: absolute; inset: 0 0 auto; height: 4px; content: "";
  background: linear-gradient(90deg, #5a883d, var(--accent), #5a883d);
}
.landing-card::after {
  position: absolute; right: -70px; top: 60px; width: 230px; height: 230px; content: "";
  border: 1px solid rgba(167, 237, 101, .08); border-radius: 28px;
  box-shadow: 0 0 0 22px rgba(167,237,101,.025), 0 0 0 44px rgba(167,237,101,.018);
  transform: rotate(25deg); pointer-events: none;
}
.landing-card > * { position: relative; z-index: 1; }
.eyebrow {
  margin: 38px 0 8px; color: var(--accent); font-size: 11px;
  font-weight: 750; letter-spacing: .16em; text-transform: uppercase;
}
h1 { max-width: 560px; margin: 0; font-size: clamp(30px, 6vw, 44px); line-height: 1.12; letter-spacing: -.04em; }
.intro { max-width: 560px; margin: 18px 0 26px; color: var(--muted); font-size: 16px; }
.instruction {
  display: grid; grid-template-columns: 42px 1fr; gap: 15px; align-items: start;
  padding: 18px; border: 1px solid var(--line); border-radius: 14px;
  background: rgba(7, 13, 10, .38);
}
.step-number {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  background: rgba(167, 237, 101, .12); color: var(--accent); font-size: 12px; font-weight: 800;
}
.instruction strong { display: block; margin: 2px 0 4px; font-size: 15px; }
.instruction p { margin: 0 0 12px; color: var(--muted); }
code {
  display: inline-block; padding: 5px 9px; border: 1px solid #3c5940; border-radius: 7px;
  background: #0a120d; color: var(--accent); font: 700 13px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
}
.footnote { margin: 22px 0 0; color: #86988a; font-size: 13px; }
.site-footer { padding: 17px 8px 0; color: #819287; text-align: center; font-size: 12px; }
.site-footer span { padding: 0 5px; color: var(--accent-deep); }
.back-link { color: var(--accent); font-weight: 700; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.editor-header {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px clamp(14px, 3vw, 30px);
  border-bottom: 1px solid rgba(148, 183, 152, .2);
  background: rgba(13, 20, 17, .94); backdrop-filter: blur(12px);
}
.editor-header .brand-mark { width: 38px; height: 38px; }
.editor-header .primary { min-height: 42px; }
.editor-layout { display: grid; grid-template-columns: minmax(250px, 310px) minmax(0, 1fr); min-height: calc(100vh - 63px); }
.editor-sidebar {
  position: sticky; top: 63px; align-self: start; height: calc(100vh - 63px); overflow: auto;
  padding: 20px 16px 90px; border-right: 1px solid rgba(148, 183, 152, .18);
  background: rgba(14, 22, 19, .62);
}
.search-label { display: block; margin: 0 0 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
input, select, textarea {
  min-width: 0; border: 1px solid #394d40; border-radius: 8px;
  background: #0b1310; color: var(--text); padding: 9px 10px; font: inherit;
}
input::placeholder, textarea::placeholder { color: #748578; }
#search { width: 100%; }
.tools { display: grid; grid-template-columns: 1fr; gap: 7px; margin: 14px 0 18px; }
.tools button { text-align: left; font-size: 12px; }
#entities { display: flex; flex-direction: column; gap: 5px; }
.entity { width: 100%; padding: 8px 10px; text-align: left; overflow-wrap: anywhere; }
.entity.selected { border-color: var(--accent-deep); background: rgba(126, 177, 76, .13); color: var(--accent); }
.editor-detail { width: min(100%, 1280px); margin: 0 auto; padding: clamp(20px, 4vw, 38px) clamp(14px, 3vw, 32px) 110px; }
.editor-detail h2 { margin: 0 0 19px; font-size: clamp(23px, 3vw, 30px); letter-spacing: -.03em; }
.hint { color: var(--muted); line-height: 1.6; }
section.card {
  margin: 15px 0; padding: 17px; border: 1px solid rgba(148, 183, 152, .19);
  border-radius: 13px; background: linear-gradient(145deg, rgba(23,35,30,.96), rgba(17,26,23,.96));
  box-shadow: 0 8px 26px rgba(0,0,0,.12);
}
section.card h3 { margin: 0 0 13px; font-size: 16px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 650; }
.field input, .field select { width: 100%; }
.node {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)) auto;
  gap: 9px; align-items: end; padding: 12px 0; border-top: 1px solid rgba(148,183,152,.13);
}
.node:first-of-type { border-top: 0; }
.node-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.node-actions button { padding: 7px 9px; font-size: 12px; }
.danger { color: var(--danger); }
.editor-status {
  position: fixed; z-index: 10; right: 14px; bottom: 14px; left: max(14px, calc(310px + 20px));
  padding: 11px 14px; border: 1px solid rgba(148,183,152,.2); border-radius: 12px;
  background: rgba(17, 26, 23, .97); color: var(--muted); box-shadow: 0 12px 35px rgba(0,0,0,.32);
}
#apply-command { display: block; margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--accent); font: 700 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
@media (max-width: 760px) {
  .landing-card { border-radius: 17px; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-sidebar { position: static; height: auto; max-height: none; border-right: 0; border-bottom: 1px solid rgba(148,183,152,.18); padding-bottom: 15px; }
  #entities { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); max-height: 270px; overflow: auto; }
  .tools { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .node { grid-template-columns: 1fr 1fr; }
  .node-actions { grid-column: 1 / -1; }
  .editor-status { left: 12px; right: 12px; bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
