/* Saucerly — Terracotta Balcony Rail theme */

:root {
  --clay: #6b4f3a;
  --clay-deep: #553c2b;
  --sage: #7a9a65;
  --sage-soft: #a7bd93;
  --rust: #b4552e;
  --accent: #d77a4a;
  --paper: #f6ead9;
  --paper-warm: #f1e0c8;
  --saucer: #fdf6ec;
  --line: #dcc4a4;
  --ink: #4a382a;
  --ink-soft: #8a735c;
  --danger: #a83b23;
  --tab-h: 62px;
  --edge-thirsty: var(--rust);
  --edge-watered: var(--sage);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
}

.app { max-width: 480px; margin: 0 auto; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}

/* ---------- tab panels ---------- */
.tab-panel {
  padding: calc(env(safe-area-inset-top, 0px) + 14px)
           14px
           calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 26px);
}
.tab-panel[hidden] { display: none; }

/* ---------- balcony rail header (Round) ---------- */
.rail-head { margin-bottom: 18px; }

.rail-bar {
  height: 34px;
  background: linear-gradient(180deg, var(--clay) 0%, var(--clay-deep) 100%);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.14), 0 2px 4px rgba(74,56,42,.25);
}
.rail-bracket {
  width: 12px; height: 22px;
  background: var(--clay-deep);
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}
.rail-pot {
  width: 26px; height: 20px;
  background: var(--accent);
  border-radius: 3px 3px 7px 7px;
  position: relative;
}
.rail-pot::before {
  content: ""; position: absolute; top: -5px; left: -2px; right: -2px;
  height: 6px; background: var(--rust); border-radius: 3px;
}
.rail-pot::after {
  content: ""; position: absolute; top: -9px; left: 7px;
  width: 8px; height: 8px;
  border-radius: 50% 50% 50% 0;
  background: var(--sage-soft);
}
.rail-pot.p2::after { border-radius: 50%; }
.rail-pot.p3::after { border-radius: 50% 0 50% 50%; }

.rail-title { font-size: 1.7rem; font-weight: 700; margin-top: 14px; letter-spacing: -0.02em; }
.rail-sub, .page-sub { color: var(--ink-soft); font-size: 0.9rem; margin-top: 2px; }

/* ---------- clay counters ---------- */
.clay-counters {
  display: flex; gap: 10px; margin-top: 14px;
}
.clay-counter {
  flex: 1;
  display: flex; align-items: center; gap: 9px;
  background: linear-gradient(180deg, #e9d3b3, #dfc39c);
  border: 1px solid #cfae83;
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 52px;
  font: inherit; color: var(--ink);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}
.clay-counter:active { transform: translateY(1px); }
.clay-num { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.clay-word { font-size: 0.78rem; color: var(--clay-deep); display: block; }

/* clay dot — filled or hollow, never a check mark */
.clay-dot {
  width: 14px; height: 14px; flex: 0 0 14px;
  border-radius: 50%;
  display: inline-block;
}
.clay-dot.filled.thirsty { background: var(--rust); border: 2px solid var(--rust); }
.clay-dot.filled.watered { background: var(--sage); border: 2px solid var(--sage); }
.clay-dot.hollow { background: transparent; border: 2px solid var(--ink-soft); }

/* ---------- wide Add strip ---------- */
.add-strip {
  width: 100%;
  margin-top: 12px;
  min-height: 56px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: var(--sage);
  color: #fff;
  font: inherit; font-weight: 700; font-size: 1.02rem;
  border: none; border-radius: 14px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 2px 5px rgba(74,56,42,.18);
}
.add-strip:active { transform: translateY(1px); }
.strip-can {
  width: 22px; height: 16px;
  position: relative;
  background: #fff;
  border-radius: 2px 6px 6px 2px;
}
.strip-can::before {
  content: ""; position: absolute; right: -8px; top: 3px;
  width: 10px; height: 10px;
  border: 2.5px solid #fff; border-radius: 50%;
  border-left-color: transparent; border-top-color: transparent;
  transform: rotate(-45deg);
}
.strip-can::after {
  content: ""; position: absolute; left: 4px; top: -7px;
  width: 12px; height: 3px;
  background: #fff; border-radius: 2px;
}

/* ---------- block titles ---------- */
.block-title, .group-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--clay-deep);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 7px;
}
.focus-block, .round-rest, .group { margin-bottom: 20px; }

