/* Browser playground (playground.html), on top of styles.css: same tokens, header, footer, buttons and window
   cards as the homepage, in both themes. Only the playground's own controls are styled here. */
:root { color-scheme: dark; --field: #262a31; --field-line: var(--line); --placeholder: #8a929e; }
:root[data-theme="light"] { --field: #ffffff; --field-line: #cfd5dd; --placeholder: #8a919c; }

/* ---------- Hero ---------- */
.pg-hero { padding: 56px 0 40px; }
.pg-hero .lead { max-width: 40em; }

/* ---------- Layout: sticky section list beside the content ---------- */
.pg-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; align-items: start; padding: 24px 0 96px; }
.pg-content { min-width: 0; }

/* The section list is a small window like the homepage's cards, with the tour's tab list inside it. */
.pg-side {
    position: sticky; top: 100px; display: flex; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius);
    box-shadow: 6px 6px 0 -1px var(--edge);
}
.pg-side-links { display: grid; gap: 3px; padding: 10px 8px; }
.pg-side-links a {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px;
    font: 500 14px/1.25 var(--sans); color: var(--muted); text-decoration: none;
    border: 1px solid transparent; border-radius: 10px;
    transition: background .2s, color .2s, border-color .2s, box-shadow .2s;
}
.pg-side-links a i { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--k); }
.pg-side-links a:hover { background: rgba(255, 255, 255, .05); color: var(--ink); }
.pg-side-links a[aria-current="true"] { background: var(--surface-2); color: var(--ink); border-color: var(--edge); box-shadow: 3px 3px 0 -1px var(--edge); }
.pg-side-note { margin: 0 18px; padding: 14px 0 18px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted); }

/* ---------- Sections ---------- */
.lab-section { margin-bottom: 72px; scroll-margin-top: 96px; }
.lab-section:last-child { margin-bottom: 0; }
.lab-head { max-width: 680px; margin-bottom: 24px; }
.lab-head h2 { font-size: clamp(26px, 3vw, 36px); font-weight: 650; }
.lab-head p { margin-top: 10px; color: var(--muted); font-size: 16px; }

/* Cards are windows, as on the homepage: the card is the frame, .tile-tab its title bar. They don't lift on hover,
   so the fields never move while you type. */
.lab-card {
    position: relative; min-width: 0; display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius);
    box-shadow: 8px 8px 0 -1px var(--edge), var(--shadow);
}
.lab-card .tile-tab i { background: var(--k, var(--green)); }
.lab-face { flex: 1; min-width: 0; padding: 22px; }
.lab-face h3 { font-size: 18px; font-weight: 650; }
.card-note { margin: 6px 0 18px; font-size: 14.5px; color: var(--muted); }

