:root {
  --bg: #f3efe6;
  --bg-dark: #1c231f;
  --ink: #2c2a24;
  --ink-soft: #7c7669;
  --accent: #6e7f5e;
  --accent-deep: #4f5e42;
  --accent-soft: #aebb9c;
  --card: #fdfcf9;
  --card-border: #e2dccd;
  --lotus: #c9a96e;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  overscroll-behavior: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
}

.screen.thumb {
  justify-content: flex-start;
  padding-top: 14vh;
}

.bottom-actions {
  margin-top: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-bottom: 28px;
}

.bottom-actions > .btn-primary,
.bottom-actions > .btn-secondary,
.bottom-actions > .btn-flat,
.bottom-actions .settle-actions {
  width: 100%;
  max-width: 320px;
}

.screen.dark {
  background: var(--bg-dark);
  color: #ece7da;
}

/* Home */
.home-btn {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(160deg, #8a9a78, #5d6e4f);
  font-size: 30px;
  font-weight: 600;
  color: #fdfcf9;
  box-shadow: 0 10px 26px rgba(78, 92, 62, 0.3);
  cursor: pointer;
}

.home-btn:active { transform: scale(0.96); }

.home-sub {
  margin-top: 20px;
  color: var(--ink-soft);
  font-size: 16px;
}

.home-count {
  position: absolute;
  bottom: 30px;
  font-size: 13px;
  color: #b3ab98;
}

.home-link {
  position: absolute;
  top: 22px;
  right: 22px;
  font-size: 15px;
  padding: 8px 4px;
  color: var(--ink-soft);
  text-decoration: none;
}

/* Category */
.cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: 100%;
  max-width: 380px;
  margin-top: 26px;
}

.cat-btn {
  padding: 24px 10px;
  min-height: 84px;
  border-radius: 16px;
  border: 1px solid var(--card-border);
  background: var(--card);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.cat-btn:active { background: #f0ede3; }

.cat-btn .desc {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-soft);
  margin-top: 6px;
}

.skip-btn {
  margin-top: 26px;
  padding: 10px 8px;
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 16px;
  text-decoration: underline;
  cursor: pointer;
}

.title {
  font-size: 20px;
  font-weight: 600;
}

/* Settle */
.lotus {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--lotus), transparent 70%);
  animation: breathe 10s ease-in-out infinite;
  margin-bottom: 30px;
}

@keyframes breathe {
  0% { transform: scale(0.8); opacity: 0.45; }
  40% { transform: scale(1.15); opacity: 0.95; }
  100% { transform: scale(0.8); opacity: 0.45; }
}

.settle-buddha {
  font-size: 18px;
  letter-spacing: 2px;
  color: #c8bc9b;
  margin-bottom: 10px;
}

.settle-timer {
  font-size: 46px;
  font-weight: 200;
  margin-bottom: 26px;
}

.settle-actions {
  display: none;
  flex-direction: column;
  gap: 14px;
  width: 240px;
}

.settle-actions.show { display: flex; }

/* Buttons */
.btn-primary {
  padding: 16px 22px;
  min-height: 52px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #fdfcf9;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary {
  padding: 16px 22px;
  min-height: 52px;
  border-radius: 999px;
  border: 1px solid #5e6a52;
  background: transparent;
  color: #ece7da;
  font-size: 17px;
  cursor: pointer;
}

/* Phrase */
.phrase-text {
  font-size: 26px;
  line-height: 1.7;
  font-weight: 600;
  max-width: 320px;
  margin-bottom: 10px;
}

.phrase-source {
  font-size: 12px;
  color: var(--ink-soft);
}

/* Reflection */
.reflect-q {
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 18px;
}

textarea {
  width: 100%;
  max-width: 320px;
  min-height: 96px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: var(--card);
  padding: 14px;
  font-size: 16px;
  font-family: inherit;
  resize: none;
}

/* Complete */
.complete-text {
  font-size: 19px;
  font-weight: 600;
  max-width: 280px;
  line-height: 1.6;
}

/* Records */
.records-wrap {
  width: 100%;
  max-width: 420px;
  align-items: stretch;
  text-align: left;
  overflow-y: auto;
  padding-top: 54px;
}

.records-back {
  position: absolute;
  top: 22px;
  left: 22px;
  font-size: 15px;
  padding: 8px 4px;
  color: var(--ink-soft);
  text-decoration: none;
}

.stat-row {
  display: flex;
  gap: 12px;
  margin: 18px 0;
}

.stat-card {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
}

.stat-card .num { font-size: 24px; font-weight: 700; color: var(--accent-deep); }
.stat-card .lbl { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }

.day-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 14px;
}

.day-row .date { width: 72px; color: var(--ink-soft); flex-shrink: 0; }

.day-bar {
  flex: 1;
  display: flex;
  height: 20px;
  border-radius: 6px;
  overflow: hidden;
  background: #e8e3d6;
}

.seg { height: 100%; }
.seg.anger { background: #c08361; }
.seg.greed { background: #cca85a; }
.seg.delusion { background: #6f8aa3; }
.seg.pride { background: #9a8868; }
.seg.anxiety { background: #6e9c80; }
.seg.other { background: #b3ab98; }

.settings-block {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--card-border);
}

.settings-label {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.buddha-select {
  width: 100%;
  padding: 14px;
  min-height: 50px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--ink);
  font-size: 16px;
  font-family: inherit;
}

.records-actions {
  display: flex;
  gap: 12px;
  margin-top: 26px;
  margin-bottom: 32px;
}

.btn-flat {
  flex: 1;
  padding: 12px;
  min-height: 46px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--card);
  font-size: 14px;
  cursor: pointer;
}

.empty-hint {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 20px 0;
}