/* ---------- saucer rows (slim strips with left stage edge) ---------- */
.saucer-list { display: flex; flex-direction: column; gap: 8px; }

.saucer-row {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  background: var(--saucer);
  border: 1px solid var(--line);
  border-left: none;
  border-radius: 8px 12px 12px 8px;
  padding: 10px 10px 10px 16px;
  min-height: 54px;
  box-shadow: 0 1px 3px rgba(74,56,42,.08);
  overflow: hidden;
}
.saucer-row::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 6px; background: var(--edge, var(--ink-soft));
}
.saucer-row[data-stage="Thirsty"] { --edge: var(--edge-thirsty); }
.saucer-row[data-stage="Watered"] { --edge: var(--edge-watered); }

.saucer-main { flex: 1; min-width: 0; }
.saucer-name {
  font-weight: 700; font-size: 0.98rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.saucer-cue {
  font-size: 0.8rem; color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.saucer-spot {
  font-size: 0.72rem; color: var(--clay);
  background: var(--paper-warm);
  border-radius: 6px; padding: 1px 7px;
  white-space: nowrap;
}

/* stage pill: word + dot, no check marks */
.stage-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 0.8rem; font-weight: 700;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 11px;
  min-height: 38px; min-width: 96px;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
}
.stage-pill:active { transform: translateY(1px); }
.stage-pill .stage-word { min-width: 58px; text-align: left; }

.icon-btn {
  font: inherit;
  background: none; border: none;
  color: var(--clay);
  min-width: 42px; min-height: 42px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.78rem; font-weight: 700;
  flex: 0 0 auto;
  letter-spacing: 0.02em;
}
.icon-btn:active { background: var(--paper-warm); }
.icon-btn.danger { color: var(--danger); }

/* next-Thirsty focus row: slightly bigger */
.focus-row .saucer-row {
  min-height: 64px;
  border-width: 1.5px;
  border-color: #d3a884;
}
.focus-row .saucer-name { font-size: 1.05rem; }

/* ---------- page heads ---------- */
.page-head { margin-bottom: 16px; }
.page-title { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; }

.group-empty { color: var(--ink-soft); font-size: 0.85rem; padding: 4px 2px 2px; }

/* ---------- form (Add / Edit) ---------- */
.clay-form {
  background: var(--saucer);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 16px 20px;
  box-shadow: 0 2px 6px rgba(74,56,42,.08);
}
.pot-field { margin-bottom: 16px; }
.pot-field label {
  display: block;
  font-size: 0.85rem; font-weight: 700;
  color: var(--clay-deep);
  margin-bottom: 6px;
}
.pot-field input,
.pot-field select {
  width: 100%;
  font: inherit; font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 12px 12px;
  min-height: 48px;
  appearance: none;
  -webkit-appearance: none;
}
.pot-field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--clay) 50%),
                    linear-gradient(135deg, var(--clay) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.pot-field input:focus,
.pot-field select:focus {
  outline: none;
  border-color: var(--accent);
  background-color: #fff;
}
.pot-field.invalid input,
.pot-field.invalid select { border-color: var(--danger); }

.field-error {
  color: var(--danger);
  font-size: 0.82rem;
  margin-top: 5px;
  font-weight: 600;
}

.save-btn {
  width: 100%;
  min-height: 52px;
  background: var(--accent);
  color: #fff;
  font: inherit; font-weight: 700; font-size: 1.02rem;
  border: none; border-radius: 12px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
}
.save-btn:active { transform: translateY(1px); }

.ghost-btn {
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
  background: none;
  color: var(--clay);
  font: inherit; font-weight: 700;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

/* ---------- Find ---------- */
.search-wrap { position: relative; margin-bottom: 14px; }
#find-input {
  width: 100%;
  font: inherit; font-size: 1rem;
  background: var(--saucer);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 44px 12px 14px;
  min-height: 50px;
  -webkit-appearance: none;
}
#find-input:focus { outline: none; border-color: var(--accent); background: #fff; }
.clear-btn {
  position: absolute; right: 6px; top: 5px;
  min-height: 40px;
  font: inherit; font-size: 0.8rem; font-weight: 700;
  color: var(--clay);
  background: none; border: none;
  padding: 0 10px; cursor: pointer;
}

/* ---------- empty states ---------- */
.empty-state {
  text-align: center;
  padding: 34px 16px;
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.can-outline {
  display: block;
  width: 64px; height: 46px;
  margin: 0 auto 12px;
  position: relative;
  opacity: 0.45;
}
/* faint CSS watering-can spout outline */
.can-outline::before {
  content: "";
  position: absolute; left: 8px; top: 10px;
  width: 40px; height: 26px;
  border: 3px solid var(--clay);
  border-radius: 4px 10px 10px 4px;
}
.can-outline::after {
  content: "";
  position: absolute; right: -2px; top: 4px;
  width: 20px; height: 20px;
  border: 3px solid var(--clay);
  border-radius: 50%;
  border-left-color: transparent;
  border-bottom-color: transparent;
  transform: rotate(45deg);
}

/* ---------- about / settings ---------- */
.about-block {
  margin-top: 26px;
  background: var(--saucer);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}
.about-note { font-size: 0.88rem; color: var(--ink-soft); line-height: 1.45; margin-bottom: 14px; }
.danger-btn {
  width: 100%;
  min-height: 48px;
  background: none;
  color: var(--danger);
  font: inherit; font-weight: 700;
  border: 1.5px solid var(--danger);
  border-radius: 12px;
  cursor: pointer;
}
.danger-btn:active { background: rgba(168,59,35,.08); }

/* ---------- bottom tab bar ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  background: var(--clay);
  padding: 6px 8px calc(env(safe-area-inset-bottom, 0px) + 6px);
  gap: 4px;
  box-shadow: 0 -2px 8px rgba(74,56,42,.25);
  z-index: 20;
}
.tab-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none;
  color: #d9c4a8;
  font: inherit; font-size: 0.7rem; font-weight: 700;
  padding: 6px 2px;
  min-height: 50px;
  cursor: pointer;
  border-radius: 10px;
  position: relative;
}
.tab-btn[aria-current="page"] { color: #fff; }

/* flat watering-can silhouette; active can tilts with soft shadow */
.can-icon {
  width: 26px; height: 20px;
  position: relative;
  display: block;
  transition: transform .18s ease, filter .18s ease;
}
.can-icon::before {
  content: "";
  position: absolute; left: 3px; top: 4px;
  width: 16px; height: 12px;
  background: currentColor;
  border-radius: 2px 4px 4px 2px;
}
.can-icon::after {
  content: "";
  position: absolute; right: 0; top: 0;
  width: 11px; height: 11px;
  border: 2.5px solid currentColor;
  border-radius: 50%;
  border-left-color: transparent;
  border-bottom-color: transparent;
  transform: rotate(45deg);
}
.tab-btn[aria-current="page"] .can-icon {
  transform: rotate(-14deg);
  filter: drop-shadow(0 3px 3px rgba(0,0,0,.35));
}

/* ---------- confirm dialog ---------- */
.confirm-veil {
  position: fixed; inset: 0;
  background: rgba(74,56,42,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  z-index: 40;
}
.confirm-veil[hidden] { display: none; }
.confirm-box {
  background: var(--saucer);
  border-radius: 16px;
  padding: 20px 18px;
  width: 100%; max-width: 320px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(74,56,42,.3);
}
.confirm-box p { margin-bottom: 16px; line-height: 1.4; }
.confirm-row { display: flex; gap: 10px; }
.confirm-row .ghost-btn, .confirm-row .danger-btn { margin-top: 0; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 14px);
  transform: translateX(-50%);
  background: var(--clay-deep);
  color: #fff;
  font-size: 0.85rem; font-weight: 600;
  padding: 10px 16px;
  border-radius: 999px;
  z-index: 50;
  max-width: 88vw;
  text-align: center;
}
.toast[hidden] { display: none; }

/* ---------- tiny screens ---------- */
@media (max-width: 340px) {
  .stage-pill { min-width: 84px; }
  .stage-pill .stage-word { min-width: 50px; }
  .icon-btn { min-width: 36px; }
}
