:root{font-family:-apple-system,BlinkMacSystemFont,"Hiragino Sans","Noto Sans JP",sans-serif;color:#171719;background:#f2f2f5;--bg:#f2f2f5;--surface:#fff;--text:#171719;--muted:#89898e;--line:#dedee3;--selected:#e7e7ed;--accent:#5148ef;--shadow:0 5px 14px #26263a08;--tab:rgba(255,255,255,.83);font-synthesis:none;-webkit-font-smoothing:antialiased}*{box-sizing:border-box}html,body{margin:0;min-height:100%;overscroll-behavior-y:none}body{color:var(--text);background:var(--bg);font-size:16px}button,input,textarea,select{font:inherit;color:inherit}button{border:0;background:none;cursor:pointer;-webkit-tap-highlight-color:transparent;touch-action:manipulation}button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}button:disabled{cursor:default}svg{width:24px;height:24px;display:block;pointer-events:none}button:active:not(:disabled){opacity:.75} [hidden]{display:none!important}main{max-width:600px;margin:auto;padding:0 10px 100px}.toolbar{display:flex;align-items:center;gap:10px;padding:calc(env(safe-area-inset-top,0px) + 12px) 0 13px;position:sticky;top:0;z-index:3;background:var(--bg)}.spacer{flex:1}.round{display:grid;place-items:center;width:43px;height:43px;border-radius:50%;background:var(--surface);box-shadow:var(--shadow);flex-shrink:0}.round.accent{background:var(--accent);color:white}.round svg{width:23px;height:23px}.habit-card{--habit:#0ba5d5;border-radius:24px;background:linear-gradient(165deg,color-mix(in srgb,var(--habit) 7%,var(--surface)),var(--surface) 70%);padding:15px 15px 17px;margin-bottom:16px;box-shadow:0 5px 12px #3030440a}.card-top{display:flex;align-items:center;gap:12px;margin-bottom:13px}.habit-icon{display:grid;place-items:center;flex-shrink:0;width:46px;height:46px;border-radius:13px;background:color-mix(in srgb,var(--habit) 16%,var(--surface));color:var(--habit)}.habit-icon svg{width:26px;height:26px}.habit-name{font-size:19px;font-weight:500;letter-spacing:-.35px;text-align:left;padding:0;min-width:0;flex:1;overflow-wrap:anywhere}.log-button{width:47px;height:47px;border-radius:16px;background:var(--surface);box-shadow:0 1px 5px #22222210;display:grid;place-items:center;flex-shrink:0;color:#9a9a9c;font-size:15px}.log-button svg{width:26px;height:26px}.log-button.is-done{background:var(--habit);color:white}.heat{display:grid;grid-template-columns:repeat(var(--cols),minmax(0,1fr));gap:3px;align-items:center}.heat .cell{width:100%;aspect-ratio:1;border-radius:3px;padding:0;position:relative;background:color-mix(in srgb,var(--habit) 7%,var(--surface))}.heat .cell.filled,.day-cell.filled{background:color-mix(in srgb,var(--habit) calc(var(--level)*100%),var(--surface))}.cell.today,.day-cell.today{box-shadow:inset 0 0 0 1.2px var(--text)}.cell.future{opacity:.35}.cell.has-note:after,.day-cell.has-note:after{content:'';position:absolute;inset:32%;border-radius:50%;background:var(--habit)}.filled.has-note:after{background:var(--surface)}.tabs{position:fixed;bottom:calc(env(safe-area-inset-bottom,0px) + 25px);left:50%;transform:translateX(-50%);display:flex;gap:5px;align-items:center;padding:6px;border-radius:40px;background:var(--tab);box-shadow:0 10px 28px #25252d25,inset 0 1px 1px #fff9;backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);z-index:4}.tabs button{width:50px;height:44px;display:grid;place-items:center;border-radius:50%}.tabs button.active{background:var(--selected)}.tabs svg{width:24px;height:24px}#listHead{display:flex;align-items:center;justify-content:space-between;margin:0 0 13px;gap:8px;color:var(--muted);font-size:12px}.pill{background:var(--surface);border-radius:25px;box-shadow:var(--shadow);padding:10px 14px;font-size:14px;color:var(--text)}.table{background:var(--surface);border-radius:21px;overflow:hidden;box-shadow:var(--shadow)}.table-row{display:grid;grid-template-columns:minmax(0,1fr) repeat(var(--days),minmax(0,1fr));grid-template-columns:minmax(90px,1fr) repeat(var(--days),minmax(0, var(--day-width,37px)));align-items:center;gap:6px;padding:9px 13px;border-bottom:1px solid var(--line)}.table-row:last-child{border:0}.table-row.head{font-size:12px;color:var(--muted);min-height:52px;text-align:center}.table-row.head>span:first-child{text-align:left;align-self:end;padding-bottom:3px}.table-row.head b{font-size:14px;font-weight:400;display:block;margin-top:2px}.table-row.head .current{color:var(--text);font-weight:700}.table-row.head .current b{font-weight:700}.table-name{display:flex;gap:10px;align-items:center;min-width:0;text-align:left;padding:0}.table-name span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:15px}.table-name .habit-icon{width:34px;height:34px;border-radius:10px}.table-name .habit-icon svg{width:21px;height:21px}.day-cell{width:100%;max-width:34px;aspect-ratio:1;border-radius:9px;background:color-mix(in srgb,var(--habit) 9%,var(--surface));padding:0;position:relative;justify-self:center}.day-cell.today{box-shadow:inset 0 0 0 1.5px var(--text)}.compact-row{display:flex;align-items:center;gap:10px;background:var(--surface);padding:13px;border-radius:18px;margin-bottom:8px;box-shadow:var(--shadow)}.compact-row .habit-icon{width:37px;height:37px}.compact-row small{color:var(--muted);white-space:nowrap}.compact-row .log-button{width:39px;height:39px}.empty{text-align:center;color:var(--muted);padding:65px 20px}.empty svg{margin:0 auto 15px;color:var(--accent);width:45px;height:45px}.empty h2{font-size:19px;color:var(--text)}.empty .primary{margin-top:15px}#filterLabel{font-size:13px;color:var(--muted);margin:0 6px 10px}#detail{padding:0 18px 35px}.detail-heading{display:flex;align-items:center;gap:15px;margin:14px 0 20px}.detail-heading .habit-icon{width:53px;height:53px;border-radius:16px}.detail-heading h1{font-size:28px;line-height:1.15;margin:0 0 5px;overflow-wrap:anywhere}.detail-heading p{margin:0;color:var(--muted);font-size:13px;white-space:pre-wrap}.detail-chart{padding:15px 13px 12px;border-radius:24px;background:linear-gradient(165deg,color-mix(in srgb,var(--habit) 7%,var(--surface)),var(--surface) 75%);box-shadow:var(--shadow)}.chart-layout{display:grid;grid-template-columns:18px minmax(0,1fr);gap:5px}.month-labels{display:grid;grid-template-columns:repeat(var(--cols),minmax(0,1fr));height:14px;color:var(--muted);font-size:10px;white-space:nowrap}.week-labels{display:grid;grid-template-rows:repeat(7,1fr);font-size:10px;color:var(--muted);align-items:center;text-align:center}.badges{display:flex;gap:8px;flex-wrap:wrap;margin:14px 0 20px}.badge{color:var(--habit);background:color-mix(in srgb,var(--habit) 12%,var(--surface));border-radius:30px;padding:7px 11px;font-size:13px}.calendar{background:var(--surface);border-radius:24px;padding:15px 12px;box-shadow:var(--shadow)}.calendar-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:5px;text-align:center}.weekday{font-size:12px;color:var(--muted);padding-bottom:5px}.calendar-day{position:relative;aspect-ratio:.95;display:grid;place-items:center;border-radius:12px;font-size:16px;padding:0;color:var(--text)}.calendar-day.outside{color:var(--muted)}.calendar-day:disabled{opacity:.25}.calendar-day.filled{background:color-mix(in srgb,var(--habit) calc(8% + var(--level)*12%),var(--surface))}.calendar-day.today{box-shadow:inset 0 0 0 1.4px var(--habit);font-weight:600}.calendar-day.filled:after,.calendar-day.has-note:after{content:'';position:absolute;bottom:4px;left:calc(50% - 2.5px);width:5px;height:5px;background:var(--habit);border-radius:50%}.cal-controls{display:flex;gap:7px;align-items:center;margin:15px 0 7px}.cal-controls .pill{padding:9px 10px;font-size:13px;border:1px solid var(--bg)}.cal-controls input{min-width:0;flex:1;border-radius:28px;padding:10px;background:var(--bg);font-size:13px}.cal-controls .round{width:36px;height:36px}.hint{font-size:12px;color:var(--muted);line-height:1.6;text-align:center;margin:7px 0 16px}.calendar .hint{margin:10px 0 0}dialog{border:0;color:var(--text);background:var(--bg);padding:0;max-width:600px;width:100%;margin:auto auto 0;max-height:calc(100% - env(safe-area-inset-top,0px) - 20px);height:calc(100% - env(safe-area-inset-top,0px) - 25px);border-radius:26px 26px 0 0;overflow:auto;overscroll-behavior:contain}dialog::backdrop{background:#0003}.sheet-head{position:sticky;top:0;z-index:2;display:grid;grid-template-columns:42px 1fr 42px;align-items:center;padding:17px 14px 10px;background:color-mix(in srgb,var(--bg) 92%,transparent);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px)}.sheet-head:before{content:'';position:absolute;top:6px;left:45%;width:10%;height:4px;border-radius:5px;background:var(--line)}.sheet-head h2{text-align:center;margin:0;font-size:22px;font-weight:650}.sheet-head .round{width:39px;height:39px}.sheet-body{padding:5px 17px 24px}.sheet form{min-height:100%;display:flex;flex-direction:column}.sheet-foot{position:sticky;bottom:0;padding:12px 24px calc(env(safe-area-inset-bottom,0px) + 20px);margin-top:auto;background:linear-gradient(transparent,var(--bg) 28%);z-index:2}.small-sheet{height:auto;min-height:220px;max-height:85%;padding-bottom:env(safe-area-inset-bottom,0px)}label{display:block;color:var(--muted);font-size:13px;margin:16px 3px 8px;line-height:1.4}input,textarea,select{display:block;width:100%;border:0;background:var(--surface);border-radius:17px;padding:15px 17px;outline:none;margin-top:7px;min-height:49px;color:var(--text);font-size:16px;box-shadow:var(--shadow)}input:focus,textarea:focus,select:focus{box-shadow:0 0 0 1.5px var(--accent)}textarea{resize:vertical}.two{display:grid;grid-template-columns:1fr 1fr;gap:10px}.icon-hero{position:relative;isolation:isolate;min-height:158px;display:grid;place-items:center;overflow:hidden;margin:5px 0 10px;color:var(--habit)}#iconPattern{position:absolute;z-index:-1;inset:0;display:grid;grid-template-columns:repeat(10,1fr);gap:8px;align-content:center;justify-items:center;opacity:.22;transform:rotate(-5deg)}#iconPattern svg{width:19px;height:19px}#chooseIcon{display:grid;justify-items:center;gap:10px;color:var(--habit);padding:4px;background:radial-gradient(var(--bg) 40%,transparent 73%)}#iconPreview{display:grid;place-items:center;width:98px;height:98px;background:color-mix(in srgb,var(--habit) 16%,var(--bg));border-radius:50%;position:relative}#iconPreview svg{width:48px;height:48px}#iconPreview:after{content:'✎';position:absolute;bottom:1px;right:0;border:3px solid var(--bg);color:white;background:var(--habit);width:25px;height:25px;display:grid;place-items:center;border-radius:50%;font-size:17px}.icon-caption{font-size:15px;background:var(--bg);padding:3px 8px;border-radius:10px}.colors{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:12px;padding:5px 5px 12px}.colors button{aspect-ratio:1;border-radius:12px;background:var(--swatch);padding:0}.colors button[aria-pressed=true]{outline:2.5px solid var(--swatch);outline-offset:3px}.segments{display:flex;background:var(--surface);border-radius:17px;padding:4px;box-shadow:var(--shadow);gap:3px}.segments button{flex:1;min-width:0;padding:13px 3px;border-radius:13px;color:var(--muted);font-size:14px}.segments button.active{background:var(--selected);color:var(--text);font-weight:550}.field-row{display:flex;align-items:center;gap:9px;justify-content:space-between;width:100%;background:var(--surface);border-radius:18px;min-height:52px;padding:15px 16px;text-align:left;box-shadow:var(--shadow)}.field-row>span:first-child{flex:1}.field-row strong{display:block;font-size:18px;font-weight:550}.field-row small{display:block;color:var(--muted);margin-top:4px}.chev{font-size:24px;color:var(--muted);line-height:1}#repeatDots{display:flex;gap:4px}#repeatDots i{width:8px;height:8px;border-radius:3px;background:color-mix(in srgb,var(--habit) 17%,var(--surface))}#repeatDots i.on{background:var(--habit)}.primary,.secondary,.danger{display:block;width:100%;padding:14px 16px;border-radius:28px;margin:8px 0;font-size:16px}.primary{color:white;background:var(--accent);font-weight:550}.secondary{background:var(--bg);color:var(--accent)}.danger{color:#e34856;background:transparent}.panel{padding:12px 15px;background:var(--surface);border-radius:18px;box-shadow:var(--shadow);margin:8px 0 20px}.panel p{font-size:13px;line-height:1.6;margin:5px 0 10px}.panel .hint{text-align:left}.check-row{display:flex;align-items:center;gap:10px;font-size:16px;color:var(--text);background:var(--surface);padding:15px;border-radius:17px}.check-row input{width:22px;min-height:22px;margin:0;accent-color:var(--accent);box-shadow:none}.icon-choices{display:grid;grid-template-columns:repeat(6,1fr);gap:8px}.icon-choices button{display:grid;place-items:center;aspect-ratio:1;border-radius:13px;background:var(--surface);color:var(--habit)}.icon-choices button.active{outline:2px solid var(--habit)}.option{width:100%;display:flex;justify-content:space-between;text-align:left;border-radius:14px;background:var(--surface);padding:15px;margin:7px 0}.option.active{color:var(--accent);font-weight:600}.weekdays{display:flex;gap:5px;margin:12px 0}.weekdays button{flex:1;aspect-ratio:1;border-radius:50%;background:var(--surface);font-size:13px}.weekdays button.active{background:var(--accent);color:white}.stat-row{margin:10px 0;display:flex;align-items:center;gap:10px}.stat-row .habit-icon{width:34px;height:34px}.stat-row strong{flex:1;font-size:14px}.stat-bar{height:7px;background:var(--bg);border-radius:6px;overflow:hidden;margin-bottom:12px}.stat-bar i{display:block;height:100%;background:var(--habit);border-radius:6px}#toast{position:fixed;z-index:99;bottom:calc(env(safe-area-inset-bottom,0px) + 90px);left:50%;transform:translateX(-50%);background:#242428;color:white;font-size:13px;padding:10px 17px;border-radius:20px;opacity:0;pointer-events:none;transition:opacity .15s;max-width:90%;width:max-content}#toast.show{opacity:1} :root[data-theme=dark]{--bg:#161619;--surface:#25252a;--text:#f6f6f7;--muted:#a1a1aa;--line:#393940;--selected:#3d3d45;--tab:#29292de8;color-scheme:dark;background:var(--bg)}@media(min-width:500px){.heat{gap:4px}.heat .cell{border-radius:4px}.habit-card{padding:19px}.table-row{--day-width:45px}.day-cell{max-width:40px}}@media(max-width:350px){.table-row{padding:9px 8px;gap:4px;--day-width:30px}.heat{gap:2px}.colors{gap:9px}}
.log-button{overflow:hidden;overflow-wrap:anywhere;padding:4px;font-variant-numeric:tabular-nums}.heat .cell,.day-cell,.calendar-day{-webkit-touch-callout:none;user-select:none}.badge{white-space:nowrap}

/* v3: geometric English lettering, HabitKit-inspired icon browser and progress */
:root{font-family:"Avenir Next",Avenir,-apple-system,BlinkMacSystemFont,"Hiragino Sans","Noto Sans JP",sans-serif}
.habit-name{font-weight:500;letter-spacing:-.2px}.table-name span:last-child{font-weight:500;letter-spacing:-.15px}.detail-heading h1{letter-spacing:-.6px}
.today-progress{margin:0 0 16px}.progress-date{font-size:13px;color:var(--muted);font-weight:500;letter-spacing:.1px;margin:1px 6px 10px}.progress-card{border-radius:22px;background:var(--surface);box-shadow:var(--shadow);min-height:112px;padding:14px 18px;display:flex;align-items:center;justify-content:space-between;gap:12px}.progress-label{font-size:10px;letter-spacing:1.2px;font-weight:700;color:var(--muted)}.progress-number{font-size:34px;line-height:1.18;font-weight:700;letter-spacing:-1.4px;font-variant-numeric:tabular-nums}.progress-number span{font-size:25px;color:var(--muted);font-weight:500;letter-spacing:-.8px}.progress-caption{font-size:12px;color:var(--muted);margin-top:2px}.progress-ring{position:relative;width:76px;height:76px;flex:none;display:grid;place-items:center}.progress-ring svg{position:absolute;inset:0;width:100%;height:100%;fill:none;stroke-width:7}.ring-track{stroke:color-mix(in srgb,var(--accent) 13%,var(--surface))}.ring-fill{stroke:var(--accent);stroke-linecap:round;transition:stroke-dasharray .2s}.progress-ring strong{font-size:17px;font-weight:700;font-variant-numeric:tabular-nums}
.icon-picker{height:calc(100% - env(safe-area-inset-top,0px) - 25px);max-height:calc(100% - env(safe-area-inset-top,0px) - 20px)}.icon-picker .sheet-body{padding-top:0}.icon-picker-controls{position:sticky;top:66px;z-index:1;background:var(--bg);padding:6px 0 12px}.icon-tabs{border-radius:30px;margin-bottom:8px}.icon-tabs button{border-radius:25px}.icon-tabs button.active{background:color-mix(in srgb,var(--accent) 13%,var(--surface));color:var(--accent)}#iconSearch{width:100%;border:0;background:var(--surface);border-radius:22px;padding:10px 14px;font-size:16px;outline:none;box-shadow:var(--shadow)}.icon-category h3{font-size:13px;color:var(--muted);font-weight:500;margin:19px 2px 11px}.icon-choices{gap:9px}.icon-choices button{color:var(--text);box-shadow:var(--shadow);border-radius:14px;padding:6px;min-width:0}.icon-choices button svg{width:30px;height:30px;max-width:100%;max-height:100%}.icon-choices button.active{background:color-mix(in srgb,var(--accent) 13%,var(--surface));outline:1.5px solid var(--accent);color:var(--accent)}.emoji-icon{display:inline-block;font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif;font-size:26px;line-height:1.1}.habit-icon .emoji-icon{font-size:25px}.table-name .emoji-icon{font-size:21px}#iconPreview .emoji-icon{font-size:49px}.detail-heading .emoji-icon{font-size:33px}.icon-choices .emoji-icon{font-size:27px}.calendar-grid .weekday{font-size:12px}.week-labels{font-size:8px}.month-labels{font-size:9px}.cal-controls select{min-width:0;flex:1;border-radius:24px;padding:10px 9px;background:var(--surface);border:0;text-align:center;box-shadow:var(--shadow)}
@media(max-width:360px){.icon-choices{gap:6px}.icon-choices button svg{width:27px;height:27px}.icon-choices .emoji-icon{font-size:24px}}

/* v4: 63 colors, grouped by tone. */
.colors{display:flex;flex-direction:column;gap:17px;padding:5px 5px 12px}.palette-label{font-size:12px;font-weight:600;color:var(--muted);margin:0 0 9px;letter-spacing:.04em}.palette-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:12px}.palette-grid button{width:100%;min-width:0;box-shadow:inset 0 0 0 1px #0000000a}.palette-grid button[aria-pressed=true]{outline:2.5px solid var(--swatch);outline-offset:3px}.palette-grid button[aria-pressed=true]:after{content:"";display:block;width:100%;height:100%;border:2px solid var(--surface);border-radius:12px;box-sizing:border-box}@media(max-width:350px){.palette-grid{gap:9px}}
