/* Layout: single column for one-handed use. Black body with engraved white
   numerals in dark mode, satin chrome top plate in light mode. Orange is the
   T3's 125 and Tamron AE; green is the Hexanon AE. */
:root {
  --bg: #e6e6e2;
  --card: #f6f6f3;
  --ink: #17181a;
  --muted: #5e6166;
  --line: #cfd0cb;
  --well: #dcdcd7;
  --accent: #c85d14;
  --accent-ink: #ffffff;
  --ae-orange: #c85d14;
  --ae-green: #2f8a4c;
  --ok: #2c7a45;
  --warn: #9a5a00;
  --bad: #b3261e;
  --display: "DIN Condensed", "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121314;
    --card: #1b1c1e;
    --ink: #ecebe6;
    --muted: #9a9ca0;
    --line: #2e3033;
    --well: #0c0c0d;
    --accent: #ee8435;
    --accent-ink: #160b02;
    --ae-orange: #ee8435;
    --ae-green: #5bbf7a;
    --ok: #74c58e;
    --warn: #f0b25b;
    --bad: #f08a80;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--body);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.top, main {
  max-width: 560px;
  margin: 0 auto;
  padding-left: max(14px, env(safe-area-inset-left, 0px));
  padding-right: max(14px, env(safe-area-inset-right, 0px));
}
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 12px 6px; }
.brand { font-family: var(--display); font-size: 26px; letter-spacing: 0.04em; line-height: 1; }
.brand span { color: var(--muted); }
.roll-chip {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; max-width: 64%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.roll-chip b { font-weight: 600; }

main { display: block; }
.view { display: flex; flex-direction: column; gap: 10px; padding-block: 6px 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }

.eyebrow { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.hint { margin: 0; color: var(--muted); font-size: 14px; }
.error { margin: 0; color: var(--bad); font-size: 14px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line); background: transparent; font-weight: 600;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--bad); border-color: var(--bad); align-self: flex-start; }
.link { background: none; border: 0; padding: 4px 0; color: var(--accent); font-weight: 600; font-size: 15px; }
.danger-text { color: var(--bad); }

.seg { display: flex; gap: 6px; }
.seg.wrap { flex-wrap: wrap; }
.seg button {
  flex: 1 1 auto; min-height: 40px; padding: 6px 10px; border-radius: 9px;
  border: 1px solid var(--line); background: transparent; font-size: 15px;
}
.seg.small button { min-height: 34px; font-size: 13.5px; }
.seg button[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); font-weight: 600; }

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: transparent; font-size: 22px; line-height: 1; }
.stepper output { min-width: 64px; text-align: center; font-family: var(--display); font-size: 24px; font-variant-numeric: tabular-nums; padding-top: 3px; }
.stepper.wide { display: flex; }
.stepper.wide input { flex: 1; accent-color: var(--accent); }

/* reading */
.stage { position: relative; border-radius: 10px; overflow: hidden; background: var(--well); touch-action: manipulation; }
.stage img { display: block; width: 100%; height: auto; max-height: 52vh; object-fit: contain; }
.spot, .centre-ring {
  position: absolute; border-radius: 50%; pointer-events: none;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.6), inset 0 0 0 1px rgba(0,0,0,.6);
  transform: translate(-50%, -50%);
}
.spot { width: 9%; aspect-ratio: 1; }
.centre-ring { width: 46%; aspect-ratio: 1; left: 50%; top: 55%; border-style: dashed; opacity: .8; }

.ev-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ev-big { font-family: var(--display); font-size: 56px; line-height: 1; font-variant-numeric: tabular-nums; padding-top: 4px; }
.ev-label { font-size: 26px; color: var(--muted); }
.source { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.camera-btn { position: relative; min-width: 104px; min-height: 64px; border-radius: 50%; aspect-ratio: 1; font-size: 16px; overflow: hidden; }
.camera-btn input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.alt-row { display: flex; gap: 18px; }
.panel { padding-top: 2px; }

.range-bar { position: relative; height: 18px; border-radius: 4px; background: var(--well); overflow: hidden; }
.range-bar .lat { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--ok) 26%, transparent); }
.range-bar .span { position: absolute; top: 5px; bottom: 5px; background: var(--ink); border-radius: 3px; }
.range-bar .mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent); }
.range-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 3px; }

