/* ================================================================
   The SkyScrapers — style.css
   기준: portal/designguideline/skyscrapers.html v1.0
   원칙: 파스텔=면적·배경 / 딥=텍스트·아이콘·인터랙션, 각진(0~4px), pill 금지
   ================================================================ */

/* 전용 서체 'Isamanru' (공고딕 GongGothic) — Light/Medium/Bold 3웨이트 */
@font-face {
  font-family: 'Isamanru';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_20-10@1.0/GongGothicLight.woff') format('woff');
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: 'Isamanru';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_20-10@1.0/GongGothicMedium.woff') format('woff');
  font-weight: 400 500;
  font-display: swap;
}
@font-face {
  font-family: 'Isamanru';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_20-10@1.0/GongGothicBold.woff') format('woff');
  font-weight: 700 900;
  font-display: swap;
}

:root {
  --primary:       #7FB3E8;
  --primary-str:   #3B7DD8;
  --primary-hov:   #2E6DC4;
  --secondary:     #7ED9C3;
  --secondary-str: #2FA98C;
  --brand-grad:    linear-gradient(135deg, #3B7DD8 0%, #2FA98C 100%);
  --sky-grad:      linear-gradient(135deg, #7FB3E8 0%, #7ED9C3 100%);
  --primary-dim:   rgba(59,125,216,0.12);
  --secondary-dim: rgba(47,169,140,0.14);

  --bg:         #F4F8FC;
  --bg-soft:    #E9F1F9;
  --surface:    #FFFFFF;
  --text:       #1E2A38;
  --text-soft:  #5E7186;
  --text-faint: #93A6B8;
  --border:     #D3E0EE;

  /* 고정 칸(given) 전용 — 흰 셀과 확실히 구분되도록 --bg-soft보다 한 단계 진하게 */
  --given-bg:     #D4E2F1;
  --given-bg-hl:  #C2D7EC;   /* 선택된 행·열 위에 놓였을 때 */
  --given-border: #A9C2DC;
  --given-text:   #16202C;
  --given-mark:   #7C93AB;

  --danger-surface:#FEECF0; --danger-border:#FCD4DE; --danger:#EB003B; --danger-text:#D50136;
  --success-surface:#EEF7F0; --success-border:#CEE9D4; --success-text:#006E18;
  --info-surface:#E9F0FF; --info-border:#D4E1FF; --info-text:#1F53CC;

  --shadow:    0 4px 20px rgba(30,42,56,.08);
  --shadow-lg: 0 12px 40px rgba(30,42,56,.14);

  --radius-cell: 2px;
  --radius:      3px;
  --radius-lg:   4px;

  --font: "Isamanru", -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
  --side-w: 272px;
}
[data-theme="dark"] {
  --primary:       #5B93C9;
  --primary-str:   #6AA8EE;
  --primary-hov:   #7FB6EE;
  --secondary:     #4FB89E;
  --secondary-str: #5FD0B6;
  --primary-dim:   rgba(106,168,238,0.16);
  --secondary-dim: rgba(95,208,182,0.16);

  --bg:         #121820;
  --bg-soft:    #1A2430;
  --surface:    #1E2A38;
  --text:       #E6EEF6;
  --text-soft:  #93A6B8;
  --text-faint: #6B7E90;
  --border:     #2C3A4A;

  --given-bg:     #2C3C4F;
  --given-bg-hl:  #35485F;
  --given-border: #475D77;
  --given-text:   #FFFFFF;
  --given-mark:   #8AA2BB;

  --danger-surface:rgba(235,0,59,.14); --danger-border:rgba(235,0,59,.3); --danger-text:#FF6B8F;
  --success-surface:rgba(0,138,30,.14); --success-border:rgba(0,138,30,.3); --success-text:#5ACB74;
  --info-surface:rgba(39,104,255,.14); --info-border:rgba(39,104,255,.3); --info-text:#7FA5FF;

  --shadow:    0 4px 20px rgba(0,0,0,.3);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.45);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg); color: var(--text);
  min-height: 100dvh;
  line-height: 1.6; -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}
button { font-family: inherit; }
.hidden { display: none !important; }

