/* Buddhist colour symbolism: gold = enlightenment, vermilion/朱红 = sacred
   and protective, saffron = monk robes / renunciation. No greens. */
:root {
  --bg: #f8f2e7;
  --surface: #fffaf1;
  --surface-strong: #ffffff;
  --ink: #2b1f18;
  --muted: #6d5a4a;
  --line: rgba(43, 31, 24, 0.16);
  --vermilion: #9d2b20;
  --lotus: #b5476b;
  --lapis: #3a4a8a;
  --saffron: #c8701c;
  --coral: #a8382a;
  --gold: #b8892a;
  --shadow: 0 24px 60px rgba(70, 45, 25, 0.18);
  color-scheme: light;
}

body.dark {
  --bg: #17110e;
  --surface: #241b16;
  --surface-strong: #2d221b;
  --ink: #f6ece0;
  --muted: #b8a595;
  --line: rgba(246, 236, 224, 0.14);
  --vermilion: #e0705c;
  --lotus: #d97a99;
  --lapis: #7d8fc4;
  --saffron: #e79a4d;
  --coral: #e0705c;
  --gold: #e6b95c;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(145deg, var(--bg), #f1e5d5);
  color: var(--ink);
  font-family: Cambria, "Iowan Old Style", Georgia, serif;
}

body.dark {
  background: linear-gradient(145deg, var(--bg), #100b09);
}

/* Slow ambient washes that drift like light through water. */
body::before {
  content: "";
  position: fixed;
  inset: -22%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 12%, rgba(198, 155, 63, 0.2), transparent 30rem),
    radial-gradient(circle at 84% 6%, rgba(157, 43, 32, 0.17), transparent 26rem),
    radial-gradient(circle at 70% 88%, rgba(200, 112, 28, 0.12), transparent 30rem);
  animation: ambient-drift 52s ease-in-out infinite alternate;
}

@keyframes ambient-drift {
  from {
    transform: translate3d(-1.5%, -1%, 0) scale(1);
  }
  to {
    transform: translate3d(1.5%, 2%, 0) scale(1.06);
  }
}

::selection {
  background: rgba(198, 155, 63, 0.35);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--gold) 76%, white);
  outline-offset: 3px;
}

.app-shell {
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 14px 20px;
  position: relative;
}

.topbar,
.section-heading,
.profile-head,
.top-actions,
.layer-row,
.badge-row,
.donation-options {
  display: flex;
  align-items: center;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  margin: -18px -14px 8px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--vermilion), var(--gold));
  color: #fffaf1;
  font-size: 1.2rem;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(157, 43, 32, 0.3);
}

.brand-word {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.brand-word em {
  font-style: normal;
  color: var(--gold);
  margin-left: 3px;
}

.top-nav {
  display: none;
  align-items: center;
  gap: 4px;
}

.top-nav-item {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background-color 200ms ease, color 200ms ease;
}

.top-nav-item:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--vermilion) 10%, transparent);
}

.top-nav-item.active {
  color: var(--surface);
  background: var(--ink);
}

.lang-select {
  min-height: 48px;
  max-width: 116px;
  flex-shrink: 0;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
}

.profile-menu {
  position: relative;
}

.profile-trigger {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, var(--vermilion), var(--gold));
  color: #fffaf1;
  font-size: 1.2rem;
  display: grid;
  place-items: center;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 250px;
  padding: 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
  z-index: 40;
}

.profile-dropdown[hidden] {
  display: none;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-lg {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--vermilion), var(--gold));
  color: #fffaf1;
  font-size: 1.5rem;
  flex-shrink: 0;
}

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

.profile-sub {
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.8rem;
  margin-top: 2px;
}

.menu-link {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-strong);
  color: var(--ink);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-weight: 700;
  text-align: center;
}

