/* ── 토스 디자인 시스템(TDS) 토큰 ───────────────────────────────────────────
   tds-mobile.md 의 adaptive 토큰을 순수 CSS 변수로 옮겨 토스와 일관된 룩앤필을 따른다.
   (TDS 패키지는 쓰지 않고 값만 따른다.) */
:root {
  /* blue */
  --blue-50: #e8f3ff;
  --blue-100: #c9e2ff;
  --blue-500: #3182f6; /* primary */
  --blue-700: #1b64da; /* pressed */
  /* grey scale */
  --grey-900: #191f28;
  --grey-800: #333d4b;
  --grey-700: #4e5968;
  --grey-600: #6b7684;
  --grey-500: #8b95a1;
  --grey-400: #b0b8c1;
  --grey-300: #c9cdd2;
  --grey-200: #e5e8eb;
  --grey-100: #f2f4f6;
  --grey-50: #f9fafb;
  --white: #ffffff;
  /* semantic */
  --red-500: #f04452;
  --red-bg: #fdeced;
  --red-border: #f9c7cc;
  /* roles */
  --primary: var(--blue-500);
  --primary-pressed: var(--blue-700);
  --bg: var(--grey-50);
  --surface: var(--white);
  --border: var(--grey-200);
  --text-strong: var(--grey-900);
  --text: var(--grey-800);
  --text-sub: var(--grey-600);
  --text-weak: var(--grey-500);
  /* radius (TDS: 큰 둥근 모서리) */
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  color-scheme: light;
}

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

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Toss Product Sans", "Pretendard", -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

/* ── 상단바 ── */
.topbar {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-mark {
  font-size: 22px;
}
.brand-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -0.02em;
}
.brand-sub {
  font-size: 13px;
  color: var(--text-weak);
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}
.loading-screen {
  padding: 80px 0;
  text-align: center;
  color: var(--text-weak);
}
.footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  color: var(--text-weak);
  font-size: 12px;
  text-align: center;
}

/* ── 카드/그룹 ── */
.intro,
.group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 22px;
  margin-bottom: 16px;
}
.intro {
  margin-bottom: 20px;
}
.intro h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -0.02em;
}
.intro p {
  margin: 0;
  color: var(--text-sub);
  font-size: 14px;
}
.group-head {
  margin-bottom: 18px;
}
.group-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -0.02em;
}
.group-desc {
  font-size: 13px;
  color: var(--text-weak);
  margin-top: 2px;
}

/* ── 필드 ── */
.field {
  margin-bottom: 18px;
}
.field:last-child {
  margin-bottom: 0;
}
.field > label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 7px;
}
.field .req {
  color: var(--red-500);
  margin-left: 3px;
}
.field .help {
  font-size: 12px;
  color: var(--text-weak);
  margin-top: 6px;
}
.field .err {
  font-size: 12px;
  color: var(--red-500);
  margin-top: 6px;
  display: none;
}
.field.has-error .err {
  display: block;
}
.field.has-error input,
.field.has-error textarea {
  border-color: var(--red-500);
  background: var(--red-bg);
}

input[type="text"],
input[type="email"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 13px 14px;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  font-family: inherit;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
textarea {
  resize: vertical;
  min-height: 64px;
  line-height: 1.5;
}
input::placeholder,
textarea::placeholder {
  color: var(--grey-400);
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--blue-50);
}

.color-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.color-row input[type="color"] {
  width: 48px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 3px;
  background: var(--surface);
  cursor: pointer;
}
.color-row input[type="text"] {
  flex: 1;
}

/* ── 번호 리스트 ── */
.list-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.list-item .num {
  width: 20px;
  flex: none;
  text-align: right;
  color: var(--text-weak);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 14px;
}
.list-item input {
  flex: 1;
}
.list-item .rm {
  flex: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--grey-400);
  font-size: 18px;
  cursor: pointer;
  transition: 0.15s;
}
.list-item .rm:hover {
  color: var(--red-500);
  border-color: var(--red-500);
}
.add-item {
  align-self: flex-start;
  margin-top: 8px;
  border: 1px dashed var(--grey-300);
  background: var(--grey-50);
  color: var(--text-sub);
  border-radius: var(--r-sm);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}