/* ---------- Fields ---------- */
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 22px; }
.field { display: flex; flex-direction: column; min-width: 0; gap: 7px; font-size: 14px; font-weight: 600; color: var(--ink); }
.field-wide { grid-column: 1 / -1; }
.field > span { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.field code, .choice-group code { font: 400 11.5px/1.4 var(--mono); color: var(--muted); background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }
.field input:not([type="range"]):not([type="color"]):not([type="file"]), .field select, .field textarea, .editable-box {
    width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px;
    font: 400 14.5px/1.4 var(--sans); color: var(--ink);
    background: var(--field); border: 1px solid var(--field-line); border-radius: 9px;
    box-shadow: 2px 2px 0 -1px var(--edge) inset;
    outline: none; transition: border-color .2s, box-shadow .2s;
}
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible, .editable-box:focus-visible {
    border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); outline: none; border-radius: 9px;
}
.field input::placeholder, .field textarea::placeholder { color: var(--placeholder); }
.field input:disabled { cursor: not-allowed; opacity: .5; }
.field input:read-only:not(:disabled) { color: var(--muted); background: var(--surface-2); }
.field textarea { min-height: 112px; resize: vertical; }
.field select[multiple] { min-height: 112px; padding: 6px; }
.field select option { padding: 4px 6px; background: var(--surface); color: var(--ink); }
.field small, .subtle-note { font-size: 12.5px; font-weight: 400; color: var(--muted); }
.choice-group { display: grid; align-content: start; gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
.choice-group legend { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; padding: 0; font-size: 14px; font-weight: 600; }
.choice-group label { display: flex; align-items: center; gap: 10px; font-size: 14.5px; color: var(--muted); cursor: pointer; }
.choice-group label:hover { color: var(--ink); }
.choice-group input, .field input[type="range"] { accent-color: var(--green); }
.choice-group input { width: 17px; height: 17px; margin: 0; }
.field input[type="range"] { width: 100%; min-height: 44px; margin: 0; cursor: pointer; }
.field output { margin-left: auto; font: 500 12.5px/1 var(--mono); color: var(--green); background: var(--green-soft); padding: 4px 7px; border-radius: 5px; }
.field input[type="color"] { width: 100%; height: 44px; padding: 4px; background: var(--field); border: 1px solid var(--field-line); border-radius: 9px; cursor: pointer; }
.field input[type="file"] { width: 100%; min-width: 0; padding: 7px; font-size: 13px; font-weight: 400; color: var(--muted); background: var(--field); border: 1px dashed var(--field-line); border-radius: 9px; }
.field input[type="file"]::file-selector-button {
    margin-right: 10px; padding: 7px 11px; font: 600 13px/1 var(--sans); color: var(--blue); cursor: pointer;
    background: var(--surface); border: 1px solid rgba(82, 145, 239, .55); border-radius: 7px; box-shadow: 2px 2px 0 var(--edge);
}

/* ---------- JavaScript controls ---------- */
.interaction-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 28px; }
.action-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
/* A smaller homepage button for the controls inside the cards. */
.button-sm { min-height: 38px; padding: 0 15px; font-size: 14px; box-shadow: 3px 3px 0 var(--green-edge); cursor: pointer; }
.button-sm:hover { box-shadow: 5px 5px 0 var(--green-edge); }
.button-sm:active { box-shadow: 1px 1px 0 var(--green-edge); }
.button-ghost.button-sm { box-shadow: 3px 3px 0 var(--edge); }
.button-ghost.button-sm:hover { box-shadow: 5px 5px 0 var(--edge); }
.button-ghost.button-sm:active { box-shadow: 1px 1px 0 var(--edge); }
button.button { cursor: pointer; }
#toggle-button[aria-pressed="true"] { color: var(--green); border-color: var(--green); background: var(--green-soft); }
.quiet-button {
    min-height: 30px; padding: 4px 10px; font: 500 13px/1 var(--sans); color: var(--muted); cursor: pointer;
    background: transparent; border: 1px solid var(--line); border-radius: 7px; transition: color .2s, border-color .2s, background .2s;
}
.quiet-button:hover { color: var(--ink); border-color: var(--green); background: var(--green-soft); }
.text-link { font-size: 14px; font-weight: 600; color: var(--blue); text-decoration: underline; text-underline-offset: 4px; }
.inline-result, .async-result { margin: 16px 0 0; font: 400 13px/1.6 var(--mono); color: var(--muted); }
.result-list { min-height: 44px; margin: 10px 0 0; padding: 0; list-style: none; }
.result-list li { padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.custom-select { position: relative; }
.menu-options {
    display: grid; width: min(240px, 100%); margin-top: 8px; padding: 5px;
    background: var(--surface-2); border: 1px solid var(--edge); border-radius: 10px; box-shadow: 4px 4px 0 -1px var(--edge);
}
.menu-options[hidden] { display: none; }
.menu-options button { padding: 8px 10px; font: 500 14px/1.2 var(--sans); color: var(--muted); text-align: left; cursor: pointer; background: transparent; border: 0; border-radius: 7px; }
.menu-options button:hover, .menu-options button:focus-visible { color: var(--ink); background: var(--green-soft); outline-offset: -2px; }
.editable-box { min-height: 100px; margin-bottom: 10px; white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; }
.editable-box:empty::before { content: attr(data-placeholder); color: var(--placeholder); }
.async-result { min-height: 44px; padding: 10px 12px; background: var(--field); border: 1px solid var(--field-line); border-radius: 9px; }
.drag-layout { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.drag-token {
    padding: 10px 15px; font: 500 13px/1 var(--mono); color: var(--green); cursor: grab; user-select: none;
    background: var(--green-soft); border: 1px solid rgba(76, 205, 141, .45); border-radius: 8px; box-shadow: 3px 3px 0 -1px var(--green-edge);
}
.drag-token:active { cursor: grabbing; }
.drop-zone { display: grid; place-items: center; flex: 1; min-width: 125px; min-height: 64px; font-size: 14px; color: var(--muted); border: 1.5px dashed var(--line); border-radius: 9px; transition: border-color .2s, background .2s; }
.drop-zone.is-over { border-color: var(--green); background: var(--green-soft); color: var(--ink); }
.subtle-note { margin: 12px 0 0; }
.mini-tabs { display: flex; gap: 4px; margin-top: 20px; border-bottom: 1px solid var(--line); }
.mini-tabs button { padding: 8px 12px; font: 500 14px/1.2 var(--sans); color: var(--muted); cursor: pointer; background: transparent; border: 0; border-bottom: 2px solid transparent; }
.mini-tabs button:hover { color: var(--ink); }
.mini-tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--green); }
.tab-panel { padding: 12px 0 0; font-size: 14px; color: var(--muted); }
.tab-panel[hidden] { display: none; }
.table-wrap { overflow-x: auto; }
.table-wrap table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 14px; }
.table-wrap th, .table-wrap td { padding: 8px 4px; text-align: left; border-bottom: 1px solid var(--line); }
.table-wrap th { font: 500 12px/1.4 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.status-pill { font: 500 12px/1 var(--mono); color: var(--green); background: var(--green-soft); padding: 3px 7px; border-radius: 5px; }
.tooltip-target { display: inline-block; margin-top: 14px; font-size: 14px; color: var(--muted); text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }

/* ---------- Results and activity ---------- */
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-bottom: 26px; }
.form-actions .button { cursor: pointer; }
.form-actions > span { font-size: 13.5px; color: var(--muted); }
.feedback-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.feedback-grid > div { min-width: 0; }
.feedback-title { display: flex; align-items: center; justify-content: space-between; min-height: 34px; margin-bottom: 6px; font: 500 12px/1 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
/* Logs read like the dark Studio screens on the homepage, in both themes. */
#form-output, #event-log {
    min-height: 180px; max-height: 320px; margin: 0; padding: 16px; overflow: auto;
    font: 400 12.5px/1.7 var(--mono); color: #c9d1db; white-space: pre-wrap; overflow-wrap: anywhere;
    background: #1b1f25; border: 1px solid var(--line); border-radius: 10px;
}
#event-log { padding-left: 36px; }
#event-log li { padding-bottom: 4px; }
#event-log li::marker { color: #6f7884; }

