@font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/Atkinson-Hyperlegible-Regular.ttf"); font-weight: 400; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/Atkinson-Hyperlegible-Bold.ttf"); font-weight: 700; }

:root { --bg: #111; --fg: #eee; --dim: #888; --accent: #f2c14e; --panel: #1c1c1c; }
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* rules like #tabs { display: flex } would otherwise beat the attribute */
body {
  margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.4 "Atkinson Hyperlegible", system-ui, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
header { display: flex; align-items: center; gap: 12px; padding: 6px 12px; position: relative; }
header .button { flex: 0 0 auto; white-space: nowrap; }
#info { flex: 1 1 auto; min-width: 0; text-align: left; background: none; border: none; padding: 4px 0; color: var(--dim); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Tapping the camera info shows all of it over the top of the photo. */
#info-full { position: absolute; z-index: 10; top: 100%; left: 8px; right: 8px; padding: 10px 12px; border-radius: 10px; background: #2a2a2a; border: 1px solid #3a3a3a; box-shadow: 0 6px 20px #000a; font-size: 14px; line-height: 1.5; }
#update { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 8px 8px; padding: 6px 6px 6px 12px; border-radius: 10px; background: #2a2a2a; font-size: 14px; }
#update button { padding: 6px 12px; }
#info-full div:first-child { color: var(--dim); font-size: 13px; word-break: break-all; }
/* The photo stays fixed at the top; only the controls below it scroll. */
html, body { height: 100%; overflow: hidden; }
/* Pinned to the window's edges rather than 100dvh, which iOS has been known to work out wrongly for installed apps. */
body { display: flex; flex-direction: column; position: fixed; inset: 0; }
body.short-window { padding-bottom: 0; } /* see fitInstalledWindow in app.js */
header { flex: 0 0 auto; }
main { flex: 1 1 auto; min-height: 0; width: 100%; max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; }
#controls { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

/* A fixed height while cropping, so Taller and Wider stay put under the finger; elsewhere the area shrinks to the photo. */
#stage { flex: 0 0 auto; height: 52dvh; display: flex; justify-content: center; align-items: center; padding: 0 8px; }
#stage.fit { height: auto; padding-bottom: 8px; }
#empty { color: var(--dim); max-width: 26em; padding: 0 12px; font-size: 14px; }
#empty .lead { color: var(--fg); font-size: 26px; font-weight: 700; margin: 0 0 16px; }
/* Before a photo is open the message fills the screen and any tap opens one. */
#stage:has(#empty:not([hidden])) { flex: 1 1 auto; height: auto; }
body:has(#empty:not([hidden])) { cursor: pointer; }
#preview, #framed { max-width: 100%; max-height: 52dvh; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

button, .button {
  font: inherit; color: var(--fg); background: #2a2a2a; border: 1px solid #3a3a3a; border-radius: 8px;
  padding: 8px 12px; cursor: pointer;
}
button.primary, .button.primary { background: var(--accent); color: #111; border-color: var(--accent); font-weight: 700; }
button.active { border-color: var(--accent); color: var(--accent); }

#tabs { flex: 0 0 auto; display: flex; margin: 0 8px 8px; border-bottom: 1px solid #333; }
#tabs button { flex: 1 1 0; background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 0 7px; color: var(--dim); margin-bottom: -1px; }
#tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.panel { background: var(--panel); border-radius: 12px; margin: 0 8px 16px; padding: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.slider { display: block; margin: 10px 0; }
.slider output { float: right; color: var(--dim); }
.slider input { display: block; width: 100%; margin-top: 4px; }
.field { display: block; margin: 10px 0; }
.field textarea { display: block; width: 100%; margin-top: 4px; font: inherit; padding: 8px; border-radius: 8px; border: 1px solid #3a3a3a; background: #111; color: var(--fg); }
.field input { display: block; width: 100%; margin-top: 4px; font: inherit; padding: 8px; border-radius: 8px; border: 1px solid #3a3a3a; background: #111; color: var(--fg); }
.hint { color: var(--dim); font-size: 13px; margin: 6px 0; }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--dim); }

#strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; }
#strip button { flex: 0 0 auto; padding: 4px; background: none; border: 2px solid transparent; scroll-snap-align: start; text-align: center; }
#strip button.active { border-color: var(--accent); }
#strip canvas { display: block; width: 96px; height: 96px; object-fit: cover; border-radius: 4px; background: #222; }
#strip span { display: block; font-size: 12px; margin-top: 4px; max-width: 96px; }
#strip small { display: block; font-size: 10px; color: var(--accent); }
.nudge { background: #2a2a2a; border-radius: 10px; padding: 8px 12px 2px; margin: 8px 0; font-size: 14px; }
.nudge p { margin: 4px 0 8px; }
#combos { margin: 6px 0 10px; }
#combos .combo { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid #2a2a2a; font-size: 13px; }
#combos .combo span { min-width: 0; }
#combos .combo small { display: block; color: var(--dim); }
#combos button { flex: 0 0 auto; padding: 4px 10px; font-size: 13px; }
#strip .divider { flex: 0 0 1px; background: #333; margin: 0 2px; }

#framed { box-shadow: 0 0 0 1px #333; }
#frame-style { margin-bottom: 6px; }

#numbers { font-size: 12px; border-collapse: collapse; margin-top: 8px; width: 100%; }
#numbers th, #numbers td { padding: 2px 6px; text-align: right; }
#numbers th:first-child, #numbers td:first-child { text-align: left; color: var(--dim); }

.gear-row { margin: 4px 0 10px; }
.gear-row h4 { margin: 0 0 6px; font-size: 13px; font-weight: 400; color: var(--dim); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { padding: 6px 10px; border-radius: 16px; font-size: 14px; }
.chips button.add { color: var(--dim); border-style: dashed; }
.ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); margin-top: 2px; }
#notes { color: var(--accent); min-height: 1em; }
.check { display: block; margin: 8px 0; }
#export { margin-top: 12px; }
.caption-line .field { margin-bottom: 6px; }
.line-style { align-items: center; gap: 4px; flex-wrap: nowrap; }
.line-style select { flex: 1 1 auto; min-width: 0; font: inherit; font-size: 14px; color: var(--fg); background: #2a2a2a; border: 1px solid #3a3a3a; border-radius: 8px; padding: 7px 6px; }
.line-style button { flex: 0 0 auto; min-width: 34px; padding: 6px 6px; }
.line-style .size { flex: 0 0 auto; min-width: 1.8em; text-align: center; color: var(--dim); font-size: 13px; }
.aspect-stepper { display: flex; align-items: stretch; gap: 8px; margin-bottom: 10px; }
.aspect-stepper button { flex: 1 1 0; }
#aspect-now { background: none; border-color: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px; }
#aspect-now span { font-size: 18px; font-weight: 700; }
#aspect-now small { font-size: 11px; color: var(--dim); min-height: 1.2em; }
