/* ═══════════════════════════════════════════════
   KeepKapook — style.css
   Modern · Minimal · Friendly · โค้งมน · Mobile-first
   ═══════════════════════════════════════════════ */

:root {
  --primary:   #1B5E20;
  --secondary: #43A047;
  --accent:    #81C784;
  --success:   #2E7D32;
  --warning:   #F59E0B;
  --danger:    #EF4444;
  --bg:        #F5FFF7;
  --surface:   #FFFFFF;
  --text:      #1F2937;
  --text-2:    #6B7280;

  --radius:    1.25rem;   /* rounded-2xl */
  --radius-lg: 1.75rem;
  --shadow:    0 1px 2px rgba(27, 94, 32, .06), 0 8px 24px rgba(27, 94, 32, .08);
  --shadow-lg: 0 4px 12px rgba(27, 94, 32, .10), 0 16px 40px rgba(27, 94, 32, .14);
  --font: "Noto Sans Thai", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ─────────── Header ─────────── */

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 255, 247, .85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(27, 94, 32, .08);
}

.header-inner { display: flex; align-items: center; justify-content: space-between; padding-top: .75rem; padding-bottom: .75rem; }

.brand { display: flex; align-items: center; gap: .65rem; }

.brand-pig {
  font-size: 2.1rem;
  line-height: 1;
  display: inline-block;
  animation: pig-bob 3.5s ease-in-out infinite;
}

@keyframes pig-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-4px) rotate(-4deg); }
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -.01em;
}

.brand-motto { font-size: .75rem; color: var(--text-2); margin-top: -.2rem; }

/* ─────────── Sections ─────────── */

.section { padding: 1.25rem 0 .5rem; }

#dashboard { padding: 1rem 0 .5rem; }

/* แยก 2 โลก — กระปุกหลัก / กระปุกที่สำเร็จ เป็นคนละห้อง */
.room {
  margin: 1rem 0;
  padding: 1.1rem 1rem 1.3rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(27, 94, 32, .10);
}

.room-active {
  background:
    radial-gradient(circle at 100% 0%, rgba(129, 199, 132, .18), transparent 40%),
    linear-gradient(180deg, #eef8ef 0%, #f7fdf8 100%);
}

.room-done {
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 213, 79, .20), transparent 42%),
    linear-gradient(180deg, #fffaf0 0%, #fffdf7 100%);
  border-color: rgba(245, 158, 11, .18);
}

.room-done .section-title { color: #b8860b; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}

.section-title { font-size: 1.35rem; font-weight: 800; color: var(--primary); }

.section-sub { color: var(--text-2); font-size: .9rem; margin: -.5rem 0 1rem; }

.section-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ─────────── SECTION 1: LED Dashboard ─────────── */

.led-board {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #14501a 0%, var(--primary) 55%, #2c7a33 100%);
  border-radius: var(--radius);
  padding: .85rem 1.1rem .9rem;
  color: #fff;
  box-shadow: var(--shadow);
}

.led-glow {
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 20% 15%, rgba(129, 199, 132, .30), transparent 42%),
    radial-gradient(circle at 85% 80%, rgba(67, 160, 71, .25), transparent 45%);
  pointer-events: none;
}

.led-board > *:not(.led-glow) { position: relative; }

.led-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }

.led-total-wrap { display: flex; flex-direction: column; }

