:root {
    --bg: #1f2327;
    --panel: #2a2f35;
    --border: #3a4148;
    --text: #e6e6e6;
    --muted: #9a9ca1;
    --accent: #1fb886;          /* a touch under the VLE's #22c992: text, links, highlighted borders */
    --accent-bg: #00855e;       /* its deeper shade, behind white button text (4.6:1) */
    --danger: #ef5350;
    --shadow: 0 2px 4px rgba(0, 0, 0, .35), 0 8px 20px rgba(0, 0, 0, .4);   /* the VLE's menus and panels */
    color-scheme: dark;
}

@font-face {
    font-family: "JetBrains Mono";
    src: url("fonts/jetbrains-mono-700.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}

/* the VLE's Roboto, for buttons that match its dialogs' */
@font-face {
    font-family: "Roboto";
    src: url("/.libs/ui/fonts/Roboto-VariableFont.ttf") format("truetype");
    font-weight: 100 900;
    font-display: swap;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

#home { max-width: 1200px; margin: 0 auto; padding: 32px 16px 48px; }
.side { display: flex; flex-direction: column; gap: 20px; margin-top: 20px; }
.side .card { margin-top: 0; }

/* The editor is for desktops and tablets: there, projects sit beside the hero. */
@media (min-width: 900px) {
    #home {
        display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 32px;
        align-items: start; padding: 48px 32px;
    }
    .side { margin-top: 16px; }    /* the title's line box starts above its letters */

    /* The column fits the window and the project list scrolls inside its card, so the page doesn't. */
    .side { max-height: calc(100vh - 112px); }
    .side .card:has(#projects) { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
    #projects { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin-right: -8px; padding-right: 8px; }
}

.hero h1 { font: 700 44px/1.2 "JetBrains Mono", ui-monospace, monospace; margin: 0 0 14px; letter-spacing: -1.5px; }
.hero h1 .tld { color: var(--accent); }
.tagline { font-size: 19px; margin: 0 0 6px; }
.tagline strong { color: var(--accent); font-weight: 600; }
.sub, .muted { color: var(--muted); }
.sub .free { color: var(--accent); }
.shot { display: block; width: 100%; height: auto; margin-top: 20px; }   /* on the page's own colour, so no frame */

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 16px 20px;
    margin-top: 20px;
}
.card h2 { font-size: 16px; margin: 0 0 12px; }
.heading { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.heading h2 { margin: 0; }

/* Hover (or focus, or a tap) shows the box, spanning its card so it fits any column width. Its
   transparent top padding bridges the gap from the icon. */
.card:has(.tip) { position: relative; }
.tip { display: inline-flex; }
.info {
    width: 18px; height: 18px; padding: 0;
    border-radius: 50%; border: 1px solid var(--muted); background: none; color: var(--muted);
    font: italic 600 11px/16px Georgia, serif;
}
.tip:hover .info, .info:focus-visible { color: var(--accent); border-color: var(--accent); }
.tip-box { display: none; position: absolute; left: 10px; right: 10px; top: 38px; z-index: 20; padding-top: 6px; }
.tip:hover .tip-box, .tip:focus-within .tip-box { display: block; }
.tip-card {
    display: flex; flex-direction: column; gap: 8px; padding: 14px 16px;
    background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
    font-size: 14px; line-height: 1.45; box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
}
#remix { border-color: var(--accent); }
#remix p { margin: 0 0 12px; }
.row { display: flex; gap: 8px; align-items: center; }

form { display: flex; gap: 8px; flex-wrap: wrap; }

/* sunk as the VLE's props fields: a dark edge, a shadow inside the top and a light lip below; the accent on hover and focus */
input {
    flex: 1 1 200px;
    min-width: 0;
    height: 32px;
    background: #25292e;
    color: var(--text);
    border: 1px solid rgba(0, 0, 0, .5);
    border-radius: 4px;
    box-shadow: inset 0 3px 3px -2px rgba(0, 0, 0, .2), 0 1px 0 rgba(255, 255, 255, .1);
    padding: 0 10px;
    font: inherit;
    font-size: 14px;
}
input:hover { border-color: rgba(34, 201, 146, .35); }
input:focus { outline: none; border-color: rgba(34, 201, 146, .8); }

button {
    background: #007a57;   /* a tad deeper than --accent-bg, as the lit edge brightens it */
    color: #fff;
    border: 0;
    border-radius: 6px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 -1px 0 #005f43, 0 1px 2px rgba(0, 0, 0, .25);   /* raised as the VLE's emerald buttons */
    padding: 8px 16px;
    font: inherit;
    cursor: pointer;
}
/* the filled ones as the VLE's toolbox buttons, flush in a hole: 1.5px of dark floor round them and a light lip below,
   a lit top edge inside (look.css --vle-btn-lit, --vle-sunk-lip). Widths rounded to whole pixels keep the edges sharp (calc-size: Chromium) */
button:where(:not(.link, .icon, .info, .choice, .seg button, .import-menu button)) {
    height: 32px; min-width: 64px; padding: 0 16px; width: calc-size(fit-content, round(up, size, 1px));
    border: 1.5px solid #181b1f; border-radius: 5.5px;
    font: 500 13px/1 Roboto, Helvetica, Arial, sans-serif; letter-spacing: .02857em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 1px 0 rgba(255, 255, 255, .1);   /* the emerald ones: a strong top light, as the colour flattens a softer one */
}
button:hover:where(:not(:disabled, .link, .icon, .info, .choice, .seg button, .import-menu button)) { background: #008a62; }
/* a dialog's other buttons, and the bar's Download: the toolbox buttons' grey */
button.grey { background: #31363c; color: #ccc; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 1px 0 rgba(255, 255, 255, .1); }
button.grey:hover { background: #373d43; }
button.link { background: none; color: var(--accent); padding: 4px 8px; }
:is(button.link, button.icon, button.info, button.choice, .seg button, .import-menu button) { box-shadow: none; }
button.danger { color: var(--danger); }

.error { color: var(--danger); margin: 8px 0 0; }
.import-row { margin: 8px 0 0; font-size: 14px; }
.import-row button { padding: 0; }
/* "import a project": guitool's own zip, or screens from Figma */
.import-wrap { position: relative; }
.import-menu {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 20; margin-top: 6px;
    display: flex; flex-direction: column; gap: 2px; padding: 6px;
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
}
.import-menu[hidden] { display: none; }
.import-menu button {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
    background: none; color: var(--text); padding: 8px 10px; border-radius: 6px;
}
.import-menu button:hover, .import-menu button:focus-visible { background: var(--bg); }
.import-menu strong { font-size: 14px; font-weight: 600; }
.import-menu span { font-size: 13px; color: var(--muted); }

#projects { list-style: none; margin: 0; padding: 0; }
#projects li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
#projects li:first-child { border-top: 0; }
#projects a { font-weight: 600; flex: 1 1 auto; }
#projects .muted { font-size: 13px; }
#projects .actions { display: inline-flex; gap: 4px; margin-left: auto; }
button.icon { display: inline-flex; padding: 4px; color: var(--muted); }
button.icon:hover { color: var(--accent); }
button.icon.danger { color: var(--muted); }
button.icon.danger:hover { color: var(--danger); }


#editor { position: fixed; inset: 0; display: flex; flex-direction: column; }
#editor[hidden] { display: none; }

.bar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 40px;
    padding: 0 8px;
    background: var(--panel);   /* no line below: the VLE's panels sit apart by their shades */
}
#project-name { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#vle { flex: 1; width: 100%; border: 0; background: var(--bg); }

#toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 10;
    max-width: calc(100% - 32px);
    background: #333;
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: 8px;
}

#preview { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; background: var(--bg); }
#preview[hidden] { display: none; }
#preview .title { font-weight: 600; flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg button { background: none; color: var(--muted); border-radius: 0; padding: 4px 10px; }
#devices button { display: inline-flex; padding: 5px 10px; }
#preview-rotate[hidden] { display: none; }
.seg button.on { background: var(--accent-bg); color: #fff; }
.stage { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 24px; background: #3a3d42; }
#device-fit { position: relative; flex: none; }
#device { position: absolute; transform-origin: 0 0; box-shadow: 0 8px 24px 4px rgba(0, 0, 0, .3); }
#device .screen { position: relative; }
#device.noframe .screen { width: 100%; height: 100%; }
.stage.fill { padding: 0; }
.stage.fill #device { box-shadow: none; }

/* The debug panel: drops down under the preview toolbar. */
#debug-open { position: relative; }
#debug-open[aria-expanded="true"] { color: var(--accent); }
#debug-count {
    position: absolute; top: -3px; right: -5px; min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 8px; background: #5f6368; color: #fff; font: 600 10px/16px system-ui, sans-serif; text-align: center;
}
#debug-count.error { background: var(--danger); }
#debug-count[hidden] { display: none; }
#debug {
    position: absolute; top: 40px; left: 0; right: 0; z-index: 4; max-height: 45%;
    display: flex; flex-direction: column; background: #17181a;
    border-bottom: 1px solid var(--border); box-shadow: 0 6px 16px rgba(0, 0, 0, .4);
}
#debug[hidden] { display: none; }
.debug-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 12px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); }
#debug-list { list-style: none; margin: 0; padding: 0; overflow: auto; font: 12px/1.5 ui-monospace, monospace; }
#debug-list li { padding: 4px 12px; border-bottom: 1px solid #2a2b2e; white-space: pre-wrap; word-break: break-word; }
#debug-list li.error { color: #ff8a80; background: rgba(239, 83, 80, .08); }
#debug-list li.warn { color: #ffd180; background: rgba(255, 152, 0, .06); }
#debug-list .where { color: var(--muted); font-size: 11px; }
#debug-list .where a { color: var(--accent); }
#debug-list summary { cursor: pointer; color: var(--muted); font-size: 11px; }
#debug-list pre { margin: 2px 0 0; white-space: pre-wrap; color: var(--muted); }
#debug-empty { margin: 8px 12px; font-size: 12px; }
#debug-empty[hidden] { display: none; }

/* Full window (frameless desktop): the toolbar floats over the app, hidden until the pointer reaches the top edge. */
#preview .hot { display: none; }
#preview.overlay .hot { display: block; position: absolute; top: 0; left: 0; right: 0; height: 8px; z-index: 2; }
#preview.overlay .bar {
    position: absolute; top: 0; left: 0; right: 0; z-index: 3;
    background: rgba(43, 45, 49, .85); backdrop-filter: blur(8px); border-bottom-color: transparent;
    transform: translateY(-100%); transition: transform .2s;
}
#preview.overlay.show .bar { transform: none; }
#run { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
#preview-error { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; text-align: center; background: var(--bg); }
#preview-error[hidden] { display: none; }

/* the bar's buttons at the VLE's toolbar height */
.bar button.grey, #share-open { height: 28px; padding: 0 12px; }
#share, #download, #phone-warn { width: min(520px, calc(100% - 32px)); background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 16px 20px; }
#share::backdrop, #download::backdrop, #phone-warn::backdrop { background: rgba(0, 0, 0, .6); }
#share h2, #download h2, #phone-warn h2 { font-size: 17px; margin: 0 0 12px; }
#share p, #download p, #phone-warn p { margin: 0 0 12px; }
#share .warn-text { color: #ffcc80; }
#share-key-list { margin: 0 0 12px; padding-left: 20px; font: 12px/1.6 ui-monospace, monospace; color: #ffcc80; }
.link-row { display: flex; gap: 8px; margin-bottom: 8px; }
.link-row input { flex: 1; font: 13px ui-monospace, monospace; }
#share .actions, #download .actions, #phone-warn .actions { display: flex; align-items: center; gap: 8px; }
#share .spacer, #download .spacer, #phone-warn .spacer { flex: 1; }
#phone-note { border-color: #b26a00; }
#phone-note p { margin: 0; }
.choices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border); color: var(--text); }
.choice:hover:not(:disabled) { border-color: var(--accent); }
.choice:disabled { opacity: .5; cursor: default; }
.choice span { font-size: 13px; color: var(--muted); }
.badge { font-size: 11px; padding: 1px 6px; border-radius: 10px; background: var(--accent-bg); color: #fff; }
#share-full { word-break: break-all; }

/* scrollbars as the VLE's: soft pills lit from the top left, widening under the mouse and emerald while dragged */
::-webkit-scrollbar { width: 9px; height: 9px; }   /* as the VLE's (look.css): the panel's grey, lit and shaded, 12px clear of each end */
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-track { margin: 12px; }   /* each bar keeps just the ends along its own axis */
::-webkit-scrollbar-thumb { background-color: #2d3238; background-clip: padding-box; border: 2px solid transparent; border-radius: 4px; min-height: 32px; min-width: 32px;
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .1), inset -1px -1px 0 rgba(0, 0, 0, .45), 0 0 0 .5px rgba(0, 0, 0, .3); }
::-webkit-scrollbar-thumb:hover { background-color: #353b41; border-width: 1px; }
::-webkit-scrollbar-thumb:active { background-color: rgba(34, 201, 146, .7); border-width: 1px; }
