:root {
  --bg: #070708;
  --bg-elev: #101012;
  --card: rgba(20, 20, 22, 0.78);
  --line: rgba(232, 195, 106, 0.12);
  --gold: #e0b84e;
  --gold-2: #f3d58a;
  --gold-dim: #8a6a1f;
  --ink: #14110b;
  --text: #f4f1ea;
  --muted: #a39e92;
  --dim: #6d685e;
  --green: #3dd68c;
  --red: #f07171;
  --nav: 86px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --radius: 20px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  min-height: 100dvh;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  padding-top: var(--safe-top);
  max-width: 480px;
  margin: 0 auto;
  letter-spacing: -0.01em;
}
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(224, 184, 78, 0.14), transparent 55%),
    radial-gradient(600px 300px at 100% 20%, rgba(224, 184, 78, 0.05), transparent 50%);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
input, select {
  background: #0b0b0d;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 13px 14px;
  width: 100%;
  outline: none;
  color: var(--text);
}
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(224,184,78,0.12); }
input[type=number]::-webkit-inner-spin-button { opacity: 1; }

.header {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px 10px;
  background: linear-gradient(180deg, rgba(7,7,8,0.94), rgba(7,7,8,0.72) 70%, transparent);
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.logo {
  font-size: 18px; font-weight: 750; letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.date { color: var(--muted); font-size: 12px; text-transform: capitalize; font-weight: 500; }

main { position: relative; z-index: 1; padding: 6px 16px calc(var(--nav) + var(--safe-bot) + 28px); }
body.timer-on main { padding-bottom: calc(var(--nav) + var(--safe-bot) + 168px); }

.tab { display: none; animation: rise .28s ease; }
.tab.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.hero {
  background: linear-gradient(160deg, rgba(224,184,78,0.16), rgba(20,20,22,0.9) 42%);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}
.kicker { color: var(--gold); font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.hero h2 { margin: 6px 0 0; font-size: 26px; font-weight: 750; line-height: 1.15; }
.hero p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.hero-meta { display: flex; gap: 8px; margin-top: 14px; }
.pill {
  flex: 1; background: rgba(0,0,0,0.28); border: 1px solid rgba(255,255,255,0.05);
  border-radius: 14px; padding: 8px 10px;
}
.pill b { display: block; font-size: 16px; color: var(--gold-2); }
.pill span { display: block; font-size: 10px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 2px; }

.row-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 6px; scrollbar-width: none; }
.row-scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 9px 14px; border-radius: 999px;
  background: #141416; color: var(--text); font-size: 12px; font-weight: 650;
  border: 1px solid rgba(255,255,255,0.06);
}
.chip.on {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: var(--ink); border-color: transparent;
}

.card, .ex {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
  backdrop-filter: blur(18px);
}
.sec {
  margin: 0 0 12px; font-size: 12px; font-weight: 750;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold);
}
.muted { color: var(--muted); font-size: 13px; }
.dim { color: var(--dim); font-size: 11px; }
.tiny { font-size: 12px; color: var(--muted); }

.shot {
  margin-top: 12px; border-radius: 22px; overflow: hidden;
  border: 1px solid var(--line); background: #111; box-shadow: var(--shadow);
}
.shot img { display: block; width: 100%; height: auto; }

.ex-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.ex-name { font-weight: 700; font-size: 16px; }
.pr { color: var(--gold-2); font-size: 10px; font-weight: 800; letter-spacing: 0.12em; }
.set-head, .set {
  display: grid; grid-template-columns: 28px 1fr 16px 1fr 40px;
  gap: 8px; align-items: center; margin-top: 8px;
}
.set-head { color: var(--dim); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 10px; }
.set .lbl { font-size: 12px; color: var(--gold); font-weight: 700; }
.set input { width: 100%; padding: 10px 8px; text-align: center; flex: none; }
.set.wide { display: flex; }
.set.wide input { width: auto; flex: 1; text-align: left; }
.set .x { color: var(--dim); text-align: center; }
.done {
  width: 40px; height: 40px; border-radius: 12px;
  background: #0b0b0d; border: 1px solid rgba(255,255,255,0.08);
  color: var(--dim); font-weight: 800;
}
.done.on {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: var(--ink); border-color: transparent;
}

