/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
button { font: inherit; color: inherit; }

/* ---------- Theme ---------- */
:root {
  --bg: #fbf6ee;
  --bg-card: #ffffff;
  --ink: #2a2a2a;
  --ink-soft: #6b6b6b;
  --accent: #8a4b2a;      /* warm walnut */
  --accent-soft: #d9b48d;
  --good: #4a9d6a;
  --mid:  #d4a04a;
  --bad:  #c45a52;
  --line: #ece2d0;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(120,80,40,0.06);
  --nav-h: 64px;
}

body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 18px 24px;
}

/* ---------- Screens ---------- */
.screen { display: block; }
.screen[hidden] { display: none; }

h1 { font-size: 22px; margin: 8px 0 14px; font-weight: 600; }
h2 { font-size: 14px; margin: 18px 0 8px; font-weight: 600; color: var(--ink-soft); letter-spacing: 0.04em; text-transform: uppercase; }

/* ---------- Session screen ---------- */
.session-header {
  display: flex; justify-content: space-between; align-items: baseline;
  color: var(--ink-soft); font-size: 14px; margin-bottom: 8px;
}
.session-header .step { font-weight: 600; color: var(--accent); }

.task-card {
  background: var(--bg-card);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px 22px;
  margin-bottom: 22px;
  text-align: center;
}
.task-card .category {
  font-size: 13px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.task-card .name { font-size: 28px; font-weight: 600; line-height: 1.2; margin-bottom: 12px; }
.task-card .hint { font-size: 15px; color: var(--ink-soft); }

.rating-prompt { text-align: center; color: var(--ink-soft); margin-bottom: 10px; }

.smileys {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.smiley {
  border: none;
  background: var(--bg-card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px 0;
  font-size: 30px;
  cursor: pointer;
  transition: transform 0.08s ease;
}
.smiley:active { transform: scale(0.94); }
.smiley[disabled] { opacity: 0.4; }

.skip-row { text-align: center; }
.skip-row a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
}
.skip-row a:active { color: var(--accent); }

/* Progress dots */
.dots { display: flex; gap: 6px; justify-content: center; margin: 0 0 18px; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--line);
}
.dot.done    { background: var(--accent-soft); }
.dot.current { background: var(--accent); }

/* Done state */
.done-card {
  background: var(--bg-card);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px 22px;
  text-align: center;
}
.done-card h1 { font-size: 24px; margin-bottom: 8px; }
.done-card .subtitle { color: var(--ink-soft); margin-bottom: 18px; }

/* ---------- History ---------- */
.session-row {
  background: var(--bg-card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.session-row summary {
  list-style: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
}
.session-row summary::-webkit-details-marker { display: none; }
.session-row .date { font-weight: 600; }
.session-row .meta { color: var(--ink-soft); font-size: 14px; }
.session-row .items { margin-top: 12px; }
.session-row .items li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; border-top: 1px solid var(--line); font-size: 15px;
}
.session-row .items li:first-child { border-top: none; }
.rating-pill {
  display: inline-block; min-width: 28px; padding: 2px 8px;
  border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--line); color: var(--ink);
}
.rating-pill.good { background: rgba(74,157,106,0.15); color: var(--good); }
.rating-pill.mid  { background: rgba(212,160,74,0.20); color: var(--mid); }
.rating-pill.bad  { background: rgba(196,90,82,0.15); color: var(--bad); }
.rating-pill.skipped { background: var(--line); color: var(--ink-soft); }

/* ---------- Stats ---------- */
.stat-group { margin-bottom: 18px; }
.stat-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.stat-row .name { font-weight: 500; }
.stat-row .last { color: var(--ink-soft); font-size: 13px; }
.stat-row .avg  { font-weight: 600; min-width: 38px; text-align: right; }
.stat-row .avg.good { color: var(--good); }
.stat-row .avg.mid  { color: var(--mid); }
.stat-row .avg.bad  { color: var(--bad); }
.stat-row .avg.none { color: var(--ink-soft); font-weight: 400; }

/* ---------- Settings ---------- */
.btn {
  display: block;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: left;
  font-size: 16px;
  cursor: pointer;
  margin-bottom: 10px;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.btn:active { background: #f5ecdb; }
.btn.danger { color: var(--bad); }
.about { color: var(--ink-soft); font-size: 13px; text-align: center; margin-top: 24px; }

/* ---------- Bottom nav ---------- */
#nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--nav-h);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg-card);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 10;
}
#nav a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 12px;
  padding: 6px 0;
  gap: 2px;
}
#nav a .icon { font-size: 22px; line-height: 1; }
#nav a.active { color: var(--accent); }

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 40px 20px;
}