/* ---------- Dialog: a window over a dimmed page, like the homepage's screenshot zoom ---------- */
.pg-dialog {
    width: min(440px, calc(100% - 32px)); padding: 0; color: var(--ink);
    background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius);
    box-shadow: 10px 10px 0 -1px var(--edge), 0 40px 80px -20px rgba(0, 0, 0, .6);
}
.pg-dialog[open] { animation: zoom-in .22s var(--ease); }
.pg-dialog::backdrop { background: rgba(14, 16, 20, .7); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.dialog-top { display: flex; align-items: center; justify-content: space-between; height: 38px; padding: 0 6px 0 14px; background: rgba(255, 255, 255, .035); border-bottom: 1px solid var(--edge); }
.dialog-tab { display: flex; align-items: center; gap: 9px; font: 500 12px/1 var(--mono); color: var(--muted); }
.dialog-tab i { width: 9px; height: 9px; border-radius: 2px; background: var(--blue); }
.dialog-x { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; font: 400 22px/1 var(--sans); color: var(--muted); cursor: pointer; background: transparent; border: 0; border-radius: 8px; }
.dialog-x:hover { color: var(--ink); background: var(--surface-2); }
.dialog-face { display: grid; gap: 14px; padding: 22px; }
.dialog-face h3 { font-size: 24px; font-weight: 650; }
.dialog-face p { color: var(--muted); font-size: 15px; }
.dialog-face .button { justify-self: start; margin-top: 6px; }

/* ---------- Light mode touch-ups ---------- */
:root[data-theme="light"] .pg-side-links a:hover { background: rgba(31, 35, 40, .06); }
:root[data-theme="light"] .dialog-top { background: #f3f5f7; }
:root[data-theme="light"] .drag-token { border-color: rgba(31, 138, 86, .4); }
:root[data-theme="light"] .pg-dialog { box-shadow: 10px 10px 0 -1px var(--edge), 0 40px 80px -20px rgba(40, 48, 60, .3); }
:root[data-theme="light"] .pg-dialog::backdrop { background: rgba(40, 48, 60, .45); }
:root[data-theme="light"] .field input[type="file"]::file-selector-button { border-color: rgba(47, 111, 214, .5); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
    .pg-layout { grid-template-columns: 210px minmax(0, 1fr); gap: 28px; }
}
/* Narrower: the section list becomes a row of tabs above the content, like the tour's tabs on phones. */
@media (max-width: 900px) {
    .pg-layout { grid-template-columns: minmax(0, 1fr); gap: 32px; padding-top: 8px; }
    .pg-side { position: static; }
    .pg-side > .tile-tab, .pg-side-note { display: none; }
    .pg-side-links { display: flex; overflow-x: auto; scrollbar-width: none; padding: 8px; }
    .pg-side-links::-webkit-scrollbar { display: none; }
    .pg-side-links a { flex: none; white-space: nowrap; }
}
@media (max-width: 700px) {
    .pg-hero { padding: 32px 0 24px; }
    .field-grid, .feedback-grid, .interaction-grid { grid-template-columns: minmax(0, 1fr); }
    .field-wide { grid-column: auto; }
    .lab-section { margin-bottom: 56px; }
    .lab-face { padding: 18px; }
    .lab-card { box-shadow: 5px 5px 0 -1px var(--edge), var(--shadow); }
    .interaction-grid { gap: 28px; }
}
/* Narrowest phones: as on the homepage, the logo needs the room more than the Features link. */
@media (max-width: 420px) {
    .nav-features { display: none; }
}
