@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');

:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #e6e8ec;
  --line-soft: #f0f1f4;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --brand: #0f172a;
  --brand-2: #1e293b;
  --red: #e11d48;
  --red-2: #be123c;
  --red-soft: #fff1f3;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --warn: #c2410c;
  --warn-soft: #fff7ed;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05);
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.06);
  --shadow-lg: 0 24px 64px rgba(15,23,42,.18), 0 2px 8px rgba(15,23,42,.06);
  font-family: Pretendard, 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
::selection { background: #fecdd3; }

/* 스크롤바 */
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: #94a3b8; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-size: 14px; font-weight: 600; white-space: nowrap;
  text-decoration: none; box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, opacity .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: #f8fafc; border-color: #d5d9e0; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(225,29,72,.18); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 1px 2px rgba(225,29,72,.2), 0 4px 12px rgba(225,29,72,.18); }
.btn.danger:hover { background: var(--red-2); border-color: var(--red-2); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: #f1f5f9; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.sm svg { width: 14px; height: 14px; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 32px; }

/* 로딩 스피너 */
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 입력 */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .help { font-size: 12px; color: var(--muted); font-weight: 400; }
.input {
  height: 46px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--line); background: #fff;
  outline: none; font-size: 15px; transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder { color: #a3acb9; }
.input:hover { border-color: #d5d9e0; }
textarea.input { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.55; }
.input:focus { border-color: var(--text); box-shadow: 0 0 0 4px rgba(15,23,42,.07); }

.error { color: var(--red); font-size: 13px; min-height: 18px; margin: 2px 0 10px; font-weight: 500; }
.error:empty { min-height: 0; margin: 0; }
.muted { color: var(--muted); }

/* 배지 */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--ok-soft); color: var(--ok); white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.gray { background: #f1f5f9; color: var(--muted); }

/* 모달 */
.modal-back {
  position: fixed; inset: 0; background: rgba(15,23,42,.42); backdrop-filter: blur(3px); display: none;
  align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal-back.open { display: flex; animation: fade .15s ease-out; }
.modal-back.open .modal { animation: pop .18s ease-out; }
.modal { background: #fff; border-radius: 18px; padding: 26px; width: 100%; max-width: 440px; box-shadow: var(--shadow-lg); }
.modal .m-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 14px; background: var(--red-soft); color: var(--red); }
.modal .m-icon svg { width: 22px; height: 22px; }
.modal h3 { margin: 0 0 8px; font-size: 18px; letter-spacing: -0.01em; }
.modal p { margin: 0 0 22px; color: #475569; line-height: 1.65; font-size: 14px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* 토스트 */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(16px);
  display: flex; align-items: center; gap: 10px;
  background: var(--brand); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: calc(100% - 32px);
}
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #34d399; flex: none; }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* 로고 마크 */
.logo-mark { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #1e293b, #0f172a); display: grid; place-items: center; flex: none; box-shadow: 0 2px 6px rgba(15,23,42,.25), inset 0 1px 0 rgba(255,255,255,.08); }
.logo-mark span { width: 15px; height: 15px; border: 2px dashed #fb7185; border-radius: 4px; display: block; }

/* ---------- 모바일 공통 ---------- */
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
@media (max-width: 760px) {
  /* iOS에서 입력창 탭 시 화면이 확대되지 않도록 16px 이상 */
  .input, textarea.input { font-size: 16px; }
  .btn { height: 42px; }
  .btn.sm { height: 36px; }
  .btn.icon { width: 42px; }
  .btn.sm.icon { width: 36px; }
  /* 모달은 아래에서 올라오는 시트 형태 */
  .modal-back { align-items: flex-end; padding: 0; }
  .modal { max-width: none; border-radius: 22px 22px 0 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom)); }
  .modal-back.open .modal { animation: sheet .22s ease-out; }
  .modal::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 99px; background: #e2e8f0; margin: -8px auto 16px; }
  .modal .actions { flex-direction: column-reverse; }
  .modal .actions .btn { width: 100%; height: 48px; }
  .toast { bottom: calc(20px + env(safe-area-inset-bottom)); width: max-content; }
}
@keyframes sheet { from { transform: translateY(100%); } }

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