:root {
  --ink: #23262c;
  --ink-soft: #565b63;
  --line: #e4e0d8;
  --paper: #f6f3ec;
  --paper-2: #efeae0;
  --accent: #6f7f74;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(40, 44, 40, 0.14);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, #fbf8f1 0%, var(--paper) 55%) fixed;
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  overflow-x: hidden;
}

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(28px, 6vw, 64px) 20px 48px;
}

.masthead { text-align: center; margin-bottom: clamp(24px, 5vw, 40px); }
.wordmark {
  font-family: Fraunces, Georgia, serif;
  font-weight: 500;
  font-size: clamp(34px, 8vw, 52px);
  letter-spacing: -0.01em;
  margin: 0;
}
.tagline { color: var(--ink-soft); margin: 6px 0 0; font-size: 15px; }

.prompt {
  display: block;
  text-align: center;
  color: var(--ink-soft);
  font-size: 15px;
  margin: 0 0 14px;
}

/* free-text composer */
.composer {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 16px;
  padding: 8px 8px 8px 4px;
  transition: border-color .2s, box-shadow .2s;
  margin-bottom: 20px;
}
.composer:focus-within {
  border-color: #cfc8bb;
  box-shadow: 0 10px 30px rgba(40, 44, 40, 0.10);
  background: #fff;
}
#feeling {
  width: 100%;
  border: 0;
  outline: 0;
  resize: vertical;
  min-height: 62px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.6;
  padding: 12px 14px 4px;
}
#feeling::placeholder { color: #a8a294; }
.composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 8px 4px 14px;
}
.counter { font-size: 12px; color: #a8a294; font-variant-numeric: tabular-nums; }
.reveal-btn {
  appearance: none;
  border: 0;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .18s, opacity .2s, background .2s;
}
.reveal-btn:hover { transform: translateY(-1px); }
.reveal-btn:disabled { opacity: .45; cursor: default; transform: none; }

.hint-line {
  text-align: center;
  color: #a29c90;
  font-size: 12.5px;
  margin: 14px 0 0;
}

/* toggle */
.mode-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  user-select: none;
  position: relative;
}
.toggle .opt { font-size: 14px; color: var(--ink-soft); padding: 2px 6px; z-index: 1; transition: color .2s; }
.toggle .opt.is-on { color: var(--ink); font-weight: 600; }
.toggle .knob {
  width: 26px; height: 20px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.mode-hint { font-size: 13px; color: var(--ink-soft); font-style: italic; }

/* reveal */
.reveal { margin-top: clamp(28px, 6vw, 44px); }
.care-note {
  max-width: 560px;
  margin: 0 auto 22px;
  padding: 14px 18px;
  border: 1px solid #e6dccb;
  background: #faf3e6;
  border-radius: 12px;
  color: #6b5c46;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}
.card-frame {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #dfdacd;
}
#card { display: block; width: 100%; height: 100%; }
.card-loading {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #efe9dd; font-size: 14px; letter-spacing: .02em;
  background: rgba(30,32,36,.42);
  animation: breathe 2.4s ease-in-out infinite;
}
.card-loading::after {
  content: "";
  display: inline-block;
  width: 34px; height: 34px;
  margin-bottom: 12px;
  border: 2px solid rgba(239,233,221,.35);
  border-top-color: rgba(239,233,221,.95);
  border-radius: 50%;
  position: absolute;
  top: calc(50% - 34px);
  animation: spin 1s linear infinite;
}
.card-frame.ready .card-loading { display: none; }
@keyframes breathe { 0%,100% { opacity: .78; } 50% { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .card-loading, .card-loading::after { animation: none; }
  .card-loading::after { border-top-color: rgba(239,233,221,.6); }
}

.read { margin: 26px auto 0; max-width: 560px; }
.reflection {
  font-size: 17px;
  line-height: 1.72;
  color: #33373d;
  margin: 0;
  white-space: pre-wrap;
}
.context {
  margin: 18px 0 0;
  padding: 16px 18px;
  border-left: 2px solid var(--line);
  background: rgba(255,255,255,.5);
  border-radius: 0 10px 10px 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 15.5px;
  line-height: 1.7;
  color: #40444a;
}
.context .cur { color: var(--ink); font-weight: 500; }

.actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center;
  margin: 24px auto 0;
  max-width: 560px;
}
.act {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.65);
  color: var(--ink);
  font: inherit; font-size: 14px;
  padding: 9px 14px; border-radius: 999px; cursor: pointer;
  transition: background .18s, border-color .18s, transform .18s;
}
.act:hover { background: #fff; border-color: #d6d0c4; transform: translateY(-1px); }
.act:disabled { opacity: .5; cursor: default; transform: none; }
.act .ico { color: var(--accent); margin-right: 4px; }
.act.playing .ico { color: #b4553f; }

.size-menu {
  display: flex; gap: 8px; justify-content: center; margin: 14px auto 0;
}
.size-menu button {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-size: 13px; padding: 8px 12px; border-radius: 10px; cursor: pointer;
}
.size-menu button:hover { border-color: #cfc8bb; }

/* footer */
.foot { margin-top: clamp(40px, 8vw, 72px); text-align: center; }
.care {
  color: var(--ink-soft); font-size: 13px; max-width: 460px;
  margin: 0 auto 12px; line-height: 1.6;
}
.credit { color: #9a9488; font-size: 12px; margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(10px);
  background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: 10px; font-size: 14px;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
