/* Lightwell try page, in the getlightwell.app look: Inter and JetBrains Mono (self-hosted, so the
   page stays cross-origin isolated), warm light on near-black, glow accent, soft shafts of light. */
@font-face { font-family:"Inter"; src:url("fonts/InterVariable.woff2") format("woff2-variations"), url("fonts/InterVariable.woff2") format("woff2"); font-weight:100 900; font-style:normal; font-display:swap; }
@font-face { font-family:"JetBrains Mono"; src:url("fonts/JetBrainsMono-Regular.woff2") format("woff2"); font-weight:400; font-style:normal; font-display:swap; }
@font-face { font-family:"JetBrains Mono"; src:url("fonts/JetBrainsMono-SemiBold.woff2") format("woff2"); font-weight:600; font-style:normal; font-display:swap; }
:root {
	color-scheme: dark;
	--bg:#0a0c0d; --bg-2:#0f1213; --ink:#050505; --panel:rgba(255,255,255,.025); --line:rgba(220,230,228,.09); --line-2:rgba(220,230,228,.16);
	--text:#e9e6dd; --muted:#9aa19f; --dim:#6c7472; --light:#f6efd9; --glow:#9fe3df;
	--good:#4cc98a; --warn:#f2b84b; --bad:#ff7a6b;
	--radius:12px;
	--sans:"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--mono:"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing:border-box; }
html, body { margin:0; height:100%; }
body { display:flex; flex-direction:column; background:var(--bg); color:var(--text); font:14px/1.5 var(--sans); -webkit-font-smoothing:antialiased; overflow:hidden; }
a { color:inherit; }
b { font-weight:600; color:var(--light); }
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
::selection { background:rgba(159,227,223,.25); }
:focus-visible { outline:2px solid var(--glow); outline-offset:2px; }

/* Light from above, as on getlightwell.app. It moves only while the sandbox boots: a page that
   animates every frame makes the browser hold the terminal's echo until the next frame. */
.fx { position:fixed; inset:0; z-index:0; pointer-events:none; mix-blend-mode:screen; }
.ray { position:absolute; top:-12%; height:80%; filter:blur(22px); opacity:.3; clip-path:polygon(38% 0, 62% 0, 100% 100%, 0 100%);
	background:linear-gradient(180deg, rgba(246,239,217,.26), rgba(246,239,217,.05) 60%, rgba(246,239,217,0)); animation:breathe 9s ease-in-out infinite; }
