:root {
  --accent: #c7ce64;
  --accent-dark: #a7ae44;
  --bg: #faf9f5;
  --card: #ffffff;
  --ink: #2c2c2b;
  --muted: #7d7a75;
  --line: rgba(44, 44, 43, 0.12);
  --green: #4c9a5a;
  --amber: #d8a037;
  --red: #c0503f;
  --track: #ececE4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 1rem 1rem 4rem; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.top h1 { font-size: 1.4rem; margin: 0.4rem 0; }
.back { text-decoration: none; color: var(--muted); font-size: 0.95rem; }

.btn, .water {
  display: inline-block;
  background: var(--accent);
  color: #2c2c2b;
  border: none;
  border-radius: 10px;
  padding: 0.55rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:active, .water:active { background: var(--accent-dark); }
.water { width: 100%; padding: 0.9rem; font-size: 1.1rem; margin: 0.75rem 0; }

/* Person selector -------------------------------------------------------- */
.personbar {
  display: flex; align-items: center; gap: 0.4rem;
  margin: 0.5rem 0 1rem; font-size: 0.9rem; color: var(--muted);
  flex-wrap: wrap;
}
.personbar .person-btn {
  border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 0.3rem 0.8rem; cursor: pointer; font-size: 0.9rem; color: var(--ink);
}
.personbar .person-btn.active { background: var(--accent); border-color: var(--accent); font-weight: 600; }
.personbar .adduser { display: inline-flex; margin: 0; }
.personbar .adduser input {
  border: 1px dashed var(--line); background: transparent;
  border-radius: 999px; padding: 0.3rem 0.7rem; font-size: 0.9rem; width: 8.5rem;
}

/* Day-timer bar ---------------------------------------------------------- */
.timer {
  position: relative; height: 20px; border-radius: 8px 8px 0 0;
  background: var(--track); overflow: hidden;
}
.timer-fill { height: 100%; transition: width 0.3s ease; }
.timer-fill.green { background: var(--green); }
.timer-fill.amber { background: var(--amber); }
.timer-fill.red { background: var(--red); }
.timer-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; color: #2c2c2b; text-shadow: 0 0 3px rgba(255, 255, 255, 0.7);
}

/* Board ------------------------------------------------------------------ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.9rem;
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; text-decoration: none; color: inherit; display: flex; flex-direction: column;
}
.card .timer { border-radius: 0; }
.thumb { position: relative; aspect-ratio: 4 / 3; background: #eee; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.noimg {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; background: #eef0e0;
}
.noimg.big { aspect-ratio: 4 / 3; border-radius: 14px; font-size: 4rem; }

.meta { padding: 0.6rem 0.7rem; display: flex; flex-direction: column; gap: 0.15rem; }
.meta strong { font-size: 1rem; }
.meta small { color: var(--muted); font-size: 0.8rem; }
.meta .cc { display: inline-flex; align-items: center; gap: 0.25rem; color: var(--muted); }
.meta .cc svg { width: 15px; height: 15px; }

.empty { color: var(--muted); }

/* Detail ----------------------------------------------------------------- */
.detail-card { max-width: 460px; margin: 0 auto; }
.detail-card #timer-wrap .timer { border-radius: 10px 10px 0 0; height: 24px; }
.hero img { width: 100%; border-radius: 0 0 14px 14px; display: block; aspect-ratio: 4 / 3; object-fit: cover; }
.hero .noimg.big { border-radius: 0 0 14px 14px; }
.detail-card h1 { margin: 0.8rem 0 0.2rem; }
.loc { color: var(--muted); margin: 0 0 0.6rem; }

/* Comments --------------------------------------------------------------- */
.comments { margin-top: 1.5rem; }
.comments h2 { font-size: 1.1rem; display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.6rem; }
.comment-form { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.comment-form input {
  flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem; font-size: 1rem;
}
.comment-form button {
  border: none; background: var(--accent); border-radius: 10px; padding: 0 1rem;
  font-weight: 600; cursor: pointer;
}
.comment-list { list-style: none; padding: 0; margin: 0; }
.comment-line {
  border-top: 1px solid var(--line); padding: 0.6rem 0;
}
.comment-line b { color: var(--ink); }
.comment-line .c-when { color: var(--muted); font-size: 0.8rem; margin-left: 0.3rem; }
.comment-line p { margin: 0.2rem 0 0; }

/* Forms ------------------------------------------------------------------ */
.form, .login { max-width: 420px; margin: 1rem auto; display: flex; flex-direction: column; gap: 0.8rem; }
.form label, .login label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; }
.form input, .login input {
  border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem; font-size: 1rem; font-weight: 400;
}
.login { margin-top: 4rem; text-align: center; }
.login label { text-align: left; }
.err { color: var(--red); font-weight: 600; }