.menu-note {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

@media (min-width: 800px) {
  .top-nav {
    display: flex;
  }
}

/* Keep the sticky top bar from overflowing narrow screens: the 福 mark
   stands in for the full wordmark and the locale select tightens up. */
@media (max-width: 560px) {
  .brand-word {
    display: none;
  }

  .lang-select {
    max-width: 92px;
    padding: 0 6px;
    font-size: 0.8rem;
  }

  .topbar {
    gap: 8px;
  }

  .top-actions {
    gap: 6px;
  }
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 2rem;
  line-height: 0.9;
  letter-spacing: 0;
}

h2 {
  font-size: clamp(1.5rem, 8vw, 2.35rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h3 {
  font-size: 1.05rem;
  line-height: 1.2;
}

.eyebrow {
  color: var(--vermilion);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.top-actions {
  gap: 8px;
}

.icon-button,
.text-button,
.nav-item,
.layer,
.blessing button,
.donation-options button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.icon-button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-weight: 800;
}

.screen {
  display: none;
  animation: rise 360ms ease both;
  padding-inline: 2px;
}

.screen.active {
  display: block;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-panel,
.panel,
.deed-focus,
.spot-detail,
.ritual-panel,
.calm-ritual-card,
.blessing-form,
.profile-head {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.mood,
.deed-item,
.layer,
.blessing,
.icon-button,
.nav-item,
.primary-action,
.text-button,
.donation-options button,
.blessing button {
  transition:
    transform 240ms ease,
    box-shadow 240ms ease,
    background-color 240ms ease,
    border-color 240ms ease,
    color 240ms ease;
}

@media (hover: hover) {
  .mood:hover,
  .deed-item:hover,
  .blessing:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(52, 44, 31, 0.14);
  }

  .icon-button:hover,
  .layer:hover,
  .text-button:hover {
    transform: translateY(-1px);
  }

  .primary-action:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(157, 43, 32, 0.28);
  }
}

button:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.hero-panel {
  min-height: 196px;
  padding: 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 18px;
  overflow: hidden;
  position: relative;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: auto -30px -55px 32%;
  height: 120px;
  background:
    repeating-linear-gradient(90deg, transparent 0 26px, rgba(157, 43, 32, 0.13) 27px 28px),
    linear-gradient(135deg, rgba(49, 95, 148, 0.22), rgba(198, 155, 63, 0.12));
  transform: rotate(-5deg);
  border-radius: 50%;
}

.hero-copy {
  color: var(--muted);
  max-width: 21rem;
  margin-top: 12px;
  line-height: 1.45;
}

.karma-ring {
  width: 92px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  background:
    radial-gradient(circle, var(--surface) 0 54%, transparent 55%),
    conic-gradient(var(--vermilion) 0 68%, rgba(157, 43, 32, 0.14) 68% 100%);
  position: relative;
  z-index: 1;
}

.karma-ring span {
  font-size: 1.55rem;
  font-weight: 800;
}

.karma-ring.glow {
  animation: karma-glow 1100ms ease;
}

@keyframes karma-glow {
  35% {
    transform: scale(1.06);
    filter: drop-shadow(0 0 20px rgba(198, 155, 63, 0.8));
  }
  100% {
    transform: scale(1);
    filter: none;
  }
}

.daily-thought {
  margin-top: 12px;
  max-width: 21rem;
  padding-left: 12px;
  border-left: 3px solid rgba(198, 155, 63, 0.55);
  color: var(--muted);
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.5;
}

.sound-control {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sound-wave {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 20px;
  opacity: 0.25;
  transition: opacity 400ms ease;
}

.sound-wave i {
  width: 3px;
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--gold), var(--vermilion));
}

.sound-wave i:nth-child(2),
.sound-wave i:nth-child(4) {
  height: 14px;
}

.sound-wave i:nth-child(3) {
  height: 18px;
}

.sound-wave.playing {
  opacity: 1;
}

.sound-wave.playing i {
  animation: sound-bar 1.8s ease-in-out infinite;
}

.sound-wave.playing i:nth-child(2) {
  animation-delay: 220ms;
}

.sound-wave.playing i:nth-child(3) {
  animation-delay: 440ms;
}

.sound-wave.playing i:nth-child(4) {
  animation-delay: 660ms;
}

.sound-wave.playing i:nth-child(5) {
  animation-delay: 880ms;
}

@keyframes sound-bar {
  0%,
  100% {
    transform: scaleY(0.5);
  }
  50% {
    transform: scaleY(1.5);
  }
}

.breath-orb {
  width: 76px;
  aspect-ratio: 1;
  margin: 4px auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 250, 241, 0.92), transparent 58%),
    radial-gradient(circle, color-mix(in srgb, var(--vermilion) 62%, transparent), color-mix(in srgb, var(--gold) 30%, transparent));
  box-shadow:
    0 0 36px rgba(157, 43, 32, 0.3),
    0 0 80px rgba(198, 155, 63, 0.18);
  animation: breathe 8s ease-in-out infinite;
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(0.85);
    opacity: 0.82;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
}