/* 스크롤바 — 전 서비스 공통 6px */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #3B7DD8, #2FA98C); border-radius: 999px; }

:focus-visible { outline: 2px solid var(--primary-str); outline-offset: 2px; }

.chip-btn {
  height: 34px; min-width: 34px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface); color: var(--text-soft);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.78rem; font-weight: 700; cursor: pointer;
  transition: border-color .15s, color .15s, box-shadow .15s;
}
.chip-btn:hover { border-color: var(--primary-str); color: var(--primary-str); box-shadow: 0 0 0 3px var(--primary-dim); }
.chip-btn.icon { padding: 0; width: 34px; }
.chip-btn.icon svg { width: 17px; height: 17px; }
[data-theme="dark"] .ic-moon { display: none; }
[data-theme="light"] .ic-sun { display: none; }
html:not([data-theme]) .ic-sun { display: none; }

@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* ═══ 레이아웃: 좌측 사이드바 + 본문 ══════════════════════ */
.layout { display: flex; min-height: 100dvh; }

.side {
  position: fixed; top: 0; bottom: 0; left: 0; width: var(--side-w); z-index: 70;
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border);
}
.content {
  flex: 1; min-width: 0; margin-left: var(--side-w);
  display: flex; flex-direction: column; min-height: 100dvh;
}
.app { flex: 1; width: 100%; max-width: 780px; margin: 0 auto; padding: 0 16px; }
.view { display: none; padding: 22px 0 34px; animation: viewIn .22s ease; }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 사이드바 — 로고 */
.side-top {
  display: flex; align-items: center; gap: 8px;
  padding: 14px; border-bottom: 1px solid var(--border);
}
.side-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: 1; min-width: 0; }
.side-mk {
  width: 40px; height: 40px; flex: 0 0 auto;   /* 1:1 비율 — favicon과 동일 소스 */
  padding: 6px; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  transition: border-color .15s;
}
.side-brand:hover .side-mk { border-color: var(--primary-str); }
.side-brand-tx { min-width: 0; }
.side-brand-tx b { display: block; font-size: 0.95rem; font-weight: 800; color: var(--text); letter-spacing: -0.025em; line-height: 1.25; }
.side-brand-tx small { display: block; margin-top: 1px; font-size: 0.68rem; font-weight: 300; color: var(--text-soft); }
.side-x { display: none; }

/* 사이드바 — 섹션 */
.side-scroll { flex: 1; overflow-y: auto; padding: 0 14px 24px; }
.side-sec { padding: 15px 0; border-bottom: 1px solid var(--border); }
.side-sec:last-child { border-bottom: none; }
.side-h {
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 8px;
}
.side-h + .seg + .side-h { margin-top: 14px; }

