/* ==================================================================
 * wa-cabin 共用主题
 * 奶油底色 + 糖果色点缀，适合 WorkAdventure 内嵌 iframe
 * ================================================================== */

:root {
  --cream: #fff7ec;
  --paper: #fffdf8;
  --paper-2: #fff3e2;
  --ink: #3d2e27;
  --ink-soft: #85705f;
  --ink-faint: #b7a494;
  --peach: #ff9e6d;
  --peach-deep: #f0743f;
  --mint: #6fcfb2;
  --mint-deep: #35a887;
  --sky: #8ec5e8;
  --lilac: #c3b0e6;
  --sun: #ffc94d;
  --rose: #ff8fa3;
  --line: rgba(61, 46, 39, 0.1);
  --line-strong: rgba(61, 46, 39, 0.18);
  --shadow-sm: 0 2px 8px rgba(120, 90, 70, 0.08);
  --shadow: 0 10px 30px rgba(120, 90, 70, 0.14);
  --shadow-lg: 0 18px 48px rgba(120, 90, 70, 0.2);
  --radius: 18px;
  --radius-sm: 12px;
}

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

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

body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  color: var(--ink);
  background-color: var(--cream);
  background-image: radial-gradient(circle at 12% 8%, rgba(255, 158, 109, 0.18), transparent 42%),
    radial-gradient(circle at 88% 4%, rgba(111, 207, 178, 0.16), transparent 38%),
    radial-gradient(circle at 50% 100%, rgba(195, 176, 230, 0.16), transparent 55%);
  background-attachment: fixed;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* 细颗粒纸纹，让纯色不至于太平 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  background-image: radial-gradient(rgba(120, 90, 70, 0.06) 1px, transparent 1px);
  background-size: 4px 4px;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 16px 40px;
}

.wrap.narrow {
  max-width: 520px;
}

/* ------------------------------ 顶部 ------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.topbar h1 {
  font-size: 18px;
  margin: 0;
  letter-spacing: 0.5px;
}

.topbar .sub {
  font-size: 12px;
  color: var(--ink-faint);
}

.topbar .spacer {
  flex: 1;
}

.badge-online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--mint-deep);
  background: rgba(111, 207, 178, 0.16);
  border: 1px solid rgba(111, 207, 178, 0.35);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-online .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint-deep);
  box-shadow: 0 0 0 0 rgba(53, 168, 135, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(53, 168, 135, 0.5);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(53, 168, 135, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(53, 168, 135, 0);
  }
}

/* ------------------------------ 卡片 ------------------------------ */

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.card + .card {
  margin-top: 14px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--ink);
}

.card-title .hint {
  margin-left: auto;
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-faint);
}

/* ------------------------------ 按钮 ------------------------------ */

.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 11px 16px;
  border-radius: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease, opacity 0.18s ease;
  box-shadow: 0 2px 0 var(--line-strong);
  user-select: none;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 0 var(--line-strong);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--line-strong);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-primary {
  background: linear-gradient(180deg, #ffb083, var(--peach));
  border-color: #e88a55;
  color: #4a2a17;
  box-shadow: 0 3px 0 #d97a48;
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 5px 0 #d97a48;
}

.btn-mint {
  background: linear-gradient(180deg, #8fdfc6, var(--mint));
  border-color: #4db99a;
  color: #143d31;
  box-shadow: 0 3px 0 #3fa384;
}

.btn-mint:hover:not(:disabled) {
  box-shadow: 0 5px 0 #3fa384;
}

.btn-block {
  width: 100%;
}

.btn-row {
  display: flex;
  gap: 10px;
}

.btn-row > .btn {
  flex: 1;
}

/* ------------------------------ 表单 ------------------------------ */

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.input,
.textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--ink-faint);
}

.input:focus,
.textarea:focus {
  border-color: var(--peach);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 158, 109, 0.16);
}

.textarea {
  resize: vertical;
  min-height: 92px;
  line-height: 1.6;
}

.field-foot {
  display: flex;
  justify-content: flex-end;
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 6px;
}

.counter.warn {
  color: var(--peach-deep);
  font-weight: 700;
}

/* ------------------------------ 进度条 ------------------------------ */

.bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(61, 46, 39, 0.08);
  overflow: hidden;
  position: relative;
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  width: 0%;
  transition: width 0.5s cubic-bezier(0.34, 1.2, 0.64, 1);
  background: linear-gradient(90deg, #ffc07f, var(--peach));
}

.bar.mint > i {
  background: linear-gradient(90deg, #a6e7d4, var(--mint));
}

.bar.rose > i {
  background: linear-gradient(90deg, #ffc2cc, var(--rose));
}

/* ------------------------------ 通用小件 ------------------------------ */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(61, 46, 39, 0.06);
  color: var(--ink-soft);
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 14px 0;
}

.muted {
  color: var(--ink-faint);
  font-size: 12px;
}

.toast-host {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(92vw, 420px);
}

.toast {
  max-width: 100%;
  background: rgba(61, 46, 39, 0.94);
  color: #fff8ef;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  animation: toast-in 0.28s cubic-bezier(0.34, 1.3, 0.64, 1);
  text-align: center;
}

.toast.ok {
  background: linear-gradient(180deg, #45b393, #2f9a7c);
}

.toast.err {
  background: linear-gradient(180deg, #ef7f5b, #d9613c);
}

.toast.out {
  animation: toast-out 0.24s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
}

/* 浮动文字（+5 分之类） */
.float-text {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translateX(-50%);
  font-weight: 800;
  font-size: 20px;
  color: var(--peach-deep);
  text-shadow: 0 2px 0 #fff;
  pointer-events: none;
  animation: float-up 1s ease-out forwards;
  z-index: 5;
}

@keyframes float-up {
  0% {
    opacity: 0;
    transform: translate(-50%, 6px) scale(0.8);
  }
  25% {
    opacity: 1;
    transform: translate(-50%, -6px) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -46px) scale(1);
  }
}

/* ------------------------------ 弹窗 ------------------------------ */

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(61, 46, 39, 0.42);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: mask-in 0.18s ease;
}

.modal-mask.closing {
  animation: mask-out 0.18s ease forwards;
}

.modal {
  width: min(100%, 360px);
  background: var(--paper);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.24s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.modal h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.modal .muted {
  margin: 0 0 14px;
}

@keyframes mask-in {
  from {
    opacity: 0;
  }
}

@keyframes mask-out {
  to {
    opacity: 0;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: rgba(61, 46, 39, 0.18);
  border-radius: 999px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 420px) {
  .wrap {
    padding: 12px 12px 32px;
  }
  .card {
    padding: 14px;
    border-radius: 16px;
  }
}

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