@font-face {
  font-family: Space;
  src: url("/font.woff2") format("woff2");
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --ink: #151612;
  --paper: #f3f2e9;
  --lime: #e4ff66;
  --muted: #a4a59a;
  --line: #383930;
  --surface: #1d1f19;
  --raised: #252820;
  --outline: #656955;
  --danger: #ffc2b2;
  --rail-width: clamp(12.5rem, 16vw, 15.5rem);
  color-scheme: dark;
  font: 400 100%/1.5 Space, Arial, sans-serif;
  font-synthesis: none;
  background: var(--ink);
  color: var(--paper);
  scroll-padding: 5rem 1rem;
}

*, *::before, *::after { box-sizing: border-box }
body { margin: 0; min-height: 100svh }
img, svg { display: block; max-width: 100% }
button, input, textarea, select { font: inherit }
button, a, input, select, summary { touch-action: manipulation }
a { color: inherit; text-underline-offset: .22em; text-decoration-color: var(--outline) }
a:hover { text-decoration-color: var(--lime) }
button, a.button { cursor: pointer }
button:disabled, input:disabled { cursor: default; opacity: .6 }
[hidden] { display: none !important }
:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px }
::selection { color: var(--ink); background: var(--lime) }
h1, h2, h3, p { margin: 0 }
h1, h2, h3 { font-weight: 550; line-height: 1.12; text-wrap: balance }
h1 { font-size: clamp(2.15rem, 4vw, 3.9rem); letter-spacing: -.06em }
h2 { font-size: clamp(1.25rem, 2.4vw, 1.85rem); letter-spacing: -.04em }
h3 { font-size: 1.1rem; letter-spacing: -.025em }
p, li, dd { overflow-wrap: anywhere }
p + p { margin-block-start: .7rem }
small, .muted, .help { color: var(--muted) }
.eyebrow, .kicker {
  color: var(--muted); font: 550 .75rem/1.4 Space, Arial, sans-serif;
  text-transform: uppercase; letter-spacing: .11em;
}
.skip { position: fixed; top: .5rem; left: .5rem; transform: translateY(-160%); z-index: 20; padding: .75rem; background: var(--lime); color: var(--ink) }
.skip:focus { transform: none }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap }

