/* CHIKARA shared shell (from Scripture 0.1.1 app.css, Style 1 Gold on the Theme Kit): fonts, kit bridge, base, buttons, Island, header, menu, cards, Halo, modal, tour, update bar. Copied byte-identical into every utility by tools/build.mjs. ASCII only. */
@font-face { font-family: 'Cormorant Garamond'; src: url('fonts/cormorant-garamond-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Cormorant Garamond'; src: url('fonts/cormorant-garamond-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Plus Jakarta Sans'; src: url('fonts/plus-jakarta-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Plus Jakarta Sans'; src: url('fonts/plus-jakarta-sans-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }

:root {
  --f-display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --f-body: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --splash-bg: #09443B;
  --r: 14px;
}
/* Bridge from the CHIKARA Theme Kit (chikara-theme.css, canonical) to this app's names. The kit sets --text --muted --surface --surface-2
   --surface-3 --line --hair --gold --gold-band --teal --state-text and the plaster background; nothing below redefines a kit colour. */
:root { --primary: #C9973A; --on-primary: #1A140C; }
html[data-theme] { --ink: var(--text); --alt: var(--surface-3); --bg: var(--surface); --primary-ink: var(--gold); --teal-ink: var(--state-text); --edge: var(--muted); }
html[data-family="dark"] { color-scheme: dark; --danger-ink: #F29184; --hl1: #5A4A18; --hl2: #1F4E45; --hl3: #6A2E28; --hl4: #2B3C66; --woj: #3DDC97; }
html[data-family="light"] { color-scheme: light; --danger-ink: #8F2E24; --hl1: #F3E0A0; --hl2: #BFE3D6; --hl3: #F6D3CC; --hl4: #D1DCF0; --woj: #08603F; }
html[data-theme="mustard"] { --woj: #053D28; --danger-ink: #5C130C; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); font: 400 15px/1.5 var(--f-body); min-height: 100dvh; }
.mono { font-family: var(--f-mono); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--primary-ink); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
h1, h2 { font-family: var(--f-display); font-weight: 600; margin: 0; }

/* Buttons: one style family */
.btn { min-height: 44px; min-width: 44px; padding: 8px 14px; border: 1px solid var(--edge); border-radius: 12px; background: var(--surface); color: var(--ink); font-weight: 600; }
.btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; }
.btn.icon { padding: 8px; }
.btn.primary { background: var(--gold-band); background-size: 100% 150%; background-position: top; border-color: var(--primary); color: var(--on-primary); }
.btn[aria-pressed="true"] { background: var(--alt); border-color: var(--primary-ink); color: var(--primary-ink); }

/* Island reference layout (Standards C.2) */
:root { --safe-top: env(safe-area-inset-top, 0px); --island-h: 40px; --island-gap: 8px; --island-top: max(10px, var(--safe-top)); --island-strip: calc(var(--island-top) + var(--island-h) + var(--island-gap)); --island-bg: #1A1208; --island-ink: #FBF5EA; --island-ok: #4ADE80; --island-warn: #FBBF24; --island-off: #F87171; }
html.has-island body { padding-top: var(--island-strip); }
html.has-island::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: var(--island-strip); background: var(--plaster-base); z-index: 199; pointer-events: none; }
.topbar { position: sticky; top: 0; padding-top: var(--safe-top); z-index: 80; background: var(--ck-bar); }
html.has-island .topbar { top: var(--island-strip); padding-top: 0; }
.island { box-sizing: border-box; position: fixed; top: var(--island-top); left: 50%; transform: translateX(-50%); z-index: 200; width: max-content; max-width: min(440px, calc(100vw - 2rem)); min-height: var(--island-h); background: var(--island-bg); color: var(--island-ink); border: 0; border-radius: 999px; box-shadow: 0 8px 32px rgba(0,0,0,.28), inset 0 0 0 1px rgba(255,255,255,.14), inset 0 1px 0 rgba(255,255,255,.08); transition: border-radius .35s cubic-bezier(.175,.885,.32,1.275), padding .35s ease; }
.island[hidden] { display: none; }
.island.expanded { border-radius: 22px; }
.island-toggle { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; min-height: var(--island-h); padding: 8px 18px; background: none; border: 0; color: inherit; font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1.3; text-align: left; cursor: pointer; }
.island-toggle::after { content: ''; position: absolute; inset: -2px 0; }
.island-toggle[aria-disabled="true"] { cursor: default; }
.island-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 999px; }
.island-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.island.expanded .island-text { white-space: normal; }
.island-dot { width: 9px; height: 9px; flex: none; border-radius: 50%; animation: island-pulse 2s ease-in-out infinite; }
.island-dot[data-state="ok"] { background: var(--island-ok); box-shadow: 0 0 0 3px rgba(74,222,128,.25); }
.island-dot[data-state="warn"] { background: var(--island-warn); box-shadow: 0 0 0 3px rgba(251,191,36,.25); }
.island-dot[data-state="off"] { background: var(--island-off); box-shadow: 0 0 0 3px rgba(248,113,113,.25); animation: none; }
.island-detail { padding: 0 18px 12px 37px; font-size: 12px; font-weight: 500; color: #C3BCB2; }
@keyframes island-pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.15); opacity: .85; } }
html.has-island .modal { max-height: calc(100dvh - var(--island-strip) - 16px); }

/* Header */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-left: 14px; padding-right: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 8px 4px 0; background: none; border: 0; text-align: left; }
.crest { width: 40px; height: 40px; border-radius: 50%; display: block; }
.wordmark { font-family: var(--f-display); font-weight: 600; font-size: 1.35rem; letter-spacing: .01em; }
.badges { display: flex; gap: 6px; }
.badge { padding: 5px 10px; border-radius: 999px; background: var(--alt); color: var(--ink); font-size: .75rem; font-weight: 700; }
.badge.mono { color: var(--teal-ink); }

/* Menu */
.menu { position: fixed; z-index: 150; left: 10px; top: calc(var(--safe-top) + 64px); width: min(360px, calc(100vw - 20px)); max-height: calc(100dvh - 90px); overflow: auto; background: var(--surface); border: 1px solid var(--edge); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; }
html.has-island .menu { top: calc(var(--island-strip) + 64px); }
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px; flex-wrap: wrap; }
.menu-label { color: var(--muted); font-size: .85rem; font-weight: 600; }
.menu-item { width: 100%; min-height: 44px; text-align: left; background: none; border: 0; padding: 8px 8px; border-radius: 10px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.menu-item:hover { background: var(--alt); }
.menu-jumps, .stepper { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
kbd { font-family: var(--f-mono); font-size: .75rem; color: var(--muted); border: 1px solid var(--edge); border-radius: 6px; padding: 1px 6px; }

/* Layout */
.app { max-width: 760px; margin: 0 auto; padding: 14px 14px calc(var(--halo-size) + 60px + env(safe-area-inset-bottom, 0px)); }
.card, .panel { background: var(--surface-2); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); min-width: 0; position: relative; overflow: hidden; }
.accent-bar { position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--primary), var(--teal)); }
.refbtn { max-width: 55vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--f-display); font-size: 1.15rem; }
.row { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.field { min-height: 44px; min-width: 0; width: 100%; border: 1px solid var(--edge); border-radius: 10px; padding: 8px 10px; background: var(--surface); color: var(--ink); }
textarea.field { min-height: 110px; resize: vertical; }
.lbl, .small { font-size: .8rem; color: var(--muted); }
.empty { color: var(--muted); font-size: .9rem; margin: 0; }
.footer { color: var(--muted); font-size: .8rem; text-align: center; margin: 18px 0 0; }
.notice { border: 1px solid var(--line); border-left: 4px solid var(--primary); border-radius: 10px; padding: 10px 12px; font-size: .88rem; background: var(--surface); margin: 10px 0; }
/* Halo (Standards 5): four layers, upward petals, size tokens */
.halo { position: fixed; left: 50%; right: auto; top: auto; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: var(--halo-size); height: var(--halo-size); z-index: 120; border-radius: 50%; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; animation: breathe 3.6s ease-in-out infinite; }
.halo.dragging { cursor: grabbing; animation: none; }
.halo.open { animation: none; }
.halo-ring { position: absolute; inset: -2px; border-radius: 50%; background: conic-gradient(from 0deg, var(--primary), var(--teal), var(--primary), #E8C76F, var(--teal), var(--primary)); animation: spin 3.4s linear infinite; }
.halo.open .halo-ring { animation-duration: .7s; }
.halo-core { position: absolute; inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); border-radius: 50%; object-fit: cover; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%,100% { filter: drop-shadow(0 4px 6px rgba(0,0,0,.28)) drop-shadow(0 0 4px rgba(201,151,58,.35)); } 50% { filter: drop-shadow(0 4px 6px rgba(0,0,0,.28)) drop-shadow(0 0 12px rgba(201,151,58,.7)); } }
.halo-backdrop { position: fixed; inset: 0; z-index: 110; background: rgba(15,16,16,.35); }
.halo-petals { position: fixed; inset: 0; z-index: 130; pointer-events: none; }
.petal { position: absolute; width: var(--petal-size); height: var(--petal-size); margin: calc(var(--petal-size) / -2) 0 0 calc(var(--petal-size) / -2); border-radius: 50%; border: 1px solid var(--edge); background: var(--surface); color: var(--primary-ink); display: grid; place-items: center; padding: 0; pointer-events: none; opacity: 0; transform: translate(var(--from-x, 0), var(--from-y, 0)) scale(.5); transition: transform .38s cubic-bezier(0.34, 1.56, 0.64, 1), opacity .25s ease; }
.petal.out { opacity: 1; transform: translate(0, 0) scale(1); }
.petal.live { pointer-events: auto; }
.petal svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.petal[aria-current="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.petal-label { position: absolute; top: 100%; margin-top: 3px; left: 50%; transform: translateX(-50%); font-size: .7rem; font-weight: 700; background: #1A1208; color: #FBF5EA; padding: 2px 7px; border-radius: 8px; white-space: nowrap; }
.petal.col .petal-label { top: 50%; left: 100%; margin: 0 0 0 6px; transform: translateY(-50%); }

/* Modals, tour, update bar */
.modal-wrap { position: fixed; inset: 0; z-index: 300; background: rgba(15,16,16,.55); display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--surface); border-radius: 20px 20px 0 0; border: 1px solid var(--edge); padding: 18px; width: min(100%, 680px); max-height: 85dvh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.modal-head h2 { font-size: 1.6rem; }
.modal-body p { margin: 6px 0; }
.modal-body ul { padding-left: 20px; }
.modal-body li { margin: 4px 0; }
.about-lines p { margin: 2px 0; }
.palette-list { display: grid; gap: 4px; margin-top: 8px; max-height: 50dvh; overflow: auto; }
.palette-list button { text-align: left; min-height: 44px; padding: 8px 10px; background: none; border: 1px solid transparent; border-radius: 10px; }
.palette-list button:hover, .palette-list button:focus-visible { background: var(--alt); }
.tour { position: fixed; inset: 0; z-index: 400; background: rgba(15,16,16,.6); display: flex; align-items: center; justify-content: center; padding: 16px; pointer-events: auto; }
.tour-card { background: var(--surface); border: 1px solid var(--edge); border-radius: 18px; padding: 18px; max-width: 420px; width: 100%; }
.tour-card h2 { font-size: 1.6rem; margin: 4px 0; }
.tour-step { color: var(--muted); font-size: .75rem; margin: 0; }
.tour-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.tour-target { outline: 4px solid var(--primary); outline-offset: 4px; border-radius: 14px; position: relative; z-index: 401; }
.update-bar { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 350; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--edge); border-radius: 14px; padding: 8px 12px; box-shadow: var(--shadow); }
.update-bar span { flex: 1; font-weight: 600; }

@media (max-width: 760px) { .wordmark { font-size: 1.15rem; } }
.picker { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.picker .btn { padding: 6px 10px; }
