@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@300;400;500&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #fdfcfa;
  --line: rgba(28,25,20,.1);
  --text: #1c1917;
  --muted: #78716c;
  --accent: #2f9e63;
  --accent-soft: rgba(47,158,99,.1);
  --blue: #3b82c4;
  --purple: #8b6cd9;
  --orange: #e8923a;
  --red: #d9534f;
  --radius: 20px;
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --sans: "Manrope", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  background:
    radial-gradient(circle at 75% -10%, rgba(47,158,99,.07), transparent 30%),
    radial-gradient(circle at 5% 20%, rgba(232,146,58,.06), transparent 25%),
    var(--bg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
::selection { background: var(--accent); color: #fff; }
.hidden { display: none !important; }

.shell { width: min(560px, calc(100% - 32px)); margin-inline: auto; }

/* ---------- header ---------- */
.site-header {
  width: min(560px, calc(100% - 32px)); height: 68px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); position: relative; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 11px; font-family: var(--mono); font-size: 14px; color: #44403c; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(47,158,99,.25); }
.header-right { display: flex; gap: 8px; }

.icon-button {
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  color: var(--muted); cursor: pointer; transition: color .2s, border-color .2s;
}
.icon-button:hover { color: var(--text); border-color: rgba(28,25,20,.25); }
.icon-button svg { width: 18px; height: 18px; }

/* ---------- shared type ---------- */
.eyebrow { font-family: var(--mono); text-transform: uppercase; letter-spacing: .11em; font-size: 11px; color: var(--muted); }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); margin-right: 10px; }
h1 { margin: 18px 0; font-size: clamp(38px, 11vw, 54px); letter-spacing: -.055em; line-height: 1.04; }
h2 { margin: 14px 0 20px; font-size: clamp(30px, 8.5vw, 42px); letter-spacing: -.05em; line-height: 1.08; }
.accent-text { color: var(--accent); }
.intro { font-size: 16px; line-height: 1.7; color: var(--muted); margin: 0 0 30px; }
.hint { font-size: 13px; line-height: 1.7; color: var(--muted); }

.view { padding-block: 44px 60px; }