.add-item:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--blue-50);
}

/* ── 토글 ── */
.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  margin-bottom: 10px;
  transition: 0.15s;
}
.toggle:last-child {
  margin-bottom: 0;
}
.toggle:hover {
  border-color: var(--grey-300);
}
.toggle .t-label {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}
.toggle .t-help {
  font-size: 12px;
  color: var(--text-weak);
  margin-top: 2px;
}
.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex: none;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  inset: 0;
  background: var(--grey-300);
  border-radius: 999px;
  transition: 0.2s;
}
.slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.switch input:checked + .slider {
  background: var(--primary);
}
.switch input:checked + .slider::before {
  transform: translateX(20px);
}

/* ── 버튼 (TDS: 큰 터치 타깃, 굵은 라벨, 둥근 모서리) ── */
.submit-bar {
  margin-top: 8px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  border: none;
  border-radius: var(--r-sm);
  padding: 15px 16px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition:
    background 0.15s,
    transform 0.1s;
}
.btn:active {
  transform: scale(0.99);
}
.btn-primary {
  background: var(--primary);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--primary-pressed);
}
.btn-primary:disabled {
  opacity: 0.45;
  cursor: default;
}
.btn-ghost {
  background: var(--grey-100);
  color: var(--text-sub);
}
.btn-ghost:hover {
  background: var(--grey-200);
}
.form-error {
  display: none;
  margin-top: 12px;
  padding: 13px 14px;
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--r-sm);
  color: var(--red-500);
  font-size: 14px;
}
.form-error.show {
  display: block;
}

/* ── 진행/결과 카드 ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px 24px;
  text-align: center;
}
.card .big-emoji {
  font-size: 56px;
  line-height: 1;
}
.card h2 {
  margin: 16px 0 6px;
  font-size: 21px;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -0.02em;
}
.card .sub {
  color: var(--text-weak);
  font-size: 14px;
  margin: 0;
}
.steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  margin: 24px auto 0;
  max-width: 420px;
}
.step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: var(--r-sm);
  background: var(--grey-50);
  color: var(--text-weak);
  font-size: 14px;
}
.step .ic {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--grey-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.step.active {
  background: var(--blue-50);
  color: var(--primary-pressed);
  font-weight: 600;
}
.step.active .ic {
  border-color: var(--primary);
  color: var(--primary);
}
.step.done {
  color: var(--text-sub);
}
.step.done .ic {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--blue-100);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--grey-100);
  overflow: hidden;
  margin: 24px 0 8px;
}
.progress-bar > div {
  height: 100%;
  background: var(--primary);
  width: 0;
  border-radius: 999px;
  transition: width 0.5s ease;
}
.activity {
  font-size: 12px;
  color: var(--text-weak);
  min-height: 18px;
  word-break: break-all;
}

/* cert timer */
.timer {
  font-size: 46px;
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin: 14px 0 4px;
}

/* ── 결과 링크 ── */
.result-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}
.result-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  text-align: left;
  transition: 0.15s;
}
.result-link:hover {
  border-color: var(--primary);
  background: var(--blue-50);
}
.result-link .rl-ic {
  font-size: 26px;
  flex: none;
}
.result-link .rl-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-strong);
}
.result-link .rl-sub {
  font-size: 12px;
  color: var(--text-weak);
  word-break: break-all;
  margin-top: 2px;
}
.result-link .rl-arrow {
  margin-left: auto;
  color: var(--grey-300);
  font-size: 18px;
}
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
  margin-top: 10px;
}
.badge-mock {
  background: #fff7e6;
  color: #b76e00;
}
.badge-ok {
  background: var(--blue-50);
  color: var(--primary-pressed);
}
.fail-box {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--r-sm);
  color: var(--red-500);
  font-size: 14px;
  text-align: left;
  word-break: break-word;
}
