:root {
  color-scheme: dark;
  --bg: #101316;
  --panel: #191e22;
  --ink: #f6f4ef;
  --muted: #9ca5aa;
  --line: rgba(255,255,255,.12);
  --gold: #f7dd72;
  font-family: Inter, ui-rounded, "SF Pro Rounded", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); }
button, input { font: inherit; }
button { color: inherit; }
main { min-height: 100svh; }
.workspace { min-height: 100svh; padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 28px max(16px, env(safe-area-inset-left)); display: flex; flex-direction: column; }
.week-strip { height: 32px; display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--muted); font-size: .82rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.week-strip .past { color: var(--gold); }
.tiles { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); grid-auto-rows: minmax(220px, 1fr); gap: 14px; padding: 12px 0 14px; }
.exercise-tile { --tile: #315c75; position: relative; min-height: 220px; overflow: hidden; border-radius: 28px; padding: 22px; background: linear-gradient(145deg, color-mix(in srgb, var(--tile) 88%, white), color-mix(in srgb, var(--tile) 78%, black)); box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 12px 28px rgba(0,0,0,.2); cursor: text; transition: transform .2s ease, box-shadow .35s ease, opacity .2s ease; -webkit-user-select: none; user-select: none; }
.exercise-tile:active { transform: scale(.992); }
.exercise-tile.complete { box-shadow: inset 0 0 0 4px var(--gold), inset 0 1px 0 rgba(255,255,255,.25), 0 0 0 3px rgba(247,221,114,.16), 0 18px 45px rgba(247,221,114,.13); }
.tile-top { position: relative; z-index: 3; display: flex; align-items: center; gap: 10px; }
input { min-width: 0; border: 0; outline: 0; color: #fff; background: transparent; border-radius: 8px; }
input:focus { background: rgba(0,0,0,.15); box-shadow: 0 0 0 2px rgba(255,255,255,.45); }
.exercise-name { flex: 1; width: 100%; padding: 5px 7px; font-size: clamp(1.06rem, 3vw, 1.3rem); font-weight: 800; letter-spacing: -.02em; }
.palette-button, .deactivate-button { width: 38px; height: 38px; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; background: rgba(0,0,0,.13); font-size: 1.18rem; cursor: pointer; }
.deactivate-button { font-size: 1.35rem; line-height: 1; font-weight: 800; }
.color-input { position: absolute; right: 0; top: 40px; width: 1px; height: 1px; opacity: 0; }
.counter-wrap { position: absolute; z-index: 2; inset: 56px 20px 43px; display: grid; place-content: center; text-align: center; }
.completed { display: block; width: min(100%, 230px); padding: 0 8px; text-align: center; font-size: clamp(4.2rem, 16vw, 7.2rem); line-height: .95; font-weight: 900; letter-spacing: -.08em; font-variant-numeric: tabular-nums; }
.target-line { display: flex; align-items: center; justify-content: center; gap: 3px; margin-top: 7px; color: rgba(255,255,255,.75); font-weight: 700; }
.target { width: 76px; padding: 3px 5px; color: inherit; font-weight: 800; text-align: center; }
input[type=number]::-webkit-inner-spin-button { display: none; }
.progress-track { position: absolute; z-index: 2; left: 22px; right: 22px; bottom: 20px; height: 5px; overflow: hidden; border-radius: 99px; background: rgba(0,0,0,.22); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: rgba(255,255,255,.88); transition: width .35s ease; }
.delete-tile { position: absolute; z-index: 4; right: 14px; bottom: 8px; width: 30px; height: 30px; padding: 0; border: 0; background: transparent; opacity: 0; font-size: 1.5rem; cursor: pointer; transition: opacity .2s; }
.exercise-tile:hover .delete-tile, .delete-tile:focus { opacity: .62; }
.exercise-tile.inactive { filter: saturate(.28) brightness(.55); box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 8px 18px rgba(0,0,0,.18); cursor: default; }
.exercise-tile.inactive::after { content: ""; position: absolute; z-index: 3; left: 7%; right: 7%; top: 50%; height: 5px; border-radius: 99px; background: rgba(255,255,255,.8); box-shadow: 0 2px 8px rgba(0,0,0,.45); transform: rotate(-12deg); pointer-events: none; }
.exercise-tile.inactive .counter-wrap, .exercise-tile.inactive .exercise-name, .exercise-tile.inactive .palette-button, .exercise-tile.inactive .progress-track { opacity: .48; }
.exercise-tile.inactive .deactivate-button { background: rgba(255,255,255,.9); color: #171a1c; opacity: 1; }
.exercise-tile.inactive .celebration { display: none; }
.exercise-tile.drag-origin { opacity: .18; transform: scale(.96); }
.exercise-tile.drag-ghost { position: fixed; z-index: 1000; margin: 0; pointer-events: none; opacity: .94; transform: rotate(1.5deg) scale(1.025); box-shadow: 0 28px 65px rgba(0,0,0,.5), inset 0 0 0 3px rgba(255,255,255,.72); transition: none; }
body.is-reordering { overflow: hidden; cursor: grabbing; }
body.is-reordering .exercise-tile:not(.drag-ghost) { cursor: grabbing; }
.celebration { position: absolute; z-index: 1; inset: 0; opacity: 0; pointer-events: none; transition: opacity .3s; }
.complete .celebration { opacity: 1; }
.crown { position: absolute; right: 16px; top: 50px; color: var(--gold); font-size: 3.5rem; line-height: 1; transform: rotate(8deg); filter: drop-shadow(0 4px 6px rgba(0,0,0,.2)); animation: crown 1.8s ease-in-out infinite; }
.spark { position: absolute; color: var(--gold); animation: float 2.5s ease-in-out infinite; }
.s1 { left: 8%; top: 22%; font-size: 1.4rem; }.s2 { left: 14%; bottom: 18%; }.s3 { right: 10%; bottom: 20%; font-size: 1.7rem; }.s4 { right: 25%; top: 17%; }.s5 { left: 37%; top: 12%; }
@keyframes crown { 50% { transform: translateY(-5px) rotate(3deg) scale(1.07); } }
@keyframes float { 50% { transform: translateY(-7px) rotate(25deg); opacity: .55; } }
.add-tile { min-height: 70px; border: 1px dashed rgba(255,255,255,.25); border-radius: 24px; background: rgba(255,255,255,.035); display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; color: var(--muted); }
.add-tile span { font-size: 2rem; line-height: 1; }.add-tile small { font-size: .9rem; font-weight: 700; }
.history { padding: 52px max(16px, env(safe-area-inset-right)) max(38px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: #14181b; }
.history-heading { max-width: 980px; margin: 0 auto 18px; display: flex; align-items: center; justify-content: space-between; }
h2 { margin: 0; font-size: 1.35rem; }
.text-button { border: 0; background: transparent; color: var(--gold); font-size: .9rem; font-weight: 750; cursor: pointer; }
.calendar { max-width: 980px; margin: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.week-card { min-height: 100px; padding: 15px; text-align: left; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); cursor: pointer; }
.week-card.active { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.week-card strong, .week-card span { display: block; }.week-card strong { margin-bottom: 16px; font-size: .95rem; }.week-card span { color: var(--muted); font-size: .77rem; line-height: 1.45; }
.week-card .score { color: var(--ink); font-weight: 750; }
.data-actions { max-width: 980px; margin: 28px auto 0; display: flex; gap: 10px; }
.action-button { min-height: 48px; padding: 0 20px; border: 0; border-radius: 14px; background: var(--ink); color: var(--bg); font-weight: 800; cursor: pointer; }.action-button.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.toast { position: fixed; z-index: 20; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px); padding: 12px 17px; border-radius: 12px; background: #f6f4ef; color: #101316; font-weight: 750; opacity: 0; pointer-events: none; transition: .25s; box-shadow: 0 10px 30px rgba(0,0,0,.35); }.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 760px) { .workspace { padding-inline: 28px; }.tiles { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }.add-tile { min-height: 76px; }.history { padding-inline: 28px; } }
@media (min-width: 1100px) { .tiles { grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); }.exercise-tile { min-height: 260px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
