/* ===== 전역 디자인 토큰 + 다크모드 — "버터 모닝" 리뉴얼 (2026-06) ===== */
/* 기존 tokens.css 드롭인 교체본. 변수명은 전부 보존, 값만 교체. */
/* 컨셉: 노란기 도는 따뜻한 크림 + 종이 질감 + 스티커 오프셋 그림자. */
/* 가족 캐릭터 컬러(--fam-*)는 정체성이므로 라이트 기준 변경 금지. */

/* Pretendard 실제 로드 (구글 폰트엔 없어서 HTML의 기존 링크는 400 → 시스템 폰트 fallback이었음) */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');

:root {
  /* Base — 버터 크림 베이지 */
  --color-bg: #f7efdc;
  --color-bg-secondary: #f0e6cc;
  --color-surface: #fffdf5;
  --color-text: #4a3f24;
  --color-text-secondary: #6e6243;
  --color-olive: #7a8450;
  --color-olive-light: #a3ad7a;
  --color-olive-dark: #5c6339;
  --color-purple: #9b6bb0;
  --color-purple-light: #c9a5d9;
  --color-purple-bg: #f3ecf7;
  --color-cream: #faf4e0;
  --color-yellow: #f3e3a2;
  --color-yellow-light: #fdf6da;
  --color-warm: #f0d9a8;
  --color-border: #e7d9b4;
  --color-shadow: rgba(150, 120, 60, 0.10);
  --color-shadow-heavy: rgba(150, 120, 60, 0.20);

  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --transition: 0.25s ease;

  /* ===== HB Mobile Tokens ===== */
  /* Brand expanded */
  --olive-d: #5c6339;
  --olive: #7a8450;
  --olive-l: #a3ad7a;
  --olive-bg: #ecf1dd;
  --purple-d: #7a4f93;
  --purple: #9b6bb0;
  --purple-l: #c9a5d9;
  --purple-bg: #f3ecf7;
  --cream: #faf4e0;
  --butter: #f6e7a8;
  --yellow-l: #fdf6da;
  --warm: #f0d9a8;
  --orange: #e89055;
  --orange-bg: #ffeeda;
  --red: #e85d4a;
  --ink: #44391f;
  --text-sec: #6e6243;
  --muted: #98885c;
  --border-soft: #efe3c4;

  /* Family colors (캐릭터 정체성 — 변경 금지) */
  --fam-mom-acc: #e89055;     --fam-mom-bg: #ffeeda;
  --fam-bro-acc: #7a8450;     --fam-bro-bg: #ecf1dd;
  --fam-sis-acc: #9b6bb0;     --fam-sis-bg: #f3ecf7;
  --fam-hoochu-acc: #a3ad7a;  --fam-hoochu-bg: #f3f0db;
  --fam-bot-acc: #7070a0;     --fam-bot-bg: #ebebf4;
  --fam-pets-acc: #c0a86a;    --fam-pets-bg: #faf4e0;

  /* Radii */
  --r-hero: 26px;
  --r-card: 22px;
  --r-mini: 18px;
  --r-small: 16px;
  --r-pill: 100px;
  --r-iconbtn: 14px;

  /* Shadows — "스티커 오프셋" 형태 언어 */
  --sh-card: 0 3px 0 rgba(160, 130, 70, 0.10);
  --sh-strong: 0 4px 0 rgba(160, 130, 70, 0.13);
  --sh-hero: 0 5px 0 rgba(160, 110, 40, 0.22);
  --sh-tabbar: 0 5px 0 rgba(160, 130, 70, 0.14);

  /* ===== 버터 모닝(A+) 전용 토큰 ===== */
  --bm-line: #efe3c4;                 /* 카드 2px 보더 */
  --bm-line-strong: #e2d2a6;
  --bm-dash: #d9c894;                 /* 점선 디테일 */
  --bm-tape: rgba(246, 220, 130, 0.82);          /* 마스킹테이프 */
  --bm-tape-edge: rgba(180, 150, 60, 0.4);
  --bm-highlight: rgba(255, 215, 95, 0.6);       /* 형광펜 마커 */
  --bm-header-grad: linear-gradient(120deg, #f9e7ae, #f4c781);
  --bm-header-ink: #4a3f24;
  --bm-header-sub: #6e6243;
  --bm-hero-grad: linear-gradient(135deg, #ffe2a0, #f5ad62);
  --bm-hero-ink: #4f3c18;
  --bm-hero-sub: #7d6336;
  --bm-cta: #b07b32;                  /* 따뜻한 액션 텍스트 */
  --bm-chip-bg: #f6efd8;              /* 은은한 칩/버블 배경 */
  --bm-spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* 폭신한 스프링 */
  --bm-shadow-color: rgba(160, 130, 70, 0.13);
  --bm-polaroid: #fffefa;
  --bm-stripe-a: #f3ead2;             /* 플레이스홀더 줄무늬 */
  --bm-stripe-b: #ece1c2;
  --bm-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

/* Dark mode — 깊은 캐러멜 브라운 (따뜻함 유지) */
[data-theme="dark"] {
  --color-bg: #231d10;
  --color-bg-secondary: #2b2414;
  --color-surface: #2f2817;
  --color-text: #f4ead0;
  --color-text-secondary: #bdb08a;
  --color-olive: #a3ad7a;
  --color-olive-light: #7a8450;
  --color-olive-dark: #c4ce9e;
  --color-purple: #c9a5d9;
  --color-purple-light: #9b6bb0;
  --color-purple-bg: #382c40;
  --color-cream: #3a3119;
  --color-yellow: #8a7844;
  --color-yellow-light: #332d18;
  --color-warm: #46371c;
  --color-border: #463c20;
  --color-shadow: rgba(0, 0, 0, 0.30);
  --color-shadow-heavy: rgba(0, 0, 0, 0.45);

  /* HB tokens dark variants */
  --olive-bg: #333a22;
  --purple-bg: #382c40;
  --cream: #3a3119;
  --butter: #54461f;
  --yellow-l: #332d18;
  --warm: #46371c;
  --orange-bg: #46301a;
  --ink: #f4ead0;
  --text-sec: #bdb08a;
  --muted: #a8946a;
  --border-soft: #463c20;

  --fam-mom-bg: #46301a;
  --fam-bro-bg: #333a22;
  --fam-sis-bg: #382c40;
  --fam-hoochu-bg: #36331c;
  --fam-bot-bg: #2a2a38;
  --fam-pets-bg: #3a3424;

  /* Shadows — 다크에선 깊은 그림자 */
  --sh-card: 0 3px 0 rgba(0, 0, 0, 0.35);
  --sh-strong: 0 4px 0 rgba(0, 0, 0, 0.40);
  --sh-hero: 0 5px 0 rgba(0, 0, 0, 0.45);
  --sh-tabbar: 0 5px 0 rgba(0, 0, 0, 0.40);

  /* 버터 모닝 다크 변형 */
  --bm-line: #463c20;
  --bm-line-strong: #57491f;
  --bm-dash: #6a5a2c;
  --bm-tape: rgba(190, 160, 70, 0.5);
  --bm-tape-edge: rgba(120, 95, 35, 0.6);
  --bm-highlight: rgba(190, 150, 50, 0.4);
  --bm-header-grad: linear-gradient(120deg, #4a3c1c, #6b4a26);
  --bm-header-ink: #ffeec2;
  --bm-header-sub: #d9c595;
  --bm-hero-grad: linear-gradient(135deg, #5d4a20, #8a5e2d);
  --bm-hero-ink: #ffeec2;
  --bm-hero-sub: #d9bd85;
  --bm-cta: #f0b35e;
  --bm-chip-bg: #3a3119;
  --bm-shadow-color: rgba(0, 0, 0, 0.40);
  --bm-polaroid: #38301c;
  --bm-stripe-a: #352d18;
  --bm-stripe-b: #3c3319;
  --bm-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
}

/* ===== 공통 컴포넌트: 서브페이지 헤더 뒤로가기 버튼 ===== */
/* .header 스코프 — turtle-soup 내부 '목록으로' .back-btn과 충돌 방지 */
.header .back-btn {
  flex-shrink: 0;
  text-decoration: none;
  color: var(--bm-header-ink);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 7px 13px;
  border-radius: var(--r-pill);
  background: rgba(255, 253, 245, 0.6);
  border: 2px solid rgba(120, 90, 40, 0.15);
  transition: transform 0.2s var(--bm-spring), background 0.2s ease;
  white-space: nowrap;
}
.header .back-btn:hover {
  background: rgba(255, 253, 245, 0.9);
  transform: translateX(-2px);
}
[data-theme="dark"] .header .back-btn {
  background: rgba(255, 233, 173, 0.12);
  border-color: rgba(255, 233, 173, 0.25);
}

/* ===== 어제 게임 결과 스냅샷 (daily snapshot) — 공용 (games.html + 홈 게임 탭) ===== */
.ds-open-btn {
  display: block; width: 100%; margin: 0 0 16px;
  padding: 14px; border: none; border-radius: 14px; cursor: pointer;
  font-family: inherit; font-weight: 800; font-size: 1rem;
  background: linear-gradient(135deg, var(--color-yellow), var(--color-warm));
  color: var(--bm-header-ink); box-shadow: 0 3px 0 rgba(150,120,60,0.25);
  transition: transform 0.2s var(--bm-spring);
}
.ds-open-btn:hover { transform: translateY(-1px); }
.ds-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(45,33,15,0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 22px 14px; overflow-y: auto;
}
.ds-overlay[hidden] { display: none; }
.ds-modal {
  width: 100%; max-width: 380px; background: var(--color-surface);
  border-radius: 22px; border: 2px solid var(--color-border);
  box-shadow: 0 22px 55px rgba(60,45,20,0.45); overflow: hidden;
  animation: bmPopIn 0.4s var(--bm-spring);
}
.ds-head {
  background: linear-gradient(135deg, var(--color-yellow), var(--color-warm));
  padding: 18px 20px 20px; text-align: center; position: relative;
}
.ds-title { font-size: 1.25rem; font-weight: 900; color: var(--bm-header-ink); letter-spacing: -0.02em; }
.ds-date {
  display: inline-block; margin-top: 7px; padding: 4px 14px;
  background: rgba(255,253,245,0.7); border-radius: var(--r-pill);
  font-size: 0.82rem; font-weight: 800; color: var(--color-text-secondary);
}
.ds-sub { margin: 10px 2px 0; font-size: 0.82rem; color: var(--color-text-secondary); font-weight: 600; }
.ds-gecko { position: absolute; top: 12px; right: 14px; font-size: 20px; opacity: 0.8; }
.ds-body { padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 12px; }
.ds-loading { text-align: center; color: var(--color-text-secondary); font-weight: 700; padding: 30px 0; }

.ds-card {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 14px; border-radius: 16px;
  background: var(--card-bg, #faf4e0);
  border: 1.5px solid rgba(150,120,60,0.16);
  box-shadow: 0 3px 0 rgba(150,120,60,0.13);
}
.ds-icon {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; background: var(--ic-bg, #fff); box-shadow: 0 2px 0 rgba(0,0,0,0.06);
}
.ds-main { flex: 1; min-width: 0; }
.ds-name { font-size: 0.74rem; font-weight: 800; color: var(--color-text-secondary); letter-spacing: 0.02em; }
.ds-result { font-size: 0.98rem; font-weight: 800; color: var(--color-text); margin-top: 2px; line-height: 1.35; }
.ds-ans { color: var(--color-olive-dark); }
.ds-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.ds-chip { display: inline-flex; align-items: center; gap: 3px; padding: 3px 9px; border-radius: var(--r-pill); font-size: 0.74rem; font-weight: 800; }
.ds-chip-label { font-size: 0.68rem; font-weight: 700; color: var(--color-text-secondary); align-self: center; margin-right: 1px; }
.chip-mom { background: var(--fam-mom-bg); color: var(--fam-mom-acc); }
.chip-bro { background: var(--fam-bro-bg); color: var(--fam-bro-acc); }
.chip-sis { background: var(--fam-sis-bg); color: var(--fam-sis-acc); }
.chip-hoochu { background: var(--fam-hoochu-bg); color: var(--fam-hoochu-acc); }
.chip-bot { background: var(--fam-bot-bg); color: var(--fam-bot-acc); }

.ds-card.c-word   { --card-bg:#fdf6da; --ic-bg:#fff6cf; }
.ds-card.c-poker  { --card-bg:#f3ecf7; --ic-bg:#ecdcf3; }
.ds-card.c-hoochu { --card-bg:#f3f0db; --ic-bg:#e9eccf; }
.ds-card.c-soup   { --card-bg:#eaf3ef; --ic-bg:#d6ebe0; }
.ds-card.c-laby   { --card-bg:#f7efe0; --ic-bg:#efe0c8; }
.ds-card.c-slot   { --card-bg:#f6eee2; --ic-bg:#eaddc6; }

.ds-card.empty { background: rgba(150,120,60,0.045); border: 1.5px dashed rgba(150,120,60,0.3); box-shadow: none; }
.ds-card.empty .ds-icon { filter: grayscale(0.35); opacity: 0.8; box-shadow: none; }
.ds-empty-msg { font-size: 0.9rem; font-weight: 700; line-height: 1.45; color: var(--color-text-secondary); margin-top: 2px; display: flex; gap: 6px; align-items: flex-start; }
.ds-empty-cta { display: inline-block; margin-top: 9px; padding: 6px 13px; border-radius: var(--r-pill); background: var(--color-olive); color: #fff; font-size: 0.78rem; font-weight: 800; text-decoration: none; box-shadow: 0 2px 0 var(--color-olive-dark); }

.ds-foot { padding: 6px 16px 18px; }
.ds-btn-close { width: 100%; padding: 13px; border-radius: 14px; border: none; cursor: pointer; font-family: inherit; font-weight: 800; font-size: 0.95rem; background: rgba(150,120,60,0.12); color: var(--color-text); }
[data-theme="dark"] .ds-card.empty { background: rgba(255,233,173,0.05); border-color: rgba(255,233,173,0.2); }