.led-label { font-size: .72rem; font-weight: 600; color: #c8e6c9; letter-spacing: .03em; }

.led-total {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
  text-shadow: 0 0 18px rgba(129, 199, 132, .5);
  font-variant-numeric: tabular-nums;
}

.led-motivation {
  font-size: .82rem;
  color: #d7efd9;
  margin-top: .5rem;
  min-height: 1.2em;
}

.led-stats { display: flex; gap: .4rem; flex-wrap: wrap; }

.led-stat {
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: .8rem;
  padding: .3rem .55rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
  min-width: 3.1rem;
}

.led-stat-value { font-size: .95rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.led-stat-label { font-size: .6rem; color: #c8e6c9; }

/* ─────────── Buttons ─────────── */

.btn {
  font-family: var(--font);
  font-size: .92rem;
  font-weight: 700;
  border: none;
  border-radius: 99px;
  padding: .65rem 1.15rem;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  line-height: 1.2;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(.96); }

.btn-primary {
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  color: #fff;
  box-shadow: 0 4px 14px rgba(46, 125, 50, .35);
}

.btn-primary:hover { box-shadow: 0 6px 20px rgba(46, 125, 50, .45); transform: translateY(-1px); }

.btn-ghost {
  background: rgba(27, 94, 32, .07);
  color: var(--primary);
}

.btn-ghost:hover { background: rgba(27, 94, 32, .13); }

.btn-outline {
  background: var(--surface);
  color: var(--primary);
  border: 1.5px solid var(--accent);
}

.btn-outline:hover { background: #f0faf1; }

.btn-danger { background: var(--danger); color: #fff; }

.btn-danger-outline {
  background: var(--surface);
  color: var(--danger);
  border: 1.5px solid #fecaca;
}

.btn-danger-outline:hover { background: #fef2f2; }

.btn-sm { font-size: .8rem; padding: .45rem .85rem; }

.file-btn { position: relative; overflow: hidden; }

/* ─────────── Accordion (inline expand ทุกอย่าง) ─────────── */

.accordion {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .4s cubic-bezier(.22, 1, .36, 1), margin .4s ease, opacity .35s ease;
  opacity: 0;
  margin: 0;
}

.accordion.open {
  grid-template-rows: 1fr;
  opacity: 1;
  margin: .25rem 0 .9rem;
}

.accordion-inner { overflow: hidden; min-height: 0; }

.card .accordion.open { margin: .75rem 0 .25rem; }

/* ─────────── Panels & Forms ─────────── */

.panel {
  background: var(--surface);
  border: 1px solid rgba(27, 94, 32, .10);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.panel-title { font-size: 1.05rem; font-weight: 800; color: var(--primary); margin-bottom: .25rem; }

.panel-hint { font-size: .85rem; color: var(--text-2); margin-bottom: .75rem; }
.panel-hint.small { font-size: .75rem; margin: .75rem 0 0; }

.settings-row { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Toggle เปิด/ปิดกระปุกออมไปเรื่อยๆ */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #f7fbf7;
  border: 1px solid rgba(27, 94, 32, .08);
  border-radius: 1rem;
  padding: .7rem .9rem;
  margin-bottom: .85rem;
  cursor: pointer;
}

.toggle-row span { display: flex; flex-direction: column; gap: .1rem; }
.toggle-row b { font-size: .92rem; }
.toggle-row small { font-size: .76rem; color: var(--text-2); }

.toggle-switch {
  appearance: none;
  -webkit-appearance: none;
  width: 3rem;
  height: 1.7rem;
  border-radius: 99px;
  background: #cfd8d3;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .2s ease;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 1.3rem; height: 1.3rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .2s ease;
}

.toggle-switch:checked { background: var(--secondary); }
.toggle-switch:checked::after { transform: translateX(1.3rem); }

.reset-confirm {
  margin-top: .9rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 1rem;
  padding: .9rem 1rem;
  font-size: .88rem;
}

.reset-confirm p { margin-bottom: .6rem; color: #991b1b; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin-bottom: .75rem;
}

@media (max-width: 540px) {
  .form-grid { grid-template-columns: 1fr; }
}

.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .75rem; }

.form-grid .field { margin-bottom: 0; }

.field-label { font-size: .82rem; font-weight: 700; color: var(--text-2); }

.field input[type="text"],
.field input[type="number"],
.field input[type="date"],
.field textarea {
  font-family: var(--font);
  font-size: 1rem;
  padding: .7rem .9rem;
  border: 1.5px solid #e5e7eb;
  border-radius: .9rem;
  background: #fafffa;
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
  width: 100%;
}

.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(67, 160, 71, .15);
}

.field input[type="file"] { font-size: .85rem; color: var(--text-2); padding: .55rem 0; }

.field input[type="file"]::file-selector-button {
  font-family: var(--font);
  font-weight: 700;
  font-size: .8rem;
  color: var(--primary);
  background: rgba(27, 94, 32, .07);
  border: none;
  border-radius: 99px;
  padding: .45rem .9rem;
  margin-right: .6rem;
  cursor: pointer;
}

.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .25rem; }

/* ─────────── Icon & Color pickers ─────────── */

.icon-picker, .color-picker { display: flex; flex-wrap: wrap; gap: .4rem; }

.icon-option {
  font-size: 1.3rem;
  width: 2.7rem;
  height: 2.7rem;
  display: grid;
  place-items: center;
  border-radius: .9rem;
  border: 2px solid transparent;
  background: #f3f7f4;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}

.icon-option:hover { transform: scale(1.1); }

.icon-option.selected {
  border-color: var(--secondary);
  background: #e8f5e9;
  transform: scale(1.06);
}

.color-option {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .8);
}

.color-option:hover { transform: scale(1.12); }

.color-option.selected { border-color: var(--text); transform: scale(1.1); }

/* ─────────── กระปุก grid + jar (โหลใส) ─────────── */

@keyframes card-in {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.bank-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .8rem;
  align-items: start;
}

@media (min-width: 520px) { .bank-grid { grid-template-columns: repeat(3, 1fr); gap: 1rem; } }

.jar-card {
  background: var(--surface);
  border: 1px solid rgba(27, 94, 32, .08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: card-in .45s cubic-bezier(.22, 1, .36, 1) both;
  transition: box-shadow .2s ease, transform .2s ease;
  overflow: hidden;
}

.jar-card:hover { box-shadow: var(--shadow-lg); }

/* การ์ดที่ขยาย → กินเต็มความกว้างของ grid (master-detail) */
.jar-card.expanded { grid-column: 1 / -1; box-shadow: var(--shadow-lg); }

.jar-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 1rem .75rem .9rem;
  font-family: var(--font);
  text-align: center;
  color: var(--text);
}

.jar-visual { position: relative; width: 100%; max-width: 118px; }

.jar-svg { width: 100%; height: auto; display: block; overflow: visible; filter: drop-shadow(0 6px 10px rgba(27, 94, 32, .12)); }

.jar-money { transition: transform .9s cubic-bezier(.22, 1, .36, 1); }

.jar-icon-badge {
  position: absolute;
  right: 4px;
  bottom: 2px;
  font-size: 1rem;
  background: #fff;
  border-radius: 50%;
  width: 1.8rem;
  height: 1.8rem;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  border: 2px solid #fff;
}

.jar-info { display: flex; flex-direction: column; gap: .22rem; width: 100%; min-width: 0; align-items: center; }

.jar-name {
  font-weight: 800;
  font-size: .92rem;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jar-amount { font-weight: 800; color: var(--primary); font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.jar-amount small { color: var(--text-2); font-weight: 600; font-size: .72rem; }

.jar-pct-bar { width: 100%; height: 6px; border-radius: 99px; background: #eef4ef; overflow: hidden; margin-top: .1rem; }
.jar-pct-bar > span { display: block; height: 100%; border-radius: 99px; transition: width .8s cubic-bezier(.22, 1, .36, 1); }

.jar-meta { font-size: .74rem; color: var(--text-2); }
.jar-pct { color: var(--success); font-weight: 800; }

/* รายละเอียด (โผล่เฉพาะตอนขยาย) */
.jar-detail { display: none; padding: 0 1.15rem 1.15rem; }
.jar-card.expanded .jar-detail { display: block; }

/* ตอนขยาย: โหลอยู่ซ้าย ข้อมูลอยู่ขวา */
.jar-card.expanded .jar-tile { flex-direction: row; text-align: left; align-items: center; gap: 1.1rem; }
.jar-card.expanded .jar-visual { max-width: 108px; flex-shrink: 0; }
.jar-card.expanded .jar-info { align-items: flex-start; }
.jar-card.expanded .jar-name { font-size: 1.15rem; }
.jar-card.expanded .jar-amount { font-size: 1.35rem; }

/* Progress bar + milestone markers 25/50/75/100 */

.progress-wrap { position: relative; margin: .65rem 0 .35rem; }

.progress-track {
  height: 12px;
  background: #eef4ef;
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--secondary));
  transition: width .8s cubic-bezier(.22, 1, .36, 1);
  min-width: 0;
}

.progress-marker {
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid #cfe0d2;
  transform: translate(-50%, -50%);
  transition: background .3s ease, border-color .3s ease;
}

.progress-marker.hit { background: #fff59d; border-color: var(--warning); box-shadow: 0 0 6px rgba(245, 158, 11, .6); }

.card-plan { font-size: .84rem; color: var(--text-2); margin-top: .3rem; }

.card-motivation {
  font-size: .86rem;
  color: var(--success);
  font-weight: 600;
  margin-top: .15rem;
  min-height: 1.4em;
}

.card-actions { display: flex; gap: .45rem; flex-wrap: wrap; margin-top: .8rem; }

.card-actions .btn.active-tab {
  background: var(--primary);
  color: #fff;
}

/* ─────────── กระปุกออมไปเรื่อยๆ (tile เหมือนกระปุกทั่วไป + แต้มทองบางๆ) ─────────── */

.jar-card.infinity-tile {
  border-color: #ffdf8a;
  background: linear-gradient(180deg, #fffdf5 0%, var(--surface) 45%);
}

.jar-card.infinity-tile .jar-pct { color: #c98a00; }

/* ─────────── Transaction list (บันทึกการออม) ─────────── */

.tx-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  margin-bottom: .5rem;
}

.tx-list { list-style: none; margin-top: .75rem; display: flex; flex-direction: column; gap: .4rem; }

.tx-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: #f7fbf7;
  border: 1px solid rgba(27, 94, 32, .07);
  border-radius: .9rem;
  padding: .55rem .8rem;
  font-size: .88rem;
}

.tx-amount { font-weight: 800; color: var(--success); white-space: nowrap; font-variant-numeric: tabular-nums; }

.tx-meta { color: var(--text-2); font-size: .78rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tx-actions { display: flex; gap: .25rem; }

.tx-btn {
  font-size: .8rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: .25rem .4rem;
  border-radius: .5rem;
  transition: background .12s ease;
}

.tx-btn:hover { background: rgba(27, 94, 32, .08); }

.tx-empty { font-size: .85rem; color: var(--text-2); text-align: center; padding: .75rem 0 .25rem; }

/* ─────────── Album ─────────── */

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: .5rem;
  margin-top: .75rem;
}

.album-photo {
  position: relative;
  aspect-ratio: 1;
  border-radius: .9rem;
  overflow: hidden;
  background: #eef4ef;
}

.album-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.album-photo .photo-del {
  position: absolute;
  top: .3rem;
  right: .3rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: .75rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity .15s ease;
}

.album-photo:hover .photo-del { opacity: 1; }

.album-empty { font-size: .85rem; color: var(--text-2); text-align: center; padding: .75rem 0 .25rem; }

/* ─────────── Section 3: completed ─────────── */

.done-summary {
  background: linear-gradient(135deg, #fff8e1, #fffde7);
  border: 1px solid #ffe082;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  font-weight: 700;
  color: #7a5900;
  display: flex;
  align-items: center;
  gap: .6rem;
}

.done-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid rgba(27, 94, 32, .08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  animation: card-in .45s cubic-bezier(.22, 1, .36, 1) both;
}

.done-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 1rem;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.done-info { flex: 1; min-width: 0; }

.done-name { font-weight: 800; font-size: 1rem; }

.done-stats { font-size: .8rem; color: var(--text-2); margin-top: .1rem; }

.done-amount { font-weight: 800; color: var(--success); white-space: nowrap; font-variant-numeric: tabular-nums; }

.done-album-row { margin-top: .4rem; }

/* ─────────── Empty states / footer ─────────── */

.empty-state {
  text-align: center;
  padding: 2.25rem 1rem;
  color: var(--text-2);
  background: var(--surface);
  border: 1.5px dashed rgba(27, 94, 32, .18);
  border-radius: var(--radius);
}

.empty-pig { font-size: 2.6rem; display: block; margin-bottom: .5rem; }

.app-footer {
  text-align: center;
  padding: 2.5rem 1rem 3rem;
  color: var(--text-2);
  font-size: .85rem;
  font-weight: 600;
}

/* ─────────── Confetti ─────────── */

.confetti-piece {
  position: fixed;
  top: -20px;
  z-index: 999;
  pointer-events: none;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(105vh) rotate(720deg);
    opacity: .2;
  }
}

/* ─────────── Milestone toast (motivation, ไม่ใช่ popup แยก) ─────────── */

.flash { animation: flash-highlight 1.6s ease; }

@keyframes flash-highlight {
  0%   { box-shadow: 0 0 0 3px rgba(245, 158, 11, .0); }
  25%  { box-shadow: 0 0 0 4px rgba(245, 158, 11, .55); }
  100% { box-shadow: var(--shadow); }
}

/* ─────────── Responsive ─────────── */

@media (max-width: 480px) {
  .section-actions { width: 100%; }
  .section-actions .btn { flex: 1; }
  .tx-form-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ─────────── Page routing ─────────── */

.page { display: block; }
.page[hidden] { display: none !important; }

/* ─────────── Popup overlay ─────────── */

.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.popup-overlay[hidden] { display: none !important; }

.popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.popup-dialog {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  width: 100%;
  max-width: 460px;
  max-height: 85vh;
  overflow-y: auto;
  animation: popup-in .25s cubic-bezier(.22, 1, .36, 1);
}

@keyframes popup-in {
  from { opacity: 0; transform: scale(.92) translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(27, 94, 32, .08);
}

.popup-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
}

.popup-close {
  font-size: 1.3rem;
  background: none;
  border: none;
  cursor: pointer;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-2);
  transition: background .12s ease;
}

.popup-close:hover { background: rgba(27, 94, 32, .07); }

.popup-body { padding: 1.25rem; }

.popup-body .panel {
  border: none;
  box-shadow: none;
  padding: 0;
}

/* ─────────── Landing page ─────────── */

.page-landing {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 10%, rgba(129, 199, 132, .15), transparent 45%),
    radial-gradient(circle at 80% 90%, rgba(67, 160, 71, .10), transparent 40%),
    linear-gradient(180deg, #f0fff4 0%, #f5fff7 100%);
  padding: 2rem 1rem;
}

.landing-inner {
  max-width: 520px;
  width: 100%;
  text-align: center;
}

.landing-pig {
  font-size: 3.5rem;
  display: block;
  margin-bottom: .5rem;
  animation: pig-bob 3.5s ease-in-out infinite;
}

.landing-brand {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: -.02em;
}

.landing-tagline {
  font-size: 1rem;
  color: var(--secondary);
  font-weight: 700;
  margin-top: .15rem;
}

.landing-desc {
  font-size: .95rem;
  color: var(--text-2);
  margin-top: .75rem;
  line-height: 1.65;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.landing-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .7rem;
  margin: 1.75rem 0;
  text-align: left;
}

@media (max-width: 420px) {
  .landing-cards { grid-template-columns: 1fr; }
}

.landing-card {
  background: var(--surface);
  border: 1px solid rgba(27, 94, 32, .08);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.landing-card-icon {
  font-size: 1.6rem;
  display: block;
  margin-bottom: .3rem;
}

.landing-card h3 {
  font-size: .9rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: .15rem;
}

.landing-card p {
  font-size: .78rem;
  color: var(--text-2);
  line-height: 1.5;
}

.btn-landing {
  font-size: 1.05rem;
  padding: .85rem 1.6rem;
}

.landing-footer {
  font-size: .72rem;
  color: var(--text-2);
  margin-top: 1rem;
}

/* ─────────── Setup page ─────────── */

.page-setup {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 2rem 1rem;
}

.setup-inner {
  max-width: 400px;
  width: 100%;
  text-align: center;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.25rem 1.75rem;
}

.setup-pig {
  font-size: 3rem;
  display: block;
  margin-bottom: .25rem;
}

.setup-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--primary);
}

.setup-desc {
  font-size: .9rem;
  color: var(--text-2);
  margin: .4rem 0 1.25rem;
}

.setup-form { text-align: left; }

.setup-icon-picker {
  justify-content: center;
  margin-bottom: 1.25rem;
}

.btn-setup {
  width: 100%;
  font-size: 1rem;
  padding: .85rem;
}

/* ─────────── Header enhancements ─────────── */

.header-right {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.header-user {
  font-size: .85rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: .3rem;
}
