:root {
  --cream: #f6f1e6;
  --cream-2: #efe7d7;
  --paper: #fffdf7;
  --ink: #172a21;
  --ink-soft: #4d5d54;
  --muted: #8b948d;
  --green: #1b5c46;
  --green-deep: #123b2e;
  --green-soft: #e6efe9;
  --orange: #e07a3f;
  --orange-soft: #fbe9dc;
  --gold: #d9a441;
  --red: #b64234;
  --line: #e4dccb;
  --line-strong: #d5cab5;
  --shadow-sm: 0 4px 16px rgba(35, 54, 44, 0.06);
  --shadow: 0 18px 50px rgba(35, 54, 44, 0.1);
  --shadow-lg: 0 30px 80px rgba(20, 40, 30, 0.18);
  --radius: 20px;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-display: Georgia, "Songti SC", "STSong", "SimSun", serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, ul, ol {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
}

.icon {
  flex: none;
}

:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

::selection {
  background: rgba(224, 122, 63, 0.28);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: rgba(23, 42, 33, 0.18);
  border-radius: 99px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- shared buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--green);
  color: var(--paper);
  box-shadow: 0 8px 18px rgba(27, 92, 70, 0.18);
}

.btn-primary:hover {
  background: var(--green-deep);
}

.btn-ghost {
  border-color: var(--line);
  background: var(--paper);
}

.btn-ghost:hover {
  border-color: var(--line-strong);
  background: #fbf7ed;
}

.btn-soft {
  background: var(--green-soft);
  color: var(--green-deep);
}

.btn-soft:hover {
  background: #d9e8df;
}

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

.btn-danger-ghost {
  border-color: #ecc9c3;
  background: #fdf3f1;
  color: var(--red);
}

.btn-sm {
  padding: 7px 11px;
  border-radius: 9px;
  font-size: 12px;
}

.btn-lg {
  padding: 14px 22px;
  border-radius: 14px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
  color: var(--ink-soft);
  transition: 0.16s ease;
}

.icon-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

/* ---------- toast ---------- */
.toast-stack {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 32px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  padding: 11px 16px;
  border-radius: 12px;
  background: rgba(20, 36, 28, 0.94);
  color: #fffdf7;
  font-size: 13px;
  box-shadow: 0 14px 34px rgba(10, 25, 18, 0.28);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.24s ease, transform 0.24s ease;
  backdrop-filter: blur(8px);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  flex: none;
}

.toast-success .toast-dot {
  background: #7ddba6;
}

.toast-error .toast-dot {
  background: #ff9382;
}

/* ---------- utility animations ---------- */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pop-in {
  0% { transform: scale(0.86); opacity: 0; }
  60% { transform: scale(1.04); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.spin {
  animation: spin 0.9s linear infinite;
}

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