.karma-ring small {
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.7rem;
}

.panel,
.deed-focus,
.spot-detail,
.ritual-panel,
.calm-ritual-card,
.blessing-form,
.profile-head {
  margin-top: 14px;
  padding: 16px;
}

.section-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.soft-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.72rem;
  padding: 6px 10px;
  white-space: nowrap;
}

.mood-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mood {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  text-align: left;
  padding: 12px;
}

.mood.selected,
.layer.active,
.deed-item.selected {
  border-color: color-mix(in srgb, var(--vermilion) 70%, white);
  box-shadow: inset 0 0 0 1px rgba(157, 43, 32, 0.28);
}

.deed-focus,
.ritual-panel {
  display: grid;
  gap: 14px;
}

.calm-ritual-card {
  display: grid;
  gap: 12px;
}

.primary-action {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--ink), color-mix(in srgb, var(--ink) 78%, var(--vermilion)));
  color: var(--surface);
  padding: 0 18px;
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-weight: 800;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  padding: 12px;
  line-height: 1.45;
}

.map-stage {
  min-height: 430px;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(140deg, rgba(58, 74, 138, 0.5), rgba(157, 43, 32, 0.18)),
    linear-gradient(35deg, #e6d3a3 0 18%, #c8944f 19% 34%, #f0e2c8 35% 48%, #8b9ad0 49% 100%);
  box-shadow: var(--shadow);
}

.map-stage::before,
.map-stage::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 45% 55% 50% 50%;
  background: rgba(255, 250, 241, 0.18);
}

.map-stage::before {
  width: 230px;
  height: 126px;
  left: -26px;
  top: 142px;
  transform: rotate(-17deg);
}

.map-stage::after {
  width: 260px;
  height: 150px;
  right: -48px;
  bottom: 60px;
  transform: rotate(20deg);
}

.map-copy {
  position: relative;
  z-index: 2;
  padding: 22px;
  max-width: 330px;
}

.world-map {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.map-pin {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 3px solid var(--surface);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.26);
}

.map-pin::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: var(--surface);
}

.map-pin.lake {
  background: var(--lapis);
  left: 58%;
  top: 43%;
}

.map-pin.street {
  background: var(--coral);
  left: 25%;
  top: 36%;
}

.map-pin.forest {
  background: var(--saffron);
  left: 41%;
  top: 67%;
}

.map-pin.lantern {
  background: var(--gold);
  left: 72%;
  top: 71%;
}

.map-pin.active {
  outline: 8px solid rgba(255, 250, 241, 0.35);
}

.spot-detail p {
  color: var(--muted);
  line-height: 1.45;
}

