/* 모아 공통 디자인 토큰 · 기본 요소 */
:root {
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR",
    "Malgun Gothic", system-ui, sans-serif;
  --bg: #f6f4f0;
  --surface: #ffffff;
  --surface-2: #f1eee9;
  --surface-3: #e9e5de;
  --text: #1c1b1f;
  --text-2: #57555e;
  --text-3: #8b8892;
  --line: #e5e1da;
  --line-strong: #d3cec5;
  --primary: #ff5b37;
  --primary-hover: #f04a25;
  --primary-ink: #ffffff;
  --primary-soft: #ffece6;
  --primary-soft-ink: #c23a18;
  --ok: #17915a;
  --ok-soft: #e3f5ec;
  --warn: #b7791f;
  --warn-soft: #fdf3dc;
  --danger: #dc3b3f;
  --danger-soft: #fdebeb;
  --info: #2f6fde;
  --info-soft: #e7effd;
  --shadow-sm: 0 1px 2px rgba(28, 27, 31, 0.06);
  --shadow: 0 1px 2px rgba(28, 27, 31, 0.05), 0 6px 20px rgba(28, 27, 31, 0.07);
  --shadow-lg: 0 10px 40px rgba(28, 27, 31, 0.18);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --ring: 0 0 0 3px rgba(255, 91, 55, 0.25);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121114;
    --surface: #1c1b1f;
    --surface-2: #252429;
    --surface-3: #302e35;
    --text: #f2f0f5;
    --text-2: #bab7c2;
    --text-3: #8a8792;
    --line: #2e2c33;
    --line-strong: #3d3a43;
    --primary: #ff6a48;
    --primary-hover: #ff7f61;
    --primary-soft: #3a211b;
    --primary-soft-ink: #ffb49f;
    --ok: #3fcf8e;
    --ok-soft: #13301f;
    --warn: #f0b84f;
    --warn-soft: #33290f;
    --danger: #ff6b6e;
    --danger-soft: #3a1a1b;
    --info: #78a6ff;
    --info-soft: #18243d;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

img {
  display: block;
  max-width: 100%;
}

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

a {
  color: inherit;
}

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

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 버튼 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover {
  background: var(--surface-2);
}
.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
.btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}
.btn.primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.btn.soft {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary-soft-ink);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn.ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}
.btn.danger {
  color: var(--danger);
}
.btn.danger.fill {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn.sm {
  height: 30px;
  padding: 0 10px;
  font-size: 13px;
  gap: 4px;
}
.btn.sm .icon {
  width: 15px;
  height: 15px;
}
.btn.lg {
  height: 48px;
  padding: 0 20px;
  font-size: 16px;
  border-radius: var(--radius);
}
.btn.icon-only {
  width: 38px;
  padding: 0;
}
.btn.sm.icon-only {
  width: 30px;
}

.input {
  height: 40px;
  width: 100%;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  border-color: var(--primary);
  box-shadow: var(--ring);
}
.input::placeholder {
  color: var(--text-3);
}

.muted {
  color: var(--text-2);
}
.faint {
  color: var(--text-3);
}
.small {
  font-size: 13px;
}
.tiny {
  font-size: 12px;
}
.row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wrap {
  flex-wrap: wrap;
}
.grow {
  flex: 1;
  min-width: 0;
}
.spacer {
  flex: 1;
}
.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hidden {
  display: none !important;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
  flex: none;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  font-weight: 650;
  color: var(--text-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
}
.chip .n {
  opacity: 0.6;
  font-weight: 700;
}

.progress {
  height: 8px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}
.progress > div {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  transition: width 0.3s;
}
.progress.ok > div {
  background: var(--ok);
}
.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: calc(100% - 32px);
}
.toast {
  background: #1c1b1f;
  color: #fff;
  padding: 11px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  max-width: 480px;
  animation: toast-in 0.2s ease-out;
  display: flex;
  gap: 8px;
  align-items: center;
}
.toast.error {
  background: var(--danger);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
