/* Layout of the live-apps try pages: a header, a Graphite-style segmented switcher, one canvas that fills the rest
   (safe areas and the virtual keyboard respected), a footer. Colours and fonts come from the page's own theme
   file (--bg, --bg-2, --line, --ink, --ink-2, --accent, --cta, --seg, --seg-on, --stage, --font, --brand-*). */
* { box-sizing:border-box; }
html, body { margin:0; }
body { background:var(--bg); color:var(--ink); font:14px/1.5 var(--font); -webkit-font-smoothing:antialiased;
	display:flex; flex-direction:column; height:100vh; height:100dvh; max-height:var(--vvh, 100dvh); overflow:hidden; overscroll-behavior:none;
	padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
a { color:inherit; }
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
header { display:flex; align-items:center; gap:14px; padding:10px clamp(12px, 2.4vw, 28px); border-bottom:1px solid var(--line-soft); flex:none; flex-wrap:wrap; }
.brand { display:inline-flex; align-items:center; gap:10px; font:var(--brand-weight) var(--brand-size)/1 var(--brand-font); text-decoration:none; letter-spacing:.01em; }
.brand img { width:24px; height:24px; }
.kicker { font-size:12px; letter-spacing:.12em; text-transform:uppercase; color:var(--ink-2); }
.grow { flex:1; }
#status { color:var(--ink-2); font-size:13px; }
#status::before { content:""; display:inline-block; width:7px; height:7px; border-radius:50%; margin-right:8px; vertical-align:1px; background:var(--accent); }
body[data-state="ready"] #status::before { background:var(--green); }
body[data-state="error"] #status, body[data-state="error"] #status::before { color:var(--red); background:var(--red); }
.btn { display:inline-flex; align-items:center; gap:8px; min-height:40px; padding:0 16px; border-radius:8px; background:var(--cta); color:var(--on-cta); font:600 14px var(--font); text-decoration:none; white-space:nowrap; }
.btn svg { width:16px; height:16px; }
#tabs { display:flex; gap:4px; margin:10px clamp(12px, 2.4vw, 28px) 0; padding:4px; width:max-content; max-width:calc(100% - 2 * clamp(12px, 2.4vw, 28px)); overflow-x:auto; background:var(--seg); border:1px solid var(--line-soft); border-radius:10px; flex:none; scrollbar-width:none; }
#tabs button { min-height:40px; padding:0 18px; border:0; border-radius:7px; background:transparent; color:var(--ink-2); font:500 14px var(--font); cursor:pointer; white-space:nowrap; touch-action:manipulation; }
#tabs button:hover { color:var(--ink); }
#tabs button[aria-selected="true"] { background:var(--seg-on); color:var(--ink); box-shadow:inset 0 0 0 1px var(--line); }
#appmenu { display:none; align-items:center; gap:8px; min-height:44px; margin:10px clamp(12px, 2.4vw, 28px) 0; padding:0 14px; background:var(--seg); color:var(--ink); border:1px solid var(--line-soft); border-radius:10px; font:600 15px var(--font); cursor:pointer; width:max-content; }
#appmenu::after { content:""; width:7px; height:7px; border:solid currentColor; border-width:0 2px 2px 0; transform:rotate(45deg) translateY(-2px); }
#appsheet { position:absolute; z-index:5; left:clamp(12px, 2.4vw, 28px); right:clamp(12px, 2.4vw, 28px); margin-top:4px; padding:6px; background:var(--bg-2); border:1px solid var(--line); border-radius:12px; display:flex; flex-direction:column; box-shadow:0 18px 40px rgba(0,0,0,.5); }
#appsheet[hidden] { display:none; }
#appsheet button { min-height:48px; padding:0 14px; border:0; border-radius:8px; background:transparent; color:var(--ink-2); font:500 15px var(--font); text-align:left; cursor:pointer; }
#appsheet button[aria-selected="true"] { background:var(--seg-on); color:var(--ink); }
#appsheet button[aria-selected="true"]::after { content:" \2713"; }
#lede { margin:8px clamp(12px, 2.4vw, 28px) 0; color:var(--ink-2); font-size:13px; max-width:90ch; flex:none; }
main { flex:1; min-height:0; padding:10px clamp(12px, 2.4vw, 28px); display:flex; }
#stage { position:relative; flex:1; min-width:0; min-height:0; border:1px solid var(--line); border-radius:10px; overflow:hidden; background:var(--stage); }
#canvas { position:absolute; inset:0; display:block; touch-action:none; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; outline-offset:-3px; }
/* The hidden input that receives keys, IME text and the virtual keyboard: at the caret, not display:none (iOS will not focus that), 16px so iOS does not zoom. */
#ime { position:absolute; left:0; top:0; width:2px; height:20px; padding:0; border:0; margin:0; opacity:0; background:transparent; color:transparent; caret-color:transparent; font-size:16px; resize:none; overflow:hidden; pointer-events:none; }
#error[hidden] { display:none; }
#error { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; padding:24px; text-align:center; color:var(--red); }
footer { flex:none; display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; padding:6px clamp(12px, 2.4vw, 28px) 10px; color:var(--ink-2); font-size:12px; }
footer a { text-underline-offset:3px; }
footer button { font:inherit; color:var(--ink); background:transparent; border:1px solid var(--line); border-radius:6px; padding:2px 10px; cursor:pointer; }
@media (max-width:640px) { #tabs { display:none; } #appmenu { display:inline-flex; } #lede { display:none; } .kicker { display:none; } header { gap:10px; } #status { display:none; } footer .long { display:none; } }
@media (pointer:coarse) { #tabs button { min-height:44px; } }
/* When the app draws the Graphite tabs bar in the canvas, the DOM tabs stay only as a mirror for screen readers. */
body[data-bar="canvas"] #tabs, body[data-bar="canvas"] #appmenu, body[data-bar="canvas"] #appsheet { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); margin:0; padding:0; border:0; white-space:nowrap; }
