/* ───────────────────────────────────────────────
   schlog — iron · chalk · time
   a chalkboard bolted to a squat rack.
   ─────────────────────────────────────────────── */
:root {
  --iron: #0f0d0b;
  --iron-2: #1a1613;
  --rust: #2b211a;
  --chalk: #f2ead8;
  --chalk-dim: rgba(242, 234, 216, .55);
  --chalk-faint: rgba(242, 234, 216, .18);
  --hot: #ff5c1a;
  --hot-deep: #b93a08;
  --tape: #ffd23f;
  --head: 'Anton', 'Impact', 'Arial Narrow', sans-serif;
  --mono: 'Space Mono', ui-monospace, Menlo, monospace;
  --hand: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--iron);
  color: var(--chalk);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.3;
  overflow-x: hidden;
  /* chalk dust + iron grain */
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.035) 0 1px, transparent 2px),
    radial-gradient(circle at 70% 60%, rgba(255,255,255,.03) 0 1px, transparent 2px),
    radial-gradient(circle at 40% 85%, rgba(255,255,255,.025) 0 1px, transparent 2px),
    repeating-linear-gradient(115deg, transparent 0 7px, rgba(255,255,255,.012) 7px 8px);
  background-size: 137px 149px, 211px 173px, 173px 227px, auto;
  padding-bottom: calc(150px + var(--safe-b));
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }

/* ── masthead ─────────────────────────────── */
.masthead {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 4px 6px 6px;
  margin: 0 12px;
}
.wordmark {
  font-family: var(--head);
  font-size: 40px;
  line-height: 1;
  margin: 0;
  letter-spacing: -.01em;
  text-shadow: 2px 2px 0 var(--hot);
}
.wordmark span { color: var(--hot); text-shadow: 2px 2px 0 var(--chalk); }
.gear {
  height: 44px; padding: 0 8px; color: var(--chalk-dim);
  font-family: var(--hand); font-weight: 600; font-size: 15px; letter-spacing: .12em;
}
.gear:active { color: var(--hot); }

/* ── log ─────────────────────────────────── */
.log { padding: 10px 12px 0; }
.empty {
  margin: 60px 20px;
  font-family: var(--hand);
  font-size: 26px;
  color: var(--chalk-dim);
  text-align: center;
}
.empty small { display: block; font-size: 18px; margin-top: 8px; }

/* day header — a strip of duct tape slapped on the board */
.day { margin: 22px 0 8px; }
.dayhead {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left;
  padding: 8px 12px 6px;
  background: var(--tape);
  color: #1a1408;
  box-shadow: 0 2px 0 rgba(0,0,0,.6);
  clip-path: polygon(0 6%, 1.5% 0, 98.5% 4%, 100% 22%, 99.2% 100%, .8% 96%);
  position: sticky; top: 4px; z-index: 5;
}
.dayhead .dname { font-family: var(--head); font-size: 26px; letter-spacing: .01em; }
.dayhead .dsub  { font-family: var(--hand); font-weight: 600; font-size: 16px; opacity: .8; }
.dayhead .dsets { font-family: var(--mono); font-weight: 700; font-size: 13px; opacity: .8; }
.dayhead:active { filter: brightness(.9); }

/* exercise block — a barbell hanging on the rack */
.ex {
  margin: 14px 0 0 6px;
  border-left: 5px solid var(--chalk-faint);
  padding: 4px 0 4px 14px;
  position: relative;
}
.ex.open { border-left-color: var(--hot); }
.ex::before { /* collar */
  content: ""; position: absolute; left: -12px; top: 8px;
  width: 19px; height: 12px; background: var(--chalk); border-radius: 2px;
}
.ex.open::before { background: var(--hot); }
.exhead {
  display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: left;
}
.exname {
  font-family: var(--head); font-size: 30px; line-height: 1;
  letter-spacing: .01em; text-transform: uppercase;
  word-break: break-word;
}
.extime { margin-left: auto; font-size: 12px; color: var(--chalk-dim); white-space: nowrap; }

