/* GiveMeSpace Mobile. Windows 98, but for thumbs: big tap targets, safe areas for the notch and home bar, 16px inputs
   (smaller ones make iPhone zoom the page when you tap them). No inline styles anywhere: the page's security policy
   forbids them, so every look lives here. */

:root {
  --face: #c0c0c0;
  --hi: #ffffff;
  --lt: #dfdfdf;
  --lo: #808080;
  --dk: #0a0a0a;
  --navy: #000080;
  --blue: #1084d0;
  --teal: #008080;
  --tip: #ffffe1;
  --ok: #006400;
  --warn: #7a3d00;
  --bad: #a00000;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--teal); height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0 auto; max-width: 640px; height: 100%; height: 100dvh;
  display: flex; flex-direction: column; overflow: hidden;
  font: 16px/1.35 Tahoma, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: #000; background: var(--teal); overscroll-behavior: none;
}
body.noscroll { overflow: hidden; }
h4 { margin: 14px 0 4px; font-size: 15px; }
p { margin: 0 0 8px; }
code { font: 13px/1.3 "Courier New", ui-monospace, Menlo, monospace; overflow-wrap: anywhere; }
ol, ul { margin: 6px 0 8px; padding-left: 22px; }
li { margin: 0 0 6px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; white-space: nowrap; }

/* ------------------------------------------------------------- the frame */

.titlebar {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: calc(7px + var(--sat)) calc(10px + var(--sar)) 7px calc(10px + var(--sal));
  color: #fff; font-weight: 700; background: linear-gradient(90deg, var(--navy), var(--blue));
}
.tb-icon { width: 22px; height: 22px; image-rendering: pixelated; flex: none; }
.tb-title { font-size: 17px; }
.tb-sub { font-weight: 400; font-size: 13px; opacity: .9; }
.tb-ver { margin-left: auto; font-weight: 400; font-size: 12px; opacity: .8; }

#banner { flex: none; }
#banner:empty { display: none; }
.banner { display: flex; align-items: center; gap: 10px; padding: 8px calc(12px + var(--sar)) 8px calc(12px + var(--sal)); background: var(--tip); border-bottom: 1px solid #000; font-size: 14px; }
.banner span { flex: 1; }

.screen {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 8px calc(8px + var(--sar)) 14px calc(8px + var(--sal));
}
.screen:focus { outline: none; }

.tabs {
  display: flex; gap: 3px; flex: none; padding: 4px 4px calc(4px + var(--sab)) 4px; background: var(--face);
  box-shadow: inset 0 1px 0 var(--lt), inset 0 2px 0 var(--hi);
}
.tab {
  flex: 1; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font: inherit; font-size: 12px; color: #000; background: var(--face); border: 0; border-radius: 0; cursor: pointer; touch-action: manipulation;
  box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--hi), inset -2px -2px var(--lo), inset 2px 2px var(--lt);
}
.tab-i { font-size: 21px; line-height: 1; }
.tab[aria-selected="true"] {
  font-weight: 700; background: #d6d6d6;
  box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--dk), inset -2px -2px var(--lt), inset 2px 2px var(--lo);
}
.tab:focus-visible, .btn:focus-visible, .chip:focus-visible, .seg-b:focus-visible, summary:focus-visible, .linkbtn:focus-visible { outline: 1px dotted #000; outline-offset: -5px; }

/* --------------------------------------------------------------- windows */

.win {
  margin: 0 0 10px; padding: 3px; background: var(--face);
  box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--lt), inset -2px -2px var(--lo), inset 2px 2px var(--hi);
}
.win-title { display: flex; align-items: center; gap: 8px; min-height: 28px; padding: 3px 4px 3px 7px; color: #fff; font-weight: 700; background: linear-gradient(90deg, var(--navy), var(--blue)); }
.win-t { flex: 1; min-width: 0; line-height: 1.2; overflow-wrap: anywhere; }
.win-body { padding: 10px; }
.win-x {
  flex: none; width: 44px; height: 34px; font: inherit; font-weight: 700; color: #000; background: var(--face); border: 0; border-radius: 0; cursor: pointer; touch-action: manipulation;
  box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--hi), inset -2px -2px var(--lo), inset 2px 2px var(--lt);
}
.win-x:active { box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--dk), inset -2px -2px var(--lt), inset 2px 2px var(--lo); }

