/* LYNE P0 — visual language of design/vision-2050: paper, ink, one ring per Thing, phase colours.
   Every state is shown by shape, word and colour together, never by colour alone. */
:root {
  --paper: #f3f0e8; --surface: #fbfaf6; --rule: #dcd7ca;
  --ink: #17171b; --ink-2: #4a4951; --ink-3: #6f6d67;
  --open: #2f54eb; --open-t: #2340c4;
  --ready: #d18a00; --ready-t: #845500;
  --lyne: #0b9467; --lyne-t: #066b4a;
  --result: #6b3fdd; --result-t: #5230b8;
  --closed: #2b2b30; --closed-t: #2b2b30;
  --warn: #b3261e;
  --accent: var(--open); --accent-t: var(--open-t);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f0f12; --surface: #17171c; --rule: #2d2c34;
    --ink: #f1eee6; --ink-2: #bcb9b1; --ink-3: #9a978f;
    --open: #7d98ff; --open-t: #a3b6ff; --ready: #f0b23a; --ready-t: #f5c872;
    --lyne: #34c793; --lyne-t: #6fdcb4; --result: #a98bff; --result-t: #c3adff;
    --closed: #d9d6ce; --closed-t: #e8e5dd; --warn: #ff8a80;
  }
}
body[data-phase="open"], body[data-phase="waiting"] { --accent: var(--open); --accent-t: var(--open-t); }
body[data-phase="ready"], body[data-phase="connecting"] { --accent: var(--ready); --accent-t: var(--ready-t); }
body[data-phase="lyne"] { --accent: var(--lyne); --accent-t: var(--lyne-t); }
body[data-phase="result"] { --accent: var(--result); --accent-t: var(--result-t); }
body[data-phase="closed"] { --accent: var(--closed); --accent-t: var(--closed-t); }
body[data-phase="error"] { --accent: var(--warn); --accent-t: var(--warn); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.label { margin: 0 0 8px; font: 600 10.5px/1.2 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }

.top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 0 10px; }
.mark { font-weight: 800; font-size: 15px; letter-spacing: .34em; }
.tag { margin: 0; font-size: 11.5px; color: var(--ink-3); text-align: right; overflow-wrap: anywhere; }

