/* shared/base.css — 모든 사이트 공통 리셋 + 토스트 + 광고 슬롯 + 푸터 + 크로스 프로모 */

:root {
  --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Malgun Gothic', sans-serif;
  --max-width: 480px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --toast-bg: rgba(20, 18, 30, 0.94);
  --toast-fg: #fff;
}

/* 일본어 페이지: 가나/한자는 일본어 글꼴로 (Pretendard에는 가나가 없다) */
html:lang(ja) {
  --font-sans: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN',
    'Yu Gothic UI', 'Yu Gothic', Meiryo, 'Noto Sans JP', 'Pretendard', sans-serif;
}
/* 일본어 제목은 문절 단위로 줄바꿈 (지원 브라우저만, 나머지는 무시) */
html:lang(ja) :is(h1, h2, h3, summary) { word-break: auto-phrase; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------------- 토스트 ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(12px);
  background: var(--toast-bg);
  color: var(--toast-fg);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 9999;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------------- 크로스 프로모 ---------------- */
#more-tests {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: var(--max-width);
  margin: 0 auto;
}
.more-test-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.15s ease, background 0.15s ease;
}
.more-test-card:active { transform: scale(0.98); }
.more-test-emoji { font-size: 26px; line-height: 1; flex-shrink: 0; }
.more-test-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.more-test-title { font-weight: 700; font-size: 15px; }
.more-test-desc {
  font-size: 12.5px;
  opacity: 0.65;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.more-test-arrow { opacity: 0.4; font-size: 16px; flex-shrink: 0; }

/* ---------------- 푸터 ---------------- */
.site-footer {
  max-width: var(--max-width);
  margin: 40px auto 0;
  padding: 24px 20px 40px;
  text-align: center;
  font-size: 12px;
  opacity: 0.55;
  line-height: 1.8;
}
.site-footer a { text-decoration: underline; text-underline-offset: 2px; }

/* ---------------- 언어 전환 ---------------- */
.lang-switch {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 0 0;
  font-size: 12px;
  line-height: 1;
}
.lang-switch a {
  padding: 6px 9px;
  border-radius: 999px;
  opacity: 0.6;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.lang-switch a:hover { opacity: 0.9; }
.lang-switch a[aria-current="page"] {
  opacity: 1;
  font-weight: 800;
  background: rgba(150, 150, 160, 0.16);
}

/* 기본 언어 루트에서만 JS로 삽입되는 "다른 언어 버전" 배너 */
.lang-banner {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 32px);
  max-width: calc(var(--max-width) - 40px);
  margin: 12px auto 0;
  padding: 10px 8px 10px 16px;
  border-radius: var(--radius-md);
  background: var(--toast-bg);
  color: var(--toast-fg);
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  animation: lang-banner-in 0.3s ease;
}
.lang-banner-text { flex: 1; min-width: 0; }
/* 한국어 페이지 위에 뜨는 일본어 배너도 일본어 글꼴로 */
.lang-banner:lang(ja) { font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Yu Gothic', Meiryo, 'Noto Sans JP', var(--font-sans); }
.lang-banner-cta {
  flex-shrink: 0;
  padding: 7px 12px;
  border-radius: 999px;
  background: #fff;
  color: #14121e;
  font-weight: 700;
  font-size: 12.5px;
  white-space: nowrap;
}
.lang-banner-close {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
}
@keyframes lang-banner-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------- 유틸 ---------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
