:root {
  /* Toss-derived palette — Toss Blue accent on clean neutral-grey surfaces */
  --kb-background: #f9fafb;
  --kb-surface: #ffffff;
  --kb-surface-muted: #f2f4f6;
  --kb-fill: #f2f4f6;
  --kb-primary: #3182f6;
  --kb-primary-pressed: #1b64da;
  --kb-primary-tint: #e8f3ff;
  --kb-ink: #191f28;
  --kb-body: #4e5968;
  --kb-caption: #8b95a1;
  --kb-placeholder: #b0b8c1;
  --kb-border: rgba(0, 0, 0, 0.08);
  --kb-border-muted: rgba(0, 0, 0, 0.12);
  --kb-focus: #3182f6;
  --kb-verified: #4cc9f0;
  --kb-korean: #ffe5d9;
  --kb-korean-strong: #e0603c;
  --kb-international: #d8e2dc;
  --kb-international-strong: #5c8a70;
  --kb-safety: #f2b8bc;
  --kb-safety-deep: #f04452;
  --kb-radius-card: 16px;
  --kb-radius-control: 12px;
  --kb-shadow-card: 0 2px 10px rgba(0, 0, 0, 0.06);
  --kb-shadow-float: 0 4px 16px rgba(0, 0, 0, 0.10);
  --kb-font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", Roboto, "Noto Sans KR", sans-serif;
}

html {
  background: var(--kb-background);
}

body {
  margin: 0;
  background: var(--kb-background);
  color: var(--kb-ink);
  font-family: var(--kb-font);
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body,
button,
input,
textarea,
select {
  font-family: var(--kb-font);
  letter-spacing: 0;
}

.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  line-height: 1;
  letter-spacing: normal;
}

main:not([data-welcome-splash]):not([data-call-canvas]) {
  background: var(--kb-background) !important;
  color: var(--kb-ink) !important;
  font-family: var(--kb-font) !important;
}

main:not([data-welcome-splash]):not([data-call-canvas]) .font-semibold {
  font-weight: 500 !important;
}

main:not([data-welcome-splash]):not([data-call-canvas]) :is(.text-6xl, .text-4xl, .text-3xl) {
  font-size: 26px !important;
  line-height: 35px !important;
}

main:not([data-welcome-splash]):not([data-call-canvas]) .text-2xl {
  font-size: 24px !important;
  line-height: 32px !important;
}

main:not([data-welcome-splash]):not([data-call-canvas]) .text-xl {
  font-size: 20px !important;
  line-height: 27px !important;
}

main:not([data-welcome-splash]):not([data-call-canvas]) .text-lg {
  font-size: 18px !important;
  line-height: 24px !important;
}

main:not([data-welcome-splash]):not([data-call-canvas]) :is(p, span, h1, h2, h3, h4, label, a, button, .uppercase, [style*="letter-spacing"]) {
  letter-spacing: 0 !important;
}

main:not([data-welcome-splash]):not([data-call-canvas]) :is(input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]):not(.bg-transparent), textarea:not(.bg-transparent), select:not(.bg-transparent)) {
  min-height: 40px;
  border: 1px solid #e5e8eb !important;
  border-radius: 8px !important;
  background: var(--kb-surface-muted) !important;
  color: var(--kb-ink) !important;
}

main:not([data-welcome-splash]):not([data-call-canvas]) :is(input, textarea)::placeholder {
  color: var(--kb-placeholder) !important;
}

main:not([data-welcome-splash]):not([data-call-canvas]) :is(a, button) {
  -webkit-tap-highlight-color: transparent;
}

main:not([data-welcome-splash]):not([data-call-canvas]) :is(a, button, input, textarea, select):focus-visible {
  outline: 2px solid #3182f6;
  outline-offset: 2px;
}

.kb-main-nav {
  border-top: 1px solid var(--kb-border);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}

.kb-main-nav__link {
  width: 68px;
  min-height: 52px;
  flex-direction: column;
  gap: 2px;
  border-radius: 12px;
  text-decoration: none;
}

.kb-main-nav__label {
  font-size: 11px;
  font-weight: 500;
  line-height: 15px;
}

.kb-main-nav__icon {
  font-variation-settings: "FILL" 0, "wght" 500;
}

.kb-main-nav a[style*="#3182f6"] .kb-main-nav__icon {
  font-variation-settings: "FILL" 1, "wght" 600;
}

.kb-scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.kb-scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* ============================================================
   Component layer — token-mapped, Meeff photo-forward system.
   Use these instead of inline hex / ad-hoc shadows in views.
   ============================================================ */

/* App bar: sticky top chrome, centered title */
.kb-app-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--kb-background);
}
.kb-app-bar__icon {
  display: flex;
  height: 40px;
  width: 40px;
  align-items: center;
  justify-content: center;
  color: var(--kb-ink);
  text-decoration: none;
}
.kb-app-bar__title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  line-height: 22px;
  color: var(--kb-ink);
}

