/* WAE 공통 디자인 규격. 정본: packages/wae-ui/wae.css
   각 앱의 복사본은 scripts/sync-ui.sh 로만 갱신한다(직접 고치지 않는다).
   폰트는 각 앱 <head> 에서 Google Fonts 로 불러온다:
   https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Asta+Sans:wght@400;600;800&family=Outfit:wght@700&display=swap */
:root {
  --w-bg: #fafafa;
  --w-surface: #ffffff;
  --w-surface-2: #f2f2ef;
  --w-surface-3: #e9e9e5;
  --w-border: #e4e4df;
  --w-border-strong: #c8c8c2;
  --w-text: #16181d;
  --w-text-2: #50545c;
  --w-text-3: #8a8e96;
  --w-primary: #16181d;
  --w-primary-hover: #2c2f37;
  --w-font: 'Inter', 'Asta Sans', system-ui, -apple-system, 'Segoe UI', 'Apple SD Gothic Neo', sans-serif;
  --w-logo-font: 'Outfit', 'Inter', sans-serif;
  --w-fs-xs: 12px; --w-fs-sm: 14px; --w-fs-md: 16px; --w-fs-lg: 20px; --w-fs-xl: 28px;
  --w-r-sm: 8px; --w-r-md: 12px; --w-r-lg: 16px; --w-r-pill: 999px;
  --w-sh-1: 0 1px 2px rgba(16,18,24,.04), 0 2px 6px rgba(16,18,24,.05);
  --w-sh-2: 0 2px 4px rgba(16,18,24,.05), 0 6px 16px rgba(16,18,24,.07);
  --w-sh-pop: 0 8px 24px rgba(16,18,24,.12);
  --w-header-h: 64px;
  --w-gutter: 24px;
  --w-app: #16181d; /* 앱 색. 각 앱이 덮어쓴다 */
}
@media (max-width: 720px) { :root { --w-header-h: 56px; --w-gutter: 16px; } }

/* ---------- 로고 ---------- */
.w-logo { font-family: var(--w-logo-font); font-weight: 700; letter-spacing: -0.02em; line-height: 1; font-size: 26px; color: var(--w-text); text-decoration: none; white-space: nowrap; display: inline-flex; align-items: baseline; user-select: none; }
.w-logo .w-logo-why { color: var(--w-text); }
.w-logo .w-logo-name { color: var(--w-app); }
a.w-logo, button.w-logo { cursor: pointer; background: none; border: 0; padding: 0; }
.w-logo-lg { font-size: 64px; }
.w-logo-gate { font-size: 56px; }
@media (max-width: 720px) { .w-logo { font-size: 22px; } .w-logo-lg { font-size: 44px; } .w-logo-gate { font-size: 40px; } }

/* ---------- 헤더 ---------- */
.w-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; height: var(--w-header-h); padding: 0 var(--w-gutter); box-sizing: border-box; font-family: var(--w-font); }
.w-header-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.w-header-center { display: flex; align-items: center; justify-content: center; gap: 8px; }
.w-header-right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }

/* ---------- 버튼 ---------- */
.w-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: var(--w-r-pill); border: 0; background: var(--w-surface); color: var(--w-text); font: 600 var(--w-fs-sm)/1 var(--w-font); box-shadow: var(--w-sh-1); cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s, box-shadow .15s; }
.w-btn:hover { box-shadow: var(--w-sh-2); }
.w-btn:active { transform: translateY(1px); }
.w-btn:disabled { opacity: .45; cursor: default; }
.w-btn.w-in { box-shadow: none; border: 1px solid var(--w-border-strong); } /* 흰 상자 안 */
.w-btn.w-in:hover { background: var(--w-surface-2); }
.w-btn.w-primary { background: var(--w-primary); color: #fff; }
.w-btn.w-primary:hover { background: var(--w-primary-hover); }
.w-btn.w-ghost { background: transparent; box-shadow: none; }
.w-btn.w-ghost:hover { background: var(--w-surface-2); }
.w-btn.w-sm { height: 32px; padding: 0 12px; font-size: var(--w-fs-xs); }
.w-btn.w-lg { height: 48px; padding: 0 32px; font-size: var(--w-fs-md); }
.w-icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 0; background: var(--w-surface); color: var(--w-text-2); box-shadow: var(--w-sh-1); cursor: pointer; position: relative; }
.w-icon-btn:hover { box-shadow: var(--w-sh-2); color: var(--w-text); }
.w-icon-btn svg { width: 18px; height: 18px; }