/* the bar: sets are plates, breaks are gaps */
.bar { margin: 8px 0 2px; display: flex; flex-direction: column; gap: 4px; }
.plate {
  display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 10px;
  min-width: 96px;
  background: linear-gradient(90deg, var(--chalk) 0 4px, transparent 4px 6px, var(--chalk) 6px);
  color: var(--iron);
  border-radius: 3px 8px 8px 3px;
  font-weight: 700;
  transform: skewX(-4deg);
  box-shadow: 3px 3px 0 var(--rust);
  animation: slam .28s cubic-bezier(.2,1.6,.4,1) both;
}
.plate .n  { font-family: var(--head); font-weight: 400; font-size: 18px; letter-spacing: .04em; margin-left: 4px; }
.plate .w  { font-size: 15px; }
.plate .t  { margin-left: auto; font-size: 11px; font-weight: 400; opacity: .7; }
.plate .del { margin-left: 4px; font-size: 18px; line-height: 1; opacity: .5; padding: 0 4px; }
.plate.heavy { background: linear-gradient(90deg, var(--hot) 0 4px, transparent 4px 6px, var(--hot) 6px); color: var(--chalk); box-shadow: 3px 3px 0 var(--hot-deep); }
@keyframes slam { from { transform: translateY(-14px) skewX(-4deg) scale(1.08); opacity: 0; } to { transform: skewX(-4deg); opacity: 1; } }
.gap {
  height: 22px; display: flex; align-items: center; gap: 8px;
  color: var(--chalk-dim); font-family: var(--hand); font-size: 16px; letter-spacing: .04em; text-transform: uppercase;
  padding-left: 6px;
  background: repeating-linear-gradient(90deg, var(--chalk-faint) 0 6px, transparent 6px 12px) left center / 60px 2px no-repeat;
  padding-left: 68px;
}
.gap .del { font-size: 16px; opacity: .5; font-family: var(--mono); }

/* the pit — where you punch in a set */
.pit {
  margin: 12px 0 6px 0;
  padding: 12px 10px 12px;
  background: var(--iron-2);
  border: 2px dashed var(--chalk-faint);
  border-radius: 6px;
}
.dials { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; }
.dial { text-align: center; }
.dial label { display: block; font-family: var(--hand); font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--chalk-dim); margin-bottom: 2px; }
.dial .row { display: flex; align-items: stretch; gap: 4px; }
.dial .row button {
  flex: 0 0 44px;
  height: 58px; font-family: var(--head); font-size: 26px;
  background: var(--rust); border-radius: 6px; color: var(--chalk);
}
.dial .row button:active { background: var(--hot); transform: translateY(2px); }
.dial input {
  flex: 1; width: 0; min-width: 0; text-align: center; height: 58px;
  background: transparent; border: 0; border-bottom: 3px solid var(--chalk);
  font-family: var(--head); font-size: 34px; color: var(--chalk); padding: 0;
  outline: none; border-radius: 0;
}
.dial input:focus { border-bottom-color: var(--hot); }
.slam {
  width: 100%; margin-top: 12px; height: 64px;
  font-family: var(--head); font-size: 30px; letter-spacing: .06em;
  background: var(--hot); color: var(--iron); border-radius: 6px;
  box-shadow: 0 5px 0 var(--hot-deep);
  transform: rotate(-.5deg);
}
.slam:active { transform: translateY(5px) rotate(-.5deg); box-shadow: 0 0 0 var(--hot-deep); }
.breaks { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.breaks span { font-family: var(--hand); font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--chalk-dim); margin-right: 2px; }
.breaks button {
  flex: 1; height: 44px; border: 2px solid var(--chalk-dim); border-radius: 22px;
  font-weight: 700; font-size: 15px;
}
.breaks button:active { background: var(--chalk); color: var(--iron); }
.exdel { margin-top: 12px; width: 100%; text-align: right; font-size: 12px; color: var(--chalk-dim); text-decoration: underline; }

