:root {
  --bg: #1a0f24;
  --card: #261836;
  --card2: #31204a;
  --line: #3e2a5a;
  --text: #f6eefc;
  --muted: #b7a5c9;
  --pink: #ff4f9a;
  --orange: #ff9f45;
  --teal: #2de2d0;
  --green: #5fe39a;
  --grad: linear-gradient(120deg, #ff4f9a 0%, #ff7a6b 50%, #ff9f45 100%);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(76px + var(--safe-b)); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.top { padding: calc(14px + env(safe-area-inset-top, 0px)) 18px 14px;
  background: var(--grad); }
.brand { font-weight: 900; letter-spacing: .08em; font-size: 22px; font-style: italic; color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,.18); }
.brand span { color: #2a0d33; }
.sub { font-size: 13px; color: rgba(255,255,255,.9); margin-top: 2px; }

main { padding: 14px 14px 20px; max-width: 640px; margin: 0 auto; }

.daypick { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.daypick button { flex: 1 0 auto; min-width: 44px; padding: 8px 6px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 13px; font-weight: 600; }
.daypick button.on { background: var(--grad); color: #fff; border-color: transparent; }
.daypick button.today:not(.on) { border-color: var(--teal); color: var(--teal); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px; margin-bottom: 12px; }
.card h2 { margin: 0 0 4px; font-size: 20px; }
.card h3 { margin: 0; font-size: 17px; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.45; }
.small { font-size: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pill { display: inline-block; font-size: 12px; padding: 3px 8px; border-radius: 99px;
  background: var(--card2); color: var(--muted); margin-right: 4px; margin-top: 6px; }
.pill.hot { background: rgba(255,79,154,.18); color: #ff8cbc; }
.pill.go { background: rgba(95,227,154,.15); color: var(--green); }

.hero { background: linear-gradient(160deg, #3a1f52, #261836); }
.datebox { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.datebox input { background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }

details.cue { margin-top: 8px; }
details.cue summary { color: var(--teal); font-size: 13px; cursor: pointer; list-style: none; }
details.cue summary::-webkit-details-marker { display: none; }
details.cue p { margin: 6px 0 0; }

.hint { margin-top: 8px; font-size: 13px; padding: 8px 10px; border-radius: 10px; background: var(--card2); }
.hint.up { background: rgba(95,227,154,.12); color: var(--green); }

.sets { margin-top: 10px; display: grid; gap: 6px; }
.set { display: grid; grid-template-columns: 34px 1fr 1fr 48px; gap: 6px; align-items: center; }
.set.nokg { grid-template-columns: 34px 1fr 48px; }
.set .n { color: var(--muted); font-size: 13px; text-align: center; }
.set label { position: relative; display: block; }
.set input { width: 100%; padding: 10px 34px 10px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); font-size: 17px; text-align: center; }
.set input::placeholder { color: #6d5a83; }
.set .unit { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--muted); pointer-events: none; }
.set .chk { height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--card2); font-size: 20px; color: var(--muted); }
.set.done input { border-color: rgba(95,227,154,.5); }
.set.done .chk { background: var(--green); color: #12301f; border-color: transparent; }

.ex.complete { border-color: rgba(95,227,154,.45); }
.ex .tick { color: var(--green); font-weight: 700; }

.checklist label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.4; }
.checklist label:first-of-type { border-top: 0; }
.checklist input { width: 20px; height: 20px; accent-color: var(--pink); flex: none; margin-top: 1px; }

.btn { display: block; width: 100%; padding: 14px; border-radius: 14px; border: 0; background: var(--grad); color: #fff; font-weight: 800; font-size: 16px; letter-spacing: .02em; }
.btn.ghost { background: var(--card2); color: var(--text); font-weight: 600; }
.btn + .btn { margin-top: 8px; }

select { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card2); }
canvas { width: 100%; height: 220px; display: block; margin-top: 10px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 22px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { font-size: 11px; color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
td, th { text-align: left; padding: 7px 4px; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; border-top: 0; }

.hist-item .del { background: none; border: 0; color: #ff7a9c; font-size: 13px; }
.hist-ex { font-size: 13px; color: var(--muted); margin-top: 4px; }
.hist-ex b { color: var(--text); font-weight: 600; }

ol, ul { padding-left: 20px; margin: 6px 0; }
li { margin: 5px 0; font-size: 14px; line-height: 1.45; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: rgba(26,15,36,.96);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b); backdrop-filter: blur(10px); z-index: 20; }
.tabs button { flex: 1; background: none; border: 0; color: var(--muted); padding: 8px 0 10px; font-size: 11px; font-weight: 600; }
.tabs .ico { display: block; font-size: 20px; margin-bottom: 2px; filter: grayscale(.8); opacity: .7; }
.tabs button.active { color: var(--pink); }
.tabs button.active .ico { filter: none; opacity: 1; }

.timer { position: fixed; left: 10px; right: 10px; bottom: calc(70px + var(--safe-b)); z-index: 19;
  background: #2f1b45; border: 1px solid var(--pink); border-radius: 16px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); max-width: 620px; margin: 0 auto; }
.timer.hidden { display: none; }
.timer.finished { border-color: var(--green); animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(95,227,154,.25); } }
.timer-bar { height: 4px; background: var(--line); }
#timerFill { height: 100%; width: 0; background: var(--grad); transition: width .25s linear; }
.timer-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; }
.timer-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.timer-time { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer-btns { display: flex; gap: 6px; }
.timer-btns button { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card2); font-weight: 600; }
.timer-btns .primary { background: var(--grad); border: 0; color: #fff; }

.toast { position: fixed; left: 50%; top: 20px; transform: translateX(-50%); background: var(--card2); border: 1px solid var(--teal);
  padding: 10px 16px; border-radius: 12px; z-index: 50; font-size: 14px; max-width: 90vw; }
.toast.hidden { display: none; }

.rest-day { text-align: center; padding: 30px 14px; }
.rest-day .big { font-size: 54px; }
body.timing { padding-bottom: calc(170px + var(--safe-b)); }