.btn {
  width: 100%;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: var(--ink); font-weight: 800; padding: 15px;
  border-radius: 16px; margin-top: 14px;
  box-shadow: 0 10px 24px rgba(224,184,78,0.22);
}
.btn:active { transform: translateY(1px); }
.btn-ghost { background: #101012; color: var(--text); border: 1px solid rgba(255,255,255,0.08); box-shadow: none; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }
.rest-chip.on {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: var(--ink); border-color: transparent;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: #0b0b0d; border-radius: 14px; padding: 12px; border: 1px solid rgba(255,255,255,0.04); }
.stat span { display: block; color: var(--muted); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.stat b { display: block; font-size: 20px; margin-top: 4px; }

.rings { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ring-box { text-align: center; }
.ring-box svg { width: 118px; height: 118px; }
.ring-box .val { font-size: 18px; font-weight: 750; }
.ring-box .lab { font-size: 11px; color: var(--muted); margin-top: 2px; }

.bar { height: 7px; background: #1c1c1f; border-radius: 999px; overflow: hidden; margin: 8px 0; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); border-radius: inherit; transition: width .3s; }
.bar.green > i { background: linear-gradient(90deg, #1f8a55, var(--green)); }
.between { display: flex; justify-content: space-between; align-items: center; }

.drops { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.drop {
  height: 36px; border-radius: 11px; background: #0b0b0d;
  border: 1px solid rgba(255,255,255,0.06); color: var(--dim); font-size: 14px;
}
.drop.on { background: rgba(61,214,140,0.16); border-color: rgba(61,214,140,0.4); color: var(--green); }

.food {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  background: #0b0b0d; border-radius: 12px; padding: 10px 12px; margin-top: 8px;
  border: 1px solid rgba(255,255,255,0.04);
}
.del { color: var(--red); font-size: 12px; font-weight: 700; padding: 4px 6px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.preset {
  background: #0b0b0d; border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px; padding: 7px 11px; font-size: 12px; font-weight: 650;
}

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd { text-align: center; background: #0b0b0d; border-radius: 12px; padding: 8px 0; border: 1px solid transparent; }
.wd.on { background: rgba(224,184,78,0.12); border-color: rgba(224,184,78,0.4); }
.wd b { display: block; font-size: 10px; color: var(--muted); font-weight: 650; letter-spacing: 0.04em; }
.wd span { display: block; margin-top: 4px; font-size: 14px; color: var(--gold-2); }

.hist { background: #0b0b0d; border-radius: 14px; padding: 12px; margin-top: 8px; border: 1px solid rgba(255,255,255,0.04); }
.hist summary { list-style: none; display: flex; justify-content: space-between; gap: 8px; cursor: pointer; }
.hist summary::-webkit-details-marker { display: none; }
.sets-view { margin-top: 10px; font-size: 12px; color: var(--muted); line-height: 1.55; }
.hist-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
svg.chart { width: 100%; height: 180px; display: block; }

nav.app {
  position: fixed; left: 50%; bottom: 0; z-index: 30;
  transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: rgba(8,8,10,0.97);
  border-top: 1px solid var(--line);
  padding: 8px 8px var(--safe-bot);
  display: flex; justify-content: space-around;
  backdrop-filter: blur(20px);
}
nav.app button {
  flex: 1; color: var(--dim); display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 6px 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
nav.app button.on { color: var(--gold); }
nav.app svg { width: 22px; height: 22px; }

.timer {
  position: fixed; left: 50%; bottom: calc(var(--nav) + var(--safe-bot) + 8px);
  transform: translateX(-50%);
  width: calc(100% - 24px); max-width: 456px;
  z-index: 25; display: none;
  background: rgba(16, 13, 6, 0.94);
  border: 1px solid rgba(224,184,78,0.35);
  border-radius: 22px; padding: 14px 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
  backdrop-filter: blur(16px);
}
.timer.show { display: block; }
.timer.done { background: rgba(8, 22, 14, 0.94); border-color: rgba(61,214,140,0.4); }
.t-wrap { display: flex; gap: 14px; align-items: center; }
.t-ring { width: 72px; height: 72px; flex: 0 0 auto; }
.t-copy { flex: 1; }
.t-label { font-size: 11px; color: var(--muted); font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.t-clock { font-size: 30px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; line-height: 1.1; }
.timer.done .t-clock { color: var(--green); }
.t-acts { display: flex; gap: 8px; margin-top: 10px; }
.t-acts button {
  flex: 1; background: #0b0b0d; border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px; padding: 9px; font-size: 13px; font-weight: 700;
}

.toast {
  position: fixed; left: 50%; top: calc(var(--safe-top) + 62px);
  transform: translateX(-50%) translateY(-8px); opacity: 0; pointer-events: none;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: var(--ink); font-weight: 800; font-size: 13px;
  padding: 10px 16px; border-radius: 999px; z-index: 50; transition: .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.lightbox {
  display: none; position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.94);
  align-items: center; justify-content: center; padding: 16px;
}
.lightbox.show { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }

.welcome, .done-sheet {
  display: none; position: fixed; inset: 0; z-index: 55;
  background: rgba(5,5,6,0.86); align-items: flex-end; justify-content: center;
}
.welcome.show, .done-sheet.show { display: flex; }
.sheet {
  width: 100%; max-width: 480px; background: #111113;
  border-radius: 28px 28px 0 0; padding: 22px 20px calc(24px + var(--safe-bot));
  border: 1px solid var(--line);
}
.sheet h3 { margin: 0; font-size: 24px; }
.sheet p { color: var(--muted); line-height: 1.5; }

.install { display: none; }
.install.show { display: block; }
ul.tips { margin: 0; padding-left: 18px; color: #d7d1c5; font-size: 14px; line-height: 1.65; }
.empty { text-align: center; color: var(--dim); padding: 22px 8px; }
.hidden { display: none !important; }
.delta-up { color: var(--green); }
.delta-down { color: var(--gold-2); }
