/* 옮 디자인 시스템: 토큰과 테마
   색 컨셉: 로고처럼 보라, 주황, 핑크, 노랑.
   - 주요 버튼(보내기, 방 만들기 등): 보라에서 핑크로 이어지는 그라데이션(cool), 흰 글자
   - 보조 버튼(파일 선택, 코드 만들기, 저장 등): 주황에서 노랑으로 이어지는 그라데이션(warm), 진한 글자
   - 기본 배경은 흰색, 글자는 잉크색으로 두어 색이 버튼과 강조에만 쓰이게 합니다. */
:root {
  color-scheme: light dark;

  /* 색상 (밝은 테마) */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f0ec;
  --text: #1b1d21;
  --text-muted: #565b65;
  --border: #d6d3c9;
  --border-strong: #8e8b80;
  --purple: #7b3fe4;
  --pink: #c2307a;
  --orange: #f28c38;
  --yellow: #f5b841;
  --grad-cool: linear-gradient(135deg, #7b3fe4 0%, #c2307a 100%);
  --grad-warm: linear-gradient(135deg, #f28c38 0%, #f5b841 100%);
  --on-warm: #2b1a05;
  --accent: #7b3fe4;
  --accent-hover: #6a2fd0;
  --on-accent: #ffffff;
  --accent-soft: #f2ebfe;
  --accent-text: #5b2bb5;
  --accent-ring: rgba(123, 63, 228, 0.35);
  /* 기기 종류 표시(PC, 폰, 태블릿) */
  --kind-pc-bg: #efe7fe;
  --kind-pc-fg: #5b2bb5;
  --kind-phone-bg: #fff0e2;
  --kind-phone-fg: #9a4a08;
  --kind-tablet-bg: #fde8f2;
  --kind-tablet-fg: #a3265f;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --warn-text: #7a4f00;
  --warn-soft: #fdf1d6;
  --focus: #7b3fe4;
  --backdrop: rgba(20, 22, 26, 0.55);

  /* 서체 */
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "D2Coding", monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --leading: 1.5;

  /* 간격 (4px 기준) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;

  /* 모양 */
  --radius: 6px;
  --radius-sm: 4px;
  --tap: 44px;

  /* 레이아웃 */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1200px;
  --sidebar: 320px;
}

[data-theme="dark"] {
  --bg: #121416;
  --surface: #1b1e22;
  --surface-2: #262a30;
  --text: #eceef1;
  --text-muted: #a7acb6;
  --border: #353a42;
  --border-strong: #6d7480;
  --accent: #a47bff;
  --accent-hover: #b795ff;
  --on-accent: #1a0d33;
  --accent-soft: #261d3d;
  --accent-text: #c9b2ff;
  --accent-ring: rgba(164, 123, 255, 0.45);
  --kind-pc-bg: #2a2045;
  --kind-pc-fg: #cbb5ff;
  --kind-phone-bg: #3a2614;
  --kind-phone-fg: #ffbf85;
  --kind-tablet-bg: #3a1a2b;
  --kind-tablet-fg: #ff9cc9;
  --danger: #ff8f86;
  --danger-soft: #3a1f1d;
  --warn-text: #f2c66d;
  --warn-soft: #33290f;
  --focus: #b795ff;
  --backdrop: rgba(0, 0, 0, 0.7);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121416;
    --surface: #1b1e22;
    --surface-2: #262a30;
    --text: #eceef1;
    --text-muted: #a7acb6;
    --border: #353a42;
    --border-strong: #6d7480;
    --accent: #a47bff;
    --accent-hover: #b795ff;
    --on-accent: #1a0d33;
    --accent-soft: #261d3d;
    --accent-text: #c9b2ff;
    --accent-ring: rgba(164, 123, 255, 0.45);
    --kind-pc-bg: #2a2045;
    --kind-pc-fg: #cbb5ff;
    --kind-phone-bg: #3a2614;
    --kind-phone-fg: #ffbf85;
    --kind-tablet-bg: #3a1a2b;
    --kind-tablet-fg: #ff9cc9;
    --danger: #ff8f86;
    --danger-soft: #3a1f1d;
    --warn-text: #f2c66d;
    --warn-soft: #33290f;
    --focus: #b795ff;
    --backdrop: rgba(0, 0, 0, 0.7);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: var(--leading);
  word-break: keep-all;
  overflow-wrap: anywhere;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
}

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

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -100px;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius);
}
.skip-link:focus {
  top: var(--space-2);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* hidden 속성은 항상 숨김(컴포넌트의 display 지정보다 우선) */
[hidden] {
  display: none !important;
}

/* 읽기 편한 줄바꿈: 한국어 단어 중간에서 줄이 바뀌지 않게 하고(긴 주소는 예외),
   여러 줄 문장은 마지막 줄이 너무 짧게 남지 않게, 제목은 줄 길이를 고르게 맞춥니다. */
body {
  word-break: keep-all;
  overflow-wrap: break-word;
}
p,
li,
.hint,
.empty,
.target,
.toast,
.item__phase {
  text-wrap: pretty;
}
h1,
h2,
h3,
.sheet__title,
.dialog__title {
  text-wrap: balance;
}
