/* A Penny for Your Thoughts — warm theme (v1 design language)
   Sunny cream, peach glow, vivid copper-orange accent, 18px radii,
   Nunito type, active tab on a peach pill. Day is the default theme;
   Night is opt-in per account, or follows the phone in "system" mode. */

:root {
  --bg: #fff7ec;
  --bg-glow: #ffe3c2;
  --card: #fffdf8;
  --card-border: #f3ddc0;
  --text: #3d2b1f;
  --text-soft: #8a6f5c;
  --accent: #cf5f1d;
  --accent-strong: #b34d12;
  --accent-soft: #ffe8d6;
  --pill: #ffd9ae;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --shadow: 0 6px 24px rgba(207, 95, 29, 0.10);
  --radius: 18px;
}

[data-theme="night"] {
  --bg: #221812;
  --bg-glow: #3a2417;
  --card: #2f2016;
  --card-border: #4d3420;
  --text: #f7e9d7;
  --text-soft: #c4a68c;
  --accent: #ef8f43;
  --accent-strong: #ffa25e;
  --accent-soft: #42301e;
  --pill: #5a3a1e;
  --danger: #ff9d94;
  --danger-soft: #472320;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Nunito", ui-rounded, "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1200px 600px at 85% -10%, var(--bg-glow), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, var(--bg-glow), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent); }

button { font-family: inherit; cursor: pointer; }

/* ---------- layout ---------- */

.shell { max-width: 760px; margin: 0 auto; padding: 0 16px 110px; }

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 4px 8px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .coin {
  width: 38px; height: 38px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffb066, var(--accent));
  color: #fff; display: grid; place-items: center;
  font-weight: 900; font-size: 20px; box-shadow: var(--shadow);
}
.brand h1 { font-size: 20px; margin: 0; line-height: 1.15; }
.brand h1 span { display: block; font-size: 12px; color: var(--text-soft); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin: 14px 0;
}

.card h2, .card h3 { margin-top: 0; }
.muted { color: var(--text-soft); }
.small { font-size: 13px; }

/* ---------- forms & buttons ---------- */

label { display: block; font-weight: 700; margin: 12px 0 6px; }
input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%; padding: 12px 14px; font: inherit; color: var(--text);
  background: var(--bg); border: 1.5px solid var(--card-border);
  border-radius: 12px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { min-height: 110px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; border-radius: 999px; padding: 11px 20px;
  font-weight: 800; font-size: 15px;
  background: var(--accent); color: #fff;
  transition: transform .05s ease, background .15s ease;
}
.btn:hover { background: var(--accent-strong); }
.btn:active { transform: scale(.98); }
.btn.secondary { background: var(--accent-soft); color: var(--accent-strong); }
.btn.ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--card-border); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger-ghost { background: var(--danger-soft); color: var(--danger); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

.error-box {
  display: none; background: var(--danger-soft); color: var(--danger);
  border-radius: 12px; padding: 10px 14px; font-weight: 700; margin: 10px 0;
}
.error-box.show { display: block; }
.notice-box {
  background: var(--accent-soft); color: var(--accent-strong);
  border-radius: 12px; padding: 10px 14px; font-weight: 700; margin: 10px 0;
}

/* ---------- auth ---------- */

.auth-wrap { max-width: 430px; margin: 6vh auto 0; padding: 0 16px; }
.auth-logo { text-align: center; margin-bottom: 8px; }
.auth-logo .coin {
  width: 74px; height: 74px; margin: 0 auto 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffb066, var(--accent));
  color: #fff; display: grid; place-items: center; font-size: 38px; font-weight: 900;
  box-shadow: var(--shadow);
}
.auth-logo h1 { margin: 0 0 4px; font-size: 26px; }
.linklike { background: none; border: none; color: var(--accent); font-weight: 800; padding: 0; }

/* ---------- tabs ---------- */