/* Card surface */
.kb-card {
  background: var(--kb-surface);
  border: 1px solid var(--kb-border);
  border-radius: var(--kb-radius-card);
  box-shadow: var(--kb-shadow-card);
}

/* Buttons */
.kb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 20px;
  border-radius: var(--kb-radius-control);
  border: 1px solid transparent;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
.kb-btn:active { transform: scale(0.98); }
.kb-btn--sm { min-height: 40px; padding: 0 16px; font-size: 14px; border-radius: 8px; }
.kb-btn--block { width: 100%; }
.kb-btn--primary { background: var(--kb-primary); color: #fff; }
.kb-btn--primary:active { background: var(--kb-primary-pressed); }
.kb-btn--neutral { background: var(--kb-fill); color: var(--kb-ink); }
.kb-btn--outline { background: transparent; color: var(--kb-ink); border-color: #e5e8eb; }
.kb-btn--critical { background: var(--kb-safety-deep); color: #fff; }
.kb-btn:disabled, .kb-btn[aria-disabled="true"] { background: var(--kb-fill); color: #d1d6db; pointer-events: none; }

/* Chips */
.kb-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 12px;
  border-radius: 9999px;
  background: var(--kb-fill);
  color: var(--kb-body);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
}
.kb-chip--selected { background: var(--kb-ink); color: #fff; }
.kb-chip--brand { background: var(--kb-primary-tint); color: var(--kb-primary); }
.kb-chip--korean { background: var(--kb-korean); color: var(--kb-ink); }
.kb-chip--international { background: var(--kb-international); color: var(--kb-ink); }

/* Radio pill — visual selected state for sr-only radios inside <label>.
   Lets the user see which option is checked without a re-render. */
.kb-radio-pill:has(:checked) {
  background: var(--kb-primary-tint) !important;
  border-color: var(--kb-primary) !important;
  color: var(--kb-primary) !important;
}

/* Avatars */
.kb-avatar {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: var(--kb-fill);
  color: var(--kb-primary);
  font-weight: 700;
  overflow: visible;
}
.kb-avatar img {
  height: 100%;
  width: 100%;
  border-radius: 9999px;
  object-fit: cover;
}
.kb-avatar--sm { height: 40px; width: 40px; font-size: 14px; }
.kb-avatar--md { height: 56px; width: 56px; font-size: 18px; }
.kb-avatar--lg { height: 96px; width: 96px; font-size: 28px; }
.kb-avatar--xl { height: 128px; width: 128px; font-size: 36px; }
.kb-avatar__badge {
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  height: 24px;
  width: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: 2px solid var(--kb-surface);
  background: var(--kb-primary);
  color: #fff;
}
.kb-avatar__badge--verified { background: var(--kb-verified); }

/* Segmented tabs (two-up) */
.kb-segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--kb-fill);
}
.kb-segmented__item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--kb-caption);
  text-decoration: none;
}
.kb-segmented__item[aria-current="page"],
.kb-segmented__item[aria-selected="true"] {
  background: var(--kb-surface);
  color: var(--kb-ink);
  font-weight: 700;
  box-shadow: var(--kb-shadow-card);
}

/* Empty / inline states */
.kb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 56px 16px;
  text-align: center;
}
.kb-empty__text { font-size: 14px; color: var(--kb-caption); }

/* Onboarding profile-photo capture */
.kb-onboarding-photo-screen {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--kb-surface);
  color: var(--kb-ink);
  font-family: var(--kb-font);
}

.kb-onboarding-photo-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  padding: 48px 32px calc(24px + env(safe-area-inset-bottom));
  flex-direction: column;
}

.kb-onboarding-photo-progress {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 9999px;
  background: var(--kb-fill);
}

