* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: #000; color: #fff; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  font-size: 17px; line-height: 1.3; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; text-align: left; }
.nav button, .seg button, .days button, .ov-btns button, .card .item.btn, .card .item.danger, .bar .btn, .grid .d { text-align: center; }
input, select, textarea { font: inherit; font-size: 16px; color: #fff; background: #1c1c1e; border: 0; border-radius: 10px; padding: 10px 12px; width: 100%; outline: none; }
textarea { min-height: 120px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.dim { color: #8e8e93; }
.green { color: #30d158; }
.red { color: #ff453a; }
.small { font-size: 13px; }

#app { max-width: 520px; margin: 0 auto; padding: 8px 20px 140px; min-height: 100vh; }

.top { display: flex; justify-content: space-between; align-items: flex-end; padding: 14px 0 4px; }
.top .date { color: #8e8e93; font-size: 13px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; white-space: nowrap; }
.top h1 { font-size: 34px; font-weight: 700; letter-spacing: -.5px; margin-top: 2px; }
.top .nav { display: flex; gap: 6px; padding-bottom: 6px; }
.top .nav button { background: #141414; border-radius: 10px; padding: 7px 12px; font-size: 14px; font-weight: 600; color: #d1d1d6; }
.top .nav button.on { background: #fff; color: #000; }

.stats { display: flex; gap: 10px; margin: 12px 0 6px; }
.st { flex: 1; background: #141414; border-radius: 14px; padding: 12px 14px; }
.st b { display: block; font-size: 24px; font-weight: 700; letter-spacing: -.5px; }
.st span { font-size: 12px; color: #8e8e93; }
.st.kept { background: #0f2a17; } .st.kept b { color: #30d158; }

.list { margin-top: 8px; }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid #1c1c1e; width: 100%; text-align: left; }
.row:last-child { border-bottom: 0; }
.ck { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #3a3a3c; flex: none; display: flex; align-items: center; justify-content: center; position: relative; }
.ck.on { background: #30d158; border-color: #30d158; }
.ck.on::after { content: ""; width: 7px; height: 13px; border: solid #000; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); margin-top: -3px; }
.ck.half { border-color: #ff9f0a; }
.t { flex: 1; min-width: 0; text-align: left; }
.t b { display: block; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t span { font-size: 13px; color: #8e8e93; display: block; }
.row.done .t b { color: #636366; text-decoration: line-through; }
.row.live .t span, .row.live .tm { color: #30d158; }
.row.live .tm { font-weight: 600; }
.tm { font-size: 15px; color: #8e8e93; flex: none; }
.row .arrow { color: #3a3a3c; font-size: 20px; flex: none; margin-left: -6px; }
.empty { color: #8e8e93; padding: 30px 0; text-align: center; }

.bar { position: fixed; left: 14px; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); max-width: 492px; margin: 0 auto;
  background: #1c1c1e; border-radius: 18px; padding: 12px 14px 12px 18px; display: flex; align-items: center; gap: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.6); }
.bar .dot { width: 10px; height: 10px; border-radius: 50%; background: #30d158; box-shadow: 0 0 0 4px rgba(48,209,88,.2); flex: none; }
.bar .dot.paused { background: #ff9f0a; box-shadow: 0 0 0 4px rgba(255,159,10,.2); }
.bar .dot.over { background: #ff453a; box-shadow: 0 0 0 4px rgba(255,69,58,.2); }
.bar .name { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.bar .time { color: #8e8e93; font-size: 15px; }
.bar .btn { background: #fff; color: #000; border-radius: 10px; padding: 8px 14px; font-size: 14px; font-weight: 700; }

.hint { background: #141414; border-radius: 14px; padding: 12px 14px; font-size: 14px; color: #d1d1d6; margin: 12px 0; }
.hint b { color: #fff; }

/* timer overlay */
#overlay { position: fixed; inset: 0; background: #000; z-index: 50; display: flex; flex-direction: column; padding: calc(10px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto; }
#overlay[hidden] { display: none; }
.ov-top { display: flex; justify-content: space-between; align-items: center; }
.ov-top button { color: #8e8e93; font-size: 15px; font-weight: 600; padding: 8px 0; }
.ov-mid { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ov-mid .lab { font-size: 13px; letter-spacing: 2px; color: #8e8e93; font-weight: 700; text-transform: uppercase; }
.ov-mid h2 { font-size: 36px; font-weight: 800; letter-spacing: -1px; margin-top: 6px; }
.ov-mid .sub { color: #8e8e93; margin-top: 2px; }
.ov-mid .time { font-size: 84px; font-weight: 800; letter-spacing: -4px; line-height: 1; margin-top: 26px; }
.ov-mid .time.over { color: #ff453a; }
.ov-mid .time.paused { color: #8e8e93; }
.ov-mid .state { margin-top: 18px; font-size: 14px; font-weight: 700; border-radius: 20px; padding: 7px 14px; }
.ov-mid .state.ok { color: #30d158; background: rgba(48,209,88,.12); }
.ov-mid .state.warn { color: #ff9f0a; background: rgba(255,159,10,.12); }
.ov-mid .state.over { color: #ff453a; background: rgba(255,69,58,.12); }
.ov-mid .state.muted { color: #8e8e93; background: #141414; }
.prog { width: 100%; height: 6px; background: #1c1c1e; border-radius: 3px; margin-top: 26px; overflow: hidden; }
.prog i { display: block; height: 100%; background: #30d158; border-radius: 3px; transition: width .5s linear; }
.prog i.over { background: #ff453a; }
.ov-btns { display: flex; gap: 10px; }
.ov-btns button { flex: 1; border-radius: 16px; padding: 18px; font-size: 18px; font-weight: 700; }
.ov-btns .pause { background: #1c1c1e; color: #fff; }
.ov-btns .done { background: #fff; color: #000; }
.ov-btns .start { background: #30d158; color: #000; flex: 2; }
.ov-foot { text-align: center; margin-top: 16px; }
.ov-foot button { color: #8e8e93; font-size: 14px; padding: 8px 12px; }
.ov-foot button + button { margin-left: 10px; }

/* history */
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 12px 0 4px; }
.grid .d { aspect-ratio: 1; border-radius: 6px; background: #141414; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #636366; font-weight: 600; }
.grid .d.p1 { background: #113a1f; color: #8e8e93; } .grid .d.p2 { background: #1b6a33; color: #d1d1d6; } .grid .d.p3 { background: #30d158; color: #000; }
.grid .d.today { outline: 2px solid #fff; outline-offset: -2px; }
.grid .d.sel { outline: 2px solid #ff9f0a; outline-offset: -2px; }
.grid .h { font-size: 11px; color: #636366; text-align: center; font-weight: 600; }
.legend { display: flex; gap: 14px; color: #636366; font-size: 12px; margin: 6px 0 14px; }
.daydetail h3 { font-size: 15px; margin: 14px 0 6px; }
.daydetail .row { padding: 10px 0; }
.wk { display: flex; justify-content: space-between; background: #141414; border-radius: 14px; padding: 12px 14px; margin-top: 10px; }
.wk div { text-align: center; } .wk b { display: block; font-size: 18px; } .wk span { font-size: 11px; color: #8e8e93; }

/* settings */
.sec { margin-top: 18px; }
.sec h3 { font-size: 13px; color: #8e8e93; letter-spacing: .5px; text-transform: uppercase; font-weight: 700; margin-bottom: 8px; }
.card { background: #141414; border-radius: 14px; overflow: hidden; }
.card .item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid #1c1c1e; width: 100%; text-align: left; }
.card .item:last-child { border-bottom: 0; }
.card .item .t { flex: 1; }
.card .item .mv { color: #8e8e93; padding: 4px 8px; font-size: 16px; }
.card .item .mv:active { color: #fff; }
.card .item.btn { color: #fff; font-weight: 600; justify-content: center; }
.card .item.danger { color: #ff453a; font-weight: 600; justify-content: center; }
.field { padding: 10px 14px; border-bottom: 1px solid #1c1c1e; }
.field:last-child { border-bottom: 0; }
.field label { display: block; font-size: 12px; color: #8e8e93; margin-bottom: 6px; font-weight: 600; }
.field .two { display: flex; gap: 10px; } .field .two > * { flex: 1; }
.days { display: flex; gap: 6px; }
.days button { flex: 1; background: #1c1c1e; border-radius: 8px; padding: 8px 0; font-size: 13px; font-weight: 600; color: #8e8e93; }
.days button.on { background: #fff; color: #000; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; background: #1c1c1e; border-radius: 8px; padding: 9px 0; font-size: 14px; font-weight: 600; color: #8e8e93; }
.seg button.on { background: #fff; color: #000; }
.toggle { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid #1c1c1e; }
.toggle:last-child { border-bottom: 0; }
.sw { width: 50px; height: 30px; border-radius: 15px; background: #3a3a3c; position: relative; flex: none; }
.sw.on { background: #30d158; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: left .15s; }
.sw.on::after { left: 22px; }
.note { font-size: 13px; color: #8e8e93; margin-top: 8px; line-height: 1.4; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(100px + env(safe-area-inset-bottom)); background: #fff; color: #000; padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; z-index: 60; }
