:root{
  /* Main — 터콰이즈 */
  --color-main:#14c9c1;
  --color-main-100:#e7f8f7;
  --color-main-200:#b8ecea;
  --color-main-400:#4ad9d3;
  --color-main-600:#0d827c;
  --color-main-700:#0a7d78;

  /* Sub — 코랄 */
  --color-sub:#ff6a4d;
  --color-sub-100:#ffece7;
  --color-sub-300:#ffc0b0;
  --color-sub-600:#e8512f;
  --color-sub-700:#b83a1c;

  /* Sub3 — 앰버 */
  --color-sub3:#ffb020;
  --color-sub3-100:#ffeac5;
  --color-sub3-600:#e0930a;
  --color-sub3-700:#8d6112;

  /* Ground */
  --color-bg:#f2f7f6;
  --color-surface:#fdfefe;
  --color-text:#0d1f1e;
  --color-track:#d5e8e6;
  --color-divider:rgba(0,0,0,.14);
  /* 명시적 muted 토큰이 없어서, 본문 텍스트색을 옅게 섞어 파생합니다 */
  --color-text-muted: color-mix(in srgb, var(--color-text) 60%, transparent);

  /* Accent (sub3 기반 배지/버튼 배경·글자 쌍) */
  --color-accent: var(--color-sub3);
  --color-accent-bg: color-mix(in srgb, var(--color-accent) 30%, transparent);
  --color-accent-text: color-mix(in srgb, var(--color-sub3) 55%, #000000);

  /* Type */
  /* Caprasimo가 영어 + 숫자까지 커버하게 */
  --font-heading: "Caprasimo","Jua",system-ui,sans-serif;
  --font-body: "Figtree","Gowun Dodum",system-ui,sans-serif;

  /* Radius */
  --radius-sm:8px;
  --radius-md:16px;
  --radius-lg:28px;
  --radius-card:30px;
  --radius-pill:999px;

  /* Shadow */
  --shadow-sm:0 1px 2px rgba(13,31,30,.12);
  --shadow-md:0 3px 10px rgba(13,31,30,.14);
  --shadow-lg:0 12px 32px rgba(13,31,30,.20);
}

:root[data-theme="dark"]{
  color-scheme: dark;

  /* 1) 바탕 계열 — 전부 교체 */
  --color-bg:#0d1a19;
  --color-surface:#172827;
  --color-text:#e6f7f5;
  --color-track:#263836;
  --color-divider:rgba(255,255,255,.16);

  /* 2) 베이스(500)·400·600 — 손대지 않음. 브랜드색은 테마와 무관 */

  /* 3) 텍스트용 700 — 밝은 단계로 뒤집기 */
  --color-main-700: var(--color-main-400);   /* #4ad9d3 */
  --color-sub-700:  #ff9880;
  --color-sub3-700: #ffca63;

  /* 4) 틴트용 100·200·300 — 흰색이 아니라 surface에 섞어 재계산 */
  --color-main-100: color-mix(in srgb, var(--color-main) 18%, var(--color-surface));
  --color-main-200: color-mix(in srgb, var(--color-main) 28%, var(--color-surface));
  --color-sub-100:  color-mix(in srgb, var(--color-sub)  18%, var(--color-surface));
  --color-sub-300:  color-mix(in srgb, var(--color-sub)  40%, var(--color-surface));
  --color-sub3-100: color-mix(in srgb, var(--color-sub3) 18%, var(--color-surface));

  /* 5) 파생 토큰 — 기준만 바꿔서 다시 섞기 */
  --color-accent-bg:   color-mix(in srgb, var(--color-accent) 22%, var(--color-surface));
  --color-accent-text: color-mix(in srgb, var(--color-accent) 55%, #ffffff);
  --color-text-muted:  color-mix(in srgb, var(--color-text) 60%, transparent);
}
* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

/* [hidden] 속성은 브라우저 기본 스타일(display:none)로 처리되는데, .icon-btn/.wizard-step
   처럼 display를 직접 지정하는 클래스와 같이 쓰이면 그 클래스가 이겨서 hidden이 무시되고
   요소가 계속 보이는 문제가 있었습니다. hidden이 항상 최우선으로 이기도록 고정합니다. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  transition: background-color 0.2s ease, color 0.2s ease;
  /* 버튼 연타 시 브라우저가 더블탭으로 오해해서 확대하는 걸 막습니다.
     핀치 줌 자체는 막지 않아서(뷰포트 user-scalable=no 방식과 달리) 접근성은 그대로 유지됩니다. */
  touch-action: manipulation;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* 하단 고정 푸터(.app-footer)에 콘텐츠가 가려지지 않도록 여백을 둡니다. */
  padding-bottom: 76px;
}

.app-inner {
  padding: 16px;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .app-shell {
    gap: 18px;
  }

  .app-inner {
    padding: 20px;
  }
}

h1
{
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1.2;
}

h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.25;
}

