/* 포켓 솔리테어 — 애플 감성 디자인
   방향: iOS 시스템 색·서체, 넓은 여백, 부드러운 그림자, 반투명 유리 막대, 스프링 모션.
   레이아웃: 위 기록 막대 · 카드 테이블 · 광고 · 떠 있는 유리 탭 막대.
   테이블 색은 클래식 그린이 기본, 나머지는 더보기에서 고르는 옵션 (html[data-table]). */
:root {
  /* 테이블: 클래식 녹색 펠트 */
  --bg-top: #2f8a5b;
  --bg-bottom: #14543a;
  --label: #ffffff;
  --label-2: rgba(255, 255, 255, 0.66);
  --label-3: rgba(255, 255, 255, 0.34);
  --slot: rgba(0, 0, 0, 0.12);
  --slot-line: rgba(255, 255, 255, 0.16);
  --glass: rgba(16, 60, 40, 0.55);
  --glass-line: rgba(255, 255, 255, 0.16);
  --sheet: #f2f2f7;
  --group: #ffffff;
  --fill: rgba(118, 118, 128, 0.24);
  --sep: rgba(60, 60, 67, 0.14);
  --accent: #007aff;
  --accent-soft: rgba(0, 122, 255, 0.14);
  --orange: #ff9500;
  --green: #34c759;
  /* 카드 */
  --card: #f7f7f9;
  --card-red: #e0322a;
  --card-black: #1c1c1e;
  --card-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.3), 0 2px 7px rgba(0, 0, 0, 0.22);
  --card-lift: 0 18px 36px rgba(0, 0, 0, 0.22), 0 4px 10px rgba(0, 0, 0, 0.12);
  --back-a: #3d8bff;
  --back-b: #5856d6;
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Roboto", "Segoe UI", sans-serif;
  --font-display: -apple-system-ui-rounded, ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --cw: 48px;
  --ch: 68px;
  /* 가장자리(상태 바·카메라 구멍·내비게이션 바·홈 인디케이터·토스 메뉴 줄·배너)는 ncq/safe.js(NcqSafe)의
     --ncq-top·--ncq-bottom·--ncq-left·--ncq-right만큼 비워요 (웹 공개·안드로이드 앱·토스가 같은 값) */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --sheet: #1c1c1e;
    --group: #2c2c2e;
    --fill: rgba(118, 118, 128, 0.24);
    --sep: rgba(84, 84, 88, 0.6);
    --accent: #0a84ff;
    --accent-soft: rgba(10, 132, 255, 0.22);
    --orange: #ff9f0a;
    --green: #30d158;
    --card: #f4f4f6;
    --card-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.35);
    --card-lift: 0 18px 40px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
    --back-a: #2f6fdc;
    --back-b: #4c4ab8;
    color-scheme: dark;
  }
}

/* ---------- 테이블 색 옵션 ---------- */
html[data-table="night"] { --bg-top: #24332e; --bg-bottom: #0e1412; --glass: rgba(40, 48, 45, 0.66); --slot: rgba(255, 255, 255, 0.06); --slot-line: rgba(255, 255, 255, 0.10); }
html[data-table="blue"] { --bg-top: #2b62a8; --bg-bottom: #12305c; --glass: rgba(14, 40, 80, 0.55); }
html[data-table="wine"] { --bg-top: #8e2f45; --bg-bottom: #4a1324; --glass: rgba(70, 16, 32, 0.55); }
html[data-table="graphite"] { --bg-top: #4a4d52; --bg-bottom: #1f2124; --glass: rgba(40, 42, 46, 0.6); }
html[data-table="sage"] { --tool-icon: var(--accent); --bg-top: #f3f6f4; --bg-bottom: #dfe7e2; --label: #1c1c1e; --label-2: rgba(60, 60, 67, 0.62); --label-3: rgba(60, 60, 67, 0.32);
  --slot: rgba(120, 130, 125, 0.12); --slot-line: rgba(60, 70, 65, 0.10); --glass: rgba(255, 255, 255, 0.66); --glass-line: rgba(255, 255, 255, 0.7);
  --card-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.08); --card: #ffffff; }
.swatches { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; padding: 14px 10px; margin-bottom: 18px; border-radius: 14px; background: var(--group); }
.swatches button { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; white-space: nowrap; color: var(--label-2); }
.swatches i { width: 100%; max-width: 36px; aspect-ratio: 1; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); transition: box-shadow 0.2s, transform 0.25s var(--spring); }
.swatches button.on i { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12), 0 0 0 2.5px var(--group), 0 0 0 4.5px var(--accent); }
.swatches button.on { color: var(--label); font-weight: 600; }
.swatches button:active i { transform: scale(0.9); }
.group-label { font-size: 13px; color: var(--label-2); margin: 0 0 6px 4px; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: var(--font);
  color: var(--label);
  background: radial-gradient(ellipse 130% 85% at 50% 22%, var(--bg-top), var(--bg-bottom));
  background-color: var(--bg-bottom);
  -webkit-font-smoothing: antialiased;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }

#app { display: flex; flex-direction: column; height: 100%; max-width: 760px; margin: 0 auto;
  padding: var(--ncq-top) var(--ncq-right) var(--ncq-bottom) var(--ncq-left); }

/* ---------- 상단 기록 막대 ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px 4px; }
.stat { display: flex; flex-direction: column; gap: 1px; min-width: 64px; }
.stat.right { align-items: flex-end; }
.stat .label { font-size: 11px; font-weight: 600; color: var(--label-2); letter-spacing: 0.02em; }
.stat > span:last-child { font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.title { font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 99px; color: var(--label);
  background: var(--glass); border: 0.5px solid var(--glass-line);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); }
.title.daily { color: var(--orange); }

/* ---------- 카드 테이블 ---------- */
#board { position: relative; flex: 1; min-height: 0; }
.slot { position: absolute; width: var(--cw); height: var(--ch); border-radius: calc(var(--cw) * 0.16);
  background: var(--slot); box-shadow: inset 0 0 0 1px var(--slot-line);
  display: flex; align-items: center; justify-content: center; color: var(--label-3);
  font-family: var(--font-display); font-weight: 600; font-size: calc(var(--cw) * 0.38);
  transition: box-shadow 0.25s var(--spring), background 0.25s; }
.tab-slot { background: none; box-shadow: inset 0 0 0 1px var(--slot-line); }
.stock-slot .recycle { width: calc(var(--cw) * 0.48); height: calc(var(--cw) * 0.48); stroke-width: 2; }
.slot.glow { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }

.card { position: absolute; left: 0; top: 0; width: var(--cw); height: var(--ch);
  border-radius: calc(var(--cw) * 0.16); will-change: transform;
  transition: transform 0.38s var(--spring); }
.card.dragging, .card.no-anim { transition: none; }
.card .face, .card .back { position: absolute; inset: 0; border-radius: inherit; }
.card .face { background: var(--card); box-shadow: var(--card-shadow); display: none; transition: box-shadow 0.2s; }
.card .back {
  background:
    radial-gradient(120% 80% at 30% 0%, rgba(255, 255, 255, 0.35), transparent 55%),
    linear-gradient(150deg, var(--back-a), var(--back-b));
  box-shadow: var(--card-shadow), inset 0 0 0 calc(var(--cw) * 0.06) rgba(255, 255, 255, 0.92), inset 0 0 0 calc(var(--cw) * 0.06 + 1px) rgba(0, 0, 0, 0.06);
}
.card.up .face { display: block; }
.card.up .back { display: none; }
.card.red { color: var(--card-red); }
.card.black { color: var(--card-black); }
.card .rk { position: absolute; top: calc(var(--cw) * 0.06); left: calc(var(--cw) * 0.09);
  font-family: var(--font-display); font-size: calc(var(--cw) * 0.38); font-weight: 600; line-height: 1; letter-spacing: -0.04em; }
.card .st { position: absolute; top: calc(var(--cw) * 0.08); right: calc(var(--cw) * 0.09);
  font-size: calc(var(--cw) * 0.30); line-height: 1; }
.card .big { position: absolute; left: 0; right: 0; bottom: calc(var(--ch) * 0.1); text-align: center;
  font-size: calc(var(--cw) * 0.58); line-height: 1; }
.card.court .big { font-family: var(--font-display); font-weight: 600; font-size: calc(var(--cw) * 0.46); letter-spacing: -0.03em; }
.card.dragging .face, .card.dragging .back { box-shadow: var(--card-lift); }
.card.hint .face { box-shadow: var(--card-shadow), 0 0 0 2.5px var(--accent), 0 0 18px rgba(0, 122, 255, 0.45); }
.card.hint .back { box-shadow: 0 0 0 2.5px var(--accent), 0 0 18px rgba(0, 122, 255, 0.45); }
.card.shake { animation: shake 0.36s var(--spring); }
@keyframes shake { 0%, 100% { margin-left: 0 } 20% { margin-left: -6px } 45% { margin-left: 5px } 70% { margin-left: -3px } }

.auto-btn { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 2000;
  display: flex; align-items: center; gap: 6px;
  padding: 13px 22px; border-radius: 99px; background: var(--accent); color: #fff; font-weight: 600; font-size: 16px;
  box-shadow: 0 8px 24px rgba(0, 122, 255, 0.35); animation: pop 0.45s var(--spring); }
.auto-btn svg { width: 18px; height: 18px; }
@keyframes pop { from { transform: translateX(-50%) scale(0.8); opacity: 0 } }

/* ---------- 광고 ---------- */
.ad-banner { height: 50px; margin: 0 16px 6px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em; color: var(--label-3); background: var(--slot); }
.ad-banner.off { display: none; }

/* ---------- 떠 있는 유리 탭 막대 ---------- */
.toolbar { display: flex; justify-content: space-around; margin: 0 12px 8px; padding: 6px 4px;
  border-radius: 26px; background: var(--glass); border: 0.5px solid var(--glass-line);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05); }
.toolbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; padding: 6px 2px 4px;
  border-radius: 18px; font-size: 10.5px; font-weight: 600; color: var(--label);
  transition: transform 0.25s var(--spring), background 0.2s; }
.toolbar button svg { width: 25px; height: 25px; color: var(--tool-icon, var(--label)); }
.toolbar button:active { transform: scale(0.92); background: var(--fill); }
.toolbar button:disabled { opacity: 0.35; }

/* ---------- 알림 (다이내믹 아일랜드 느낌의 캡슐) ---------- */
.toast { position: fixed; left: 50%; top: calc(var(--ncq-top) + 12px); transform: translate(-50%, -16px) scale(0.92); opacity: 0;
  padding: 11px 18px; border-radius: 99px; background: rgba(20, 20, 22, 0.92); color: #fff; font-size: 14px; font-weight: 600;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  transition: opacity 0.3s var(--spring), transform 0.45s var(--spring); pointer-events: none; z-index: 5000; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ---------- 바텀 시트 ---------- */
.modal { position: fixed; inset: 0; z-index: 6000; background: rgba(0, 0, 0, 0.28); display: flex; align-items: flex-end; justify-content: center;
  animation: fade 0.3s ease; }
@keyframes fade { from { background: rgba(0, 0, 0, 0) } }
.modal[hidden] { display: none; }
.sheet { --label: #1c1c1e; --label-2: rgba(60, 60, 67, 0.62); --label-3: rgba(60, 60, 67, 0.32); --fill: rgba(118, 118, 128, 0.12); }
@media (prefers-color-scheme: dark) {
  .sheet { --label: #f5f5f7; --label-2: rgba(235, 235, 245, 0.6); --label-3: rgba(235, 235, 245, 0.28); --fill: rgba(118, 118, 128, 0.24); }
}
.sheet { position: relative; width: 100%; max-width: 480px; background: var(--sheet); color: var(--label); border-radius: 28px 28px 0 0;
  padding: 26px 20px calc(20px + var(--ncq-bottom)); max-height: 88vh; max-height: min(88dvh, calc(100dvh - var(--ncq-top) - 8px));
  display: flex; flex-direction: column; overflow: hidden; touch-action: pan-y;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18); animation: up 0.5s var(--spring); }
@keyframes up { from { transform: translateY(100%) } }
/* 내용이 길면 내용 칸만 스크롤되고, 메인 버튼 줄(#modal-foot)은 창 아래 가리는 자리 바로 위에 늘 보여요 */
#modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -20px; padding: 0 20px; }
.sheet-foot { flex: none; }
.sheet-foot:not(:empty) { padding-top: 6px; }
.grabber { position: absolute; top: 8px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--label-3); }
.sheet h2 { margin: 0 0 4px; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
.sheet p.sub { margin: 0 0 18px; color: var(--label-2); font-size: 15px; line-height: 1.45; }
.sheet .row { display: flex; gap: 10px; }
.sheet .btn { flex: 1; padding: 15px 12px; border-radius: 14px; font-size: 17px; font-weight: 600; background: var(--fill); color: var(--accent);
  transition: transform 0.2s var(--spring), opacity 0.2s; }
.sheet .btn:active { transform: scale(0.97); opacity: 0.8; }
.sheet .btn.primary { background: var(--accent); color: #fff; }
.sheet .btn.gold { background: var(--orange); color: #fff; }
.sheet .list { display: flex; flex-direction: column; margin-bottom: 18px; border-radius: 14px; overflow: hidden; background: var(--group); }
.sheet .list .btn { border-radius: 0; background: none; color: var(--label); font-weight: 400; text-align: left;
  display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; }
.sheet .list .btn + .btn { box-shadow: inset 0 0.5px 0 var(--sep); }
.sheet .list .btn small { font-size: 15px; color: var(--label-2); }
.sheet .list .btn::after { content: "›"; color: var(--label-3); font-size: 22px; line-height: 1; margin-left: 8px; }
.seg { display: flex; background: var(--fill); border-radius: 10px; padding: 2px; margin-bottom: 18px; }
.seg button { flex: 1; padding: 9px; border-radius: 8px; font-size: 15px; font-weight: 600; color: var(--label); transition: background 0.25s var(--spring), box-shadow 0.25s; }
.seg button.on { background: var(--group); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-bottom: 18px; border-radius: 14px; overflow: hidden; background: var(--sep); }
.stats div { background: var(--group); padding: 14px 6px 12px; text-align: center; }
.stats b { display: block; font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; color: var(--label-2); }
.win-badge { display: flex; justify-content: center; margin: 4px 0 10px; }
.win-badge svg { width: 72px; height: 72px; stroke: none; animation: badge 0.7s var(--spring); }
@keyframes badge { from { transform: scale(0.4) rotate(-20deg); opacity: 0 } }
.sheet h2.center, .sheet p.center { text-align: center; }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px 4px; margin: 10px 0 18px; text-align: center; padding: 12px 8px; border-radius: 14px; background: var(--group); }
.cal .dow { font-size: 12px; color: var(--label-2); font-weight: 600; padding-bottom: 2px; }
.cal .d { aspect-ratio: 1; max-width: 42px; width: 100%; margin: 0 auto; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 500; color: var(--label); font-variant-numeric: tabular-nums; }
.cal .d.blank { visibility: hidden; }
.cal .d.future { color: var(--label-3); }
.cal .d.done { background: var(--orange); color: #fff; font-weight: 700; }
.cal .d.today { color: var(--orange); font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--orange); }
.cal .d.today.done { color: #fff; }
.cal-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 17px; }
.cal-head button { padding: 6px 10px; color: var(--accent); display: flex; }
.cal-head button svg { width: 20px; height: 20px; stroke-width: 2.4; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 5500; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 8px; height: 8px; border-radius: 50%; animation: fall cubic-bezier(.3,.1,.6,1) forwards; }
.confetti i:nth-child(3n) { border-radius: 2px; height: 12px; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

@media (prefers-reduced-motion: reduce) {
  .card, .toast, .slot { transition-duration: 0.01s !important; }
  .sheet, .modal, .auto-btn, .win-badge svg, .confetti { animation: none !important; }
}
[hidden] { display: none !important; }

/* ---------- 클리어 연출 ---------- */
.card.hop { animation: hop 0.6s var(--spring) 2; }
@keyframes hop { 0%, 100% { translate: 0 0 } 40% { translate: 0 calc(var(--ch) * -0.45) } } /* 위치는 translate로 (다시 배치하지 않아 가벼워요) */
.fireworks { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5400; }
.clear-banner { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 5600; }
.clear-banner b { font-family: var(--font-display); font-size: 48px; font-weight: 800; letter-spacing: -0.03em; color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.12), 0 8px 30px rgba(255, 204, 0, 0.55), 0 0 2px rgba(0, 0, 0, 0.3);
  animation: banner 2.1s var(--spring) forwards; }
@keyframes banner { 0% { transform: scale(0.3); opacity: 0 } 18% { transform: scale(1.08); opacity: 1 } 28% { transform: scale(1) } 80% { opacity: 1; transform: scale(1) } 100% { opacity: 0; transform: scale(1.04) translateY(-20px) } }
.clear-banner .ring { position: absolute; width: 120px; height: 120px; border-radius: 50%; border: 3px solid rgba(255, 214, 10, 0.9);
  animation: ring 1.1s cubic-bezier(.2, .7, .3, 1) forwards; opacity: 0; }
.clear-banner .ring.r2 { animation-delay: 0.18s; border-color: rgba(255, 255, 255, 0.8); }
@keyframes ring { 0% { transform: scale(0.2); opacity: 1 } 100% { transform: scale(4.2); opacity: 0 } }
@media (prefers-reduced-motion: reduce) { .card.hop, .clear-banner b, .clear-banner .ring { animation: none !important; } }

/* ---------- 스위치 (iOS) ---------- */
.sheet .list .toggle { display: flex; justify-content: space-between; align-items: center; padding: 11px 16px; font-size: 17px; }
.sheet .list .toggle + .toggle, .sheet .list .btn + .toggle, .sheet .list .toggle + .btn { box-shadow: inset 0 0.5px 0 var(--sep); }
.switch { position: relative; width: 51px; height: 31px; border-radius: 99px; background: var(--fill); flex: none; transition: background 0.25s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 0 0 0.5px rgba(0, 0, 0, 0.04); transition: transform 0.3s var(--spring); }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(20px); }

/* ---------- 결과 화면 ---------- */
.result-note { margin: -6px auto 16px; padding: 9px 14px; border-radius: 12px; background: var(--group); text-align: center; font-size: 15px; color: var(--label); }
.result-note b { color: var(--orange); }
.result-note.best { background: rgba(255, 149, 0, 0.14); color: var(--orange); font-weight: 600; }
.cta { display: flex; flex-direction: column; gap: 10px; }
.sheet .btn.big { padding: 17px 12px; font-size: 18px; }
.sheet .btn.gold-soft { background: rgba(255, 149, 0, 0.14); color: var(--orange); }

/* ---------- 오늘의 도전 ---------- */
.chips { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px 7px 9px; border-radius: 99px; background: var(--group); font-size: 14px; font-weight: 600; }
.chip svg { width: 18px; height: 18px; }
.chip.fire { color: var(--orange); }
.chip.trophy svg { color: #d4a017; stroke-width: 1.7; }
.save-streak { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; margin-bottom: 14px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.16), rgba(255, 59, 48, 0.12)); color: var(--label); text-align: left; }
.save-streak b { font-size: 15px; }
.save-streak span { font-size: 14px; color: var(--orange); font-weight: 600; }
button.d { font: inherit; padding: 0; cursor: pointer; transition: transform 0.2s var(--spring); }
button.d:active { transform: scale(0.88); }
.cal .d.late { background: rgba(255, 149, 0, 0.45); }
.cal .d.saved { box-shadow: inset 0 0 0 1.5px var(--orange); color: var(--orange); background: repeating-linear-gradient(45deg, rgba(255, 149, 0, 0.12) 0 3px, transparent 3px 6px); }
.cal .d.sel:not(.done) { background: var(--fill); }
.cal .d.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.month-progress { display: flex; align-items: center; gap: 10px; margin: -6px 2px 18px; font-size: 13px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.month-progress .bar { flex: 1; height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.month-progress .bar i { display: block; height: 100%; border-radius: 3px; background: var(--orange); transition: width 0.5s var(--spring); }

/* ---------- 카드 그림 (SVG) ---------- */
.card .face svg.art { position: absolute; inset: 0; width: 100%; height: 100%; fill: currentColor; stroke: none; overflow: visible; }
.card .face svg.art text, .mini svg.art text { font-family: var(--font-display); font-weight: 700; fill: currentColor; }
.card .face svg.art .ct { font-weight: 800; }
svg.art .ix text { letter-spacing: -1px; }

/* ---------- 카드 뒷면 4종 ---------- */
:root { --back-pattern: rgba(255, 255, 255, 0.16); --back-rim: rgba(255, 255, 255, 0.92); }
html[data-back="red"] { --back-a: #e2453c; --back-b: #a3172b; }
html[data-back="navy"] { --back-a: #24345e; --back-b: #121a33; --back-pattern: rgba(242, 190, 80, 0.22); --back-rim: #e6c06a; }
html[data-back="mint"] { --back-a: #4fd1b5; --back-b: #1b9a8a; }
.card .back, .mini-back {
  background:
    radial-gradient(120% 80% at 30% 0%, rgba(255, 255, 255, 0.28), transparent 55%),
    repeating-linear-gradient(45deg, var(--back-pattern) 0 1.5px, transparent 1.5px 7px),
    repeating-linear-gradient(-45deg, var(--back-pattern) 0 1.5px, transparent 1.5px 7px),
    linear-gradient(150deg, var(--back-a), var(--back-b));
}
.card .back { box-shadow: var(--card-shadow), inset 0 0 0 calc(var(--cw) * 0.06) var(--back-rim), inset 0 0 0 calc(var(--cw) * 0.06 + 1px) rgba(0, 0, 0, 0.08); }
.mini-back[data-back="blue"] { --back-a: #3d8bff; --back-b: #5856d6; }
.mini-back[data-back="red"] { --back-a: #e2453c; --back-b: #a3172b; }
.mini-back[data-back="navy"] { --back-a: #24345e; --back-b: #121a33; --back-pattern: rgba(242, 190, 80, 0.22); --back-rim: #e6c06a; }
.mini-back[data-back="mint"] { --back-a: #4fd1b5; --back-b: #1b9a8a; }

/* ---------- 카드 디자인 고르기 ---------- */
.face-pick, .back-pick { display: grid; gap: 8px; padding: 12px; margin-bottom: 18px; border-radius: 14px; background: var(--group); }
.face-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.back-pick { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.face-pick button, .back-pick button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 4px 10px; border-radius: 12px;
  font-size: 13px; font-weight: 600; color: var(--label-2); box-shadow: inset 0 0 0 1px var(--sep); transition: box-shadow 0.2s, transform 0.2s var(--spring); }
.face-pick button.on, .back-pick button.on { color: var(--label); box-shadow: inset 0 0 0 2px var(--accent); }
.face-pick button:active, .back-pick button:active { transform: scale(0.96); }
.minis { display: flex; gap: 6px; }
.mini { position: relative; width: 44px; height: 62px; border-radius: 6px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }
.mini svg.art { position: absolute; inset: 0; width: 100%; height: 100%; fill: currentColor; }
.mini { color: var(--card-black); }
.mini.red { color: var(--card-red); }
.mini-back { display: block; width: 100%; max-width: 44px; aspect-ratio: 0.7; border-radius: 6px; flex-basis: 100%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), inset 0 0 0 3px var(--back-rim); }
.back-pick .mini-back { width: 40px; flex-basis: auto; }
.back-pick button { flex-direction: column; align-items: center; }

/* =========================================================
   중장년층 맞춤 (심플 이즈 베스트)
   큰 글자 · 높은 대비 · 꾸밈 최소화(유리 효과·그라디언트 줄임) · 큰 터치 영역
   ========================================================= */
:root {
  --card-red: #d4161d;
  --card-black: #111214;
  --label-2: rgba(255, 255, 255, 0.82);
  --label-3: rgba(255, 255, 255, 0.45);
  --bar: rgba(0, 0, 0, 0.26);
}
html[data-table="sage"] { --bar: rgba(255, 255, 255, 0.9); --label-2: rgba(60, 60, 67, 0.8); }

/* 위 기록 막대: 숫자 크게 */
.topbar { padding: 10px 14px 6px; }
.stat .label { font-size: 14px; font-weight: 600; }
.stat > span:last-child { font-size: 26px; font-weight: 700; }
.title { font-size: 15px; font-weight: 700; padding: 8px 16px; background: var(--bar); border: 0; box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none; }

/* 카드: 테두리 또렷하게, 그림자 단순하게 */
.card .face { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(0, 0, 0, 0.12); }
.card .face svg.art text { font-weight: 800; }
.slot { font-size: calc(var(--cw) * 0.46); color: var(--label-3); box-shadow: inset 0 0 0 1.5px var(--label-3); background: rgba(0, 0, 0, 0.1); }
.tab-slot { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.18); }

/* 힌트: 멀리서도 보이는 노란 굵은 테두리 */
.card.hint .face, .card.hint .back { box-shadow: 0 0 0 4px #ffd60a, 0 0 16px rgba(255, 214, 10, 0.7); }
.slot.glow { background: rgba(255, 214, 10, 0.2); box-shadow: inset 0 0 0 4px #ffd60a; }

/* 아래 버튼 막대: 단색, 큰 아이콘·큰 글자 */
.toolbar { margin: 0; border-radius: 0; padding: 8px 2px 10px; background: var(--bar); border: 0; box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none; }
.toolbar button { font-size: 13.5px; font-weight: 700; gap: 4px; white-space: nowrap; padding: 8px 0 6px; }
.toolbar button svg { width: 30px; height: 30px; stroke-width: 2.1; }
.toolbar button:disabled { opacity: 0.4; }
.ad-banner { margin: 0 12px 8px; }
.auto-btn { font-size: 19px; padding: 15px 28px; }

/* 알림 */
.toast { font-size: 17px; padding: 13px 22px; }

/* 시트(메뉴·결과·달력): 글자 크게 */
.sheet h2 { font-size: 28px; }
.sheet p.sub { font-size: 17px; line-height: 1.5; }
.sheet .btn { font-size: 19px; padding: 17px 12px; }
.sheet .btn.big { font-size: 20px; padding: 19px 12px; }
.sheet .list .btn { font-size: 18px; padding: 16px 16px; }
.sheet .list .btn small { font-size: 16px; }
.sheet .list .toggle { font-size: 18px; padding: 13px 16px; }
.group-label { font-size: 15px; font-weight: 600; }
.seg button { font-size: 17px; padding: 12px; }
.stats b { font-size: 26px; }
.stats span { font-size: 14px; }
.result-note { font-size: 17px; padding: 12px 14px; }
.chip { font-size: 16px; padding: 8px 14px 8px 10px; }
.save-streak b { font-size: 17px; }
.save-streak span { font-size: 16px; }
.cal .dow { font-size: 14px; }
.cal .d { font-size: 18px; font-weight: 600; max-width: 46px; }
.cal-head { font-size: 19px; }
.month-progress { font-size: 15px; }
.swatches button, .face-pick button, .back-pick button { font-size: 15px; }
.clear-banner b { font-size: 56px; }
/* 알림은 아래쪽 빈 공간에 (숫자·카드를 가리지 않게) */
.toast { top: auto; bottom: calc(var(--ncq-bottom) + 150px); transform: translate(-50%, 16px) scale(0.92); }
.toast.show { transform: translate(-50%, 0) scale(1); }

/* ---------- 출시 기능 ---------- */
.ad-banner.native { background: none; border: 0; height: 0; margin: 0; }
.ad-banner.native span { display: none; }
.sheet .version { text-align: center; font-size: 13px; color: var(--label-3); margin: 14px 0 0; }
.group-label small { font-weight: 400; }
.sheet .list.test .btn { color: var(--orange); }
.sheet .list.log { padding: 4px 0; max-height: 40vh; overflow-y: auto; }
.log-row { display: flex; flex-direction: column; gap: 2px; padding: 8px 16px; font-size: 14px; }
.log-row + .log-row { box-shadow: inset 0 0.5px 0 var(--sep); }
.log-row small { color: var(--label-2); font-size: 12px; word-break: break-all; }

/* ---------- 힌트 개수 배지 · 광고 제거 ---------- */
.toolbar button { position: relative; }
.toolbar .badge { position: absolute; top: 2px; left: calc(50% + 8px); min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: #fff; color: #14543a; font-style: normal; font-size: 12px; font-weight: 800; line-height: 20px; text-align: center; }
.toolbar .badge.ad { background: #ffd60a; color: #3a2a00; font-size: 10px; }
.toolbar .badge[hidden] { display: none; }
.sheet .list.perks .btn::before { content: "✓"; color: var(--green); font-weight: 800; margin-right: 10px; }
.sheet .list.perks .btn::after, .sheet .list .done-row::after { content: none; }
.sheet .list .done-row { color: var(--green); font-weight: 600; }
.sheet .list.perks .btn { justify-content: flex-start; }

/* ---------- 되돌리기: 오늘의 도전 남은 횟수 · 되돌리기 없이 클리어 ---------- */
.toolbar .badge.empty { background: rgba(255, 255, 255, 0.35); color: #fff; }
.no-undo { display: flex; align-items: center; justify-content: center; gap: 6px; margin: -6px auto 14px; padding: 10px 16px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 204, 0, 0.22), rgba(255, 149, 0, 0.18)); color: #b86e00; font-size: 18px; font-weight: 800; flex-wrap: wrap; }
.no-undo svg { width: 22px; height: 22px; color: #ffb800; }
.no-undo small { flex-basis: 100%; text-align: center; font-size: 14px; font-weight: 600; color: var(--label-2); }
.sel-rec { margin: -6px 2px 10px; font-size: 16px; color: var(--label); font-variant-numeric: tabular-nums; }
.sel-rec b { color: var(--orange); }
.sel-rec.rule { margin-top: 0; margin-bottom: 16px; font-size: 15px; color: var(--label-2); }

/* NcqAds 배너가 가린 높이는 --ncq-top(위쪽 배너)·--ncq-bottom(아래쪽 배너)에 들어 있어요 (#app이 비워요) */

/* =========================================================
   게임 종류 추가 (스파이더·프리셀) · 진행 시스템 · 편의 기능
   ========================================================= */
/* 토스 게임: 맨 위 UI는 #app이 --ncq-top(상태 바 + 토스 메뉴 줄)만큼 내려서 토스 ⋯·✕ 메뉴와 겹치지 않아요 */

.cell-slot { background: rgba(0, 0, 0, 0.16); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.28); }
.found-slot.spider { font-size: calc(var(--cw) * 0.5); }
#board[data-variant="spider"] .stock-slot { box-shadow: none; background: none; }

/* 새 게임: 게임 종류 고르기 */
.mode-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.mode-pick button { display: flex; flex-direction: column; gap: 4px; padding: 14px 6px; border-radius: 14px; background: var(--group); box-shadow: inset 0 0 0 1px var(--sep); text-align: center; }
.mode-pick button b { font-size: 18px; }
.mode-pick button small { font-size: 12.5px; color: var(--label-2); line-height: 1.3; }
.mode-pick button.on { box-shadow: inset 0 0 0 2.5px var(--accent); }
.mode-pick button.on b { color: var(--accent); }
.seg button { font-size: 16px; }

/* 오늘의 할 일 */
.todo { border-radius: 14px; background: var(--group); padding: 6px 14px 10px; margin: 10px 0 20px; }
.todo-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; font-size: 18px; }
.todo-row + .todo-row { box-shadow: inset 0 0.5px 0 var(--sep); }
.todo-row i { flex: none; width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--label-3); display: flex; align-items: center; justify-content: center; font-style: normal; font-weight: 800; color: #fff; }
.todo-row.done i { background: var(--green); box-shadow: none; }
.todo-row.done span { color: var(--label-2); text-decoration: line-through; }
.todo-row span { flex: 1; }
.todo-row small { font-size: 15px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.todo-row.done small { color: var(--green); font-weight: 700; }
.todo-foot { font-size: 14px; color: var(--label-2); padding-top: 6px; }
.sheet h2.h2-sub { font-size: 24px; }

/* 레벨·경험치 */
.xp-box { border-radius: 14px; background: var(--group); padding: 12px 14px; margin-bottom: 16px; }
.xp-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 17px; }
.xp-head span { font-size: 15px; color: var(--orange); font-weight: 700; font-variant-numeric: tabular-nums; }
.xp-box .bar { height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; margin-top: 8px; }
.xp-box .bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #ffb800, #ff9500); transition: width 0.6s var(--spring); }
.xp-note { margin: 8px 0 0; font-size: 14px; color: var(--label-2); line-height: 1.4; }
.xp-note.up { color: var(--orange); font-weight: 700; font-size: 15px; }
.score-line { display: flex; justify-content: center; align-items: baseline; gap: 8px; margin: -4px 0 12px; font-size: 16px; color: var(--label-2); }
.score-line b { font-size: 26px; color: var(--label); font-variant-numeric: tabular-nums; }
.score-line em { font-style: normal; font-size: 14px; font-weight: 700; color: var(--orange); }

/* 잠긴 테마 */
.swatches button.locked i, .back-pick button.locked .mini-back { opacity: 0.35; filter: grayscale(0.6); }
.swatches button, .back-pick button { position: relative; }
.lock { position: absolute; top: 2px; right: 2px; font-style: normal; font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 8px; background: var(--label); color: var(--group); }

/* 기록 초기화 */
.sheet .list .btn.danger { color: #e0322a; }
.sheet .btn.danger-fill { background: #e0322a; color: #fff; }

/* 움직임 줄이기 */
html.calm .card { transition-duration: 0.12s; }
html.calm .card.shake { animation-duration: 0.2s; }
html.calm .sheet { animation-duration: 0.15s; }

/* ---------- 시작 화면 ---------- */
.home { position: fixed; inset: 0; z-index: 4000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: calc(var(--ncq-top) + 20px) calc(var(--ncq-right) + 24px) calc(var(--ncq-bottom) + 24px) calc(var(--ncq-left) + 24px);
  background: radial-gradient(ellipse 130% 85% at 50% 22%, var(--bg-top), var(--bg-bottom)); background-color: var(--bg-bottom);
  color: var(--label); transition: opacity 0.28s ease; }
.home[hidden] { display: none; }
.home.out { opacity: 0; pointer-events: none; }
.home h1 { margin: 6px 0 0; font-family: var(--font-display); font-size: clamp(34px, 10vw, 46px); font-weight: 800; letter-spacing: -0.02em; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.18); }
.home-sub { margin: 0; font-size: 18px; font-weight: 600; color: var(--label-2); }
.home-level { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }
.home-level span { padding: 8px 14px; border-radius: 99px; font-size: 16px; font-weight: 600;
  background: var(--glass); border: 0.5px solid var(--glass-line); }
.home-actions { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.home .btn { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; min-height: 66px; padding: 12px 16px;
  border-radius: 18px; font-size: 22px; font-weight: 700; background: rgba(255, 255, 255, 0.95); color: #1c1c1e;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18); transition: transform 0.2s var(--spring); }
.home .btn small { font-size: 15px; font-weight: 600; opacity: 0.72; margin-top: 2px; }
.home .btn.primary { background: var(--accent); color: #fff; }
.home .btn.gold { background: #ffd34d; color: #2b1d00; }
.home .btn:active { transform: scale(0.97); }

/* 카드 다섯 장: 부채꼴로 펼쳐진 뒤 천천히 떠 있어요 */
.home-cards { position: relative; width: 100%; height: clamp(150px, 27vh, 230px); --hw: clamp(72px, 21vw, 108px); cursor: pointer; }
.hcard { position: absolute; left: 50%; top: 50%; width: var(--hw); height: calc(var(--hw) * 1.42);
  margin: calc(var(--hw) * -0.6) 0 0 calc(var(--hw) * -0.5); border-radius: calc(var(--hw) * 0.14);
  background: var(--card); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 22px rgba(0, 0, 0, 0.28);
  transform-origin: 50% 135%; translate: calc(var(--i) * var(--hw) * 0.34) 0;
  --rot: calc(var(--i) * 11deg); --lift: calc(var(--i) * var(--i) * 4px);
  transform: rotate(var(--rot)) translateY(var(--lift)); }
.hcard.red { color: var(--card-red); }
.hcard.black { color: var(--card-black); }
.hcard svg.art { position: absolute; inset: 0; width: 100%; height: 100%; fill: currentColor; stroke: none; overflow: visible; }
.hcard svg.art text { font-family: var(--font-display); font-weight: 700; fill: currentColor; }
.hcard svg.art .ct { font-weight: 800; }
.home-cards.play .hcard { animation: fan-in 0.9s var(--spring) both, card-float 4.8s ease-in-out infinite;
  animation-delay: calc((var(--i) + 2) * 90ms), calc((var(--i) + 2) * 300ms + 1s); }
@keyframes fan-in {
  from { transform: rotate(0deg) translateY(28px) scale(0.92); opacity: 0; }
  60% { opacity: 1; }
}
@keyframes card-float {
  0%, 100% { transform: rotate(var(--rot)) translateY(var(--lift)); }
  50% { transform: rotate(calc(var(--rot) * 1.08)) translateY(calc(var(--lift) - 7px)); }
}
html.calm .home-cards.play .hcard { animation: none; }
html.calm .home { transition: none; }
@media (prefers-reduced-motion: reduce) { .home-cards.play .hcard { animation: none; } }

/* 기록 옮기기 코드 */
.code-box { width: 100%; margin: 4px 0 14px; padding: 12px; border-radius: 12px; border: 1px solid var(--sep); background: var(--group); color: var(--label);
  font: 13px/1.4 ui-monospace, Menlo, monospace; word-break: break-all; resize: none; user-select: text; -webkit-user-select: text; touch-action: auto; }

/* 작은 휴대폰(세로 740px 이하): 결과 창이 한 화면에 들어가게 줄여요 — '새 게임' 버튼이 스크롤 없이 보이게 */
@media (max-height: 740px) {
  .win-badge { margin: 0 0 4px; }
  .win-badge svg { width: 48px; height: 48px; }
  .win-badge ~ h2 { font-size: 24px; }
  .win-badge ~ .sub { margin-bottom: 10px; }
  .win-badge ~ .no-undo { padding: 6px 12px; margin-bottom: 10px; }
  .win-badge ~ .no-undo small { display: none; }
  .win-badge ~ .result-note { padding: 7px 12px; margin-bottom: 10px; }
  .win-badge ~ .xp-box { padding: 9px 12px; margin-bottom: 10px; }
  .win-badge ~ .stats { display: none; } /* 승리·승률·연승은 메뉴에서도 볼 수 있어요 */
}

/* ---------- 클리어 연출 다듬기 ---------- */
/* 배너: 큰 글자 아래 걸린 시간(되돌리기 없이) 한 줄. 글자 뒤에 은은한 빛 */
.clear-banner .cb-text { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  animation: banner 2.4s var(--spring) forwards; }
.clear-banner .cb-text::before { content: ""; position: absolute; inset: -40px -60px; z-index: -1; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.35), transparent); }
.clear-banner .cb-text b { animation: none; }
.clear-banner .cb-text small { font-size: 20px; font-weight: 700; color: #fff; opacity: 0.92; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35); }
.clear-banner.big .cb-text b { background: linear-gradient(180deg, #fff6c2, #ffd23f 55%, #ffb000); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none; filter: drop-shadow(0 3px 10px rgba(255, 176, 0, 0.55)) drop-shadow(0 1px 0 rgba(0, 0, 0, 0.25)); }
.clear-banner.big .ring { border-width: 4px; }
.clear-banner .ring.r3 { animation-delay: 0.36s; border-color: rgba(255, 214, 10, 0.6); }

/* 결과 창: 점수 숫자는 고정폭이라 올라가는 동안 흔들리지 않게, '최고 점수!'는 다 올라간 뒤 톡 */
.score-line b { font-variant-numeric: tabular-nums; }
.score-line em.pop { display: inline-block; opacity: 0; transform: scale(0.6); }
.score-line em.pop.on { animation: pop-in 0.5s var(--spring) forwards; }
@keyframes pop-in { 0% { opacity: 0; transform: scale(0.6) } 60% { opacity: 1; transform: scale(1.18) } 100% { opacity: 1; transform: scale(1) } }
html.calm .score-line em.pop { opacity: 1; transform: none; }
.xp-box .bar i { transition: width 0.9s var(--spring); }
@media (prefers-reduced-motion: reduce) { .clear-banner .cb-text { animation: banner 2.4s linear forwards; } .score-line em.pop { opacity: 1; transform: none; } }

/* ==========================================================================
   볼륨감 — 빛은 위에서, 그림자는 아래로. 글자 대비는 그대로 두고 깊이만 더해요.
   카드: 종이 두께(윗변 빛·아랫변 그늘) + 겹 그림자 / 테이블: 가장자리 그늘 / 카드 자리: 움푹 파인 홈
   버튼: 아래 두께가 있는 입체 버튼, 누르면 쑥 들어가요
   ========================================================================== */
:root {
  --card-shadow: 0 1px 1px rgba(0, 0, 0, 0.26), 0 3px 6px rgba(0, 0, 0, 0.2), 0 8px 16px rgba(0, 0, 0, 0.14);
  --card-lift: 0 24px 40px rgba(0, 0, 0, 0.32), 0 8px 14px rgba(0, 0, 0, 0.2);
  --vignette: rgba(0, 0, 0, 0.3);
  --raise: 0 1px 2px rgba(0, 0, 0, 0.07), 0 4px 12px rgba(0, 0, 0, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root { --card-shadow: 0 1px 1px rgba(0, 0, 0, 0.45), 0 3px 7px rgba(0, 0, 0, 0.35), 0 10px 20px rgba(0, 0, 0, 0.25); --raise: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.25); }
}
html[data-table="sage"] { --vignette: rgba(60, 80, 70, 0.1); --card-shadow: 0 1px 1px rgba(0, 0, 0, 0.12), 0 3px 6px rgba(0, 0, 0, 0.08), 0 8px 16px rgba(0, 0, 0, 0.06); }

/* 테이블: 가운데는 밝고 가장자리로 갈수록 그늘 — 펠트 위에 조명이 비치는 느낌 */
body, .home {
  background:
    radial-gradient(ellipse 115% 95% at 50% 38%, transparent 55%, var(--vignette) 100%),
    radial-gradient(ellipse 130% 85% at 50% 22%, var(--bg-top), var(--bg-bottom));
  background-color: var(--bg-bottom);
}

/* 카드 앞면: 위가 살짝 밝은 종이, 윗변 빛줄기, 아랫변 두께 */
.card .face {
  background: linear-gradient(180deg, #ffffff 0%, var(--card) 45%, #ebebf0 100%);
  box-shadow: var(--card-shadow), inset 0 1px 0 rgba(255, 255, 255, 1), inset 0 -2px 0 rgba(0, 0, 0, 0.07), inset 0 0 0 0.5px rgba(0, 0, 0, 0.14);
}
/* 카드 뒷면: 위쪽 광택 + 아래쪽 그늘 */
.card .back { box-shadow: var(--card-shadow), inset 0 0 0 calc(var(--cw) * 0.06) var(--back-rim), inset 0 0 0 calc(var(--cw) * 0.06 + 1px) rgba(0, 0, 0, 0.1),
  inset 0 calc(var(--ch) * -0.12) calc(var(--ch) * 0.16) rgba(0, 0, 0, 0.16); }
.card .back::before { content: ""; position: absolute; inset: calc(var(--cw) * 0.06); border-radius: calc(var(--cw) * 0.11); pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 42%); }
.card.dragging .face { box-shadow: var(--card-lift), inset 0 1px 0 #fff, inset 0 -2px 0 rgba(0, 0, 0, 0.07), inset 0 0 0 0.5px rgba(0, 0, 0, 0.14); }

/* 카드 자리: 테이블에 움푹 파인 홈 */
.slot { background: rgba(0, 0, 0, 0.14); box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3), inset 0 0 0 1.5px var(--label-3), 0 1px 0 rgba(255, 255, 255, 0.1); }
.tab-slot { background: rgba(0, 0, 0, 0.06); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.18), inset 0 0 0 1.5px rgba(255, 255, 255, 0.16); }
html[data-table="sage"] .slot { background: rgba(120, 130, 125, 0.1); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08), inset 0 0 0 1.5px var(--label-3), 0 1px 0 #fff; }

/* 위 막대 이름표·아래 버튼 막대: 살짝 떠 있는 판 */
.title { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 -1px 0 rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.16); }
.toolbar { background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(0, 0, 0, 0.08)), var(--bar);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 -6px 18px rgba(0, 0, 0, 0.16); }
.toolbar button { border-radius: 14px; }
.toolbar button:active { background: rgba(0, 0, 0, 0.16); box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.25); }
.toolbar .badge { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.ad-banner { box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2); }
.auto-btn { background: linear-gradient(180deg, #3d97ff, #0068e6); box-shadow: 0 4px 0 #0050b0, 0 10px 24px rgba(0, 104, 230, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.auto-btn:active { transform: translateX(-50%) translateY(3px); box-shadow: 0 1px 0 #0050b0, 0 4px 10px rgba(0, 104, 230, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35); }

/* 창(시트) 안 버튼: 아래 두께가 있는 입체 버튼 */
.sheet .row .btn, .sheet .cta .btn { box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.55); transition: transform 0.12s, box-shadow 0.12s; }
.sheet .btn.primary { background: linear-gradient(180deg, #3d97ff, #0068e6); box-shadow: 0 3px 0 #0050b0, 0 8px 16px rgba(0, 104, 230, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.sheet .btn.gold { background: linear-gradient(180deg, #ffb340, #f28a00); box-shadow: 0 3px 0 #c06a00, 0 8px 16px rgba(242, 138, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
.sheet .btn.danger-fill { background: linear-gradient(180deg, #f0544c, #d42a22); box-shadow: 0 3px 0 #a51d17, 0 8px 16px rgba(212, 42, 34, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.sheet .row .btn:active, .sheet .cta .btn:active { transform: translateY(2px); opacity: 1; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
@media (prefers-color-scheme: dark) { .sheet .row .btn, .sheet .cta .btn { box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08); } }
/* 창 안의 묶음 상자(목록·기록·경험치·할 일): 살짝 떠 있게 */
.sheet .list, .stats, .xp-box, .todo, .face-pick, .back-pick, .swatches, .result-note, .no-undo, .chip { box-shadow: var(--raise); }
.seg { box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12); }
.sheet { box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.6); }
@media (prefers-color-scheme: dark) { .sheet { box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08); } }

/* 시작 화면: 입체 버튼, 떠 있는 카드, 글자 그림자 */
.home h1 { text-shadow: 0 2px 0 rgba(0, 0, 0, 0.16), 0 6px 18px rgba(0, 0, 0, 0.25); }
.home-level span { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 2px 8px rgba(0, 0, 0, 0.16); }
.home .btn { background: linear-gradient(180deg, #ffffff, #e9e9ef); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2), 0 10px 22px rgba(0, 0, 0, 0.22), inset 0 1px 0 #fff;
  transition: transform 0.12s, box-shadow 0.12s; }
.home .btn.primary { background: linear-gradient(180deg, #3d97ff, #0068e6); box-shadow: 0 4px 0 #0050b0, 0 10px 22px rgba(0, 60, 140, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.home .btn.gold { background: linear-gradient(180deg, #ffe07a, #ffc21a); box-shadow: 0 4px 0 #c99000, 0 10px 22px rgba(120, 80, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.6); }
.home .btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 4px 10px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.hcard { background: linear-gradient(180deg, #ffffff 0%, var(--card) 45%, #ebebf0 100%);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.25), 0 12px 26px rgba(0, 0, 0, 0.32), inset 0 1px 0 #fff, inset 0 -3px 0 rgba(0, 0, 0, 0.07), inset 0 0 0 0.5px rgba(0, 0, 0, 0.14); }

/* 클리어 때 날아가는 카드: 그림자를 한 겹으로 줄여 가볍게 */
.card.flying .face, .card.flying .back { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28); }
.card.flying .back::before { display: none; }

/* 시작 화면 맨 아래 이용 등급 (토스 게임 출시 기준: 3초 이상 보이게) */
.home-rating { margin: 6px 0 0; }
.home-rating b { display: inline-block; padding: 5px 12px; border-radius: 8px; font-size: 14px; font-weight: 700; color: var(--label);
  background: rgba(0, 0, 0, 0.22); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.5); }
html[data-table="sage"] .home-rating b { background: rgba(255, 255, 255, 0.8); box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.25); }

/* 시작 화면: 세로가 짧은 휴대폰(토스 상단 바까지 있으면 더 짧아요)에서도 카드와 이름이 겹치지 않게 */
.home-cards { --hw: clamp(56px, min(21vw, 13vh), 108px); height: calc(var(--hw) * 2.05); flex: none; }
@media (max-height: 700px) {
  .home { gap: 8px; }
  .home h1 { font-size: clamp(28px, 8.5vw, 40px); margin-top: 2px; }
  .home-sub { font-size: 16px; }
  .home .btn { min-height: 56px; font-size: 20px; padding: 9px 14px; }
  .home-actions { gap: 10px; margin-top: 4px; }
  .home-level span { padding: 6px 12px; font-size: 15px; }
}

/* 위쪽 배너(안드로이드·웹): 맨 위에 붙고, 시간·점수 줄은 그 아래로 */
.ad-banner.top { margin: 6px 12px 0; }

/* ---------- 언어 (영어·한국어, src/texts.js) ---------- */
/* 글자를 고른 언어로 채우기 전(여는 첫 순간)에는 HTML의 글자를 숨겨요. NcqLang이 <html lang>을 정하면 보여요 */
html:not([lang]) [data-i18n] { visibility: hidden; }
/* 메뉴의 언어 고르기: 지구본 + '언어 · Language' */
.group-label.lang-label { display: flex; align-items: center; gap: 6px; }
.group-label.lang-label svg { width: 18px; height: 18px; stroke-width: 2; flex: none; }
/* 영어는 한국어보다 길어요: 알림은 화면 폭 안에서 줄바꿈, 창 글자는 넘치지 않게 */
.toast { white-space: normal; width: max-content; max-width: calc(100vw - 32px); text-align: center; overflow-wrap: anywhere; }
.sheet, .home { overflow-wrap: break-word; }
/* 클리어 배너가 두 줄이 되면(오늘의 도전 성공! / Daily Cleared!) 가운데 맞춤 */
.clear-banner .cb-text { text-align: center; }
