/* ── tokens ────────────────────────────────────────────────────────────── */
:root {
  --bg:         #0a0a0a;
  --surface:    #141414;
  --border:     rgba(255, 255, 255, 0.07);
  --text:       #ffffff;
  --text-dim:   rgba(255, 255, 255, 0.35);
  --text-muted: rgba(255, 255, 255, 0.10);
  --green:      #22c55e;
  --font:       'JetBrains Mono', 'SF Mono', 'Courier New', monospace;
  --radius:     6px;
  --safe-top:    env(safe-area-inset-top,    0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left,   0px);
  --safe-right:  env(safe-area-inset-right,  0px);
}

/* ── reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

button, input { font-family: var(--font); font-size: inherit; color: inherit; }

/* ── layout ────────────────────────────────────────────────────────────── */
#app {
  max-width: 480px;
  margin: 0 auto;
  padding:
    calc(var(--safe-top)    + 32px)
    calc(var(--safe-right)  + 28px)
    calc(var(--safe-bottom) + 56px)
    calc(var(--safe-left)   + 28px);
  min-height: 100dvh;
}

/* ── header ────────────────────────────────────────────────────────────── */
#app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.app-title {
  font-size: 12px;
  letter-spacing: 0.10em;
  color: var(--text-dim);
}

.header-icons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-dim);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s, background 0.15s;
}

.icon-btn svg { width: 18px; height: 18px; }

.icon-btn:hover   { color: var(--text); background: rgba(255,255,255,0.06); }
.icon-btn:active  { opacity: 0.6; }
.icon-btn.active  { color: var(--text); }

/* ── day label + date ──────────────────────────────────────────────────── */
.day-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.date-line {
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 32px;
  line-height: 1.1;
}

/* ── divider ───────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 32px 0;
}

.divider-thin { margin: 20px 0; }

/* ── section label ─────────────────────────────────────────────────────── */
.section-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 18px;
}

/* ── tasks ─────────────────────────────────────────────────────────────── */
.task-list { list-style: none; }

.task-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.1s;
}

.task-item:last-child { border-bottom: none; }
.task-item:active     { opacity: 0.55; }
.task-item.readonly   { cursor: default; pointer-events: none; }

.task-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.task-item.done .task-check {
  background: var(--text);
  border-color: var(--text);
}

.task-item.done .task-check::after {
  content: '';
  width: 5px;
  height: 9px;
  border: 1.5px solid var(--bg);
  border-top: none;
  border-left: none;
  transform: rotate(43deg) translateY(-1px);
}

.task-label {
  font-size: 15px;
  transition: opacity 0.15s;
}

.task-item.done .task-label {
  opacity: 0.28;
  text-decoration: line-through;
  text-decoration-color: rgba(255, 255, 255, 0.12);
}

/* ── log ───────────────────────────────────────────────────────────────── */
.log-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.log-row-last { border-bottom: none; }

.log-label { font-size: 14px; color: var(--text-dim); }

.log-input-group { display: flex; align-items: baseline; gap: 6px; }

.log-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 15px;
  width: 68px;
  text-align: right;
  outline: none;
  padding: 3px 0;
  -moz-appearance: textfield;
  appearance: textfield;
}

.log-input::-webkit-inner-spin-button,
.log-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.log-input::placeholder { color: var(--text-muted); }
.log-input:focus { border-bottom-color: rgba(255, 255, 255, 0.28); }

.log-unit { font-size: 12px; color: var(--text-dim); }

/* ── rating ────────────────────────────────────────────────────────────── */
.rating { display: flex; gap: 7px; }

.r-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.r-dot.active { background: var(--text); border-color: var(--text); color: var(--bg); }

/* ── complete day button ───────────────────────────────────────────────── */
.complete-wrap {
  padding: 32px 0 8px;
}

.complete-btn {
  width: 100%;
  padding: 16px;
  border-radius: 10px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  letter-spacing: 0.06em;
  cursor: default;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.1s;
}

.complete-btn:not(:disabled) {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
}

.complete-btn:not(:disabled):active { transform: scale(0.98); }

.complete-btn.done {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.08);
  color: var(--green);
  cursor: default;
}

/* ── reset ─────────────────────────────────────────────────────────────── */
.section-bottom { text-align: center; }

.reset-btn {
  background: transparent;
  border: none;
  color: rgba(255, 70, 70, 0.40);
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 8px 0;
  cursor: pointer;
  transition: color 0.15s;
}

.reset-btn:hover { color: rgba(255, 70, 70, 0.72); }

/* ── bottom sheet ──────────────────────────────────────────────────────── */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.sheet-overlay.hidden { display: none; }

.bottom-sheet {
  background: #181818;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 16px 16px 0 0;
  padding: 12px 28px calc(var(--safe-bottom) + 36px);
  width: 100%;
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.sheet-title {
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.sheet-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  padding: 4px;
  display: flex;
  -webkit-tap-highlight-color: transparent;
}

.sheet-close svg { width: 16px; height: 16px; }
.sheet-close:hover { color: var(--text); }

.sheet-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.sheet-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── time input ────────────────────────────────────────────────────────── */
.time-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 22px;
  outline: none;
  padding: 4px 0;
  width: 110px;
  cursor: pointer;
}

.time-input:focus { border-bottom-color: rgba(255, 255, 255, 0.28); }
.time-input::-webkit-calendar-picker-indicator { display: none; }

/* ── toggle button ─────────────────────────────────────────────────────── */
.toggle-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 0.08em;
  padding: 7px 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.toggle-btn[data-active="true"] {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

/* ── modal ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  z-index: 100;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.hidden { display: none; }

.modal {
  background: #181818;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  width: 100%;
  max-width: 340px;
  max-height: 82dvh;
  overflow-y: auto;
}

.modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 15px;
  letter-spacing: 0.02em;
}

.modal-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 28px;
  margin-top: -8px;
}

.modal-actions { display: flex; flex-direction: column; gap: 10px; }

.modal-confirm {
  background: rgba(255, 70, 70, 0.12);
  border: 1px solid rgba(255, 70, 70, 0.28);
  border-radius: var(--radius);
  color: rgba(255, 110, 110, 1);
  font-size: 14px;
  padding: 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.modal-confirm:hover { background: rgba(255, 70, 70, 0.22); }

.modal-cancel {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 14px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.modal-cancel:hover { border-color: rgba(255, 255, 255, 0.20); }

/* ── history grid ──────────────────────────────────────────────────────── */
.modal-history {
  max-width: 380px;
  max-height: 80dvh;
  overflow-y: auto;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  margin-top: 4px;
}

.h-day {
  aspect-ratio: 1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-dim);
  position: relative;
}

.h-day.complete  { background: rgba(255,255,255,0.12); color: var(--text); }
.h-day.today     { border: 1.5px solid rgba(255,255,255,0.5); color: var(--text); }
.h-day.future    { color: var(--text-muted); }

/* ── info modal body ───────────────────────────────────────────────────── */
.info-body { display: flex; flex-direction: column; gap: 18px; }

.info-item {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.65;
}

.info-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.10em;
  color: var(--text);
  margin-bottom: 4px;
}

.info-credit {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