.big { margin: 0 0 6px; font-size: 20px; font-weight: 700; line-height: 1.2; }
.lead { font-size: 17px; }
.hint { font-size: 13px; color: #404040; }
.warn { color: var(--warn); }
.okmark { color: var(--ok); font-weight: 700; }
.save { margin: 0 0 6px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 0; }
.linkbtn { font: inherit; color: var(--navy); background: none; border: 0; padding: 15px 8px; margin: -15px -4px; text-decoration: underline; cursor: pointer; touch-action: manipulation; }

.callout { margin: 10px 0; padding: 8px 10px; background: var(--tip); border: 1px solid #000; font-size: 15px; }
.callout.ok { background: #e3f6e3; }
.callout.warn { background: var(--tip); color: #000; }

/* ---------------------------------------------------------------- widgets */

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 14px;
  font: inherit; color: #000; text-align: center; text-decoration: none; background: var(--face); border: 0; border-radius: 0; cursor: pointer; touch-action: manipulation;
  -webkit-appearance: none; appearance: none;
  box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--hi), inset -2px -2px var(--lo), inset 2px 2px var(--lt);
}
.btn:active:not([disabled]) { padding: 9px 13px 7px 15px; box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--dk), inset -2px -2px var(--lt), inset 2px 2px var(--lo); }
.btn[disabled] { color: var(--lo); text-shadow: 1px 1px 0 var(--hi); cursor: default; }
.btn-primary { font-weight: 700; margin: 1px; box-shadow: 0 0 0 1px #000, inset -1px -1px var(--dk), inset 1px 1px var(--hi), inset -2px -2px var(--lo), inset 2px 2px var(--lt); }
.btn-danger { color: var(--bad); font-weight: 700; }
.btn-block { display: flex; width: 100%; margin-top: 12px; }
.btn-small { min-width: 44px; min-height: 44px; padding: 4px 10px; font-size: 14px; }
.btn-link { color: var(--navy); }

.badge { display: inline-block; padding: 0 6px; font-size: 12px; line-height: 18px; color: #000; background: var(--tip); border: 1px solid #000; vertical-align: 1px; }
.badge-ok { background: #c8f0c8; }
.badge-bad { background: #ffc8c8; }

.meter {
  height: 24px; margin: 8px 0; padding: 2px; background: #fff;
  box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--lo), inset -2px -2px var(--lt), inset 2px 2px var(--dk);
}
.meter-fill { height: 100%; max-width: 100%; background: repeating-linear-gradient(90deg, var(--navy) 0 12px, transparent 12px 14px); }

.field { margin: 12px 0; }
.field-l { display: block; margin-bottom: 4px; font-weight: 700; }
.input {
  display: block; width: 100%; min-height: 44px; padding: 8px; font: inherit; font-size: 16px; color: #000; background: #fff; border: 0; border-radius: 0;
  -webkit-appearance: none; appearance: none;
  box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--lo), inset -2px -2px var(--lt), inset 2px 2px var(--dk);
}
.input:focus { outline: 1px dotted #000; outline-offset: -4px; }
.input-num { width: 6.5em; text-align: right; }
.goalrow .input-num { width: 5.5em; font-size: 20px; font-weight: 700; }
.catrow .input-num { width: 5.5em; }

.seg { display: flex; gap: 0; }
.seg-b {
  flex: 1; min-height: 44px; font: inherit; color: #000; background: var(--face); border: 0; border-radius: 0; cursor: pointer; touch-action: manipulation;
  box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--hi), inset -2px -2px var(--lo), inset 2px 2px var(--lt);
}
.seg-b.on { font-weight: 700; background: #d6d6d6; box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--dk), inset -2px -2px var(--lt), inset 2px 2px var(--lo); }

.goalrow { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.goal-l, .goal-u { font-weight: 700; }
.chips { display: flex; gap: 6px; margin: 10px 0; }
.chip {
  flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0 6px; font: inherit; color: #000; background: var(--face); border: 0; border-radius: 0; cursor: pointer; touch-action: manipulation;
  box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--hi), inset -2px -2px var(--lo), inset 2px 2px var(--lt);
}
.chip.on { font-weight: 700; background: #d6d6d6; box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--dk), inset -2px -2px var(--lt), inset 2px 2px var(--lo); }
.lastread { margin: 8px 0 0; font-size: 14px; }

details.fit { margin: 10px 0 0; }
details.fit > summary, details.recipe > summary { display: flex; align-items: center; min-height: 44px; font-weight: 700; cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "\25B8"; flex: none; width: 1.3em; font-weight: 400; }
details[open] > summary::before { content: "\25BE"; }
.catrow { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.cat-i { font-size: 20px; width: 26px; text-align: center; flex: none; }
.cat-l { flex: 1; min-width: 0; }
.help { margin: 0; border-top: 1px solid var(--lo); }
.help:first-child { border-top: 0; }
.help-body { padding: 0 2px 8px; }

/* ----------------------------------------------------------- plan + cards */

ol.steps, ul.plain { margin: 8px 0 0; padding: 0; list-style: none; background: #fff; box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--lo), inset -2px -2px var(--lt), inset 2px 2px var(--dk); }
.card { margin: 0; padding: 10px; border-bottom: 1px dotted var(--lo); }
.card:last-child, .simple:last-child { border-bottom: 0; }
.card-top { display: flex; gap: 10px; align-items: flex-start; }
.card-n { flex: none; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; background: var(--navy); border-radius: 50%; }
.card-main { flex: 1; min-width: 0; }
.card-title { font-weight: 700; }
.card-meta { font-size: 14px; color: #303030; }
.card-sub { font-size: 12px; color: var(--ok); }
.card.done { background: #f1f1f1; }
.card.done .card-title { color: #555; text-decoration: line-through; }
.card.done .card-n { background: var(--ok); }
.simple { display: flex; align-items: center; gap: 10px; margin: 0; padding: 8px 10px; border-bottom: 1px dotted var(--lo); }
.simple-main { flex: 1; min-width: 0; }

.where { display: flex; flex-direction: column; gap: 2px; margin: 10px 0; padding: 8px; background: #fff; box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--lo), inset -2px -2px var(--lt), inset 2px 2px var(--dk); }
.where-l { font-size: 12px; font-weight: 700; color: #404040; text-transform: uppercase; }
ol.how { padding-left: 24px; }
ol.how li { margin-bottom: 8px; }
details.recipe { margin: 14px 0 6px; padding: 0 8px 8px; background: #e8e8e8; border: 1px solid var(--lo); }

/* ------------------------------------------------------------------ check */

.kinds { margin: 4px 0 8px; padding: 0; list-style: none; }
.tips { padding-left: 20px; font-size: 14px; }
.busy-n { min-height: 18px; overflow-wrap: anywhere; }

.items { margin: 8px 0 0; padding: 0; list-style: none; background: #fff; box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--lo), inset -2px -2px var(--lt), inset 2px 2px var(--dk); }
.items.inner { margin: 0; box-shadow: none; }
.item { margin: 0; border-bottom: 1px dotted var(--lo); }
.item:last-child { border-bottom: 0; }
.item-in { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 6px 8px; cursor: pointer; }
.item.keep { background: #eaf7ea; }
.item-ctl { flex: none; display: flex; align-items: center; justify-content: center; width: 44px; }
.chk { flex: none; width: 26px; height: 26px; margin: 0; accent-color: var(--navy); }
.keeptag { padding: 2px 3px; font-size: 10px; font-weight: 700; background: #c8f0c8; border: 1px solid #000; }
.thumb { flex: none; width: 56px; height: 56px; object-fit: cover; background: #e8e8e8; box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--lo); }
.thumb.ph { display: flex; align-items: center; justify-content: center; font-size: 26px; }
.item-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.item-name { font-weight: 700; overflow-wrap: anywhere; }
.item-meta { font-size: 13px; color: #404040; }
.item-err { font-size: 12px; color: var(--bad); }
.grp { margin: 0; border-bottom: 2px solid var(--lo); list-style: none; }
.grp-h { padding: 4px 8px; font-size: 13px; font-weight: 700; background: #e8e8e8; }
.selcount { font-size: 13px; color: var(--navy); font-weight: 700; }

.bar {
  position: sticky; bottom: -14px; z-index: 5; display: flex; align-items: center; gap: 10px; margin: 8px -8px -14px; padding: 8px 12px; background: var(--face);
  box-shadow: inset 0 1px 0 var(--hi), 0 -2px 0 var(--lo);
}
.bar.off { display: none; }
.bar-t { display: flex; flex: 1; flex-direction: column; font-size: 14px; }
.removal h4 { margin-top: 16px; }

/* -------------------------------------------------------------------- log */

.spark { display: block; width: 100%; height: auto; aspect-ratio: 3.4 / 1; margin: 8px 0 2px; background: #fff; box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--lo), inset -2px -2px var(--lt), inset 2px 2px var(--dk); }
.spark-axis { stroke: var(--lo); stroke-width: 1; }
.spark-line { stroke: var(--navy); stroke-width: 2; }
.spark-dot { fill: var(--navy); }
.spark-l { display: flex; justify-content: space-between; font-size: 12px; color: #404040; margin-bottom: 8px; }
.logrow { display: flex; align-items: center; gap: 8px; margin: 0; padding: 6px 8px; border-bottom: 1px dotted var(--lo); }
.logrow:last-child { border-bottom: 0; }
.logrow-main { flex: 1; min-width: 0; }

/* ----------------------------------------------------------- sheets, toast */

.sheet-back { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; padding-top: var(--sat); background: rgba(0, 0, 0, .45); }
.sheet {
  display: flex; flex-direction: column; width: 100%; max-width: 640px; max-height: 94vh; max-height: 94dvh; padding: 3px; background: var(--face);
  box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--lt), inset -2px -2px var(--lo), inset 2px 2px var(--hi);
}
.sheet:focus { outline: none; }
.sheet .win-title { min-height: 38px; padding-right: 2px; flex: none; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 12px 12px calc(14px + var(--sab)); }

.toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(72px + var(--sab)); z-index: 80; max-width: 616px; margin: 0 auto; padding: 10px 12px;
  background: var(--tip); border: 1px solid #000; box-shadow: 2px 2px 0 rgba(0, 0, 0, .5);
  opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .15s, transform .15s;
}
.toast.show { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

noscript p { margin: 12px; padding: 10px; background: var(--tip); border: 1px solid #000; }