/* 로그인 (추후 Bibong.dev 통합 계정) */
.side-login {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 14px; background: var(--bg-soft); color: var(--text);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-family: inherit; font-size: 0.86rem; font-weight: 700; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.side-login svg { width: 17px; height: 17px; }
.side-login:hover { border-color: var(--primary-str); color: var(--primary-str); }
.side-note { margin-top: 7px; font-size: 0.67rem; font-weight: 300; color: var(--text-faint); text-align: center; }

/* 언어 선택 */
.side-select {
  width: 100%; padding: 9px 30px 9px 12px;
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-family: inherit; font-size: 0.85rem; font-weight: 700; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  /* 화살표는 배경 이미지라 currentColor를 못 쓴다 — 명·암 양쪽에서 읽히는 중간 회색 */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238C9CAD' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 15px;
}
.side-select:hover { border-color: var(--primary-str); }

/* 크기 · 난이도 세그먼트 */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg button {
  padding: 9px 4px; background: var(--surface); color: var(--text-soft);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-family: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.seg button:hover { border-color: var(--primary-str); color: var(--primary-str); }
.seg button.on { background: var(--primary-str); border-color: var(--primary-str); color: #fff; }

.side-btn { width: 100%; margin-top: 10px; padding: 11px 14px; font-size: 0.88rem; flex-direction: column; gap: 1px; }
.side-btn small { font-size: 0.65rem; font-weight: 600; opacity: .9; }

/* 확대 · 축소 */
.zoom-row { display: flex; align-items: center; gap: 6px; }
.zoom-btn {
  width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center;
  background: var(--surface); color: var(--text-soft);
  border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer;
  transition: border-color .15s, color .15s;
}
.zoom-btn svg { width: 18px; height: 18px; }
.zoom-btn:hover:not(:disabled) { border-color: var(--primary-str); color: var(--primary-str); }
.zoom-btn:disabled { opacity: .35; cursor: not-allowed; }
.zoom-val {
  flex: 1; height: 38px; background: var(--bg-soft); color: var(--text);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-family: inherit; font-size: 0.82rem; font-weight: 800; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.zoom-val:hover { border-color: var(--primary-str); color: var(--primary-str); }

/* 메뉴 목록 */
.side-menu { display: flex; flex-direction: column; gap: 2px; }
.side-menu button, .side-menu a {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; background: none; border: none; border-radius: var(--radius);
  color: var(--text-soft); font-family: inherit; font-size: 0.84rem; font-weight: 700;
  text-align: left; text-decoration: none; cursor: pointer;
  transition: background .15s, color .15s;
}
.side-menu svg { width: 17px; height: 17px; flex: 0 0 auto; }
.side-menu button:hover, .side-menu a:hover { background: var(--primary-dim); color: var(--primary-str); }

/* 모바일 드로어용 요소 — 데스크톱에서는 숨김 */
.nav-toggle { display: none; }
.side-scrim { display: none; }

/* ─── 버튼 ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 0.92rem;
  padding: 12px 20px; border-radius: var(--radius-cell);
  border: 1.5px solid transparent; cursor: pointer;
  transition: transform .12s, box-shadow .2s, background .2s, color .2s, border-color .2s;
}
.btn-big { padding: 15px 20px; font-size: 1rem; flex-direction: column; gap: 2px; }
.btn-big small { font-size: 0.7rem; font-weight: 600; opacity: .85; }
.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: 0 4px 14px rgba(59,125,216,.3); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(59,125,216,.42); }
.btn-secondary { background: var(--secondary-str); color: #fff; box-shadow: 0 4px 14px rgba(47,169,140,.28); }
.btn-secondary:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(47,169,140,.4); }
.btn-ghost { background: transparent; color: var(--primary-str); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary-str); background: var(--primary-dim); }
.btn-soft { background: var(--bg-soft); color: var(--text); border-color: var(--border); }
.btn-soft:hover { border-color: var(--primary-str); }
.btn-danger { background: var(--danger-surface); color: var(--danger-text); border-color: var(--danger-border); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ─── 배지 ─────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.74rem; font-weight: 700; padding: 4px 10px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-soft); color: var(--text-soft);
}
.badge-brand { background: var(--primary-dim); border-color: transparent; color: var(--primary-str); }
.badge-onbrand { background: rgba(255,255,255,.22); border-color: transparent; color: #fff; }

/* ─── 게임 바 ──────────────────────────────────────────── */
.gamebar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.gamebar-stats { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.gstat { display: inline-flex; align-items: center; gap: 4px; color: var(--text-soft); font-size: 0.8rem; }
.gstat svg { width: 15px; height: 15px; }
.gstat b { font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
/* Isamanru(공고딕)는 고정폭 숫자를 지원하지 않아 매초 갱신되는 타이머가 흔들린다.
   폭을 고정해 주변 레이아웃이 밀리지 않게 한다. */
.gstat.timer b { font-size: 0.92rem; display: inline-block; min-width: 54px; text-align: center; }

/* ─── 보드 ─────────────────────────────────────────────── */
.board-wrap { display: flex; justify-content: center; }
.board {
  --cluew: clamp(22px, 6vw, 30px);
  display: grid;
  grid-template-columns: var(--cluew) repeat(var(--n, 5), 1fr) var(--cluew);
  gap: 4px;
  /* --zoom: 사이드바의 확대·축소 버튼이 조절 (0.7 ~ 1.6) */
  width: min(100%, calc(470px * var(--zoom, 1)));
  background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 8px;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.corner { }
.clue {
  display: grid; place-items: center; position: relative;
  font-weight: 800; color: var(--primary-str);
  font-size: clamp(0.85rem, 3.4vw, 1rem);
  font-variant-numeric: tabular-nums;
  cursor: default; border-radius: var(--radius-cell);
  min-height: var(--cluew);
  transition: background .15s, color .2s;
}
.clue.has { cursor: pointer; }
.clue.has:hover { background: var(--primary-dim); }
.clue.ok { color: var(--secondary-str); }
.clue.bad { color: var(--danger-text); }
/* 방향 인디케이터 (각진 삼각형) */
.clue.has::after { content: ''; position: absolute; width: 0; height: 0; opacity: .5; }
.clue.has.t::after { bottom: 0; left: 50%; transform: translateX(-50%); border-left: 3.5px solid transparent; border-right: 3.5px solid transparent; border-top: 4.5px solid currentColor; }
.clue.has.b::after { top: 0; left: 50%; transform: translateX(-50%); border-left: 3.5px solid transparent; border-right: 3.5px solid transparent; border-bottom: 4.5px solid currentColor; }
.clue.has.l::after { right: 0; top: 50%; transform: translateY(-50%); border-top: 3.5px solid transparent; border-bottom: 3.5px solid transparent; border-left: 4.5px solid currentColor; }
.clue.has.r::after { left: 0; top: 50%; transform: translateY(-50%); border-top: 3.5px solid transparent; border-bottom: 3.5px solid transparent; border-right: 4.5px solid currentColor; }

.cell {
  aspect-ratio: 1; min-width: 0; position: relative;
  display: grid; place-items: center;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-cell);
  font-size: clamp(1.05rem, 4.6vw, 1.45rem); font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer; padding: 0;
  transition: background .12s, border-color .12s, box-shadow .12s, color .12s;
}
/* 고정 칸(given) — 배경·테두리·글자굵기·모서리 마커 4중으로 구분한다.
   배경 하나만으로는 행·열 하이라이트나 충돌 틴트에 덮여 구분이 사라진다. */
.cell.given {
  background: var(--given-bg);
  border-color: var(--given-border);
  color: var(--given-text);
  font-weight: 900;
  cursor: default;
}
.cell.rowcol { background: var(--primary-dim); }
/* 선택된 행·열 위에 놓여도 고정 칸은 계속 진하게 유지 (specificity 0,3,0) */
.cell.given.rowcol { background: var(--given-bg-hl); }
/* 배경이 어떤 상태로 덮이든 남는 각진 모서리 마커 = "수정 불가" */
.cell.given::before {
  content: '';
  position: absolute; top: 0; left: 0;
  border-top: 8px solid var(--given-mark);
  border-right: 8px solid transparent;
  pointer-events: none;
}
.cell.same { color: var(--primary-str); }
.cell.sel { box-shadow: inset 0 0 0 2px var(--primary-str), 0 0 0 3px var(--primary-dim); z-index: 2; }
/* 선택 표시(.sel)가 곧 포커스 위치다 — 링이 겹쳐 두 겹으로 보이지 않게 기본 아웃라인은 끈다. */
.cell:focus-visible { outline: none; }
.cell.conflict { background: var(--danger-surface); color: var(--danger-text); border-color: var(--danger-border); }
.cell.peek { background: var(--secondary-dim); box-shadow: inset 0 0 0 2px var(--secondary-str); color: var(--secondary-str); }
.cell.peek-dim { opacity: .45; }
.cell.err { animation: errFlash 1.6s ease; }
@keyframes errFlash { 0%,60% { background: var(--danger-surface); color: var(--danger-text); border-color: var(--danger-border); } 100% { } }
.cell.pop .val { animation: pop .18s ease; }
@keyframes pop { 0% { transform: scale(.6); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }

.cell .pencil {
  position: absolute; inset: 2px;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr;
}
.cell .pencil span {
  display: grid; place-items: center;
  font-size: clamp(0.42rem, 1.8vw, 0.58rem); font-weight: 700;
  color: var(--primary-str); opacity: .95; line-height: 1;
}

/* ─── 툴바 & 숫자 패드 ─────────────────────────────────── */
.toolbar { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.tool {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  background: var(--surface); color: var(--text-soft);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s, transform .1s;
}
.tool svg { width: 20px; height: 20px; }
.tool:hover { border-color: var(--primary-str); color: var(--primary-str); transform: translateY(-1px); }
.tool.active { background: var(--primary-str); border-color: var(--primary-str); color: #fff; }
.tool:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.tool-hint:hover { border-color: var(--secondary-str); color: var(--secondary-str); }

.numpad { display: flex; justify-content: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.key {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color .15s, color .15s, transform .1s, opacity .2s;
}
.key:hover { border-color: var(--primary-str); color: var(--primary-str); transform: translateY(-1px); }
.key.done { opacity: .35; }

/* ─── 푸터 ─────────────────────────────────────────────── */
.app-foot {
  width: 100%; margin-top: 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}
.foot-inner {
  max-width: 560px; margin: 0 auto;
  padding: 26px 16px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center;
}
/* 서비스명 + 1:1 로고 (favicon과 동일 소스: assets/images/logo.svg) */
.foot-brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; }
.foot-mk {
  width: 34px; height: 34px; flex: 0 0 auto;   /* 1:1 비율 */
  padding: 5px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  transition: border-color .15s;
}
.foot-brand:hover .foot-mk { border-color: var(--primary-str); }
.foot-name { font-size: 0.95rem; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }

.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; }
.foot-link {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--text-soft); font-family: inherit; font-size: 0.76rem; font-weight: 400;
  text-decoration: none; transition: color .15s;
}
.foot-link:hover { color: var(--primary-str); }
/* [법적 요구사항] 개인정보처리방침은 반드시 Bold */
.foot-link.bold { font-weight: 700; color: var(--text); }

.foot-copy { font-size: 0.7rem; color: var(--text-faint); }
.foot-bibong { color: var(--text-soft); font-weight: 700; text-decoration: none; transition: color .15s; }
.foot-bibong:hover { color: var(--primary-str); text-decoration: underline; }

/* ─── 문서형 모달 본문 (약관·공지·문의) ────────────────── */
.doc-body p { font-size: 0.85rem; font-weight: 300; color: var(--text-soft); line-height: 1.7; }
.doc-list { margin-top: 12px; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.doc-list li { font-size: 0.85rem; font-weight: 300; color: var(--text-soft); line-height: 1.7; }
.doc-list li::marker { color: var(--primary-str); font-weight: 700; }
.doc-note { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); font-size: 0.78rem !important; }

.notice-item { padding: 14px 0; border-bottom: 1px dashed var(--border); }
.notice-item:first-child { padding-top: 0; }
.notice-item:last-child { border-bottom: none; padding-bottom: 0; }
.notice-date {
  display: inline-block; margin-bottom: 6px;
  font-size: 0.68rem; font-weight: 700; color: var(--primary-str);
  background: var(--primary-dim); padding: 3px 9px; border-radius: var(--radius);
}
.notice-date.soon { color: var(--secondary-str); background: var(--secondary-dim); }
.notice-item b { display: block; font-size: 0.92rem; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.notice-item p { margin-top: 5px; }

.contact-rows { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.contact-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 14px; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.contact-row span { font-size: 0.76rem; font-weight: 700; color: var(--text-soft); }
.contact-row a { font-size: 0.82rem; font-weight: 700; color: var(--primary-str); text-decoration: none; }
.contact-row a:hover { text-decoration: underline; }

/* ─── 오버레이 & 모달 ──────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(18,24,32,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  width: min(100%, 420px); max-height: min(84dvh, 640px);
  display: flex; flex-direction: column;
  box-shadow: 0 40px 80px rgba(0,0,0,.35); overflow: hidden;
  position: relative; animation: modalIn .2s cubic-bezier(.2,.8,.3,1);
}
.modal::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--brand-grad); }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-sm { width: min(100%, 340px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 0; }
.modal-head h3 { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.02em; }
.modal-body { padding: 16px 20px 22px; overflow-y: auto; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.confirm-title { font-size: 1.05rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; }
.confirm-body { font-size: 0.85rem; font-weight: 300; color: var(--text-soft); line-height: 1.6; }

/* 이용방법 */
.howto-list { padding-left: 18px; display: flex; flex-direction: column; gap: 9px; font-size: 0.86rem; font-weight: 300; color: var(--text-soft); }
.howto-list li::marker { color: var(--primary-str); font-weight: 800; }
.howto-vis { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.vis-label { font-size: 0.74rem; font-weight: 800; color: var(--text-soft); margin-bottom: 6px; }
.vis-bars { display: flex; align-items: flex-end; gap: 5px; height: 84px; }
.vis-bars i {
  width: 34px; height: var(--h, 50%);
  display: flex; align-items: flex-start; justify-content: center; padding-top: 3px;
  border-radius: var(--radius) var(--radius) 0 0; border: 1px solid var(--border);
  font-style: normal;
}
.vis-bars i b { font-size: 0.72rem; font-weight: 800; }
.vis-bars i.vis { background: var(--primary-str); border-color: var(--primary-str); }
.vis-bars i.vis b { color: #fff; }
.vis-bars i.hid { background: var(--bg-soft); }
.vis-bars i.hid b { color: var(--text-faint); }

/* 설정 */
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 0; border-bottom: 1px solid var(--border); cursor: pointer;
}
.set-row:last-child { border-bottom: none; }
.set-info { display: flex; flex-direction: column; gap: 1px; }
.set-info b { font-size: 0.9rem; font-weight: 700; }
.set-info span { font-size: 0.74rem; color: var(--text-soft); }
.switch { appearance: none; width: 42px; height: 24px; flex-shrink: 0; background: var(--bg-soft); border: 1.5px solid var(--border); border-radius: var(--radius); position: relative; cursor: pointer; transition: background .2s, border-color .2s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: var(--radius-cell); background: var(--text-faint); transition: transform .18s, background .2s; }
.switch:checked { background: var(--primary-str); border-color: var(--primary-str); }
.switch:checked::after { transform: translateX(18px); background: #fff; }

.privacy-body p { font-size: 0.85rem; font-weight: 300; color: var(--text-soft); line-height: 1.7; }
.privacy-body p + p { margin-top: 10px; }

/* 통계 */
.stats-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.stats-table th, .stats-table td { padding: 9px 10px; border: 1px solid var(--border); text-align: left; }
.stats-table th { background: var(--primary-dim); font-weight: 700; font-size: 0.78rem; }
.stats-table td b { font-variant-numeric: tabular-nums; }
.stats-daily { display: flex; gap: 10px; margin-top: 14px; }
.stats-tile { flex: 1; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 14px; }
.stats-tile b { display: block; font-size: 1.3rem; font-weight: 800; color: var(--primary-str); font-variant-numeric: tabular-nums; }
.stats-tile span { font-size: 0.72rem; color: var(--text-soft); }

/* ─── 결과 ─────────────────────────────────────────────── */
.result-card {
  width: min(100%, 360px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-lg);
  animation: modalIn .25s cubic-bezier(.2,.8,.3,1);
}
.result-top { padding: 22px 22px 0; background: var(--brand-grad); color: #fff; }
.result-top .rank { font-size: 1.8rem; font-weight: 900; letter-spacing: -0.02em; }
.result-top .lv { font-size: 0.8rem; opacity: .92; margin: 2px 0 8px; min-height: 1.2em; }
.result-sky { display: flex; align-items: flex-end; gap: 3px; height: 44px; margin-top: 14px; }
.result-sky i {
  flex: 1; height: var(--h, 50%);
  background: rgba(255,255,255,.55); border-radius: var(--radius-cell) var(--radius-cell) 0 0;
  transform-origin: bottom; animation: rise .6s cubic-bezier(.2,.8,.3,1) backwards;
}
.result-body { padding: 16px 22px 20px; }
.res-row { display: flex; justify-content: space-between; font-size: 0.82rem; padding: 6px 0; color: var(--text-soft); border-bottom: 1px dashed var(--border); }
.res-row b { font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.res-row b .nb { color: var(--secondary-str); font-size: 0.72rem; margin-left: 6px; }
.result-actions { display: flex; gap: 8px; margin-top: 16px; }
.result-actions .btn { flex: 1; padding: 11px 8px; font-size: 0.85rem; }

/* ─── 로딩 ─────────────────────────────────────────────── */
.busy-card {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 26px 34px; font-size: 0.85rem; font-weight: 700; color: var(--text-soft);
  box-shadow: var(--shadow-lg);
}
.busy-sky { display: flex; align-items: flex-end; gap: 4px; height: 40px; }
.busy-sky i { width: 10px; background: var(--sky-grad); border-radius: var(--radius-cell) var(--radius-cell) 0 0; animation: busyRise 1s ease-in-out infinite; }
.busy-sky i:nth-child(1){ height: 40%; animation-delay: 0s; }
.busy-sky i:nth-child(2){ height: 65%; animation-delay: .12s; }
.busy-sky i:nth-child(3){ height: 100%; animation-delay: .24s; }
.busy-sky i:nth-child(4){ height: 55%; animation-delay: .36s; }
.busy-sky i:nth-child(5){ height: 78%; animation-delay: .48s; }
@keyframes busyRise { 0%,100% { transform: scaleY(.55); } 50% { transform: scaleY(1); } }
.busy-sky i { transform-origin: bottom; }

/* ─── 토스트 ───────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 200;
  transform: translateX(-50%) translateY(16px);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 12px 18px; font-size: 0.84rem; font-weight: 600;
  max-width: min(90vw, 420px); text-align: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success-surface); border-color: var(--success-border); color: var(--success-text); }
.toast.danger { background: var(--danger-surface); border-color: var(--danger-border); color: var(--danger-text); }
.toast.info { background: var(--info-surface); border-color: var(--info-border); color: var(--info-text); }

/* ─── 다운로드 모달 (2026-07-28: 별도 페이지 → index.html 팝업으로 전환) ── */
.dl-sub { font-size: 0.85rem; font-weight: 300; color: var(--text-soft); line-height: 1.65; margin-bottom: 14px; }

.store-list { display: flex; flex-direction: column; gap: 10px; }
.store-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .2s, border-color .15s;
}
/* 웹 카드는 링크가 아닌 상태 안내(이미 이 화면에서 플레이 중) — hover 인터랙션 없음 */
.store-card.soon { cursor: not-allowed; opacity: .62; box-shadow: none; }

/* 1:1 로고 타일 — 스토어별 원본 로고를 동일 규격으로 정렬 */
.store-logo {
  width: 48px; height: 48px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.store-logo img { width: 28px; height: 28px; object-fit: contain; display: block; }
.store-logo svg { width: 28px; height: 28px; display: block; color: var(--text); }
/* Apple 로고는 배경이 투명한 단색 검정 — 다크모드에서 반전해 가시성 확보 */
[data-theme="dark"] .store-logo img.mono { filter: invert(1); }

.store-text { flex: 1; min-width: 0; }
.store-text b { display: block; font-size: 0.98rem; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.store-text span { display: block; font-size: 0.78rem; font-weight: 300; color: var(--text-soft); margin-top: 1px; }
.store-state {
  flex: 0 0 auto; font-size: 0.68rem; font-weight: 700; padding: 4px 10px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-soft); color: var(--text-soft);
}
.store-state.on { background: var(--secondary-dim); border-color: transparent; color: var(--secondary-str); }

.dl-note {
  margin-top: 16px; padding: 13px 16px;
  background: var(--info-surface); border: 1px solid var(--info-border); border-radius: var(--radius-lg);
  font-size: 0.78rem; font-weight: 300; color: var(--info-text); line-height: 1.6;
}

/* ─── 문서 페이지 공통 (2026-07-28: privacy/terms/notice/contact.html) ──
   사이드바를 쓰는 index.html과 달리, 이 4개 페이지는 상단 Sticky 헤더 +
   중앙 정렬 본문의 홑겹 문서 레이아웃을 쓴다(가이드라인 06절 GLOBAL HEADER). */
.doc-shell { display: flex; flex-direction: column; min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 50; height: 56px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); }
.brand-mk {
  width: 28px; height: 28px; flex: 0 0 auto; padding: 4px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s;
}
.brand-mk img { display: block; width: 100%; height: 100%; }
.brand:hover .brand-mk { border-color: var(--primary-str); }
.brand-name { font-weight: 800; font-size: 1rem; letter-spacing: -0.02em; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-select { width: auto; min-width: 118px; padding: 7px 28px 7px 10px; font-size: 0.8rem; }

.doc-main-wrap { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 32px 16px 50px; }
.doc-title { font-size: clamp(1.5rem, 5.5vw, 1.9rem); font-weight: 800; letter-spacing: -0.03em; margin-bottom: 20px; }
.doc-back { margin-top: 30px; display: flex; justify-content: center; }

/* ─── 공지사항 아코디언 (notice.html, Firestore 연동) ───────
   처음엔 전부 접혀 있고, 헤더를 누르면 개별로 펼쳐진다(상호 배타 아님). */
.notice-list { display: flex; flex-direction: column; gap: 10px; }
.notice-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow);
}
.notice-head {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 15px 16px; background: none; border: none; border-bottom: 1px solid transparent;
  cursor: pointer; font-family: inherit; text-align: left; transition: border-color .2s;
}
.notice-item.open .notice-head { border-bottom-color: var(--border); }
.notice-badge {
  flex: 0 0 auto; font-size: 0.68rem; font-weight: 700; padding: 3px 9px;
  border-radius: var(--radius); background: var(--primary-dim); color: var(--primary-str);
}
.notice-head-title { flex: 1; min-width: 0; font-size: 0.9rem; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.notice-head-date { flex: 0 0 auto; font-size: 0.72rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.notice-chevron { flex: 0 0 auto; width: 16px; height: 16px; color: var(--text-faint); transition: transform .2s ease; }
.notice-item.open .notice-chevron { transform: rotate(180deg); }

/* 임의 높이 콘텐츠를 접고 펼친다. max-height를 넉넉히 크게 잡아 두면
   실제 내용 높이와 무관하게 JS 측정 없이 항상 안정적으로 동작한다. */
.notice-body-wrap { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.notice-item.open .notice-body-wrap { max-height: 2000px; }
.notice-body {
  padding: 12px 16px 16px;
  font-size: 0.85rem; font-weight: 300; color: var(--text-soft); line-height: 1.75;
}
.notice-body p { margin: 0 0 8px; }
.notice-body p:last-child { margin-bottom: 0; }

.notice-state { padding: 34px 16px; text-align: center; font-size: 0.85rem; font-weight: 300; color: var(--text-soft); }
.notice-state.error { color: var(--danger-text); }

/* ─── 반응형 ───────────────────────────────────────────── */

/* 좁은 화면: 사이드바를 오프캔버스 드로어로 전환 */
@media (max-width: 900px) {
  .side {
    width: min(86vw, 300px);
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.2,.8,.3,1);
    box-shadow: var(--shadow-lg);
  }
  .side.open { transform: none; }
  .side-x { display: inline-flex; }
  .content { margin-left: 0; }
  .nav-toggle { display: inline-flex; }
  .side-scrim { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(18,24,32,.5); }
  .side-scrim[hidden] { display: none; }
  body.nav-locked { overflow: hidden; }
}

@media (max-width: 420px) {
  .key { width: 46px; height: 46px; font-size: 1.15rem; }
  .tool { width: 42px; height: 42px; }
}
@media (max-width: 480px) {
  /* 공지 헤더가 좁은 화면에서 빽빽해지지 않도록 제목을 다음 줄로 내린다 */
  .notice-head { flex-wrap: wrap; row-gap: 6px; }
  .notice-badge { order: 1; }
  .notice-head-date { order: 2; margin-left: auto; }
  .notice-chevron { order: 3; }
  .notice-head-title { order: 4; flex-basis: 100%; }
}
@media (min-width: 901px) {
  .view { padding-top: 30px; }
}
