:root {
  --bg: #f3f4f7; --card: #ffffff; --line: #e6e9f0; --text: #12161f; --muted: #5b6475;
  --accent: #2f4bd8; --accent-soft: #e9edfc; --late: #b3261e; --late-soft: #fdeceb; --ok: #1b7a4b; --water: #1f8fe0;
  --shadow: 0 1px 2px rgba(18, 22, 31, 0.06), 0 6px 20px rgba(18, 22, 31, 0.04);
  --top: env(safe-area-inset-top, 0px); --bottom: env(safe-area-inset-bottom, 0px);
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text); overscroll-behavior: none;
  font: 500 16px/1.4 var(--font); -webkit-font-smoothing: antialiased; -webkit-user-select: none; user-select: none;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
svg.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.err { color: var(--late); min-height: 1.4em; margin: 0; }

.login { height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 32px; }
.logo { font-size: 40px; font-weight: 800; letter-spacing: -1px; color: var(--accent); }
input, textarea {
  font: inherit; color: var(--text); background: var(--card); border: 1px solid #d5d9e3;
  border-radius: 14px; padding: 14px 16px; width: 100%; outline: none; -webkit-user-select: text; user-select: text;
}
input::placeholder, textarea::placeholder { color: #8a92a3; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 14px; min-height: 52px; padding: 0 18px; font-weight: 700; background: var(--card); border: 1px solid #d5d9e3; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); font-weight: 600; }
.btn.big { min-height: 60px; font-size: 18px; width: 100%; border-radius: 18px; }
.btn:active { transform: scale(0.98); opacity: 0.85; }
.btn[disabled] { opacity: 0.45; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

#app { height: 100%; display: flex; flex-direction: column; }
main { flex: 1; min-height: 0; position: relative; }
.tab { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: calc(var(--top) + 20px) 20px 28px; }
nav { display: flex; border-top: 1px solid #e3e6ee; background: var(--card); padding: 6px 8px var(--bottom); }
nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 8px; font-size: 12px; font-weight: 600; color: var(--muted); position: relative; }
nav button.on { color: var(--accent); font-weight: 700; }
.dot { position: absolute; top: 6px; left: 50%; margin-left: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--late); border: 2px solid var(--card); }

.date { font-size: 14px; color: var(--muted); margin: 0 4px 4px; }
h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.6px; line-height: 1.15; margin: 0 4px 18px; }
h2 { font-size: 14px; font-weight: 700; color: var(--muted); margin: 24px 4px 10px; }
.card { background: var(--card); border-radius: 24px; padding: 22px; margin-bottom: 14px; box-shadow: var(--shadow); }
.banner { display: flex; flex-direction: column; gap: 14px; background: var(--accent-soft); box-shadow: none; }
.banner p { margin: 0; }

