/* Kite Force web - light theme to match the Android app. */
:root {
  --brand: #0EA5E9;
  --brand-dark: #0284C7;
  --btn: #0369A1;          /* sky-700: white text passes 4.5:1 */
  --ink: #0F172A;
  --ink-2: #334155;
  --muted: #64748B;
  --line: #E2E8F0;
  --bg: #F1F5F9;
  --card: #FFFFFF;
  --good: #047857;
  --good-bg: #D1FAE5;
  --warn: #B45309;
  --warn-bg: #FEF3C7;
  --caution: #92400E;
  --bad: #B91C1C;
  --bad-bg: #FEE2E2;
  --calm: #475569;
  --calm-bg: #E2E8F0;
  --radius: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-dark); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); font-weight: 600; }
.boot img { border-radius: 18px; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 5; background: var(--card);
  padding: calc(10px + var(--safe-top)) 16px 10px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.topbar h1 { font-size: 20px; flex: 1; }
.topbar img { width: 30px; height: 30px; border-radius: 8px; }
main { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(96px + var(--safe-bottom)); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--card);
  border-top: 1px solid var(--line); display: flex; justify-content: center;
  padding-bottom: var(--safe-bottom);
}
.tabbar button {
  flex: 1; max-width: 240px; background: none; border: 0; padding: 10px 4px 12px;
  display: grid; justify-items: center; gap: 2px; color: var(--muted); font-size: 12px; font-weight: 600;
}
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button[aria-current="page"] { color: var(--brand-dark); }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(15,23,42,.06); }
.card h2 { font-size: 17px; margin-bottom: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.stack > * + * { margin-top: 10px; }

/* ── Controls ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 600;
  background: var(--btn); color: #fff; min-height: 46px; text-decoration: none;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: translateY(1px); }
.btn.block { width: 100%; }
.btn.secondary { background: #E0F2FE; color: var(--brand-dark); }
.btn.ghost { background: transparent; color: var(--brand-dark); }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.outline { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.iconbtn { background: none; border: 0; padding: 8px; border-radius: 10px; color: var(--ink-2); display: inline-grid; place-items: center; }
.iconbtn svg { width: 22px; height: 22px; }

label.field { display: block; }
label.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid #CBD5E1; border-radius: 12px; background: #fff;
  padding: 11px 12px; min-height: 46px; outline: none;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,165,233,.18); }
textarea.input { min-height: 90px; resize: vertical; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.suffix { position: relative; }
.suffix .input { padding-right: 46px; }
.suffix > em { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-size: 14px; pointer-events: none; }

.segmented { display: flex; background: var(--bg); border-radius: 12px; padding: 3px; gap: 3px; }
.segmented button { flex: 1; border: 0; background: none; border-radius: 10px; padding: 8px 6px; font-weight: 600; color: var(--ink-2); min-height: 40px; }
.segmented button[aria-pressed="true"] { background: var(--card); color: var(--brand-dark); box-shadow: 0 1px 2px rgba(15,23,42,.12); }

.switch { display: flex; align-items: center; gap: 12px; }
.switch input { appearance: none; width: 46px; height: 28px; border-radius: 14px; background: #CBD5E1; position: relative; transition: background .15s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(18px); }

details.adv > summary { cursor: pointer; font-weight: 600; color: var(--brand-dark); padding: 6px 0; list-style: none; }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary::before { content: "▸ "; }
details.adv[open] > summary::before { content: "▾ "; }

/* ── Auth ───────────────────────────────────────────────────────────────── */
.auth { max-width: 420px; margin: 0 auto; padding: calc(28px + var(--safe-top)) 20px 40px; }
.auth .logo { display: grid; justify-items: center; gap: 8px; margin-bottom: 22px; text-align: center; }
.auth .logo img { width: 84px; height: 84px; border-radius: 20px; box-shadow: 0 4px 14px rgba(15,23,42,.12); }
.auth .logo h1 { font-size: 28px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.divider:empty { gap: 0; }
.error { color: var(--bad); font-size: 14px; min-height: 1em; }

/* ── Kites grid ─────────────────────────────────────────────────────────── */
.conditions-strip { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); margin-bottom: 12px; }
.kite-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.kite-card {
  background: var(--card); border: 0; border-radius: var(--radius); padding: 0; text-align: left;
  overflow: hidden; box-shadow: 0 1px 2px rgba(15,23,42,.06); display: flex; flex-direction: column;
}
.kite-card .pic { aspect-ratio: 4 / 3; background: #F8FAFC; display: grid; place-items: center; position: relative; }
.kite-card .pic img { width: 100%; height: 100%; object-fit: cover; }
.kite-card .pic svg { width: 56px; height: 56px; }
.kite-card .body { padding: 10px 12px 12px; }
.kite-card .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kite-card .meta { font-size: 13px; color: var(--muted); }
.kite-card .badge { position: absolute; left: 8px; top: 8px; }
.kite-card.loaded { outline: 3px solid var(--brand); }

/* Care reminders (cleaning / drying) - teal, never the verdict colours */
.care { color: #0E7490; font-weight: 700; }
.kite-card .care { margin-top: 2px; font-size: 12px; }

.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; color: #fff; }
.pill { display: inline-block; font-size: 15px; font-weight: 700; padding: 6px 14px; border-radius: 999px; color: #fff; }

.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty svg { width: 64px; height: 64px; }

/* ── Wind & Calc ────────────────────────────────────────────────────────── */
.picker { display: flex; align-items: center; gap: 12px; }
.thumb { width: 56px; height: 56px; border-radius: 12px; background: #F8FAFC; display: grid; place-items: center; overflow: hidden; flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb svg { width: 40px; height: 40px; }
.picker .title { font-weight: 700; font-size: 17px; }
.verdict-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wind-now { font-size: 15px; color: var(--ink-2); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.tile { background: var(--bg); border-radius: 12px; padding: 12px; }
.tile .k { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tile .v { font-size: 26px; font-weight: 800; line-height: 1.15; margin-top: 2px; }
.tile .s { font-size: 13px; color: var(--muted); }
.rangebar { margin-top: 14px; }
.rangebar svg { width: 100%; height: 46px; display: block; }
.hours { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.hour { flex: none; width: 54px; border-radius: 10px; padding: 6px 0; text-align: center; font-size: 12px; scroll-snap-align: start; }
.hour b { display: block; font-size: 15px; }
.hour svg { width: 16px; height: 16px; display: block; margin: 2px auto; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; }
.list-row button.plain { all: unset; cursor: pointer; flex: 1; min-width: 0; }
.breakdown { font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--bg); padding: 10px 12px; border-radius: 10px; white-space: pre-wrap; word-break: break-word; }

/* ── Editor ─────────────────────────────────────────────────────────────── */
.shape-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.shape-grid button { background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 8px 4px; display: grid; justify-items: center; gap: 2px; font-size: 13px; font-weight: 600; }
.shape-grid button svg { width: 40px; height: 40px; }
.shape-grid button[aria-pressed="true"] { border-color: var(--brand); background: #F0F9FF; }
.rating-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rating-buttons button { border: 2px solid var(--line); background: var(--card); border-radius: 12px; padding: 8px 4px; }
.rating-buttons button b { display: block; }
.rating-buttons button span { font-size: 12px; color: var(--muted); }
.rating-buttons button[aria-pressed="true"] { border-color: var(--brand); background: #F0F9FF; }
.photo-pick { display: flex; align-items: center; gap: 12px; }
.photo-pick .thumb { width: 72px; height: 72px; }
.actionbar { position: sticky; bottom: calc(64px + var(--safe-bottom)); display: flex; gap: 10px; padding: 12px 0; background: linear-gradient(to top, var(--bg) 70%, transparent); }

/* ── Sheets & toast ─────────────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--card); width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + var(--safe-bottom)); animation: rise .18s ease-out; }
.sheet h2 { font-size: 19px; margin-bottom: 12px; }
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { border-radius: 20px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(30px); opacity: .6; } }
#toast { position: fixed; left: 50%; bottom: calc(84px + var(--safe-bottom)); transform: translateX(-50%); z-index: 30; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100vw - 32px); opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.show { opacity: 1; }

.banner { background: #E0F2FE; color: #075985; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-bottom: 14px; display: flex; gap: 10px; align-items: flex-start; }
.banner.warn { background: var(--warn-bg); color: #78350F; }

/* Tip line at the bottom of Wind & Calc and My Kites */
.fund-foot { text-align: center; margin: 22px 0 4px; font-size: 14px; }
.fund-foot a { font-weight: 700; text-decoration: none; color: var(--brand-dark); }
.fund-foot span { font-size: 12px; color: var(--muted); }