.kb-onboarding-photo-progress > div {
  height: 100%;
  border-radius: inherit;
  background: var(--kb-primary);
  transition: width 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.kb-onboarding-photo-header {
  margin-top: 96px;
  margin-bottom: 56px;
}

.kb-onboarding-photo-header h1 {
  margin: 0;
  color: var(--kb-ink);
  font-size: 44px;
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: 0;
}

.kb-onboarding-photo-header p {
  margin: 24px 0 0;
  color: var(--kb-caption);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0;
}

.kb-onboarding-photo-error {
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid var(--kb-safety);
  border-radius: 12px;
  background: #fff5f5;
  color: var(--kb-safety-deep);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

.kb-onboarding-photo-form {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.kb-onboarding-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: 12px;
}

.kb-onboarding-photo-slot {
  position: relative;
  display: flex;
  aspect-ratio: 1 / 1;
  min-width: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 24px;
  background: #dcdee3;
}

.kb-onboarding-photo-slot--primary {
  grid-column: span 2;
  grid-row: span 2;
}

.kb-onboarding-photo-slot img {
  height: 100%;
  width: 100%;
  object-fit: cover;
}

.kb-onboarding-photo-placeholder {
  display: flex;
  height: 100%;
  width: 100%;
  align-items: center;
  justify-content: center;
  color: var(--kb-surface);
}

.kb-onboarding-photo-placeholder .material-symbols-outlined {
  font-size: 56px;
  font-variation-settings: "wght" 300;
}

.kb-onboarding-photo-slot:not(.kb-onboarding-photo-slot--primary) .kb-onboarding-photo-placeholder .material-symbols-outlined {
  font-size: 44px;
}

.kb-onboarding-photo-warning {
  margin: 24px 0 0;
  color: var(--kb-caption);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0;
}

.kb-onboarding-photo-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: auto;
  padding-top: 28px;
}

.kb-onboarding-photo-actions__previous,
.kb-onboarding-photo-actions__next {
  display: inline-flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-decoration: none;
}

.kb-onboarding-photo-actions__previous {
  border: 1px solid var(--kb-border-muted);
  background: var(--kb-surface);
  color: var(--kb-ink);
}

.kb-onboarding-photo-actions__next {
  border: 1px solid transparent;
  background: var(--kb-primary);
  color: var(--kb-surface);
}

.kb-onboarding-photo-actions__next:disabled {
  background: var(--kb-fill);
  color: #d1d3d8;
  cursor: default;
}

@media (max-width: 380px) {
  .kb-onboarding-photo-shell {
    padding-right: 24px;
    padding-left: 24px;
  }

  .kb-onboarding-photo-header {
    margin-top: 72px;
    margin-bottom: 48px;
  }

  .kb-onboarding-photo-header h1 {
    font-size: 38px;
  }

  .kb-onboarding-photo-actions {
    gap: 12px;
  }
}

/* MBTI bottom sheet — DESIGN.md §5 (20px sheet radius), §6 (s3 shadow),
   §15 (rise from y+40 / ease-enter / motion-standard; backdrop to
   rgba(0,0,0,0.5); dismissal lighter at motion-fast / ease-exit). */
.kb-mbti-sheet__backdrop,
.kb-mbti-sheet__panel {
  display: none;
}

.kb-mbti-sheet--open .kb-mbti-sheet__backdrop {
  opacity: 1;
}

.kb-mbti-sheet--open .kb-mbti-sheet__panel {
  transform: translateY(0);
  opacity: 1;
}

.kb-mbti-sheet__backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 250ms cubic-bezier(0.0, 0.0, 0.2, 1); /* motion-standard / ease-enter */
}

.kb-mbti-sheet__panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: var(--kb-surface);
  border-radius: 20px 20px 0 0;
  box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.12); /* s3 */
  transform: translateY(40px);
  opacity: 0;
  /* Enter rides ease-enter / motion-standard (250ms); when the --open class
     drops, the same transition reverses on the lighter ease-exit curve. */
  transition:
    transform 250ms cubic-bezier(0.4, 0.0, 1, 1),
    opacity 150ms cubic-bezier(0.4, 0.0, 1, 1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.kb-mbti-sheet__handle {
  width: 36px;
  height: 4px;
  border-radius: 9999px;
  background: #dcdee3;
  margin: 12px auto 4px;
  flex: none;
}

.kb-mbti-sheet__header {
  padding: 12px 20px 8px;
}

.kb-mbti-sheet__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--kb-ink);
}

.kb-mbti-sheet__list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 12px 16px;
}

.kb-mbti-sheet__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-radius: 12px;
  cursor: pointer;
}

.kb-mbti-sheet__row:focus-visible {
  outline: 2px solid var(--kb-focus);
  outline-offset: -2px;
}

.kb-mbti-sheet__row:hover {
  background: var(--kb-surface-muted);
}

.kb-mbti-sheet__row + .kb-mbti-sheet__row {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.kb-mbti-sheet__code {
  font-size: 15px;
  font-weight: 700;
  color: var(--kb-ink);
  min-width: 48px;
}

.kb-mbti-sheet__name {
  font-size: 14px;
  color: var(--kb-body);
}

/* Trigger field — reads like the Icebreaker <select> on the same card:
   fill background, soft border, 12px control radius, 13px caption label. */
.kb-mbti-sheet__trigger {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 12px;
  border: 1px solid var(--kb-border);
  background: var(--kb-fill);
  color: var(--kb-placeholder);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.kb-mbti-sheet__trigger:focus-visible {
  outline: 2px solid var(--kb-focus);
  outline-offset: 2px;
}

.kb-mbti-sheet__trigger--filled {
  color: var(--kb-ink);
}

.kb-mbti-sheet__chevron {
  flex: none;
  color: var(--kb-caption);
}

@media (prefers-reduced-motion: reduce) {
  .kb-mbti-sheet__backdrop,
  .kb-mbti-sheet__panel {
    transition: none;
  }

  .kb-mbti-sheet--open .kb-mbti-sheet__panel {
    transform: none;
  }
}