.ray--1 { left:22%; width:16%; transform:skewX(5deg); }
.ray--2 { left:30%; width:7%; transform:skewX(8deg); animation-duration:7s; animation-delay:-3s; opacity:.2; }
@keyframes breathe { 0%,100% { opacity:.16; } 50% { opacity:.38; } }
.motes { position:absolute; left:18%; top:4%; width:30%; height:60%; opacity:.55;
	background-image:
		radial-gradient(1.4px 1.4px at 20% 30%, rgba(255,250,235,.8), transparent 60%),
		radial-gradient(1px 1px at 60% 12%, rgba(255,250,235,.7), transparent 60%),
		radial-gradient(1.2px 1.2px at 80% 55%, rgba(255,250,235,.6), transparent 60%),
		radial-gradient(1px 1px at 35% 75%, rgba(255,250,235,.6), transparent 60%),
		radial-gradient(1.6px 1.6px at 50% 45%, rgba(255,250,235,.7), transparent 60%);
	background-size:220px 260px;
	-webkit-mask-image:linear-gradient(180deg, transparent, #000 15%, #000 70%, transparent); mask-image:linear-gradient(180deg, transparent, #000 15%, #000 70%, transparent);
	animation:float 24s linear infinite; }
@keyframes float { from { background-position:0 0; } to { background-position:40px 260px; } }
body:not([data-state="boot"]) .ray, body:not([data-state="boot"]) .motes { animation-play-state:paused; }
@media (prefers-reduced-motion: reduce) { .ray, .motes, .boot__bar span { animation:none !important; } }

/* Header: the mark, what this is, status, and the way to the real thing */
header { position:relative; z-index:2; display:flex; align-items:center; gap:16px; padding:12px clamp(14px, 2.4vw, 28px); }
.brand { display:inline-flex; align-items:center; gap:10px; text-decoration:none; font-weight:600; font-size:16px; letter-spacing:.02em; }
.brand__mark { width:28px; height:28px; }
.kicker { font-size:11.5px; font-weight:600; letter-spacing:.22em; text-transform:uppercase; color:var(--glow); }
.grow { flex:1; }
#status { color:var(--muted); font-size:13px; white-space:nowrap; }
#status::before { content:""; display:inline-block; width:7px; height:7px; border-radius:50%; margin-right:8px; vertical-align:1px; background:var(--warn); box-shadow:0 0 8px currentColor; }
body[data-state="ready"] #status { color:var(--text); }
body[data-state="ready"] #status::before { background:var(--good); }
body[data-state="error"] #status { color:var(--bad); }
body[data-state="error"] #status::before { background:var(--bad); }
.btn { --h:40px; display:inline-flex; align-items:center; justify-content:center; gap:9px; height:var(--h); padding:0 18px; border-radius:999px; border:0;
	font:600 14.5px var(--sans); letter-spacing:.01em; text-decoration:none; white-space:nowrap; cursor:pointer; transition:transform .2s ease, box-shadow .3s ease, background .2s, border-color .2s; }
.btn svg { width:17px; height:17px; }
.btn--light { background:linear-gradient(180deg, #fbf6e7, #e6dcc0); color:#121314; box-shadow:0 0 0 1px rgba(255,255,255,.25) inset, 0 8px 30px -10px rgba(246,239,217,.55); }
.btn--light:hover { transform:translateY(-1px); box-shadow:0 0 0 1px rgba(255,255,255,.35) inset, 0 12px 40px -8px rgba(246,239,217,.7); }
.btn--ghost { color:var(--text); border:1px solid rgba(233,230,221,.28); background:rgba(10,12,13,.35); }
.btn--ghost:hover:not(:disabled) { border-color:rgba(233,230,221,.6); background:rgba(255,255,255,.06); }
.btn--sm { --h:32px; padding:0 13px; font-size:13px; }
.btn:disabled { opacity:.45; cursor:default; }

/* Two windows: the map (wide) and the terminal */
main { position:relative; z-index:1; flex:1; min-height:0; display:grid; grid-template-columns:minmax(0, 2fr) minmax(400px, 1fr); gap:14px; padding:4px clamp(14px, 2.4vw, 28px) 12px; }
.window { position:relative; display:flex; flex-direction:column; min-height:0; border:1px solid var(--line-2); border-radius:var(--radius); overflow:hidden;
	background:linear-gradient(180deg, #111516, #0b0e0f); box-shadow:0 40px 80px -40px rgba(0,0,0,.9), 0 0 0 1px rgba(0,0,0,.6); }
.window__bar { display:flex; align-items:center; gap:12px; min-height:40px; padding:6px 12px; border-bottom:1px solid var(--line); background:rgba(255,255,255,.02); font-size:13px; }
/* Window controls: the title-bar dots minimize (the window becomes a chip on the desktop) and
   maximize (it fills the page). Their marks show on hover and keyboard focus, as on a Mac. */
.ctl { display:inline-flex; gap:7px; }
.ctl button { position:relative; width:12px; height:12px; padding:0; border:0; border-radius:50%; cursor:pointer; background:rgba(233,230,221,.16); transition:background .15s; }
.ctl button::before { content:""; position:absolute; inset:-6px; }
.ctl button::after { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font:700 10px/1 var(--sans); color:rgba(10,12,13,.75); opacity:0; }
.ctl__min::after { content:"\2013"; }
.ctl__max::after { content:"\2197"; }
body[data-max] .ctl__max::after { content:"\2199"; }
.window__bar:hover .ctl__min, .ctl__min:focus-visible { background:var(--warn); }
.window__bar:hover .ctl__max, .ctl__max:focus-visible { background:var(--good); }
.window__bar:hover .ctl button::after, .ctl button:focus-visible::after { opacity:1; }
.fs { display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; padding:0; border:0; border-radius:8px; background:transparent; color:var(--muted); cursor:pointer; }
.fs:hover { color:var(--text); background:rgba(255,255,255,.06); }
.fs svg { width:15px; height:15px; }
.fs[hidden] { display:none; }
.window__title { font-weight:600; letter-spacing:.01em; }
.dim { color:var(--dim); font-weight:400; font-family:var(--mono); font-size:12px; margin-left:6px; }
.picker { margin-left:auto; }
.picker select { font:500 12.5px var(--sans); color:var(--text); background:var(--bg-2); border:1px solid var(--line-2); border-radius:8px; padding:4px 8px; max-width:14em; }
.picker select:disabled { opacity:.6; }
.chip { font-size:12px; color:var(--muted); border:1px solid var(--line-2); border-radius:999px; padding:2px 10px; white-space:nowrap; }
.chip.live { color:var(--glow); border-color:rgba(159,227,223,.35); }
.window__body { position:relative; flex:1; min-height:0; }
#viewer { position:absolute; inset:0; width:100%; height:100%; border:0; background:var(--bg); }
.note { position:absolute; left:50%; top:45%; transform:translate(-50%,-50%); color:var(--muted); font-size:13px; text-align:center; pointer-events:none; }
.note[hidden] { display:none; }

/* A minimized window hides and leaves a chip on the desktop, which brings it back. The other
   window takes the width; a maximized one covers the page (and the screen, in full screen). */
body[data-hide="map"] #map-window, body[data-hide="term"] #term-window { display:none; }
body[data-hide] main { grid-template-columns:minmax(0, 1fr) auto; }
#desk { display:flex; flex-direction:column; gap:10px; padding-top:4px; }
#desk[hidden] { display:none; }
.desk__chip { display:flex; flex-direction:column; align-items:center; gap:6px; width:84px; padding:10px 4px 8px; border:1px solid transparent; border-radius:var(--radius); background:transparent;
	color:var(--text); font:500 12px var(--sans); cursor:pointer; transition:background .15s, border-color .15s; }
.desk__chip[hidden] { display:none; }
.desk__chip:hover { background:rgba(255,255,255,.05); border-color:var(--line-2); }
.desk__chip img, .desk__chip svg { width:30px; height:30px; filter:drop-shadow(0 0 14px rgba(246,239,217,.25)); }
.desk__chip svg { color:var(--light); }
body[data-max="map"] #map-window, body[data-max="term"] #term-window { position:fixed; inset:0; z-index:8; height:auto; min-height:0; border:0; border-radius:0; }
body[data-max] { overflow:hidden; }
/* main is a stacking context under the header: raise it so the maximized window is on top. */
body[data-max] main { z-index:8; }

#term-window .window__body { background:var(--ink); }
#term { position:absolute; inset:0; }
#term .xterm { padding:8px 0 0 10px; height:100%; }
#term .xterm-viewport { background-color:var(--ink) !important; }

/* Boot screen over the terminal until the Lightwell session is up */
#boot { position:absolute; inset:0; z-index:3; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:14px; background:var(--ink); transition:opacity 320ms ease, visibility 320ms; }
body:not([data-state="boot"]) #boot { opacity:0; visibility:hidden; }
body[data-state="error"] #boot { opacity:1; visibility:visible; }
.boot__mark { filter:drop-shadow(0 0 24px rgba(246,239,217,.25)); }
.boot__bar { position:relative; width:min(260px, 60%); height:1px; background:var(--line-2); overflow:hidden; }
.boot__bar span { position:absolute; top:0; bottom:0; width:30%; background:var(--light); animation:sweep 1.4s ease-in-out infinite; }
@keyframes sweep { from { left:-30%; } to { left:100%; } }
.boot__stage { color:var(--muted); font-size:13px; }
body[data-state="error"] .boot__bar span { animation:none; left:0; width:100%; background:var(--bad); }
body[data-state="error"] .boot__stage { color:var(--bad); }

/* Map your own project */
.own { border-top:1px solid var(--line); padding:10px 12px 12px; font-size:13px; color:var(--muted); background:rgba(255,255,255,.015); }
.own__row { display:flex; gap:8px; flex-wrap:wrap; margin-top:8px; }
.own__row[hidden] { display:none; }
.st { margin-top:6px; min-height:1.2em; }
/* A phone or tablet can't drop files on the page or pick a folder: it gets the archive picker. */
.if-touch { display:none; }
@media (pointer: coarse) { .if-touch { display:inline; } .if-mouse, #pick-dir { display:none; } }
.st.error { color:var(--bad); } .st.done { color:var(--text); }

/* Drop target */
#drop { display:none; position:fixed; inset:0; z-index:10; align-items:center; justify-content:center; background:rgba(8,10,11,.88); }
#drop > div { border:1px dashed rgba(246,239,217,.55); border-radius:var(--radius); padding:44px 64px; text-align:center; font-size:26px; font-weight:300; color:var(--light); }
#drop span { display:block; margin-top:8px; font-size:12px; letter-spacing:.18em; text-transform:uppercase; color:var(--muted); }
body.dropping #drop { display:flex; }

footer { position:relative; z-index:1; display:flex; justify-content:space-between; align-items:center; gap:16px; padding:8px clamp(14px, 2.4vw, 28px) 12px; color:var(--dim); font-size:12px; }
.foot-actions { display:flex; align-items:center; gap:16px; white-space:nowrap; }
footer a { color:var(--muted); text-underline-offset:3px; }
footer button { font:600 12px var(--sans); color:var(--text); background:transparent; border:1px solid rgba(233,230,221,.28); border-radius:999px; padding:4px 12px; cursor:pointer; }
footer button:hover { border-color:rgba(233,230,221,.6); }

/* Narrow screens: the map above the terminal, the page scrolls */
@media (max-width: 900px) {
	body { overflow:auto; height:auto; min-height:100%; }
	header { flex-wrap:wrap; gap:10px 14px; }
	.kicker { order:3; width:100%; }
	#status { display:none; }
	main { display:flex; flex-direction:column; }
	#map-window { height:62svh; min-height:360px; }
	#term-window { height:70svh; min-height:380px; }
	footer { flex-direction:column; align-items:flex-start; }
	.chip { display:none; }
	/* One window at a time when the other is minimized; its chip sits on the desktop under it. */
	body[data-hide] #map-window, body[data-hide] #term-window { height:calc(100svh - 210px); }
	#desk { flex-direction:row; padding:0; }
}
/* Touch: bigger targets for the dots, and their marks always shown. */
@media (pointer: coarse) {
	.ctl { gap:12px; }
	.ctl button { width:16px; height:16px; }
	.ctl .ctl__min { background:var(--warn); } .ctl .ctl__max { background:var(--good); }
	.ctl button::after { opacity:1; font-size:12px; }
}