/* ---------- 회색 스위치 (Study Test/Words) ---------- */
.w-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--w-r-pill); background: var(--w-surface-2); border: 1px solid var(--w-border); }
.w-seg > button { height: 28px; padding: 0 12px; border: 0; border-radius: var(--w-r-pill); background: transparent; color: var(--w-text-2); font: 600 var(--w-fs-xs)/1 var(--w-font); cursor: pointer; white-space: nowrap; }
.w-seg > button:hover { color: var(--w-text); }
.w-seg > button.on, .w-seg > button[aria-pressed="true"] { background: var(--w-surface); color: var(--w-text); box-shadow: var(--w-sh-1); }

/* ---------- 검정 탭 (Study New/Records/Analysis) ---------- */
.w-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--w-r-pill); background: var(--w-surface); box-shadow: var(--w-sh-1); }
.w-tabs > button, .w-tabs > a { height: 32px; padding: 0 20px; border: 0; border-radius: var(--w-r-pill); background: transparent; color: var(--w-text-2); font: 600 var(--w-fs-sm)/32px var(--w-font); cursor: pointer; text-decoration: none; white-space: nowrap; }
.w-tabs > button:hover, .w-tabs > a:hover { background: var(--w-surface-2); }
.w-tabs > .on, .w-tabs > [aria-selected="true"] { background: var(--w-primary); color: #fff; }
.w-tabs > .on:hover, .w-tabs > [aria-selected="true"]:hover { background: var(--w-primary); }

/* ---------- 카드 / 입력 ---------- */
.w-card { background: var(--w-surface); border-radius: var(--w-r-lg); box-shadow: var(--w-sh-1); padding: 16px; }
.w-search { width: 100%; height: 48px; padding: 0 24px; border: 0; border-radius: var(--w-r-pill); background: var(--w-surface); box-shadow: var(--w-sh-1); font: 400 var(--w-fs-md)/1 var(--w-font); color: var(--w-text); outline: none; box-sizing: border-box; transition: box-shadow .15s; }
.w-search:focus { box-shadow: var(--w-sh-2); }
.w-search::placeholder { color: var(--w-text-3); }
.w-input { height: 40px; padding: 0 12px; border: 1px solid var(--w-border-strong); border-radius: var(--w-r-sm); background: var(--w-surface); font: 400 var(--w-fs-sm)/1 var(--w-font); color: var(--w-text); box-sizing: border-box; }

/* ---------- 프로필 ---------- */
.w-profile { position: relative; display: inline-flex; }
.w-avatar { width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 1px solid var(--w-border-strong); background: var(--w-surface-2); color: var(--w-text); font: 700 var(--w-fs-sm)/1 var(--w-font); display: grid; place-items: center; overflow: hidden; cursor: pointer; flex: none; box-sizing: border-box; }
.w-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.w-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 1000; min-width: 200px; padding: 6px; background: var(--w-surface); border: 1px solid var(--w-border); border-radius: var(--w-r-md); box-shadow: var(--w-sh-pop); display: flex; flex-direction: column; gap: 2px; box-sizing: border-box; font-family: var(--w-font); }
.w-menu[hidden] { display: none; }
.w-menu > button, .w-menu > a { display: flex; align-items: center; height: 36px; padding: 0 12px; border: 0; border-radius: var(--w-r-sm); background: transparent; color: var(--w-text); font: 500 var(--w-fs-sm)/1 var(--w-font); text-align: left; text-decoration: none; cursor: pointer; white-space: nowrap; }
.w-menu > button:hover, .w-menu > a:hover { background: var(--w-surface-2); }
.w-menu > hr { border: 0; border-top: 1px solid var(--w-border); margin: 4px 0; }

/* ---------- + 버튼 ---------- */
.w-fab { position: fixed; right: 24px; bottom: 24px; z-index: 900; width: 56px; height: 56px; padding: 0; border: 0; border-radius: 50%; background: var(--w-primary); color: #fff; box-shadow: var(--w-sh-2); display: grid; place-items: center; cursor: pointer; transition: background .15s, transform .15s; }
.w-fab:hover { background: var(--w-primary-hover); }
.w-fab:active { transform: scale(.96); }
.w-fab svg { width: 24px; height: 24px; }
@media (max-width: 720px) { .w-fab { right: 16px; bottom: 16px; } }

/* ---------- 로그인 게이트 ---------- */
.w-gate { position: fixed; inset: 0; z-index: 2000; background: var(--w-bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 32px; padding: 24px; box-sizing: border-box; font-family: var(--w-font); }
.w-gate[hidden] { display: none; }
.w-gate .w-gate-btn[hidden] { display: none; }

/* ---------- 기타 ---------- */
.w-spin { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--w-surface-3); border-top-color: var(--w-text-2); animation: w-spin .8s linear infinite; }
@keyframes w-spin { to { transform: rotate(360deg); } }