.layer-row {
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.soundscape-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.layer {
  border-radius: 999px;
  min-height: 36px;
  padding: 0 12px;
}

.deed-filter-row {
  margin: 0 0 12px;
}

.map-pin.hidden,
.deed-item.hidden {
  display: none;
}

.deed-list {
  display: grid;
  gap: 10px;
}

.deed-item {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.deed-item p,
.ritual-panel p,
.profile-head p {
  color: var(--muted);
  line-height: 1.4;
}

.deed-mark {
  width: 36px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: block;
}

.deed-mark.water {
  background: linear-gradient(135deg, var(--lapis), #a9b6dd);
}

.deed-mark.elder {
  background: linear-gradient(135deg, var(--coral), #e8b79c);
}

.deed-mark.blessing {
  background: linear-gradient(135deg, var(--gold), #f1dd9c);
}

.deed-mark.earth {
  background: linear-gradient(135deg, var(--saffron), #e0b36a);
}

.deed-mark.paw { background: linear-gradient(135deg, var(--vermilion), var(--coral)); }
.deed-mark.bird { background: linear-gradient(135deg, var(--gold), var(--saffron)); }
.deed-mark.phone { background: linear-gradient(135deg, var(--lapis), var(--gold)); }
.deed-mark.flower { background: linear-gradient(135deg, var(--lotus), var(--gold)); }
.deed-mark.leaf { background: linear-gradient(135deg, var(--saffron), var(--gold)); }
.deed-mark.meal { background: linear-gradient(135deg, var(--saffron), var(--coral)); }
.deed-mark.hands { background: linear-gradient(135deg, var(--vermilion), var(--gold)); }
.deed-mark.book { background: linear-gradient(135deg, var(--lapis), var(--lotus)); }

.map-pin.reading {
  background: var(--lotus);
  left: 40%;
  top: 22%;
}

/* Project-category groups in the deed catalog */
.deed-group {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
  animation: rise 320ms ease both;
}

.deed-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.deed-group-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--gold) 16%, var(--surface-strong));
  font-size: 1.05rem;
}

.deed-group-title {
  font-family: Cambria, "Iowan Old Style", Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.deed-group-count {
  margin-left: auto;
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.78rem;
}

.deed-item {
  cursor: pointer;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

@media (hover: hover) {
  .deed-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(70, 45, 25, 0.12);
  }
}

.deed-item.selected {
  border-color: color-mix(in srgb, var(--vermilion) 55%, var(--line));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--vermilion) 35%, transparent);
}

.ritual-panel {
  grid-template-columns: 140px 1fr;
  align-items: center;
}

.ritual-scene {
  min-height: 160px;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, #8b9ad0, #3a4a8a);
}

.ripple {
  position: absolute;
  width: 96px;
  aspect-ratio: 1;
  left: 28px;
  top: 35px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  animation: pulse 2.2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.55);
    opacity: 0.85;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

.fish-shape {
  position: absolute;
  width: 38px;
  height: 18px;
  left: 52px;
  top: 72px;
  border-radius: 60% 45% 45% 60%;
  background: #fff7d0;
}

.fish-shape::after {
  content: "";
  position: absolute;
  right: -13px;
  top: 3px;
  border-left: 14px solid #fff7d0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.shoreline {
  position: absolute;
  inset: auto -10px -24px;
  height: 62px;
  background: #e6d3a3;
  transform: rotate(-4deg);
}

.ritual-scene.completed .fish-shape {
  animation: release 900ms ease both;
}

.focus-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--vermilion) 12%, var(--surface));
}

.focus-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--vermilion), var(--gold));
  transition: width 500ms ease;
}

.guided-steps {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.42;
}

.calm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.calm-actions .primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.calm-copy,
.safety-note {
  color: var(--muted);
  line-height: 1.45;
}

.safety-note {
  font-size: 0.86rem;
}

@keyframes release {
  0% {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateX(48px) scale(0.72);
    opacity: 0.18;
  }
}

.blessing-form {
  display: grid;
  gap: 10px;
}

.blessing-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.blessing {
  border-left: 4px solid var(--gold);
  background: var(--surface);
  border-radius: 8px;
  padding: 14px;
}

.blessing p {
  line-height: 1.45;
}

.blessing button {
  margin-top: 10px;
  border-radius: 999px;
  min-height: 34px;
  padding: 0 12px;
}

.avatar {
  width: 68px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--vermilion), var(--gold));
  color: white;
  font-size: 2rem;
  font-weight: 900;
}

.profile-head {
  gap: 14px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.stat-grid div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 10px;
  text-align: center;
}

.stat-grid strong,
.stat-grid span {
  display: block;
}

.stat-grid strong {
  font-size: 1.45rem;
}

.stat-grid span {
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.75rem;
}

.text-button {
  border-radius: 999px;
  min-height: 34px;
  padding: 0 12px;
}

.text-button.danger {
  color: var(--coral);
}

.badge-row {
  gap: 8px;
  flex-wrap: wrap;
}

.badge-row span {
  border-radius: 999px;
  background: rgba(198, 155, 63, 0.18);
  padding: 8px 10px;
  font-size: 0.85rem;
}

.settings-panel {
  display: grid;
  gap: 12px;
}

