* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #273549;
  --text: #f1f5f9;
  --text-mute: #94a3b8;
  --accent: #f97316;
  --accent-hover: #ea580c;
  --success: #22c55e;
  --fail: #ef4444;
  --border: #334155;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", sans-serif;
  min-height: 100vh;
  overscroll-behavior-y: none;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.date { font-size: 14px; color: var(--text-mute); letter-spacing: 0.02em; }
.streak {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.streak-fire { font-size: 18px; }
.streak-count { font-size: 22px; font-weight: 800; color: var(--accent); letter-spacing: -0.02em; }
.streak-label { font-size: 12px; color: var(--text-mute); }

.main { flex: 1; display: flex; flex-direction: column; gap: 20px; }

.progress-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 24px;
  text-align: center;
}
.count-row { display: flex; justify-content: center; align-items: baseline; gap: 6px; margin-bottom: 20px; }
.count-now { font-size: 64px; font-weight: 800; color: var(--text); letter-spacing: -0.04em; line-height: 1; }
.count-sep { font-size: 32px; color: var(--text-mute); font-weight: 300; }
.count-target { font-size: 32px; color: var(--text-mute); font-weight: 600; }
.count-unit { font-size: 20px; color: var(--text-mute); margin-left: 4px; }

.bar { height: 10px; background: #0b1220; border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #fbbf24);
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 999px;
}

.status { font-size: 14px; color: var(--text-mute); font-weight: 500; }
.status.achieved { color: var(--success); }
.status.failing { color: var(--accent); }

.action-stack { display: flex; flex-direction: column; gap: 10px; }

.btn-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-hover));
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 28px 16px;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 30px -10px rgba(249, 115, 22, 0.6);
  transition: transform 0.1s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
.btn-primary:active { transform: scale(0.97); box-shadow: 0 4px 16px -4px rgba(249, 115, 22, 0.5); }
.btn-plus { font-size: 44px; font-weight: 900; line-height: 1; }
.btn-sub { font-size: 12px; font-weight: 500; opacity: 0.9; letter-spacing: 0.05em; }

.btn-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.btn-sec {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 6px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-sec:active { background: var(--bg-card-hover); }
.btn-minus { color: var(--text-mute); font-size: 13px; }

.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 12px;
}
.summary-item { text-align: center; }
.summary-label { font-size: 11px; color: var(--text-mute); margin-bottom: 6px; letter-spacing: 0.05em; }
.summary-value { font-size: 18px; font-weight: 700; }

.history {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 16px;
}
.history-title { font-size: 13px; color: var(--text-mute); margin-bottom: 12px; font-weight: 600; letter-spacing: 0.05em; }
.history-list { display: flex; flex-direction: column; gap: 6px; }
.history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  padding: 6px 0;
  border-bottom: 1px dashed #283244;
}
.history-row:last-child { border-bottom: none; }
.history-date { color: var(--text-mute); font-variant-numeric: tabular-nums; }
.history-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.history-row.ach .history-val { color: var(--success); }
.history-row.fail .history-val { color: var(--text-mute); }

.footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
}
.link-btn {
  background: transparent;
  color: var(--text-mute);
  border: none;
  font-size: 13px;
  cursor: pointer;
  padding: 8px;
}
.link-btn:active { color: var(--text); }
.footer-sep { color: var(--border); }

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--text);
  color: var(--bg);
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

@keyframes pop {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.pop { animation: pop 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
