/* ViziScreen iPhone POC. Palette matches the Android POC. Light only (a reading "paper" should be dark-on-light). */
:root {
  --bg: #F4F6FA;
  --card: #FFFFFF;
  --ink: #14181F;
  --ink-soft: #4A5360;
  --accent: #1553B6;
  --on: #0E7A3B;
  --warn-bg: #FFF4D6;
  --stroke: #C9D1DC;
  --z: 1;            /* text scale applied to the reading papers (set by app.js) */
  --base: 15px;      /* normal body size of a sample document at scale 1 */
  --tabs-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }

.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ---------- top bar ---------- */
.top {
  background: var(--accent);
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.top h1 { margin: 0; font-size: 24px; letter-spacing: .2px; }
.tag { font-size: 14px; background: rgba(255,255,255,.2); padding: 3px 10px; border-radius: 999px; }

main { flex: 1; padding: 14px 14px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 24px); max-width: 640px; width: 100%; margin: 0 auto; }

/* ---------- cards & text ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
}
.card h2 { margin: 0 0 8px; font-size: 22px; }
.card h3 { margin: 0 0 4px; font-size: 20px; }
.card p { margin: 0 0 10px; }
.card ul { margin: 0 0 10px; padding-left: 22px; }
.card li { margin-bottom: 6px; }
.card > :last-child { margin-bottom: 0; }
.card.note { background: var(--warn-bg); border-color: #E8D49A; }
.card.camerr { background: #FDECEC; border-color: #E5A5A5; }
.hint { color: var(--ink-soft); font-size: 17px; }
.where { color: var(--accent); font-weight: 600; font-size: 17px; }

/* ---------- buttons (all >= 56 px tall) ---------- */
.btn {
  font: inherit; font-size: 20px; font-weight: 600;
  min-height: 56px; padding: 10px 18px;
  border-radius: 14px; border: 2px solid var(--accent);
  background: #fff; color: var(--accent);
  touch-action: manipulation; cursor: pointer;
}
.btn:active { filter: brightness(.92); }
.btn.primary { background: var(--accent); color: #fff; width: 100%; font-size: 22px; min-height: 64px; margin-bottom: 10px; }
.btn.secondary { flex: 1; }
.btn.round { width: 72px; min-height: 72px; border-radius: 50%; font-size: 36px; line-height: 1; padding: 0; }
.btn:focus-visible, .big-toggle:focus-visible, .tab:focus-visible, .chip:focus-visible, .linkbtn:focus-visible {
  outline: 4px solid #F5A623; outline-offset: 2px;
}
.pair { display: flex; gap: 12px; margin: 10px 0; }
.linkbtn {
  font: inherit; font-size: 18px; color: var(--accent); background: none; border: 0;
  text-decoration: underline; padding: 12px 0; min-height: 48px; cursor: pointer;
}

.stepper { display: flex; align-items: center; justify-content: space-between; margin: 12px 0; }
.stepper-val { text-align: center; }
.stepper-val span { display: block; font-size: 44px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stepper-val small { color: var(--ink-soft); font-size: 16px; }

/* The one big Reading on/off button */
.big-toggle {
  display: block; width: 100%; min-height: 88px;
  font: inherit; font-size: 24px; font-weight: 700; line-height: 1.2;
  border-radius: 18px; border: 0; padding: 12px 16px;
  background: var(--accent); color: #fff;
  touch-action: manipulation; cursor: pointer;
}
.big-toggle small { display: block; font-size: 17px; font-weight: 500; opacity: .95; margin-top: 4px; }
.big-toggle[aria-pressed="true"] { background: var(--on); }
.big-toggle:active { filter: brightness(.92); }

/* the toggle sticks to the top on Read and Camera; Smaller/Larger scroll away (keeps small phones usable) */
.readbar-slot, .readbar { display: contents; }
.readbar .big-toggle {
  position: sticky; top: 0; z-index: 5;
  min-height: 72px; font-size: 22px;
  margin-bottom: 8px; box-shadow: 0 6px 0 var(--bg);
}
.readbar-tune { display: flex; gap: 12px; margin: 0 0 12px; }
.readbar-tune .btn { min-height: 52px; }

/* ---------- documents ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.chip {
  font: inherit; font-size: 17px; font-weight: 600; min-height: 48px; padding: 8px 14px;
  border-radius: 999px; border: 2px solid var(--stroke); background: #fff; color: var(--ink); cursor: pointer;
}
.chip[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.paper {
  background: #fff; color: #111;
  border: 1px solid var(--stroke); border-radius: 6px;
  padding: 1.1em;
  font-size: calc(var(--base) * var(--z));     /* the lens: everything inside is in em */
  line-height: 1.4;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.paper p { margin: 0 0 .7em; }
.paper h3 { margin: 0 0 .2em; font-size: 1.3em; }
.paper h4 { margin: 1em 0 .2em; font-size: 1em; text-transform: uppercase; letter-spacing: .03em; border-top: 1px solid #ccc; padding-top: .5em; }
.paper .small { font-size: .85em; }
.paper .fine { font-size: .62em; line-height: 1.35; color: #333; }   /* realistic fine print: ~9 px at normal size */
.paper .center { text-align: center; }
.paper hr { border: 0; border-top: 1px solid #ccc; margin: .8em 0; }
.bill { font-family: "Courier New", Courier, monospace; }
.bill-head { text-align: center; }
.bill-lines { width: 100%; border-collapse: collapse; margin: .5em 0; font-size: .85em; }
.bill-lines td { padding: .15em 0; vertical-align: top; }
.bill-lines td + td { text-align: right; white-space: nowrap; padding-left: .8em; }
.bill-lines.totals { border-top: 1px dashed #555; padding-top: .4em; }
.bill-lines .due td { font-weight: 700; font-size: 1.15em; padding-top: .4em; }
.sample-banner { background: #FFE9A8; border: 1px solid #D9B94E; padding: .4em .6em; font-size: .7em; font-weight: 700; border-radius: 4px; }
.menu .item p { margin: 0 0 .15em; }
.menu .item { margin-bottom: .7em; }
.menu .price { float: right; font-weight: 600; }
.email .small { line-height: 1.5; }
.news .byline { color: #555; }
.paper textarea {
  display: block; width: 100%; margin-top: .6em; font: inherit; font-size: 1em; /* >= 16 px: iOS will not zoom on focus */
  line-height: 1.4; padding: .6em; border: 2px solid var(--stroke); border-radius: 8px; resize: vertical; min-height: 12em;
  color: #111; background: #fff;
}
.paper .small b { font-weight: 700; }
body.dark-text .paper { color: #000; font-weight: 500; }
body.dark-text .paper .fine { color: #000; font-weight: 600; }

/* ---------- camera ---------- */
.cam {
  position: relative; width: 100%; aspect-ratio: 3 / 4; max-height: 62vh;
  overflow: hidden; border-radius: 16px; background: #000; margin-bottom: 12px;
}
.cam video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transform: scale(var(--cam-zoom, 1)); transform-origin: center center;
}
.cam-badge {
  position: absolute; left: 10px; top: 10px; background: rgba(0,0,0,.65); color: #fff;
  font-weight: 700; font-size: 18px; padding: 4px 12px; border-radius: 999px;
}
.cam-controls { margin-bottom: 4px; }

/* ---------- bottom tab bar ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; background: #fff; border-top: 1px solid var(--stroke);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
.tab {
  flex: 1; min-height: var(--tabs-h); background: none; border: 0; font: inherit; font-size: 15px; font-weight: 600;
  color: var(--ink-soft); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer;
}
.tab .ico { font-size: 24px; line-height: 1; }
.tab[aria-current="page"] { color: var(--accent); box-shadow: inset 0 4px 0 var(--accent); }

@media (max-width: 340px) {
  body { font-size: 17px; }
  .btn.round { width: 64px; min-height: 64px; }
  .stepper-val span { font-size: 38px; }
}
@media (min-width: 700px) { main { padding-top: 24px; } }
@media (prefers-reduced-motion: no-preference) { .big-toggle, .btn { transition: background-color .15s; } }