.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 14px; z-index: 40;
  display: flex; gap: 2px; padding: 6px;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: 999px; box-shadow: var(--shadow);
  max-width: calc(100vw - 16px); overflow-x: auto;
}
.tabbar button {
  border: none; background: transparent; color: var(--text-soft);
  font-weight: 800; font-size: 13.5px; padding: 9px 13px; border-radius: 999px;
  white-space: nowrap;
}
.tabbar button.active { background: var(--pill); color: var(--accent-strong); }

.view { display: none; }
.view.active { display: block; }

/* ---------- moods ---------- */

.mood-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.mood-chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1.5px solid var(--card-border); background: var(--bg);
  border-radius: 999px; padding: 6px 12px 6px 8px; font-weight: 700; font-size: 13.5px; color: var(--text);
}
.mood-chip.selected { border-color: var(--accent); background: var(--accent-soft); }
.mood-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: inset 0 -2px 4px rgba(0,0,0,.18); }
.mood-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 800; color: var(--text-soft); }

/* ---------- entries ---------- */

.entry-card { cursor: pointer; }
.entry-card:hover { border-color: var(--accent); }
.entry-meta { display: flex; align-items: center; gap: 10px; color: var(--text-soft); font-size: 13px; font-weight: 700; }
.entry-body { white-space: pre-wrap; line-height: 1.55; margin: 8px 0 0; }
.entry-photo { width: 100%; border-radius: 12px; margin-top: 10px; display: block; }
.reflection {
  background: var(--accent-soft); border-radius: 14px; padding: 12px 14px; margin-top: 12px;
}
.reflection .who { font-weight: 900; color: var(--accent-strong); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.shared-badge {
  background: var(--pill); color: var(--accent-strong);
  border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 800;
}

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(40, 22, 8, .5);
  display: none; align-items: center; justify-content: center; z-index: 60; padding: 16px;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--card); color: var(--text); border-radius: var(--radius);
  max-width: 480px; width: 100%; padding: 24px; box-shadow: var(--shadow);
  max-height: 88vh; overflow-y: auto;
}

/* ---------- switch ---------- */

.switch-row { display: flex; gap: 14px; align-items: flex-start; margin: 10px 0; }
.switch { position: relative; width: 52px; height: 30px; flex: none; margin-top: 2px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px; background: var(--card-border); transition: .2s;
}
.switch .track::after {
  content: ""; position: absolute; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px; transition: .2s; box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(22px); }

.radio-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-pills label {
  margin: 0; border: 1.5px solid var(--card-border); border-radius: 999px;
  padding: 8px 16px; cursor: pointer; background: var(--bg);
}
.radio-pills input { display: none; }
.radio-pills label:has(input:checked) { background: var(--pill); border-color: var(--accent); color: var(--accent-strong); }

/* ---------- plus ---------- */

.price-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .price-grid { grid-template-columns: 1fr; } }
.price-card { border: 2px solid var(--card-border); border-radius: var(--radius); padding: 16px; text-align: center; }
.price-card.hot { border-color: var(--accent); background: var(--accent-soft); }
.price-card .amount { font-size: 30px; font-weight: 900; }
.feature-list { line-height: 1.9; padding-left: 20px; }

/* ---------- footer / policy ---------- */

.app-footer { text-align: center; color: var(--text-soft); font-size: 13px; padding: 26px 0 0; }
.policy { max-width: 720px; margin: 0 auto; padding: 24px 16px 60px; line-height: 1.65; }
.policy h1 { font-size: 26px; }
.policy h2 { margin-top: 28px; font-size: 19px; }

/* ---------- toast ---------- */

#toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: 92px; z-index: 80; background: var(--text); color: var(--bg);
  padding: 11px 18px; border-radius: 999px; font-weight: 700; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s; max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }
.insight-bar { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.insight-bar .bar { height: 12px; border-radius: 999px; background: var(--accent); min-width: 4px; }
.week-chart { display: flex; align-items: flex-end; gap: 8px; height: 90px; margin-top: 10px; }
.week-chart .col { flex: 1; background: var(--pill); border-radius: 8px 8px 0 0; position: relative; min-height: 4px; }
.week-chart .col span { position: absolute; top: -20px; left: 0; right: 0; text-align: center; font-size: 12px; font-weight: 800; color: var(--text-soft); }