/* The shared World switcher styles its own controls inside its shadow root. */
kashe-world-nav { display: inline-block; flex: 0 0 auto; max-width: 100% }
.brand { display: inline-flex; gap: .75rem; align-items: center; width: fit-content; font-size: 1.35rem; font-weight: 650; letter-spacing: -.05em; text-decoration: none }
.brand img, .brand > svg { width: 2rem; height: 2rem; object-fit: contain; flex: none }
.brand small { display: block; font-size: .73rem; font-weight: 450; letter-spacing: 0 }
.welcome { min-height: 100svh; max-width: 92rem; margin-inline: auto; padding: 0 clamp(1rem, 5vw, 5rem) 3rem }
.welcome-bar, .topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.5rem; border-bottom: 1px solid var(--line) }
.welcome-hero { display: grid; align-items: center; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: clamp(1.5rem,5vw,6rem); padding-block: clamp(3rem,9vw,8.5rem) }
.welcome-copy { display: grid; align-content: center; justify-items: start; gap: clamp(1rem,2vw,1.6rem) }
.welcome-copy h1 { font-size: clamp(3.2rem,6.1vw,6rem); line-height: .96; letter-spacing: -.075em; max-width: 15ch }
.welcome-copy > p:not(.eyebrow):not(.kicker) { max-width: 49ch; font-size: clamp(1.05rem,2vw,1.25rem); color: #c2c5b7 }
.welcome-art { width: 100%; max-height: 32rem; object-fit: contain }

.shell { display: grid; grid-template-columns: var(--rail-width) minmax(0,1fr); min-height: 100svh }
.rail {
  position: sticky; top: 0; height: 100svh; overflow-y: auto;
  background: #191b16; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 1.5rem; padding: 1.5rem .85rem;
}
.rail .brand { margin: 0 .45rem .6rem }
.rail .nav, .rail nav { display: grid; gap: .25rem }
.rail nav :is(a,button), .mobile-nav :is(a,button) {
  display: flex; align-items: center; gap: .7rem; width: 100%;
  min-height: 44px; padding: .55rem .8rem; border: 0; border-radius: .55rem;
  background: transparent; color: #c5c6bb; text-align: left; text-decoration: none; font-weight: 500;
}
.rail nav :is(a,button):hover, .mobile-nav :is(a,button):hover { background: var(--raised); color: var(--paper) }
.rail nav :is([aria-current="page"],.active), .mobile-nav :is([aria-current="page"],.active) {
  color: var(--lime); background: #303522; box-shadow: inset 3px 0 var(--lime);
}
.rail nav svg, .mobile-nav svg { width: 1.1rem; height: 1.1rem; flex-shrink: 0 }
.rail-foot { margin-top: auto; display: grid; gap: .6rem }
.workspace { min-width: 0 }
.topbar { min-height: 4rem; padding-inline: clamp(1rem,3vw,3rem); color: #ced0c4 }
.main, .workspace > main { width: 100%; max-width: 104rem; margin-inline: auto; padding: clamp(1.1rem,3vw,3.2rem); min-width: 0; }
.pagehead { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: end; gap: 1rem; margin-block-end: 1.7rem }
.pagehead .eyebrow { margin-bottom: .6rem }
.pagehead p:not(.eyebrow) { max-width: 67ch; color: var(--muted); margin-top: .55rem }
.stack { display: grid; align-content: start; gap: 1rem; min-width: 0 }
.grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,16rem),1fr)); gap: 1rem; min-width: 0 }
.split { display: grid; grid-template-columns: minmax(0,1fr) minmax(16rem,30%); align-items: start; gap: 1.1rem }
.split > *, .grid > * { min-width: 0 }
.card, .inspector, .panel, .empty {
  background: var(--surface); border: 1px solid var(--line); border-radius: .95rem;
  padding: clamp(1rem,1.9vw,1.6rem); min-width: 0;
}
.card > :is(h2,h3) + *, .panel > :is(h2,h3) + *, .inspector > :is(h2,h3) + * { margin-top: .8rem }
.card > .eyebrow + h2 { margin-top: .45rem }
.empty { border-style: dashed; color: #c5c7ba }
.inspector { display: grid; gap: .85rem }
.row, .actions, .toolbar, .tabs { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; min-width: 0 }
.row { justify-content: space-between; gap: 1rem; padding-block: .8rem; border-bottom: 1px solid var(--line) }
.row:last-child { border-bottom-color: transparent }
.row > *, .toolbar > * { min-width: 0 }
.actions { gap: .5rem }
.button, button {
  min-height: 44px; padding: .58rem .92rem; border-radius: .55rem; border: 1px solid var(--outline);
  display: inline-flex; align-items: center; justify-content: center; gap: .42rem;
  background: var(--raised); color: var(--paper); text-decoration: none; font-weight: 550; line-height: 1.3;
}
:is(.button,button):hover:not(:disabled) { background: #30342a; border-color: #9caa78 }
.button.primary, button.primary, .primary.button:hover, button.primary:hover:not(:disabled) { background: var(--lime); color: var(--ink); border-color: var(--lime) }
.button.primary:hover, button.primary:hover:not(:disabled) { background: #efff9e }
button.danger, .button.danger, .error { color: var(--danger) }
.tabs { border-bottom: 1px solid var(--line); gap: .35rem; margin-bottom: 1rem }
.tabs :is(button,a) { border: 0; border-radius: 0; background: transparent; color: var(--muted); text-decoration: none; padding: .7rem; min-height: 44px }
.tabs :is([aria-selected="true"],[aria-current="page"],.active) { color: var(--paper); box-shadow: inset 0 -2px var(--lime) }
.pill { display: inline-flex; align-items: center; width: fit-content; padding: .16rem .52rem; background: #2e3228; color: #d3d8c5; border: 1px solid #525b45; border-radius: .4rem; font-size: .8rem }
.notice, [role="alert"]:not(:empty) { padding: .75rem .95rem; border-inline-start: 3px solid var(--lime); background: #262a20; border-radius: .25rem }
.notice:empty { display: none }
.form, form.stack { display: grid; gap: .95rem }
label { display: grid; gap: .35rem; color: #dadcd0; font-size: .94rem }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%; max-width: 100%; min-width: 0; min-height: 44px; padding: .62rem .75rem;
  border: 1px solid var(--outline); border-radius: .5rem; color: var(--paper); background: #151711;
}
textarea { resize: vertical; min-height: 7rem; line-height: 1.55 }
textarea.code, pre, code, kbd, .mono { font-family: "Cascadia Mono", Consolas, monospace }
pre { overflow: auto; max-width: 100%; background: #151711; padding: 1rem; border-radius: .5rem; font-size: .88rem }
input:is([type="checkbox"],[type="radio"]) { accent-color: var(--lime); width: 1.15rem; height: 1.15rem }
label:has(> input:is([type="checkbox"],[type="radio"])) { display:flex; align-items:center; gap:.6rem; min-height:44px }
fieldset { min-width: 0; border: 1px solid var(--line); border-radius: .7rem; margin: 0; padding: .9rem }
legend { padding-inline: .4rem }
summary { cursor: pointer; min-height: 44px; padding-block: .55rem }
.table-wrap { overflow: auto; max-width: 100% }
table { border-collapse: collapse; width: 100%; text-align: left }
th, td { padding: .65rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere }
th { color: #c1c6b5; font-size: .86rem; font-weight: 550 }
.canvas { overflow: auto; min-height: 18rem; padding: 1.3rem; background: radial-gradient(#4c5340 1px, transparent 1px) 0 0 / 18px 18px, #1d2019; border: 1px solid var(--line); border-radius: .8rem }
.node { border: 1px solid #70795f; border-radius: .7rem; background: #292e24; padding: .8rem; max-width: 23rem; min-width: 0 }
.node:is([aria-selected="true"],[aria-current],.selected) { border-color: var(--lime); box-shadow: 0 0 0 1px var(--lime) }
dialog { color: var(--paper); background: var(--surface); border: 1px solid var(--outline); padding: 1.35rem; border-radius: .85rem; width: min(94vw,36rem); max-height: 86svh; overflow: auto }
dialog::backdrop { background: #080a07c9 }
.mobile-nav { display:none }

@media (max-width: 960px) {
  .split { grid-template-columns: 1fr }
  .welcome-hero { gap: 1.5rem }
}
@media (max-width: 740px) {
  .shell { display: block }
  .shell > .rail { display: none }
  .shell { padding-bottom: calc(4.5rem + env(safe-area-inset-bottom)) }
  .mobile-nav {
    display: flex; position: fixed; isolation:isolate; bottom: 0; left: 0; right: 0;
    background: #191b16; border-top: 1px solid var(--line); z-index: 5;
    min-height: 3.65rem; align-items: stretch; padding: .2rem .25rem calc(.2rem + env(safe-area-inset-bottom));
  }
  .mobile-nav :is(a,button) {
    flex: 1 1 0; min-width: 0; min-height: 48px; flex-direction: column; justify-content: center;
    text-align: center; font-size: .78rem; padding: .25rem .1rem; gap: .15rem; border-radius: .3rem;
    overflow-wrap: anywhere;
  }
  .mobile-nav :is([aria-current="page"],.active) { box-shadow: inset 0 2px var(--lime) }
  .welcome-hero { grid-template-columns: 1fr; padding-block: 2.75rem 2rem }
  .welcome-art { max-width: 35rem; margin-inline: auto }
  .main, .workspace > main { padding-inline: 1rem }
  .topbar, .welcome-bar { min-height: 3.6rem; gap: .45rem }
  .pagehead { align-items: start }
  .canvas { min-height: 12rem; padding: .75rem }
}
@media (max-width: 410px) {
  .welcome-copy h1 { font-size: clamp(2.6rem,12.4vw,3.25rem) }
  .actions { gap: .35rem }
  .grid { grid-template-columns: 1fr }
  th, td { padding-inline: .3rem }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important }
}
@media (forced-colors: active) {
  .rail nav [aria-current], .mobile-nav [aria-current], .tabs [aria-selected="true"], .node.selected { outline: 2px solid Highlight }
  .canvas { background: Canvas }
}
