:root {
  --bg: #14120F;
  --field: #1C1A16;
  --field2: #1A1813;
  --cell0: #201E19;
  --line: #322E27;
  --line2: #221F1A;
  --dash: #3d382f;
  --ink: #F2ECE0;
  --mut: #8A8478;
  --dim: #5E594F;
  --nav: #6b6459;
  --accent: #FF4D19;
  --accent16: rgba(255,77,25,.16);
  --accent34: rgba(255,77,25,.34);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Archivo', sans-serif;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  user-select: none;
  -webkit-user-select: none;
}
input, textarea { user-select: text; -webkit-user-select: text; }

#app { height: 100dvh; display: flex; flex-direction: column; position: relative; overflow: hidden; }
#screen { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding-top: env(safe-area-inset-top); }
#screen::-webkit-scrollbar { width: 0; height: 0; }
.hscroll { display: flex; gap: 8px; overflow-x: auto; }
.hscroll::-webkit-scrollbar { width: 0; height: 0; }

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 40;
  background-image: radial-gradient(rgba(255,255,255,.045) .5px, transparent .6px);
  background-size: 3px 3px;
}

.mono { font-family: 'Space Mono', monospace; }
.narrow { font-family: 'Archivo Narrow', sans-serif; font-weight: 700; }

@keyframes gaFade { from { opacity: 0 } to { opacity: 1 } }
@keyframes gaUp { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
.fade { animation: gaFade .3s ease; }

input { font: inherit; color: var(--ink); }
input::placeholder { color: var(--dim); }
input:focus { outline: none; border-color: var(--accent) !important; }
button { font: inherit; cursor: pointer; padding: 0; }

/* section head: 01 CONSISTENCY ---- */
.sechead { display: flex; align-items: center; gap: 10px; margin: 30px 0 12px; }
.sechead .num { font-family: 'Space Mono', monospace; font-size: 11px; font-weight: 700; color: var(--accent); }
.sechead .ttl { font-family: 'Space Mono', monospace; font-size: 11px; font-weight: 700; letter-spacing: .2em; color: var(--mut); }
.sechead .sub { font-family: 'Space Mono', monospace; font-size: 9px; letter-spacing: .12em; color: var(--dim); }
.sechead .rule { flex: 1; height: 1px; background: var(--line); }

/* list head: SUPPLEMENTS ---- 3/5 TAKEN */
.listhead { display: flex; align-items: center; justify-content: space-between; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.listhead .l { font-family: 'Space Mono', monospace; font-size: 10px; font-weight: 700; letter-spacing: .16em; color: var(--mut); }
.listhead .r { font-family: 'Space Mono', monospace; font-size: 10px; color: var(--dim); }

.panel { border: 1px solid var(--line); }

/* segmented progress bar */
.pbar { position: relative; height: 16px; background: var(--line2); margin-top: 16px; overflow: hidden; }
.pbar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); transition: width .4s ease; }
.pbar .seg { position: absolute; inset: 0; background-image: repeating-linear-gradient(90deg, transparent, transparent calc(3.3333% - 1.5px), var(--bg) calc(3.3333% - 1.5px), var(--bg) 3.3333%); }
.pbar.thin { height: 9px; margin-top: 0; }
.pbar.thin .seg { background-image: repeating-linear-gradient(90deg, transparent, transparent calc(5% - 1.5px), var(--bg) calc(5% - 1.5px), var(--bg) 5%); }

/* set-row grid */
.setgrid { display: grid; grid-template-columns: 22px 1fr 1fr 38px 38px; gap: 7px; }
.setgrid input {
  width: 100%; background: var(--field); border: 1px solid var(--line);
  font-family: 'Archivo Narrow', sans-serif; font-weight: 700; font-size: 18px;
  text-align: center; padding: 9px 3px;
}

/* quick-add fields */
.qa-num { position: relative; }
.qa-num input {
  width: 100%; background: var(--field); border: 1px solid var(--line);
  font-family: 'Archivo Narrow', sans-serif; font-weight: 700; font-size: 18px; padding: 11px 46px 11px 12px;
}
.qa-num span { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); font-family: 'Space Mono', monospace; font-size: 9px; letter-spacing: .06em; color: var(--dim); }

/* nav */
#nav {
  flex: 0 0 auto; height: calc(66px + env(safe-area-inset-bottom));
  border-top: 1.5px solid var(--line); background: var(--bg);
  display: flex; padding-bottom: env(safe-area-inset-bottom); z-index: 25;
}
#nav button {
  flex: 1; border: none; border-top: 2px solid transparent; background: none; color: var(--nav);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
#nav button.on { border-top-color: var(--accent); color: var(--accent); }
#nav button span { font-family: 'Space Mono', monospace; font-size: 10px; font-weight: 700; letter-spacing: .08em; }

/* buttons */
.btn-ghost {
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  font-family: 'Space Mono', monospace; font-size: 12px; font-weight: 700; letter-spacing: .1em; padding: 12px; width: 100%;
}
.btn-accent {
  border: none; background: var(--accent); color: var(--bg);
  font-family: 'Space Mono', monospace; font-size: 14px; font-weight: 700; letter-spacing: .14em; padding: 17px; width: 100%;
}
.btn-dash {
  border: 1.5px dashed var(--dash); background: transparent; color: var(--accent);
  font-family: 'Space Mono', monospace; font-size: 12px; font-weight: 700; letter-spacing: .1em; padding: 13px; width: 100%;
}

/* modal */
.modal-wrap { position: absolute; inset: 0; z-index: 30; background: rgba(8,7,5,.72); display: flex; align-items: flex-end; animation: gaFade .2s ease; }
.modal { width: 100%; background: var(--bg); border-top: 1.5px solid var(--accent); padding: 22px 22px calc(30px + env(safe-area-inset-bottom)); animation: gaUp .28s ease; }

/* photo placeholder texture */
.ph-empty { background: repeating-linear-gradient(135deg, #1C1A16, #1C1A16 6px, #191713 6px, #191713 12px); }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); font-family: 'Space Mono', monospace; font-size: 11px; font-weight: 700;
  letter-spacing: .08em; padding: 10px 16px; z-index: 60; display: none; white-space: nowrap;
}
#toast.show { display: block; animation: gaUp .25s ease; }