h4{
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

h5 {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  line-height: 1.3;
}

.section-label {
  font-size: 0.85rem;
  font-weight: 700;
}

.input {
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
}

/* 뽀모도로 설정 폼 (뽀모도로 등록/수정, 회원가입 마법사에서 공통으로 씁니다). */
.field-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 32px;
}

/* 회원가입 마법사의 한 단계입니다. h3(제목)/h5(설명) 아래로 입력 요소들이 이어집니다. */
.wizard-step {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.stepper-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stepper-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
}

.stepper-label {
  flex: 1;
}

.stepper-label-main {
  font-size: 0.9rem;
  font-weight: 600;
}

.stepper-label-sub {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

.stepper-value {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  min-width: 44px;
  text-align: center;
}

.alert-group {
  display: flex;
  flex-direction: column;
}

.option-row {
  display: flex;
  gap: 8px;
}

.option-btn {
  flex: 1;
  height: 44px;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.85rem;
  cursor: pointer;
}

.option-btn.active {
  border-color: var(--color-main-600);
  background: color-mix(in srgb, var(--color-main-600) 14%, var(--color-surface));
  color: var(--color-main-700);
  font-weight: 700;
}

/* 소리/진동을 고르면 그 아래로 슬라이드하며 세부 옵션이 열립니다. */
.suboption-panel {
  display: flex;
  gap: 8px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin-top 0.25s ease;
}

.suboption-panel.open {
  max-height: 60px;
  opacity: 1;
  margin-top: 10px;
}

.suboption-chip {
  flex: 1;
  height: 38px;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-pill);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.8rem;
  cursor: pointer;
}

.suboption-chip.active {
  border-color: var(--color-main-600);
  background: var(--color-main-600);
  color: var(--color-bg);
}

/* 폭 전체를 채우는 굵은 CTA 버튼입니다 (저장하기/로그인하기/다음 등). */
.btn-block {
  width: 100%;
  justify-content: center;
  height: 50px;
  font-size: 0.95rem;
  margin-top: 8px;
}

/* 화면 하단에서 30px 위에 고정되는 액션 버튼 영역입니다. 내용이 길면 위 콘텐츠가
   스크롤되고, 짧아도 이 버튼은 항상 같은 자리에 붙어 있습니다 (로그인/회원가입 등). */
.bottom-action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 30px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
  box-sizing: border-box;
}

/* bottom-action-bar를 쓰는 페이지는 마지막 입력이 버튼에 가리지 않도록 여백을 더 둡니다. */
.app-shell.has-bottom-action {
  padding-bottom: 130px;
}

header {
  padding: 10px 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* /user, /profile/invite 같은 뒤로가기+타이틀 형태의 "작업용" 페이지 헤더입니다. */
.editor-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
}

.editor-header h1 {
  flex: 1;
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
}

/* 회원가입 같은 여러 단계 화면의 editor-header에서, h1 대신 현재 단계를 보여주는 점입니다. */
.step-dots {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-divider);
  transition: width .16s ease, background-color .16s ease;
}

.step-dot.active {
  width: 20px;
  background: var(--color-main-600);
}

.session-meta {
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* 가로/세로 스크롤은 그대로 되지만, 스크롤바 자체는 안 보이게 합니다. */
.no-scrollbar {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* 구형 Edge/IE */
}
.no-scrollbar::-webkit-scrollbar {
  display: none; /* Chrome/Safari/Edge(Chromium) */
}

/* 데이터가 없을 때 공통으로 쓰는 빈 상태 컴포넌트입니다. (common/noData.js)
   아이콘+텍스트만 기본이고, __desc/__action은 쓰는 쪽에서 선택적으로 추가합니다. */
.no-data {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 120px 20px;
  text-align: center;
  box-sizing: border-box;
}

.no-data__icon {
  width: 64px;
  height: 64px;
  opacity: 0.7;
}

.no-data__text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
}

.no-data__desc {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.no-data__action {
  margin-top: 4px;
  color: var(--color-main-700);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
}

.no-data__action:hover {
  text-decoration: underline;
}

/* 특정 섹션 위에 얹는 공용 로딩 오버레이입니다. (common/loadingOverlay.js)
   전체 화면을 덮는 #global-spinner-overlay와 달리, 대상 요소 하나만 덮습니다. */
.loading-overlay-host {
  position: relative;
}

.loading-overlay {
  display: none;
}

.loading-overlay-host.is-loading > .loading-overlay {
  display: flex;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: var(--color-sub3-700);
}

.loading-overlay-host.is-loading > :not(.loading-overlay) {
  visibility: hidden;
}

.app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  justify-content: space-around;
  background: var(--color-surface);
  border-top: 1px solid var(--color-divider);
  padding: 8px 0;
}

