:root {
  --pink: #ff6b81;
  --pink-dark: #e8566c;
  --bg: #fff5f6;
  --card: #ffffff;
  --text: #3a2b30;
  --muted: #9b8790;
  --border: #f3dde2;
  --ok: #2ecc71;
  --danger: #e74c3c;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
  min-height: 100%;
}

.hidden { display: none !important; }

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen { display: flex; flex-direction: column; flex: 1; }

.card {
  background: var(--card);
  border-radius: 20px;
  padding: 28px 20px;
  box-shadow: 0 6px 24px rgba(255, 107, 129, 0.12);
  margin-top: 8vh;
}

.brand { margin: 0 0 4px; font-size: 28px; color: var(--pink); }
.subtitle { margin: 0 0 20px; color: var(--muted); font-size: 14px; line-height: 1.5; }

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

.code-input {
  width: 100%;
  font-size: 28px;
  letter-spacing: 0.35em;
  text-align: center;
  padding: 14px 8px;
  border: 2px solid var(--border);
  border-radius: 14px;
  outline: none;
  font-variant-numeric: tabular-nums;
}
.code-input:focus { border-color: var(--pink); }

.text-input, .msg-input {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 16px;
  outline: none;
  font-family: inherit;
  resize: none;
  color: var(--text);
  background: #fff;
}
.text-input:focus, .msg-input:focus { border-color: var(--pink); }

.btn {
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s ease, opacity 0.15s ease;
  font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--pink); color: #fff; }
.btn-primary:active { background: var(--pink-dark); }
.btn-ghost { background: transparent; color: var(--muted); padding: 8px 12px; font-size: 14px; }
.btn-block { width: 100%; margin-top: 14px; }

.feedback { min-height: 20px; font-size: 13px; margin: 10px 2px 0; }
.feedback.ok { color: var(--ok); }
.feedback.err { color: var(--danger); }

/* 编辑屏 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px 14px;
}
.topbar-title { display: flex; align-items: baseline; gap: 8px; }
.topbar-name { font-size: 20px; font-weight: 700; }
.topbar-dot { font-size: 12px; color: var(--ok); }

.action-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  border: 2px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
}
.chip.active { border-color: var(--pink); background: var(--pink); color: #fff; }

.input-wrap { position: relative; }
.char-count {
  position: absolute;
  right: 12px;
  bottom: 10px;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}
.char-count.near { color: var(--danger); }

.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.quick-item {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--pink-dark);
  cursor: pointer;
  font-family: inherit;
}
.quick-item:active { background: var(--bg); }

.recent { margin-top: 24px; flex: 1; }
.recent-title { font-size: 15px; color: var(--muted); margin: 0 0 10px; }
.recent-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.recent-item {
  background: var(--card);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.recent-body { flex: 1; min-width: 0; }
.recent-text { font-size: 15px; line-height: 1.4; word-break: break-word; }
.recent-meta { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; gap: 8px; align-items: center; }
.status { padding: 1px 8px; border-radius: 999px; font-size: 11px; }
.status.pending { background: #fff3cd; color: #8a6d3b; }
.status.delivered { background: #d1ecf1; color: #0c5460; }
.status.acknowledged { background: #d4edda; color: #155724; }
.status.expired, .status.cancelled { background: #f0f0f0; color: var(--muted); }
.cancel-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--danger);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 20px 0; }