/* ---------- buttons ---------- */
.button {
  min-height: 52px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  border-radius: 14px; font-weight: 700; font-size: 14px; border: 0; cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease, opacity .2s;
}
.button:hover { transform: translateY(-2px); }
.button:disabled { opacity: .5; pointer-events: none; }
.button-primary { color: #fff; background: var(--accent); box-shadow: 0 10px 30px rgba(47,158,99,.25); }
.button-ghost { border: 1px solid var(--line); color: var(--text); background: var(--surface); }
.button-ghost:hover { border-color: rgba(28,25,20,.28); }

/* ---------- auth ---------- */
.auth-actions { display: flex; flex-direction: column; gap: 18px; margin-bottom: 46px; }
.auth-actions .button-primary { width: 100%; }
.divider { display: flex; align-items: center; gap: 14px; color: var(--muted); font: 10px var(--mono); text-transform: uppercase; letter-spacing: .1em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.login-row { display: flex; gap: 10px; }
.login-row input {
  flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  color: var(--text); font: 500 18px var(--mono); letter-spacing: .35em; text-align: center; text-transform: uppercase;
  padding: 0 14px; min-height: 52px; outline: none; transition: border-color .2s;
}
.login-row input:focus { border-color: var(--accent); }

/* ---------- new id ---------- */
.id-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border: 1px solid rgba(47,158,99,.35); border-radius: var(--radius); padding: 26px 22px;
  background: radial-gradient(circle at 85% 20%, var(--accent-soft), transparent 45%), var(--surface);
  box-shadow: 0 14px 40px rgba(28,25,20,.06);
  margin: 26px 0 14px;
}
.id-chars { font: 500 34px var(--mono); letter-spacing: .3em; color: var(--accent); }
#view-newid .button-primary { width: 100%; margin-top: 26px; }

/* ---------- setup form ---------- */
.setup-form { display: flex; flex-direction: column; gap: 22px; margin-top: 28px; }
.field-group { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.field-label { font: 10px var(--mono); text-transform: uppercase; letter-spacing: .11em; color: var(--muted); }
.field-label .optional { text-transform: none; letter-spacing: .02em; opacity: .7; }
.setup-form input, .setup-form textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: 13px; color: var(--text);
  font: 600 16px var(--sans); padding: 14px; width: 100%; outline: none; transition: border-color .2s; resize: none;
}
.setup-form textarea { font-weight: 500; line-height: 1.5; }
.setup-form input:focus, .setup-form textarea:focus { border-color: var(--accent); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.seg button {
  border: 1px solid var(--line); border-radius: 100px; background: var(--surface); color: var(--muted);
  font: 600 13px var(--sans); padding: 11px 15px; cursor: pointer; transition: all .2s;
}
.seg button.selected { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.form-error { color: var(--red); font: 12px var(--mono); margin: 0; }
#btn-setup-submit { width: 100%; }

/* ---------- tabs ---------- */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.tab {
  border: 1px solid var(--line); border-radius: 100px; background: var(--surface); color: var(--muted);
  font: 700 14px var(--sans); padding: 12px 15px; cursor: pointer; transition: all .2s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.tab.selected { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.tab-count { font: 500 11px var(--mono); background: rgba(28,25,20,.06); border-radius: 100px; padding: 2px 8px; }
.tab.selected .tab-count { background: rgba(47,158,99,.15); }

/* ---------- activity list ---------- */
.activity-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.activity {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  box-shadow: 0 6px 24px rgba(28,25,20,.05); padding: 18px; transition: transform .2s, box-shadow .2s;
}
.activity:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(28,25,20,.08); }
.activity-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.chip { font: 10px var(--mono); text-transform: uppercase; letter-spacing: .09em; border-radius: 100px; padding: 5px 10px; }
.chip-home { color: var(--purple); background: rgba(139,108,217,.1); }
.chip-outside { color: var(--blue); background: rgba(59,130,196,.1); }
.chip-time { color: var(--muted); background: rgba(28,25,20,.05); margin-left: auto; }
.activity h3 { margin: 0 0 7px; font-size: 17px; letter-spacing: -.02em; }
.activity p { margin: 0; font-size: 14px; line-height: 1.65; color: var(--muted); }
.activity-actions { display: flex; gap: 8px; margin-top: 15px; }
.act-btn {
  flex: 1; min-height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2);
  font: 700 13px var(--sans); color: var(--muted); cursor: pointer; transition: all .2s;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.act-btn:hover { transform: translateY(-1px); }
.act-done { color: var(--accent); border-color: rgba(47,158,99,.35); }
.act-done:hover { background: var(--accent-soft); }
.act-skip { flex: 0 0 auto; padding: 0 16px; }
.act-skip:hover { color: var(--red); border-color: rgba(217,83,79,.4); background: rgba(217,83,79,.06); }
.act-redo { color: var(--accent); border-color: rgba(47,158,99,.35); }
.act-redo:hover { background: var(--accent-soft); }
.act-similar { color: var(--purple); border-color: rgba(139,108,217,.35); }
.act-similar:hover { background: rgba(139,108,217,.08); }
.done-date { font: 10px var(--mono); color: var(--muted); margin-left: auto; }

.empty-list {
  font-size: 14px; line-height: 1.7; color: var(--muted); border: 1px dashed var(--line);
  border-radius: 16px; padding: 24px 20px; margin: 0; text-align: center; background: rgba(255,255,255,.5);
}

.fab-space { height: 90px; }
.fab {
  position: fixed; bottom: calc(20px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  min-height: 56px; padding: 0 34px; border: 0; border-radius: 100px; cursor: pointer;
  background: var(--accent); color: #fff; font: 800 15px var(--sans);
  box-shadow: 0 14px 40px rgba(47,158,99,.35), 0 4px 14px rgba(28,25,20,.12); z-index: 30;
  transition: transform .2s;
}
.fab:hover { transform: translateX(-50%) translateY(-2px); }

/* ---------- toast / loading ---------- */
.toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--text); border-radius: 100px;
  padding: 12px 22px; font: 12px var(--mono); color: #fff; box-shadow: 0 12px 40px rgba(28,25,20,.25);
  max-width: calc(100% - 40px); text-align: center;
}
.toast.error { background: var(--red); }
.loading { position: fixed; inset: 0; background: rgba(247,245,240,.65); backdrop-filter: blur(2px); z-index: 50; display: grid; place-items: center; }
.loading-box {
  display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 18px 26px; font: 13px var(--mono); color: var(--text);
  box-shadow: 0 14px 40px rgba(28,25,20,.12);
}
.loading-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse .9s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.8); } }

/* ---------- footer ---------- */
footer { margin-top: 30px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--muted); font: 10px var(--mono); padding-block: 26px calc(26px + env(safe-area-inset-bottom)); }
footer a:hover { color: var(--text); }

@media (min-width: 561px) {
  .view { padding-block: 60px 70px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