.app-footer-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 12px;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-decoration: none;
}

.app-footer-link .icon {
  width: 22px;
  height: 22px;
}

.app-footer-link.active {
  color: var(--color-main-700);
}

.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  vertical-align: middle;
}

.icon-btn {
  inline-size: 44px;
  block-size: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .16s ease, color .16s ease, transform .12s ease;
}

/* 헤더에서 back-btn과 짝을 맞춰, step-dots 같은 가운데 요소가 진짜 중앙에 오도록
   자리만 차지하는 투명한 자리표시자입니다 (auth/signup.html 참고). */
.icon-btn-spacer {
  inline-size: 44px;
  block-size: 44px;
  flex: none;
}

.icon-btn--sm {
  background: none;
  position: relative;
  isolation: isolate;
}
.icon-btn--sm::before {
  content: "";
  position: absolute;
  inline-size: 32px;
  block-size: 32px;
  border-radius: 999px;
  background: var(--color-surface);
  z-index: -1;
}

/* 친구 목록/알림 목록처럼 "왼쪽 텍스트 + 오른쪽 액션" 형태로 반복되는 행의 공통 틀입니다.
   각 화면은 이 클래스와 함께 자기만의 클래스(.friend-row, .notification-row 등)를 덧붙여
   텍스트 스타일이나 강조 표시 같은 세부 사항만 얹습니다. */
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  margin-bottom: 10px;
}

/* 헤더 알림 벨의 안 읽음 배지입니다. [data-notification-badge]는 안 읽은 알림이 없으면
   hidden 속성이 붙는데, 위쪽의 [hidden] { display:none !important } 규칙이 이 display보다
   항상 이겨서 그때는 그대로 숨겨집니다. */
.icon-btn--notification {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--color-sub-600);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--color-surface);
}

.icon-btn:hover {
  background: color-mix(in srgb, var(--color-main) 14%, var(--color-surface));
  color: var(--color-main-700);
}

.icon-btn:active {
  background: color-mix(in srgb, var(--color-main) 24%, var(--color-surface));
  transform: scale(.94);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--color-main);
  outline-offset: 2px;
}

.icon-btn[disabled],
.icon-btn[aria-disabled="true"] {
  opacity: .45;
  cursor: not-allowed;
}

.icon-btn-label {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  min-block-size: 44px;
  padding-inline: 16px;
  border: 0;
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
}

.icon-btn--primary {
  background: var(--color-main-600);
  color: var(--color-bg);
}
.icon-btn--primary:hover {
  background: var(--color-main-700);
  color: var(--color-bg);
}

.icon-btn[aria-pressed="true"] {
  background: var(--color-main-600);
  color: var(--color-bg);
}
.btn-delete{
  background: var(--color-sub-600);
  color: var(--color-bg);
}

.icon-btn:hover {
  background: color-mix(in srgb, var(--color-main) 14%, var(--color-surface));
  color: var(--color-main-700);
}

.btn-delete:hover {
  background: color-mix(in srgb, var(--color-sub) 14%, var(--color-surface));
  color: var(--color-sub-700);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .icon-btn { transition: none; }
  .icon-btn:active { transform: none; }
}

@media (forced-colors: active) {
  .icon-btn { border: 1px solid ButtonBorder; background: ButtonFace; color: ButtonText; }
  .icon-btn:focus-visible { outline: 2px solid Highlight; }
  .icon { stroke: currentColor; }
}

.btn-dark-toggle{
  background: var(--color-sub3-100);
  color: var(--color-sub3-600);
}
.btn-dark-toggle:hover{
  background: color-mix(in srgb, var(--color-sub3) 14%, var(--color-surface));
  color: var(--color-sub3-700);
}

/* 전체 화면을 덮는 반투명 배경 */
/* fetch 중일 때만 Spinner.show()가 display:flex로 바꿔주는 용도라 기본은 숨김 상태여야
   합니다. display:flex가 기본값이면 페이지를 열자마자 아무 fetch도 없는 화면(로그인 등)에서
   Spinner.hide()가 한 번도 호출되지 않아 전체 화면이 계속 스피너로 덮여 있게 됩니다. */
#global-spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.4);
    display: none;
    transition: opacity 0.1s ease;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* 스피너 디자인 */
.spinner-circle {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
