/* Shared base and components for every screen. Values come from tokens.css; guide: DESIGN-SYSTEM.md. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Keep the scrollbar's room on every page, so a short page and a long one line up (no sideways jump between them). */
html { scrollbar-gutter: stable; }
body {
  margin: 0;
  background: var(--color-page);
  color: var(--color-text-primary);
  font: var(--text-body)/var(--leading-body) var(--font-family);
  word-break: keep-all;
}
/* PC: the page is a phone-width frame on a grey backdrop. 480px = --page-max (media queries cannot read variables). */
@media (min-width: 481px) {
  html { background: var(--color-backdrop); }
  body { max-width: var(--page-max); min-height: 100vh; min-height: 100dvh; margin: 0 auto; }
}
button, input, select { font: inherit; color: inherit; }
/* Focus ring: only for keyboard users. After a tap or click (and when going back to a page, or when a script
   moves focus into the menu) no outline is left behind. menu.js sets html.ptr and drops it on Tab. */
html.ptr :focus-visible { outline: none !important; }
button { cursor: pointer; }
a { color: var(--color-text-brand); }

/* Header: the same bar on home and inner screens. [back | title | menu], or [brand | menu] on home. */
.sub-top {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: var(--tap) 1fr var(--tap); align-items: center;
  max-width: var(--page-max); height: calc(var(--header-height) + env(safe-area-inset-top));
  margin: 0 auto; padding: env(safe-area-inset-top) calc(var(--gutter) - (var(--tap) - var(--icon)) / 2) 0;
  background: var(--color-page);
}
.sub-top.home-top { grid-template-columns: 1fr var(--tap); }
/* 로그인: the bar is the logo (a link home) + ☰; its h1 is hidden (.sr). */
a.brand { color: inherit; text-decoration: none; }
.sub-title, .brand {
  margin: 0; font-size: var(--text-title-3); line-height: 1.4; font-weight: var(--weight-bold);
}
.sub-title { text-align: center; }
.brand { padding-left: calc((var(--tap) - var(--icon)) / 2); }  /* Text lines up with the page gutter. */
.home-top .brand { font-size: var(--text-brand); }  /* 홈·로그인 로고 글자 18(다른 화면 가운데 제목은 17) */
.back, .menu-btn {
  display: grid; place-content: center; width: var(--tap); height: var(--tap);
  padding: 0; border: 0; background: none; color: inherit; text-decoration: none;
}
.back img, .menu-btn img { display: block; width: var(--icon); height: var(--icon); }

/* Page body */
.sub { max-width: var(--page-max); margin: 0 auto; padding: var(--space-2) var(--gutter) max(var(--space-8), env(safe-area-inset-bottom)); }

/* Buttons */
.primary {
  min-height: var(--button-height); border: 0; border-radius: var(--radius-sm);
  background: var(--color-button); color: var(--color-text-inverse);
  font-size: var(--text-body); font-weight: var(--weight-bold);
}
/* 비활성 주 버튼(지금 누를 수 없을 때: 결제 준비 중 · 체크 전 복채로 열기 · 빈 칸 있는 의견 보내기 · 동의 전 시작하기):
   흐리게(opacity) 하지 않고 바탕 gray-400 + 흰 글자 color-text-inverse, 누를 수 없는 커서. disabled 또는 aria-disabled="true" */
.primary:disabled, .primary[aria-disabled="true"] { background: var(--gray-400); color: var(--color-text-inverse); opacity: 1; cursor: not-allowed; }
.ghost {
  min-height: var(--control-height); border: 1px solid var(--color-line); border-radius: var(--radius-sm);
  background: var(--color-soft); font-weight: var(--weight-medium);
}
/* Secondary button: a filled grey button for the next step after a section (no border). 52px like .ghost. */
.secondary {
  display: grid; place-items: center; min-height: var(--control-height); padding: 0 var(--space-4); border: 0; border-radius: var(--radius-sm);
  background: var(--gray-100); color: var(--color-text-primary); font: inherit; font-size: var(--text-body); font-weight: var(--weight-medium);
  text-decoration: none; cursor: pointer;
}
.secondary:active { background: var(--gray-200); }
.secondary:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }
/* Text button: 14px, underline set 4px below the letters. .subtle for quiet actions such as 회원 탈퇴. */
.link {
  min-height: 44px; border: 0; background: none; color: var(--color-text-brand);
  font-size: var(--text-caption); font-weight: var(--weight-medium);
  text-decoration: underline; text-underline-offset: 4px; cursor: pointer;
}
.link.subtle { color: var(--color-text-tertiary); font-weight: var(--weight-regular); }