/* ring ------------------------------------------------------------------ */
.object { margin: 4px auto 0; width: min(210px, 56vw); }
.object svg { display: block; width: 100%; height: auto; overflow: visible; }
.ring { fill: none; stroke: var(--ink-3); stroke-width: 1.5; }
body[data-phase="closed"] .ring { stroke: var(--closed); stroke-width: 10; }
.aperture { fill: none; stroke: var(--ready); stroke-width: 9; stroke-linecap: round; opacity: 0; }
body[data-phase="ready"] .aperture, body[data-phase="connecting"] .aperture, body[data-phase="lyne"] .aperture { opacity: 1; }
.core { fill: var(--accent); }
body[data-phase="lyne"] .core, body[data-phase="result"] .core, body[data-phase="closed"] .core { opacity: 0; }
.pole { fill: var(--paper); stroke: var(--ink-2); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; }
.pole.on { fill: var(--accent); stroke: var(--accent); }
body[data-phase="lyne"] .pole.on { animation: breathe 2.8s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.35); } }
.live { stroke: var(--lyne); stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 2 9; opacity: 0; }
body[data-phase="lyne"] .live { opacity: 1; animation: flow 1.1s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -22; } }
.seal { opacity: 0; }
body[data-phase="result"] .seal, body[data-phase="closed"] .seal { opacity: 1; }
.seal .half { fill: none; stroke: var(--result); stroke-width: 4; stroke-linecap: round; }
.seal .half.by-client { stroke-dasharray: 3 6; }
body[data-phase="closed"] .seal .half { stroke: var(--closed); stroke-dasharray: none; }
.seal .disk { fill: transparent; }
body[data-phase="closed"] .seal .disk { fill: var(--closed); }
.seal .tick { fill: none; stroke: var(--paper); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
body[data-phase="closed"] .seal .tick { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .pole.on, .live { animation: none !important; } }

.state { text-align: center; margin-top: 4px; }
.state-word { margin: 0; font-size: clamp(32px, 10vw, 44px); line-height: 1; font-weight: 800; letter-spacing: .03em; color: var(--accent-t); }
.who { margin: 8px 0 0; font-size: 15px; color: var(--ink-2); }
.facts { margin: 14px 0 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; font-size: 13px; color: var(--ink-2); }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.primary { margin-top: 16px; width: 100%; min-height: 52px; border: 0; border-radius: 16px; cursor: pointer; background: var(--ink); color: var(--paper); font-size: 17px; font-weight: 650; display: flex; align-items: center; justify-content: center; gap: 10px; }
.primary::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.primary[disabled] { cursor: default; background: transparent; color: var(--ink-3); border: 1px dashed var(--rule); }
.primary[disabled]::before { display: none; }
.quiet { padding: 8px 14px; border: 1px solid var(--rule); border-radius: 12px; background: transparent; cursor: pointer; }
.quiet[disabled] { cursor: default; color: var(--ink-3); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row > input[type="text"] { flex: 1 1 160px; min-width: 0; }
input[type="text"], input[type="number"], select { padding: 9px 11px; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); max-width: 100%; }

.panel { margin-top: 16px; padding: 14px; border: 1px solid var(--rule); border-radius: 16px; background: var(--surface); }
.panel.live-panel { border-left: 4px solid var(--lyne); }
.panel.result-panel { border-left: 4px solid var(--result); }
body[data-phase="closed"] .panel.result-panel { border-left-color: var(--closed); }
.onl { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.onl li { padding: 8px 10px; border-radius: 10px; background: var(--paper); overflow-wrap: anywhere; }
.onl li small { display: block; color: var(--ink-3); font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.summary { margin: 6px 0 8px; font-size: 16px; }
.sigs { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--lyne); color: var(--lyne-t); font: 700 11px var(--mono); letter-spacing: .12em; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--lyne); }
.remote-video { display: block; width: 100%; max-height: 240px; margin: 0 0 10px; border-radius: 12px; background: #000; object-fit: contain; }
.device-choice { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 0; font-size: 13px; color: var(--ink-2); }
.qr-box { margin-top: 10px; display: grid; justify-items: start; gap: 6px; }
.qr-box canvas { width: 204px; height: 204px; image-rendering: pixelated; border-radius: 8px; }
.d3-banner { margin: 0 0 10px; padding: 8px 12px; border: 1px dashed var(--ready); border-radius: 10px; font: 700 12px/1.3 var(--mono); letter-spacing: .08em; color: var(--ready-t); }
.verdict { margin: 10px 0 4px; font: 700 14px var(--mono); letter-spacing: .06em; }
.verdict.bad { color: var(--warn); }
.reasons { margin: 4px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--ink-2); }
.steps { margin: 10px 0 0; padding-left: 20px; font-size: 14px; color: var(--ink-2); }
.steps li.done { color: var(--lyne-t); }
.table-wrap { overflow-x: auto; }
.d3-table { width: 100%; border-collapse: collapse; font: 12px/1.3 var(--mono); }
.d3-table th, .d3-table td { padding: 5px 6px; border-bottom: 1px solid var(--rule); text-align: left; white-space: nowrap; }
.d3-table tr.pass td { color: var(--lyne-t); }
.d3-table tr.fail td { color: var(--warn); }
.notice { margin: 14px 0 0; font-size: 14px; color: var(--ink-2); text-align: center; min-height: 1.4em; }
.notice.bad { color: var(--warn); font-weight: 650; }
.link { font: 12.5px/1.4 var(--mono); padding: 10px; border: 1px dashed var(--rule); border-radius: 10px; background: var(--paper); overflow-wrap: anywhere; user-select: all; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--rule); font: 600 11px var(--mono); letter-spacing: .08em; }

details.proof { margin: 18px 0 24px; font-size: 12.5px; color: var(--ink-2); }
details.proof summary { cursor: pointer; font: 600 11px var(--mono); letter-spacing: .14em; color: var(--ink-3); }
details.proof pre { margin: 8px 0 0; padding: 10px; max-height: 360px; overflow: auto; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); font: 11.5px/1.45 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }

/* client surface --------------------------------------------------------- */
.client-surface { width: 100%; max-width: 440px; margin: 0 auto; padding: 0 16px; }
.thing-head { display: grid; gap: 2px; }
.provider-line { margin: 0; font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.thing-title { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 750; overflow-wrap: anywhere; }

/* provider surface ------------------------------------------------------- */
.provider-surface { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
@media (min-width: 900px) { .cols { grid-template-columns: 300px minmax(0, 1fr); align-items: start; } }
.things { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.things button { width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); cursor: pointer; }
.things button[aria-current="true"] { border-color: var(--ink); }
.things small { display: block; color: var(--ink-3); font: 600 11px var(--mono); letter-spacing: .08em; }
.form { display: grid; gap: 8px; }
.form label { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); }
.form input[aria-invalid="true"] { border-color: var(--warn); outline: 2px solid var(--warn); outline-offset: 1px; }
.field-hint { margin-top: -4px; font-size: 12px; color: var(--ink-3); }
.field-hint code { font: 12px var(--mono); }
.form-error { margin: 2px 0 0; font-size: 13px; font-weight: 650; color: var(--warn); overflow-wrap: anywhere; }
.detail-head { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px; align-items: center; }
.detail-head .object { width: 120px; margin: 0; }
.detail-head .state { text-align: left; }

/* Product UI: technical detail is shown only in developer debug mode (?debug=1 on the page URL). */
.debug-only { display: none !important; }
body[data-debug="1"] .debug-only { display: revert !important; }
body[data-debug="1"] .debug-only[hidden] { display: none !important; }

/* AC8: a provider's brand colour, when set, marks the top of the customer page. */
body[data-brand-color] .top { border-top: 4px solid var(--brand, transparent); }