.settings-panel label {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.privacy-actions,
.blessing-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.blessing.reported {
  opacity: 0.7;
  border-left-color: var(--muted);
}

.blessing button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.bottom-nav {
  position: static;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  padding: 8px 6px;
  margin: 18px auto 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  z-index: 20;
}

.nav-item {
  min-width: 0;
  min-height: 46px;
  border-radius: 10px;
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: clamp(0.64rem, 2.5vw, 0.78rem);
}

.nav-item.active {
  background: var(--ink);
  color: var(--surface);
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  width: min(92vw, 380px);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(12, 18, 18, 0.48);
}

.dialog-body {
  padding: 22px;
}

.dialog-body p {
  color: var(--muted);
  line-height: 1.45;
}

.donation-options {
  gap: 10px;
  margin: 18px 0;
}

.donation-options button {
  flex: 1;
  min-height: 46px;
  border-radius: 8px;
  font-weight: 800;
}

@media (min-width: 800px) {
  /* One calm, centered column on desktop. Earlier a generic two-column grid
     was applied to every screen; it scattered the richer screens (blessings,
     deeds, community) into unbalanced, disconnected halves, so all screens
     now share a single comfortable reading column. */
  .app-shell {
    width: min(100%, 720px);
    min-height: auto;
    padding-bottom: 26px;
  }

  main {
    min-height: 0;
  }

  .bottom-nav {
    position: sticky;
    bottom: 16px;
    max-width: 460px;
  }

  .map-stage {
    min-height: 460px;
  }
}

@media (max-width: 390px) {
  .hero-panel {
    grid-template-columns: 1fr;
  }

  .karma-ring {
    width: 78px;
  }

  .ritual-panel {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

/* --- Blessings (祈福) --- */
.pray-card,
.lamp-card {
  margin-top: 14px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.pray-copy {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.pray-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pray-cat {
  min-height: 40px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease;
}

.pray-cat.active {
  background: var(--vermilion);
  border-color: var(--vermilion);
  color: #fffaf1;
}

.pray-input {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.blessing-reply {
  border-radius: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  background: color-mix(in srgb, var(--gold) 8%, var(--surface));
  padding: 18px;
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
  animation: reply-rise 500ms ease both;
}

.blessing-reply[hidden] {
  display: none;
}

@keyframes reply-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.reply-orb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 250, 241, 0.95), transparent 60%),
    radial-gradient(circle, color-mix(in srgb, var(--gold) 60%, transparent), transparent);
  display: none;
}

.blessing-reply.loading .reply-orb {
  display: block;
  animation: breathe 3.5s ease-in-out infinite;
}

.reply-text {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.55;
  color: var(--ink);
  font-family: Cambria, "Iowan Old Style", Georgia, serif;
}

.reply-source {
  margin: 0;
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.76rem;
  letter-spacing: 0.03em;
}

.lamp-stage {
  height: 120px;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 120%, rgba(198, 155, 63, 0.28), rgba(20, 24, 24, 0.9) 70%);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.lamp-flame {
  width: 26px;
  height: 40px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: linear-gradient(180deg, #fff3c4, var(--gold) 60%, var(--coral));
  box-shadow: 0 0 24px rgba(230, 185, 92, 0.7), 0 0 60px rgba(230, 185, 92, 0.4);
  transform-origin: 50% 90%;
  animation: flicker 2.6s ease-in-out infinite;
}

@keyframes flicker {
  0%, 100% { transform: scale(1) rotate(-1deg); opacity: 0.92; }
  50% { transform: scale(1.08) rotate(1.5deg); opacity: 1; }
}

.lamp-stage.lit .lamp-flame {
  animation: flare 900ms ease, flicker 2.6s ease-in-out 900ms infinite;
}

@keyframes flare {
  0% { transform: scale(0.4); opacity: 0.4; }
  55% { transform: scale(1.35); opacity: 1; box-shadow: 0 0 44px rgba(230, 185, 92, 0.9), 0 0 100px rgba(230, 185, 92, 0.6); }
  100% { transform: scale(1); opacity: 0.95; }
}

.lamp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.lamp-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 0.92rem;
}

.lamp-dot {
  font-size: 1.1rem;
}

/* A short warm line that answers something the user just did. Text comes
   from the pre-generated content pack (no runtime AI cost). */
.action-whisper {
  position: sticky;
  bottom: 84px;
  z-index: 25;
  margin: 0 auto;
  max-width: 22rem;
  padding: 0 16px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 500ms ease, transform 500ms ease;
}

.action-whisper.show {
  opacity: 1;
  transform: translateY(0);
}

/* --- Community feed --- */
.feed-composer {
  margin-top: 14px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.post-kind-row,
.post-tag-row,
.feed-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.feed-filter-row {
  margin: 16px 0 10px;
}

.post-kind,
.post-tag,
.feed-filter {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}

.post-kind.active,
.feed-filter.active {
  background: var(--vermilion);
  border-color: var(--vermilion);
  color: #fffaf1;
}

.post-tag.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #2b1f18;
}

.feed-list {
  display: grid;
  gap: 12px;
}

.feed-post {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  background: var(--surface);
  display: grid;
  gap: 10px;
  animation: rise 320ms ease both;
}

.post-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.post-kind-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
}

.post-kind-badge.share {
  background: color-mix(in srgb, var(--vermilion) 14%, transparent);
  color: var(--vermilion);
}

.post-kind-badge.ask {
  background: color-mix(in srgb, var(--gold) 20%, transparent);
  color: var(--gold);
}

.post-tag-badge {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.72rem;
}

.post-when {
  margin-left: auto;
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.74rem;
}

.post-body {
  margin: 0;
  line-height: 1.5;
  color: var(--ink);
}

.post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.post-support,
.post-reply-toggle,
.post-report {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: color 200ms ease, border-color 200ms ease, background-color 200ms ease;
}

.post-support.active {
  color: var(--vermilion);
  border-color: color-mix(in srgb, var(--vermilion) 55%, transparent);
  background: color-mix(in srgb, var(--vermilion) 10%, transparent);
}

.post-report {
  margin-left: auto;
}

.post-reply-list {
  display: grid;
  gap: 8px;
}

.post-reply {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-strong);
  border-left: 3px solid var(--vermilion);
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.45;
  animation: rise 300ms ease both;
}

.post-reply-form {
  display: flex;
  gap: 8px;
}

.post-reply-form[hidden] {
  display: none;
}

.reply-input {
  flex: 1;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
  font: inherit;
}

.reply-submit {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  border: 0;
  background: var(--vermilion);
  color: #fffaf1;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.feed-empty {
  color: var(--muted);
  font-style: italic;
  padding: 18px 4px;
  text-align: center;
}

/* Kindness Card — an app-generated visual share (no user uploads).
   RedNote-style card feel with Foobow's own illustration. */
.kindness-card {
  border-left-color: var(--vermilion);
}

.kindness-card-visual {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 82% -10%, var(--gold-soft, rgba(184, 137, 40, 0.16)), transparent 60%),
    linear-gradient(135deg, color-mix(in srgb, var(--vermilion) 12%, var(--surface-strong)), var(--surface-strong));
  border: 1px solid var(--line);
}