/* Toast: short notice at the bottom */
.toast {
  position: fixed; left: 50%; bottom: max(var(--space-8), calc(env(safe-area-inset-bottom) + var(--space-4))); z-index: 40;  /* above the menu and the login sheet */
  padding: var(--space-3) var(--space-5); border-radius: var(--radius-xl);  /* a pill on one line, a soft box when it wraps */
  background: var(--color-toast); color: var(--color-text-inverse);
  width: max-content; max-width: calc(min(100vw, var(--page-max)) - 2 * var(--gutter));  /* long notices wrap inside the page */
  font-size: var(--text-body-sm); font-weight: var(--weight-medium); line-height: 1.5; text-align: center; word-break: keep-all;
  opacity: 0; transform: translate(-50%, 8px); transition: opacity var(--duration), transform var(--duration); pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Screen-reader only */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Loading: shimmering skeletons, and a spinner inside buttons (src/skeleton.js) */
@keyframes sk-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
/* Not in the top bar or inside the home hero card: those keep their own look while loading. */
.skeleton,
.bubble-face:not([src]), .sheet-face:not([src]), .menu-avatar:not([src]) {
  background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%) 0 0 / 200% 100%;
  animation: sk-shimmer 1.2s linear infinite;
}
.sk { display: grid; gap: var(--space-3); padding: var(--space-2) 0 var(--space-6); }
.sk-row { display: flex; align-items: center; gap: var(--space-3); }
.sk-stack { display: grid; flex: 1; gap: var(--space-2); }
.sk-circle { flex: none; width: 56px; height: 56px; border-radius: 50%; }
.sk-line { display: block; height: 14px; border-radius: 6px; }
.sk-block { border-radius: var(--radius-lg); }

.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.is-loading > * { visibility: hidden; }
.is-loading::after {
  content: ""; position: absolute; inset: 0; width: 22px; height: 22px; margin: auto;
  border: 2.5px solid rgba(0, 0, 0, .18); border-top-color: rgba(0, 0, 0, .75); border-radius: 50%;
  animation: spin .7s linear infinite;
}
.primary.is-loading::after { border-color: rgba(255, 255, 255, .3); border-top-color: var(--color-on-dark); }
@media (prefers-reduced-motion: reduce) {
  .skeleton, .bubble-face:not([src]), .sheet-face:not([src]), .menu-avatar:not([src]) { animation: none; }
  .is-loading::after { animation-duration: 1.6s; }
}

/* 복채 표시(메뉴·복채 충전/관리·잠금 화면·초대하기): 빨간 복주머니 그림(src/assets/bokchae/pouch_v1.webp, 투명 배경 192px). 클래스 이름은 처음 동전이던 때 그대로 */
.bokchae-coin { display: inline-block; flex: none; width: 24px; height: 24px; background: url("/src/assets/bokchae/pouch_v1.webp") center / contain no-repeat; }

/* 사업자 정보 푸터(src/business-info.js siteFooter, 홈 맨 아래 · 복채 충전하기 아래): 화면 양끝까지 color-soft 바탕, 위 48 띄움.
   상호 14 굵게 text-secondary → 사업자 정보 줄 13 text-tertiary(줄 높이 1.7) → 이용약관 | 개인정보처리방침 | 환불정책 | 문의하기 13 → 저작권 12 text-placeholder */
.site-foot { margin: calc(var(--space-8) + var(--space-4)) calc(-1 * var(--gutter)) 0; padding: var(--space-8) var(--gutter) var(--space-10); background: var(--color-soft); }
/* 상호 줄이 펼침 버튼(<details>, 처음엔 닫힘): 오른쪽 ⌄ 16 gray-500, 펼치면 ⌃ 그리고 아래 사업자 정보 줄 */
.site-foot-name { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); min-height: 32px; cursor: pointer; list-style: none; font-size: var(--text-footnote); font-weight: var(--weight-regular); color: var(--color-text-secondary); }
/* 첫 줄: 상호 14 굵게 | 통신판매업 신고번호 13 보통 + ⌄ */
.site-foot-name b { font-size: var(--text-caption); font-weight: var(--weight-bold); }
.site-foot-sep { color: var(--color-line); }
.site-foot-name::-webkit-details-marker { display: none; }
.site-foot-name::after {
  content: ""; flex: none; width: 16px; height: 16px; background: var(--color-text-secondary); transform: rotate(90deg); transition: transform var(--duration);
  -webkit-mask: url("/src/assets/icons/ic-chevron-right.svg") center / contain no-repeat; mask: url("/src/assets/icons/ic-chevron-right.svg") center / contain no-repeat;
}
.site-foot-biz[open] .site-foot-name::after { transform: rotate(-90deg); }
.site-foot-biz[open] .site-foot-info { margin-top: var(--space-1); }
.site-foot-info { margin: 0; padding: 0; list-style: none; font-size: var(--text-footnote); line-height: 1.7; color: var(--color-text-tertiary); word-break: keep-all; overflow-wrap: anywhere; }
.site-foot-links { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: var(--space-4) 0 0; font-size: var(--text-footnote); color: var(--color-text-tertiary); }
.site-foot-links a { color: var(--color-text-secondary); text-decoration: none; }
.site-foot-links a:hover { text-decoration: underline; }
.site-foot-links span { color: var(--color-line); }
.site-foot-copy { margin: var(--space-3) 0 0; font-size: var(--text-footnote); color: var(--color-text-placeholder); }