.focal-row { display: flex; align-items: center; gap: 10px; }
.focal-row .seg { flex: 1; }

/* dials */
.dial-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.dial-note { font-size: 12px; color: var(--muted); }
.dial { position: relative; }
.dial::after {
  content: ""; position: absolute; left: 50%; top: 0; width: 0; height: 0; margin-left: -6px;
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 8px solid var(--accent);
  pointer-events: none;
}
.dial-track {
  position: relative; display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 10px calc(50% - 30px) 8px; gap: 2px;
  background: var(--well); border-radius: 10px; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
}
.dial-track::-webkit-scrollbar { display: none; }
.dial-item {
  flex: 0 0 60px; scroll-snap-align: center; border: 0; background: transparent;
  font-family: var(--display); font-size: 26px; line-height: 1; padding: 10px 0 6px;
  color: color-mix(in srgb, var(--ink) 55%, transparent); font-variant-numeric: tabular-nums; position: relative;
}
.dial-item small { display: block; font-family: var(--body); font-size: 10px; letter-spacing: .06em; margin-top: 3px; color: var(--muted); }
.dial-item[aria-pressed="true"] { color: var(--ink); font-size: 32px; }
.dial-item.sync { color: var(--ae-orange); }
.dial-item.ae { font-size: 20px; letter-spacing: .04em; }
.dial-item.ae[aria-pressed="true"] { font-size: 24px; }
.dial-item .pin { position: absolute; left: 50%; bottom: -6px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.comp-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* result */
.result-main { font-family: var(--display); font-size: 54px; line-height: 1; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; font-variant-numeric: tabular-nums; padding-top: 4px; }
.result-main .dot { color: var(--muted); }
.needle-scale { position: relative; height: 46px; border-radius: 8px; background: var(--well); }
.needle-scale .tick { position: absolute; top: 6px; transform: translateX(-50%); font-family: var(--display); font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.needle-scale .tick.zero { color: var(--ink); }
.needle-scale .needle { position: absolute; bottom: 4px; width: 3px; height: 22px; margin-left: -1.5px; background: var(--accent); border-radius: 2px; transition: left .25s ease; }
.needle-scale .zone { position: absolute; bottom: 8px; height: 4px; background: color-mix(in srgb, var(--ok) 55%, transparent); border-radius: 2px; }
@media (prefers-reduced-motion: reduce) { .needle-scale .needle { transition: none; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; padding: 4px 10px; border-radius: 999px; font-weight: 600; border: 1px solid currentColor; }
.chip.ok { color: var(--ok); }
.chip.warn { color: var(--warn); }
.chip.bad { color: var(--bad); }
.result-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* film */
.roll-name { font-family: var(--display); font-size: 34px; line-height: 1.05; }
.roll-meta { color: var(--muted); font-size: 14px; margin-top: -6px; }
.dial-callout { border-radius: 10px; background: var(--well); padding: 10px 12px; font-size: 14px; }
.dial-callout b { font-family: var(--display); font-size: 20px; font-weight: 400; }
.roll-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.list-head { display: flex; justify-content: space-between; align-items: center; }
.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.log li { display: grid; grid-template-columns: 40px 1fr auto; gap: 8px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.log li:first-child { border-top: 0; }
.log .n { font-family: var(--display); font-size: 22px; }
.log .s { font-variant-numeric: tabular-nums; }
.log .m { color: var(--muted); font-size: 12.5px; text-align: right; }
.films { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.films li { display: flex; gap: 6px; }
.films .pick {
  flex: 1; display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left;
  min-height: 46px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: transparent;
}
.films .pick[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.films .tag { font-size: 12px; color: var(--muted); white-space: nowrap; }
.films .del { width: 46px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--bad); }
.add-film summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 4px 0; }
form { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); flex: 1; }
form input, form select {
  min-height: 44px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--well); color: var(--ink); font-size: 16px;
}
.form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.form-row label { min-width: 130px; }
form .btn { align-self: flex-start; }
.cal-form { flex-direction: row; align-items: flex-end; flex-wrap: wrap; }
.prose p { margin: 0; font-size: 15px; max-width: 62ch; }

/* tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: center; gap: 4px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 6px max(14px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
}
.tabs button { flex: 1; max-width: 180px; min-height: 48px; border: 0; background: transparent; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 15px; }
.tabs button[aria-current="page"] { color: var(--ink); background: var(--card); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 6;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
}