.kindness-card-mark {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(70, 45, 25, 0.18);
}

.kindness-card-title {
  margin: 0;
  font-family: Cambria, "Iowan Old Style", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

.kindness-card-note {
  margin: 4px 2px 0;
  color: var(--muted);
  line-height: 1.5;
}

#postDeedSelect[hidden],
.post-deed-label[hidden] {
  display: none;
}

.post-deed-label {
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.82rem;
  margin-bottom: -4px;
}

/* --- Profile: progress + activity --- */
.progress-track {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--vermilion) 12%, var(--surface-strong));
  margin-bottom: 14px;
}

.progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--vermilion), var(--gold));
  transition: width 700ms ease;
}

.milestone-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.milestone {
  min-width: 42px;
  min-height: 32px;
  display: grid;
  place-items: center;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
}

.milestone.reached {
  background: linear-gradient(135deg, var(--vermilion), var(--gold));
  border-color: transparent;
  color: #fffaf1;
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.activity-item {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--vermilion), var(--gold));
}

.activity-text {
  color: var(--ink);
}

.activity-when {
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.78rem;
}

.activity-empty {
  color: var(--muted);
  font-style: italic;
  padding: 14px 4px;
}

/* Senior / high-readability mode boosts size AND contrast. It must set ink
   per theme — hardcoding a dark ink here would invert dark mode into
   unreadable near-black text on a near-black background. */
body.senior-mode {
  font-size: 1.15rem;
  --ink: #1a120c;
  --muted: #5a4738;
}

body.dark.senior-mode {
  --ink: #fff8ee;
  --muted: #cdbcab;
}

body.senior-mode button,
body.senior-mode .nav-item {
  min-height: 52px;
  font-size: 1rem;
}

/* Six tabs cannot also carry the senior font bump without clipping the
   longest label, so the bar keeps a readable-but-compact size. */
body.senior-mode .nav-item {
  font-size: clamp(0.62rem, 2.2vw, 0.84rem);
  padding-inline: 1px;
  letter-spacing: -0.01em;
}

body.senior-mode h1 {
  font-size: 2.4rem;
}

body.senior-mode h2 {
  font-size: 2.1rem;
}