/* ── composer (bottom) ───────────────────── */
.composer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 8px 12px calc(10px + var(--safe-b));
  background: linear-gradient(transparent, var(--iron) 28%);
}
.suggest { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.suggest::-webkit-scrollbar { display: none; }
.suggest:empty { display: none; }
.suggest button {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 4px;
  background: var(--chalk); color: var(--iron);
  font-family: var(--head); font-size: 17px; letter-spacing: .03em; text-transform: uppercase;
  transform: rotate(-1deg); box-shadow: 2px 2px 0 var(--rust);
}
.suggest button:nth-child(even) { transform: rotate(1.2deg); }
.suggest button:active { background: var(--hot); }
.newform { display: flex; gap: 8px; }
.newform input {
  flex: 1; min-width: 0; height: 60px; padding: 0 16px;
  background: var(--iron-2); border: 3px solid var(--chalk); border-radius: 4px;
  font-family: var(--head); font-size: 24px; letter-spacing: .02em; text-transform: uppercase;
  outline: none;
}
.newform input::placeholder { color: var(--chalk-faint); text-transform: none; font-family: var(--hand); font-size: 20px; letter-spacing: .02em; }
.newform input:focus { border-color: var(--hot); }
.newform button {
  flex: 0 0 60px; height: 60px; border-radius: 4px;
  background: var(--chalk); color: var(--iron); font-family: var(--head); font-size: 22px; letter-spacing: .06em;
  box-shadow: 0 4px 0 var(--rust);
}
.newform button:active { transform: translateY(4px); box-shadow: none; background: var(--hot); }

/* ── drawers ─────────────────────────────── */
.drawer {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.72); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end;
}
.drawer[hidden] { display: none; }
.drawer-card {
  width: 100%; padding: 18px 18px calc(24px + var(--safe-b));
  background: var(--iron-2); border-top: 4px solid var(--hot);
  animation: rise .25s ease-out;
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-head h2 { margin: 0; font-family: var(--head); font-size: 34px; text-transform: uppercase; }
.drawer-head .x { font-size: 34px; width: 44px; height: 44px; color: var(--chalk-dim); }
.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 16px; }
.tot { background: var(--iron); padding: 10px 6px; text-align: center; border-radius: 4px; border: 1px solid var(--chalk-faint); }
.tot b { display: block; font-family: var(--head); font-size: 34px; font-weight: 400; color: var(--hot); line-height: 1; }
.tot span { font-family: var(--hand); font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--chalk-dim); }
.big {
  width: 100%; height: 60px; border-radius: 4px;
  font-family: var(--head); font-size: 22px; letter-spacing: .04em;
  background: var(--chalk); color: var(--iron); box-shadow: 0 4px 0 var(--rust);
}
.big:active { transform: translateY(4px); box-shadow: none; background: var(--hot); }
.big.ghost { background: transparent; color: var(--chalk-dim); border: 2px solid var(--chalk-faint); box-shadow: none; }
.big.ghost:active { color: var(--hot); border-color: var(--hot); background: transparent; }
.hint { margin: 8px 2px 0; font-family: var(--hand); font-size: 15px; color: var(--chalk-dim); }
.hint.tiny { font-family: var(--mono); font-size: 11px; margin-top: 16px; }
hr { border: 0; border-top: 1px dashed var(--chalk-faint); margin: 18px 0; }

/* ── toast ───────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(120px + var(--safe-b)); z-index: 60;
  transform: translateX(-50%) rotate(-2deg);
  background: var(--tape); color: #1a1408; padding: 10px 18px;
  font-family: var(--head); font-size: 20px; letter-spacing: .04em;
  box-shadow: 0 3px 0 rgba(0,0,0,.6);
  animation: rise .2s ease-out;
}
.toast[hidden] { display: none; }
