*{box-sizing:border-box}body{margin:0;background:#f7f5f1;color:#222;font-family:-apple-system,BlinkMacSystemFont,"SF Pro Display","Helvetica Neue",Arial,sans-serif}
.wrap{max-width:760px;margin:auto;padding:28px 18px 90px}.brand{display:flex;align-items:center;margin:0 0 8px}.brand-logo{height:42px;width:42px;object-fit:contain;display:block;border-radius:10px}.title{font-size:40px;line-height:1.05;font-weight:800;margin:4px 0 28px}
.tabs{display:flex;gap:10px;overflow:auto}.tab{border:0;background:#ebe9e5;border-radius:18px;padding:16px 20px;font-size:18px;font-weight:700;white-space:nowrap}.tab.active{background:#222;color:#fff}
.hero{background:#efede8;border-radius:26px;padding:24px;margin:26px 0}.small{font-size:14px;color:#777}.hero h2{font-size:30px;margin:8px 0}.hero p{color:#666}.start,.btn,.complete,.btn-secondary{width:100%;border:0;background:#222;color:#fff;padding:17px;border-radius:16px;font-size:18px;font-weight:800;cursor:pointer}
.btn-secondary{background:#eeece8;color:#222;margin-top:10px}
.section{font-size:28px;font-weight:800;margin:22px 0 14px}.week{display:flex;gap:8px;overflow:auto}.day{min-width:74px;background:#eeece8;border-radius:18px;padding:12px 8px;text-align:center;font-weight:800;border:2px solid transparent;cursor:default}.day span{display:block;font-size:24px;margin-top:4px}.day.today{background:#222;color:#fff;border-color:#222}.day.clickable{cursor:pointer}.day.clickable:active{transform:scale(.98)}
.card{background:#fff;border-radius:20px;margin:12px 0;padding:16px;box-shadow:0 2px 10px #0001}.card-top{display:flex;gap:12px;align-items:flex-start}.card-body{flex:1;min-width:0}.card-image{width:72px;height:72px;border-radius:14px;object-fit:cover;background:#eeece8;flex-shrink:0}.card-image.placeholder{display:flex;align-items:center;justify-content:center;font-size:28px;color:#999}
.name{font-size:18px;font-weight:800}.meta{color:#777;margin-top:7px}.badge{display:inline-block;background:#f0eee9;border-radius:10px;padding:6px 9px;font-size:13px;margin-top:10px}.note{font-size:14px;color:#666;line-height:1.45;margin-top:8px;white-space:pre-wrap}
.card-actions{display:flex;gap:8px;margin-top:12px;flex-wrap:wrap}.card-actions button{border:0;background:#f0eee9;border-radius:12px;padding:12px 14px;font-size:15px;font-weight:700;cursor:pointer;min-height:44px}
.overlay,.rest-screen,.completion-screen{position:fixed;inset:0;background:#0008;display:none;align-items:flex-end;z-index:20;overflow:auto}.modal{background:#fff;border-radius:28px 28px 16px 16px;width:100%;max-height:92vh;overflow:auto;padding:18px}.closex{float:right;border:0;background:#eee;border-radius:50%;width:40px;height:40px;font-size:20px;cursor:pointer}.btn,.complete,.btn-secondary{margin-top:15px}.workout{position:fixed;inset:0;background:#f7f5f1;padding:0;display:none;align-items:stretch;z-index:20;overflow:hidden;height:100%;height:100svh;height:-webkit-fill-available}.rest-screen,.completion-screen{background:#f7f5f1;padding:24px 18px;padding-bottom:calc(24px + env(safe-area-inset-bottom,0px));align-items:stretch}.workout-inner,.rest-inner,.completion-inner{max-width:760px;margin:0 auto;width:100%}.workout-inner{display:flex;flex-direction:column;height:100%;max-height:100%;min-height:0;position:relative}.workout-scroll{flex:1 1 auto;min-height:0;overflow:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;padding:24px 18px calc(24px + 150px + env(safe-area-inset-bottom,0px));padding-top:calc(24px + env(safe-area-inset-top,0px))}.workout-actions{flex-shrink:0;position:fixed;left:50%;transform:translateX(-50%);bottom:0;width:100%;max-width:760px;z-index:30;background:#f7f5f1;padding:12px 18px calc(16px + env(safe-area-inset-bottom,0px));box-shadow:0 -10px 28px #00000014;border-top:1px solid #e8e5df}.workout-actions .complete{margin-top:0}.workout-actions .btn-secondary{margin-top:10px}.workout-secondary-action{margin-top:18px}.progress{color:#777;font-weight:700}.workout h2,.rest-inner h2,.completion-inner h2{font-size:32px;margin:8px 0}
.set-display{font-size:42px;line-height:1.05;font-weight:900;margin:18px 0 8px}.reps-display{font-size:28px;font-weight:800;color:#444;margin-bottom:12px}.workout-image{width:100%;max-height:220px;object-fit:cover;border-radius:18px;margin:12px 0;background:#eeece8}
.rest-screen{align-items:center;justify-content:center;text-align:center}.rest-label{font-size:18px;color:#777;font-weight:700;margin-bottom:8px}.rest-timer{font-size:96px;line-height:1;font-weight:900;letter-spacing:-2px;margin:10px 0 24px}.rest-actions{display:flex;gap:10px;justify-content:center;flex-wrap:wrap}.rest-actions button{min-width:140px;border:0;border-radius:16px;padding:16px 18px;font-size:18px;font-weight:800;cursor:pointer}.rest-skip{background:#222;color:#fff}.rest-add{background:#eeece8;color:#222}
.form-group{margin:14px 0}.form-group label{display:block;font-size:14px;color:#777;font-weight:700;margin-bottom:6px}.form-group input,.form-group textarea,.form-group select{width:100%;border:1px solid #ddd;border-radius:12px;padding:12px;font-size:16px;font-family:inherit;background:#fff}.form-group textarea{min-height:110px;resize:vertical;max-height:none}
.image-picker{display:grid;gap:10px}.image-preview{width:100%;max-height:180px;object-fit:cover;border-radius:16px;background:#eeece8}.image-pick-btn{position:relative;display:block;text-align:center;margin-top:0;cursor:pointer}.file-input{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;font-size:16px}.image-clear-btn{margin-top:0}.form-error-toast{position:fixed;left:50%;bottom:calc(24px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);max-width:min(92vw,560px);background:#222;color:#fff;padding:14px 18px;border-radius:14px;font-size:15px;line-height:1.4;z-index:60;box-shadow:0 8px 24px #0005}
.history-empty{color:#777;font-size:15px;line-height:1.5;padding:8px 0 20px}.history-empty-card{background:#fff}.history-section{margin-top:8px;padding-top:8px;border-top:1px solid #e6e3dd}.history-intro{color:#666;font-size:14px;line-height:1.45;margin:-4px 0 12px}.history-card{cursor:pointer}.history-card:active{transform:scale(.995)}.history-row{display:flex;justify-content:space-between;gap:12px;margin-top:8px;color:#555;font-size:14px}.history-row strong{color:#222}.history-detail-list{margin-top:16px}.history-exercise{background:#f7f5f1;border-radius:16px;padding:14px;margin:10px 0}.status-pill{display:inline-block;background:#222;color:#fff;border-radius:10px;padding:6px 10px;font-size:12px;font-weight:700;margin-top:8px}.status-pill.pending{background:#bbb}.status-pill.in-progress{background:#666}
.modal-image{width:100%;max-height:180px;object-fit:cover;border-radius:16px;margin:10px 0;background:#eeece8}
.completion-stats{display:grid;gap:10px;margin:18px 0}.stat-card{background:#fff;border-radius:16px;padding:14px 16px;box-shadow:0 2px 10px #0001}.stat-label{font-size:13px;color:#777;font-weight:700}.stat-value{font-size:22px;font-weight:800;margin-top:4px}
.resume-banner{background:#222;color:#fff;border-radius:18px;padding:16px 18px;margin:0 0 18px;display:none}.resume-banner p{margin:0 0 12px;line-height:1.4}.resume-actions{display:flex;gap:10px;flex-wrap:wrap}.resume-actions button{border:0;border-radius:12px;padding:12px 14px;font-weight:800;cursor:pointer;min-height:44px}.resume-continue{background:#fff;color:#222}.resume-discard{background:#444;color:#fff}

/* Welcome screen */
.welcome-screen{position:fixed;inset:0;z-index:50;display:flex;align-items:stretch;justify-content:center;overflow:hidden;background:#ebe4da}
.welcome-screen[hidden]{display:none !important}
.welcome-bg{position:absolute;left:50%;top:0;width:100%;height:100%;max-width:100%;max-height:100%;transform:translateX(-50%);object-fit:contain;object-position:center center;pointer-events:none;-webkit-user-select:none;user-select:none}
html.welcome-active,html.welcome-active body{background:#ebe4da}
.welcome-overlay{position:absolute;inset:0;pointer-events:none;background:linear-gradient(180deg,rgba(0,0,0,0) 0%,rgba(0,0,0,0) 58%,rgba(55,45,38,.06) 80%,rgba(55,45,38,.18) 100%)}
.welcome-content{position:relative;z-index:1;width:100%;max-width:480px;margin:0 auto;padding:calc(16px + env(safe-area-inset-top,0px)) 24px calc(20px + env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;justify-content:space-between;min-height:100%;min-height:100dvh;box-sizing:border-box;text-align:center;color:#3d3229;overflow:visible}
.welcome-hero{flex:1 1 auto;display:flex;flex-direction:column;justify-content:flex-start;align-items:center;padding:4px 0 12px;min-height:0}
.welcome-kicker{margin:0 0 12px;font-size:15px;letter-spacing:.04em;font-weight:600;color:rgba(74,61,50,.9)}
.welcome-logo{display:block;height:56px;width:56px;object-fit:contain;margin:0 auto 16px;border-radius:12px;filter:drop-shadow(0 2px 10px rgba(74,61,50,.16))}
.welcome-tagline{margin:0 auto;max-width:20em;font-size:22px;line-height:1.35;font-weight:700;text-wrap:balance;color:#2e2620}
.welcome-actions{display:grid;gap:10px;width:100%;flex:0 0 auto;margin-top:auto;padding-top:12px}
.welcome-btn{width:100%;border:0;border-radius:18px;padding:15px 18px;font-size:17px;font-weight:800;min-height:52px;cursor:pointer}
.welcome-btn-primary{background:#dccfc0;color:#5c4838;box-shadow:0 2px 14px rgba(92,72,56,.14)}
.welcome-btn-secondary{background:#fff;color:#6b5748;border:1px solid rgba(107,87,72,.12);box-shadow:0 2px 12px rgba(92,72,56,.08)}
.welcome-btn-stopwatch{background:rgba(255,255,255,.92);color:#5c4838;border:1px dashed rgba(92,72,56,.28)}

.app-home[hidden],.library-screen[hidden]{display:none !important}
.library-screen{min-height:100vh;min-height:100dvh;background:#f7f5f1}
.library-inner{padding-top:calc(18px + env(safe-area-inset-top,0px));padding-bottom:calc(40px + env(safe-area-inset-bottom,0px))}
.library-back{border:0;background:transparent;color:#222;font-size:16px;font-weight:700;padding:8px 0 14px;cursor:pointer;min-height:44px}
.library-intro{color:#666;font-size:15px;line-height:1.45;margin:-8px 0 18px}
.home-top{padding-top:env(safe-area-inset-top,0px);margin:0 0 8px}
.home-back{border:0;background:transparent;color:#222;font-size:16px;font-weight:700;padding:10px 0;min-height:44px;cursor:pointer}
.list-toolbar{display:grid;gap:10px;margin:0 0 8px}
.list-toolbar-btn{margin-top:0}
.list-hint{color:#777;font-size:13px;line-height:1.4;margin:0 0 10px}
.order-btns{display:flex;flex-direction:column;gap:6px;margin-left:4px}
.order-btns button{border:0;background:#f0eee9;border-radius:10px;width:40px;height:40px;font-size:16px;font-weight:800;cursor:pointer}
.set-resistance-area{margin:4px 0 14px}.set-resistance-label{font-size:14px;color:#777;font-weight:700;margin-bottom:8px}.set-resistance-row{display:inline-flex;gap:8px;align-items:stretch;width:fit-content;max-width:260px;margin-bottom:8px}.set-resistance-row input,.set-resistance-row select{flex:0 0 auto;box-sizing:border-box;border:1px solid #ddd;border-radius:12px;padding:0 12px;font-size:16px;background:#fff;min-height:48px;height:48px;line-height:1.2}.set-resistance-row input{width:5.5ch;min-width:72px;max-width:88px;text-align:center;font-weight:700}.set-resistance-row select{width:auto;min-width:92px;max-width:132px;padding-right:28px}
.history-group-title{font-size:16px;font-weight:800;margin:18px 0 8px;color:#222}
.set-log-line{font-size:14px;color:#444;margin-top:4px}
.library-actions{display:flex;gap:8px;margin-top:12px;flex-wrap:wrap}
.library-actions button{border:0;background:#f0eee9;border-radius:12px;padding:12px 14px;font-size:15px;font-weight:700;cursor:pointer;min-height:44px}
.field-hint{margin:0 0 8px;font-size:13px;line-height:1.4;color:#888}
.instruction-panel{border:1px solid #e8e4dc;border-radius:16px;padding:14px 14px 4px;margin:16px 0;background:#faf9f7}
.instruction-panel legend{padding:0 6px;font-size:14px;font-weight:800;color:#555}
.muscle-checkboxes{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 12px}
.muscle-check{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:600;color:#444;cursor:pointer}
.muscle-check input{width:auto;margin:0;flex:0 0 auto}
.muscle-tags{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0 12px}
.muscle-tag{display:inline-block;background:#efeae2;color:#5a5348;border-radius:999px;padding:4px 10px;font-size:12px;font-weight:700}
.muscle-tag.primary{background:#222;color:#fff}
.instruction-gallery{display:grid;gap:10px}
.instruction-list{display:grid;gap:10px}
.instruction-image-item{display:grid;grid-template-columns:auto 72px 1fr auto;gap:10px;align-items:center;padding:10px;border:1px solid #e5e1da;border-radius:14px;background:#fff}
.instruction-image-item.dragging{opacity:.55}
.instruction-drag{cursor:grab;color:#aaa;font-weight:900;user-select:none;padding:4px}
.instruction-image-item img{width:72px;height:72px;object-fit:cover;border-radius:10px;background:#eeece8}
.instruction-image-fields{display:grid;gap:6px}
.instruction-image-fields select,.instruction-image-fields input{font-size:14px;padding:8px 10px}
.instruction-remove-btn{border:0;background:#f3ece8;color:#a33;border-radius:10px;width:36px;height:36px;font-size:20px;line-height:1;cursor:pointer}
.instruction-add-btn{position:relative;display:block;text-align:center;margin-top:0;cursor:pointer}
.instruction-gallery-view{display:grid;gap:12px;margin:12px 0}
.instruction-view-item{border:1px solid #ece8e1;border-radius:14px;overflow:hidden;background:#fff}
.instruction-view-item img{width:100%;max-height:280px;object-fit:contain;display:block;background:#eeece8}
.detail-row{display:grid;grid-template-columns:minmax(120px,38%) 1fr;gap:8px 12px;align-items:start;margin:10px 0;font-size:15px;line-height:1.45}
.detail-label{font-weight:800;color:#666}
.detail-value{color:#222}
.detail-subnote{margin-top:8px;color:#555}
.detail-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:18px}
.detail-actions .btn,.detail-actions .btn-secondary{margin-top:0;flex:1 1 auto}
.detail-thumbnail-wrap{margin-top:14px}
.detail-thumbnail{width:100%;max-height:220px;object-fit:contain;border-radius:16px;background:#eeece8}
.detail-modal .note:empty{display:none}
.instruction-view-meta{padding:10px 12px;font-size:13px;color:#666}
.instruction-view-meta strong{display:block;color:#333;font-size:14px;margin-bottom:4px}
.detail-section-label{font-size:13px;font-weight:800;color:#888;margin:12px 0 6px;text-transform:uppercase;letter-spacing:.03em}
.pick-empty{color:#777;padding:12px 0}
.resistance-history-btn{display:inline-flex;align-items:center;border:0;background:#f0eee9;color:#222;border-radius:999px;padding:10px 14px;font-size:14px;font-weight:700;margin-left:8px;cursor:pointer;min-height:40px}
.resistance-history-content{margin-top:12px;max-height:60vh;overflow:auto}
.resistance-history-day{margin-bottom:14px}
.resistance-history-date{font-size:15px;font-weight:800;color:#222;margin-bottom:4px}
.workout-pick-btn{margin-top:0 !important;flex:0 1 auto;display:none !important}
#pick-exercise-overlay{z-index:35}
.rest-pick{background:#fff;color:#222;border:2px solid #222}
.rest-pick[hidden]{display:none !important}
.workout-actions .workout-pick-btn,.workout-pick-btn[hidden]{display:none !important}

/* Muscle group filter (library + pick modal) */
.muscle-filter-search-wrap{margin:12px 0 10px}
.muscle-filter-search{width:100%;border:1px solid #ddd;border-radius:14px;padding:12px 14px;font-size:16px;background:#fff}
.muscle-filter-panel{margin:10px 0 16px}
.muscle-filter-breadcrumb{display:flex;align-items:center;flex-wrap:wrap;gap:8px;font-size:13px;color:#666;margin-bottom:10px}
.muscle-filter-breadcrumb strong{color:#222;font-weight:800}
.muscle-filter-breadcrumb .crumb-sep{color:#bbb}
.muscle-filter-reset{border:0;background:#eeece8;color:#222;border-radius:999px;padding:6px 12px;font-size:12px;font-weight:700;cursor:pointer}
.muscle-filter-row{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:10px}
.muscle-filter-chip{border:1px solid #e0ddd6;background:#fff;color:#333;border-radius:999px;padding:8px 14px;font-size:13px;font-weight:700;cursor:pointer;white-space:nowrap}
.muscle-filter-chip.active{background:#222;color:#fff;border-color:#222}
.muscle-filter-chip.subtle{background:#f7f5f1}
.muscle-filter-label{width:100%;font-size:12px;font-weight:800;color:#888;text-transform:uppercase;letter-spacing:.03em;margin:4px 0 2px}
.muscle-filter-select{width:100%;border:1px solid #ddd;border-radius:12px;padding:12px;font-size:16px;background:#fff;margin-bottom:10px}
.muscle-filter-compact .muscle-filter-row{margin-bottom:8px}
.muscle-filter-empty{color:#777;font-size:14px;padding:8px 0}
.muscle-tag.sub{background:#ebe9e5;color:#333}

/* Standalone stopwatch (same visual language as rest timer) */
.stopwatch-screen{z-index:40}
.stopwatch-inner{position:relative;width:100%;max-width:760px;margin:0 auto;padding-top:calc(12px + env(safe-area-inset-top,0px))}
.stopwatch-close{position:absolute;top:calc(4px + env(safe-area-inset-top,0px));right:0;border:0;background:#eeece8;color:#222;border-radius:50%;width:44px;height:44px;font-size:28px;line-height:1;font-weight:700;cursor:pointer}
.stopwatch-actions{margin-top:8px}
.hero .btn-secondary{margin-top:10px}
.welcome-btn-secondary + .welcome-btn-secondary{margin-top:0}
