/* Sky Alert: plain, high-contrast styling that follows the approved wireframes. */
:root {
  --ink: #1B1F24; --muted: #566070; --line: #B8BEC8; --fill: #ECEEF1; --paper: #ffffff;
  --flight: #0B5FA5; --tag-bg: #FFE8D2; --tag-ink: #8A3500; --danger: #A12A1F;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 15px; -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.boot { padding: 24px; color: var(--muted); }
.mono { font-family: var(--mono); font-weight: 500; }

#app { height: 100%; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; position: relative; }
.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; padding-top: env(safe-area-inset-top); }
.topbar { display: flex; align-items: center; gap: 4px; min-height: 64px; padding: 10px 16px; border-bottom: 1.5px solid var(--ink); flex: none; }
.topbar.has-back { padding-left: 4px; }
.topbar h1 { margin: 0; font-size: 22px; font-weight: 600; flex: 1; }
.back { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; padding: 0; }
.content { flex: 1; overflow-y: auto; padding: 12px 16px 24px; display: flex; flex-direction: column; gap: 8px; -webkit-overflow-scrolling: touch; }
.content.roomy { gap: 14px; padding-top: 16px; }

/* chips, tags */
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border: 1.5px solid var(--ink); border-radius: 22px; font-size: 12px; font-weight: 600; text-decoration: none; background: var(--paper); }
.chip.small { min-height: 32px; }
.badge { font-size: 10px; font-weight: 600; letter-spacing: .06em; padding: 1px 5px; border-radius: 4px; border: 1.5px solid var(--muted); color: var(--muted); }
.badge.flight { color: var(--flight); border-color: var(--flight); }
.badge.new, .badge.test { color: var(--tag-ink); background: var(--tag-bg); border-color: transparent; padding: 2px 6px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter { min-height: 44px; padding: 0 16px; border: 1.5px solid var(--ink); border-radius: 22px; background: var(--paper); font-weight: 600; }
.filter[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* banners */
.banner { border: 1.5px dashed var(--muted); border-radius: 8px; padding: 8px 12px; font-size: 13px; color: var(--muted); }
.banner.solid { border-style: solid; border-color: var(--ink); background: var(--fill); color: var(--ink); }
.banner button { margin-left: 8px; min-height: 36px; padding: 0 12px; border: 1.5px solid var(--ink); border-radius: 8px; background: var(--paper); font-weight: 600; }

/* hunt rows and generic cards */
.card { display: flex; align-items: center; gap: 12px; padding: 10px 6px 10px 12px; border: 1.5px solid var(--ink); border-radius: 8px; background: var(--paper); width: 100%; text-align: left; }
.card.paused { border-style: dashed; border-color: var(--muted); }
.card.paused .title, .card.paused .icon svg { color: var(--muted); stroke: var(--muted); }
.card.tap { padding-right: 12px; text-decoration: none; color: inherit; min-height: 76px; }
.card.tap.flight { border: 2px solid var(--flight); }
.card.tap.locked { border-style: dashed; border-color: var(--muted); color: var(--muted); }
.icon { width: 40px; height: 40px; flex: none; border: 1.5px solid var(--ink); border-radius: 6px; background: var(--fill); display: flex; align-items: center; justify-content: center; }
.card.paused .icon { border-style: dashed; border-color: var(--muted); background: var(--paper); }
.card .body { flex: 1; min-width: 0; }
.row-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.title { font-family: var(--mono); font-weight: 500; font-size: 17px; word-break: break-all; }
.title.plain { font-family: var(--sans); font-weight: 600; font-size: 16px; }
.sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.status { font-size: 12px; color: var(--muted); margin-top: 1px; }
.rowbtn { display: block; width: 100%; background: none; border: 0; padding: 0; text-align: left; }

/* on/off switch */
.switch { width: 44px; height: 44px; flex: none; border: 0; background: transparent; padding: 0; display: flex; align-items: center; justify-content: center; }
.switch i { display: block; width: 40px; height: 22px; border-radius: 11px; position: relative; border: 1.5px solid var(--muted); }
.switch i::after { content: ""; position: absolute; top: 2.5px; left: 3px; width: 14px; height: 14px; border-radius: 7px; background: var(--muted); }
.switch[aria-pressed="true"] i { background: var(--ink); border-color: var(--ink); }
.switch[aria-pressed="true"] i::after { left: auto; right: 3px; top: 3px; width: 16px; height: 16px; border-radius: 8px; background: #fff; }

.meter { display: flex; align-items: center; gap: 10px; padding-top: 2px; font-size: 12px; color: var(--muted); }
.meter .bar { width: 140px; height: 8px; border: 1.5px solid var(--ink); border-radius: 4px; position: relative; flex: none; }
.meter .bar b { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink); }

.empty { text-align: center; color: var(--muted); padding: 32px 16px; line-height: 1.5; }

/* buttons */
.btn { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 16px; border: 1.5px solid var(--ink); border-radius: 8px; background: var(--paper); font-weight: 600; text-decoration: none; }
.btn.primary { background: var(--ink); color: var(--paper); min-height: 52px; font-size: 16px; }
.btn.inline { display: inline-flex; min-height: 44px; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
.linkbtn { min-height: 44px; border: 0; background: none; color: var(--muted); text-decoration: underline; font-size: 13px; }
.fab { position: absolute; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); height: 48px; padding: 0 18px; border-radius: 24px; background: var(--ink); color: #fff; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; text-decoration: none; box-shadow: 0 2px 8px rgba(0,0,0,.25); }

/* forms */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label, .field .label, fieldset legend { font-size: 13px; font-weight: 600; padding: 0; }
.field .hint { font-size: 12px; color: var(--muted); }
input[type="text"], input[type="search"], select { height: 48px; width: 100%; border: 1.5px solid var(--ink); border-radius: 8px; padding: 0 12px; background: var(--paper); font-size: 16px; }
input.code { font-family: var(--mono); font-weight: 500; font-size: 18px; text-transform: uppercase; }
fieldset { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; }
fieldset legend { margin-bottom: 2px; }
.opt { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 15px; }
.opt input { width: 22px; height: 22px; margin: 0; accent-color: var(--ink); }
.segmented { display: flex; gap: 8px; }
.segmented button { flex: 1; min-height: 48px; border: 1.5px solid var(--ink); border-radius: 8px; background: var(--paper); font-weight: 600; font-size: 15px; }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.preview { border: 1.5px solid var(--muted); border-radius: 8px; background: var(--fill); padding: 8px 12px; font-size: 13px; min-height: 52px; }
.preview .name { font-weight: 600; }
.preview .why { color: var(--muted); margin-top: 1px; }
.preview.bad { border-style: dashed; }
.error { color: var(--danger); font-size: 14px; font-weight: 600; }
.footer { padding: 0 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 6px; flex: none; }
.footer .note { font-size: 12px; color: var(--muted); text-align: center; }

/* section headings and lists */
.group { font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--muted); padding: 10px 0 2px; }
.line { display: flex; align-items: center; gap: 12px; min-height: 56px; border-bottom: 1px solid var(--line); }
.line .code4 { font-family: var(--mono); font-weight: 500; width: 52px; }
.line .grow { flex: 1; }
.alert { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--ink); border-radius: 8px; padding: 12px; }
.alert .time { flex: none; width: 44px; font-family: var(--mono); font-weight: 500; font-size: 14px; padding-top: 1px; }
.alert .head { font-size: 15px; font-weight: 600; margin-top: 2px; }

/* plan screen */
.plancard { border: 1.5px solid var(--ink); border-radius: 8px; padding: 14px; background: var(--fill); }
.plancard .name { font-size: 26px; font-weight: 600; }
.plancard .tags { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.stats { display: flex; gap: 8px; margin-top: 12px; }
.stat { flex: 1; border: 1.5px solid var(--ink); border-radius: 6px; background: #fff; padding: 6px 8px; }
.stat .v { font-family: var(--mono); font-weight: 500; font-size: 16px; }
.stat .k { font-size: 11px; color: var(--muted); }
.compare { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; border: 1.5px solid var(--ink); border-radius: 8px; overflow: hidden; font-size: 12px; }
.compare div { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.compare div:nth-last-child(-n+4) { border-bottom: 0; }
.compare .head { font-weight: 600; }
.compare .me { background: var(--fill); }
.panel { border: 1.5px dashed var(--muted); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.panel .label { font-size: 13px; font-weight: 600; }
.panel .text { font-size: 13px; color: var(--muted); }
ol.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
ol.steps li { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--ink); border-radius: 8px; padding: 12px; }
ol.steps .n { flex: none; width: 32px; height: 32px; border: 1.5px solid var(--ink); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-weight: 500; }
ol.steps li.done .n { background: var(--ink); color: #fff; }
ol.steps .what { font-size: 16px; font-weight: 600; }
ol.steps .how { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* tab bar */
.tabs { display: flex; border-top: 1.5px solid var(--ink); background: var(--paper); height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); flex: none; }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 500; }
.tabs a[aria-current="page"] { color: var(--ink); background: var(--fill); font-weight: 600; }

/* full-screen notices (update required, maintenance) */
.gate { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 24px; }
.gate .disc { width: 56px; height: 56px; border: 1.5px solid var(--ink); border-radius: 28px; display: flex; align-items: center; justify-content: center; }
.gate h1 { margin: 4px 0 0; font-size: 24px; }
.gate p { margin: 0; color: var(--muted); }
.gate .btn { align-self: stretch; }
.gate .versions { font-family: var(--mono); font-size: 12px; color: var(--muted); }

dialog { border: 1.5px solid var(--ink); border-radius: 12px; padding: 18px; max-width: 360px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog h2 { margin: 0 0 6px; font-size: 18px; }
dialog p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
dialog .actions { display: flex; flex-direction: column; gap: 8px; }

#toasts { position: fixed; left: 0; right: 0; bottom: calc(84px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 10; padding: 0 16px; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; max-width: 420px; box-shadow: 0 2px 8px rgba(0,0,0,.3); }

:focus-visible { outline: 3px solid var(--flight); outline-offset: 2px; }

.card .rowbtn { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; width: auto; }
.card .rowbtn .body { flex: 1; min-width: 0; }

.banner a { font-weight: 600; }
optgroup { font-weight: 600; }