.next { display: flex; flex-direction: column; gap: 20px; }
.next .head { display: flex; align-items: center; gap: 18px; }
.ring { width: 84px; height: 84px; flex: none; }
.ring .track { fill: none; stroke: var(--line); stroke-width: 9; }
.ring .bar { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; transition: stroke-dasharray 0.8s ease; }
.ring text { font: 800 18px var(--font); fill: var(--text); }
.next .title { font-size: 24px; font-weight: 800; line-height: 1.15; letter-spacing: -0.3px; }
.next .when { font-size: 15px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.next .late { font-size: 14px; font-weight: 700; color: var(--late); margin-top: 2px; }
.next .note { font-size: 14px; color: var(--muted); margin-top: 2px; }
.calm { text-align: center; padding: 34px 22px; color: var(--muted); }
.calm b { display: block; color: var(--text); font-size: 22px; font-weight: 800; margin-bottom: 6px; }

.minis { display: flex; gap: 12px; margin-bottom: 14px; }
.mini { flex: 1; background: var(--card); border-radius: 20px; padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; text-align: left; }
.mini .k { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.mini .k svg.ic { width: 16px; height: 16px; }
.mini .v { font-size: 22px; font-weight: 800; letter-spacing: -0.3px; font-variant-numeric: tabular-nums; }
.mini .v small { font-size: 14px; font-weight: 600; color: var(--muted); }
.mini .s { font-size: 13px; color: var(--muted); }
.meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 6px; border-radius: 3px; background: var(--water); transition: width 0.8s ease; }

.list { list-style: none; margin: 0 0 14px; padding: 6px 20px; background: var(--card); border-radius: 24px; box-shadow: var(--shadow); }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 0; border-bottom: 1px solid #eceef3; }
.list li:last-child { border-bottom: 0; }
.list .t { flex: 1; font-weight: 600; }
.list .t small { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.list .w { color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list li.done .t { color: var(--muted); font-weight: 500; text-decoration: line-through; }
.list li.done .w { color: var(--ok); font-weight: 700; font-size: 14px; }
.list li.skipped .t { color: var(--muted); font-weight: 500; }
.list li.skipped .w, .list li.late .w { color: var(--late); font-weight: 700; font-size: 14px; }

#tab-hoca { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.chat { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: calc(var(--top) + 14px) 14px 10px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 84%; padding: 11px 15px; border-radius: 20px; white-space: pre-wrap; word-wrap: break-word; -webkit-user-select: text; user-select: text; }
.msg.assistant { align-self: flex-start; background: var(--card); box-shadow: var(--shadow); border-bottom-left-radius: 6px; }
.msg.assistant.nag { background: var(--late-soft); box-shadow: none; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.msg.pending { opacity: 0.6; }
.stamp { align-self: center; font-size: 12px; color: var(--muted); margin: 8px 0 2px; }
.typing { align-self: flex-start; padding: 8px 14px; }
.typing i { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 8px 12px 10px; border-top: 1px solid #e3e6ee; background: var(--card); }
.composer textarea { resize: none; max-height: 120px; border-radius: 22px; padding: 11px 16px; background: var(--bg); border-color: transparent; }
.send { flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; }

.vase-wrap { display: flex; flex-direction: column; align-items: center; }
.vase-card { width: 100%; display: flex; flex-direction: column; align-items: center; padding: 26px 22px; }
.vase { width: 78%; max-width: 300px; }
.vase .back-fill { fill: #eef2f8; }
.vase .floor { fill: rgba(18, 22, 31, 0.07); }
.vase .glass { fill: none; stroke: #c3cad8; stroke-width: 4; }
.vase .glass.rim { fill: #f7f9fc; stroke-width: 3; }
.vase .shine { fill: none; stroke: #ffffff; stroke-width: 6; stroke-linecap: round; opacity: 0.75; }
.vase .shine.small { stroke-width: 5; opacity: 0.6; }
.vase .level { transition: transform 1.6s cubic-bezier(0.3, 1.3, 0.4, 1); }
.vase .slosh { transform-box: fill-box; transform-origin: 50% 0; }
.vase .slosh.go { animation: slosh 2.2s ease-out; }
@keyframes slosh {
  0% { transform: rotate(0); } 12% { transform: rotate(-5deg); } 30% { transform: rotate(4deg); }
  48% { transform: rotate(-3deg); } 66% { transform: rotate(2deg); } 84% { transform: rotate(-1deg); } 100% { transform: rotate(0); }
}
.vase .wave { fill: url(#wg); animation: wave 2.4s linear infinite; }
.vase .wave.mid { opacity: 0.55; animation-duration: 3.3s; animation-direction: reverse; }
.vase .wave.back { opacity: 0.35; animation-duration: 4.6s; }
@keyframes wave { from { transform: translateX(0); } to { transform: translateX(-50px); } }
.vase .bub { fill: #ffffff; opacity: 0; animation: bub 4s ease-in infinite; }
.vase .b2 { animation-delay: 1.3s; animation-duration: 5s; }
.vase .b3 { animation-delay: 2.4s; animation-duration: 4.4s; }
.vase .b4 { animation-delay: 0.6s; animation-duration: 3.6s; }
@keyframes bub {
  0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: 0.55; }
  50% { transform: translate(5px, -70px); } 85% { opacity: 0.45; }
  100% { transform: translate(-3px, -135px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .vase .wave, .vase .bub, .vase .slosh.go { animation: none; } }
.water-num { font-size: 38px; font-weight: 800; letter-spacing: -1px; margin-top: 14px; font-variant-numeric: tabular-nums; }
.water-num small { font-size: 16px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.water-actions { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.water-actions .btn.primary { background: var(--water); border-color: var(--water); }

.toast { position: fixed; left: 18px; right: 18px; bottom: calc(var(--bottom) + 84px); background: var(--text); color: #fff; border-radius: 14px; padding: 13px 16px; text-align: center; z-index: 9; font-weight: 600; }
.seg { flex: 0 0 112px; display: flex; padding: 4px; gap: 4px; background: #e4e7ee; border-radius: 14px; }
.seg button { flex: 1; border-radius: 10px; font-weight: 700; color: var(--muted); min-height: 44px; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(18, 22, 31, 0.12); }
.cam { flex: none; width: 44px; height: 44px; border-radius: 50%; color: var(--accent); display: flex; align-items: center; justify-content: center; }
.cam:active { background: var(--accent-soft); }
.trust { position: absolute; top: calc(var(--top) + 18px); right: 20px; z-index: 3; display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-size: 13px; font-weight: 700; color: var(--muted); }
.trust b { font-size: 15px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.trust.hi b { color: var(--ok); } .trust.lo b { color: var(--late); }
.score { display: flex; align-items: center; gap: 20px; }
.score .ring { width: 104px; height: 104px; }
.score .ring text { font-size: 24px; }
.score.hi .bar { stroke: var(--ok); } .score.lo .bar { stroke: var(--late); }
.score .t { font-size: 20px; font-weight: 800; }
.score .s { font-size: 14px; color: var(--muted); margin-top: 4px; }
.wk { display: flex; flex-direction: column; gap: 14px; }
.wk .r { display: flex; flex-direction: column; gap: 6px; }
.wk .h { display: flex; justify-content: space-between; font-weight: 600; }
.wk .h span { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.wk .meter i { background: var(--accent); }
.delta { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 34px; }
.delta.up { color: var(--ok); } .delta.down { color: var(--late); }
.rules { white-space: pre-wrap; margin: 0; }
.focusbar { background: var(--late); color: #fff; padding: calc(var(--top) + 10px) 20px 10px; display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 14px; }
.focusbar.permit { background: var(--ok); }
.focusbar b { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
#app.focusing .tab { padding-top: 20px; }
#app.focusing .chat { padding-top: 14px; }
#app.focusing .trust { top: 18px; }
.focus-card { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.focus-card .clock { font-size: 64px; font-weight: 800; letter-spacing: -2px; line-height: 1; font-variant-numeric: tabular-nums; margin: 10px 0 2px; }
.focus-card .of { color: var(--muted); }
.focus-card .stats { display: flex; gap: 22px; margin: 12px 0 16px; font-size: 14px; color: var(--muted); }
.focus-card .stats b { color: var(--text); }
.focus-card .row, .focus-card input { width: 100%; }
.textbtn { display: block; width: 100%; padding: 12px; color: var(--muted); font-weight: 600; font-size: 14px; text-align: center; }
.check { position: fixed; inset: 0; z-index: 20; background: rgba(18, 22, 31, 0.55); display: flex; align-items: center; padding: 24px; }
.check .card { width: 100%; text-align: center; margin: 0; }
.check b { font-size: 24px; font-weight: 800; }
.lockline { display: flex; align-items: center; gap: 10px; background: var(--late-soft); color: var(--late); border-radius: 16px; padding: 12px 16px; margin-bottom: 14px; font-weight: 700; font-size: 14px; }
.lockline svg.ic { width: 20px; height: 20px; }
details.setup { background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 4px 20px; margin-bottom: 14px; }
details.setup summary { list-style: none; padding: 16px 0; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
details.setup summary::-webkit-details-marker { display: none; }
details.setup summary::after { content: "+"; font-size: 22px; font-weight: 500; color: var(--muted); }
details.setup[open] summary::after { content: "\2212"; }
details.setup ol { margin: 0 0 14px; padding-left: 20px; color: var(--muted); font-size: 15px; }
details.setup li { margin-bottom: 8px; }
details.setup li b { color: var(--text); }
.url { display: flex; gap: 8px; align-items: center; margin: 0 0 14px; }
.url code { flex: 1; min-width: 0; font: 500 12px ui-monospace, Menlo, monospace; background: var(--bg); border-radius: 10px; padding: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.url .btn { min-height: 40px; padding: 0 14px; font-size: 14px; }
.crash { height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 32px; }
.crash b { font-size: 24px; font-weight: 800; }
.crash p { margin: 0; color: var(--muted); word-break: break-word; }
