/* 에브리박스 공통 스타일
   레이아웃: 상자 칸막이처럼 나뉜 도구 그리드 + 한 가지 포인트(앰버) */
:root {
  --bg: #F8F9FA;
  --surface: #FFFFFF;
  --surface-2: #F1F3F8;
  --ink: #212529;
  --muted: #5B6275;
  --line: #E1E6F0;
  --brand: #3B5BDB;
  --brand-ink: #2F4AC0;
  --brand-soft: #EDF2FF;
  --on-brand: #FFFFFF;
  --amber: #F59F00;
  --amber-soft: #FFF4DB;
  --amber-ink: #8A5A00;
  --good: #2B8A3E;
  --good-soft: #EBFBEE;
  --bad: #C92A2A;
  --bad-soft: #FFF0F0;
  --ball-y: #FBC400; --ball-b: #69C8F2; --ball-r: #FF7272; --ball-g: #AAAAAA; --ball-n: #B0D840;
  --shadow: 0 1px 2px rgba(33, 37, 41, .06), 0 4px 16px rgba(59, 91, 219, .06);

  --font-display: "Gothic A1", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-body: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;

  --radius: 14px;
  --wrap: 1040px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10131A; --surface: #181C26; --surface-2: #1F2431; --ink: #E9ECF2; --muted: #A3AAB8; --line: #2A3142;
    --brand: #7C94FF; --brand-ink: #9DB0FF; --brand-soft: #1C2442; --on-brand: #0E1224;
    --amber: #FFB22E; --amber-soft: #2E2512; --amber-ink: #FFCB6B;
    --good: #69DB7C; --good-soft: #13291A; --bad: #FF8787; --bad-soft: #2E1616;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #10131A; --surface: #181C26; --surface-2: #1F2431; --ink: #E9ECF2; --muted: #A3AAB8; --line: #2A3142;
  --brand: #7C94FF; --brand-ink: #9DB0FF; --brand-soft: #1C2442; --on-brand: #0E1224;
  --amber: #FFB22E; --amber-soft: #2E2512; --amber-ink: #FFCB6B;
  --good: #69DB7C; --good-soft: #13291A; --bad: #FF8787; --bad-soft: #2E1616;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.65;
  word-break: keep-all; overflow-wrap: anywhere;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand-ink); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.3; text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.4rem); font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 800; }
h3 { font-size: 1.08rem; font-weight: 700; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding-inline: 16px; }

/* 헤더 */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand img { width: 32px; height: 32px; }
.brand span { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.nav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  text-decoration: none; color: var(--muted); font-size: .92rem; font-weight: 600;
  padding: 8px 10px; border-radius: 8px; white-space: nowrap;
}
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--brand-ink); background: var(--brand-soft); }
@media (max-width: 720px) {
  .site-header .wrap { flex-wrap: wrap; gap: 0; padding-block: 8px 0; }
  .nav { margin-left: 0; width: 100%; padding-block: 4px 6px; }
}

main { padding-block: 28px 56px; }
.page-head { display: grid; gap: 8px; margin-bottom: 24px; }
.page-head .eyebrow { font-size: .8rem; font-weight: 700; letter-spacing: .08em; color: var(--amber-ink); }
.page-head p.lead { color: var(--muted); max-width: 62ch; }

/* 공통 컴포넌트 */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.stack { display: grid; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 20px; align-items: start; }
.grid-2 > * { min-width: 0; }

label.field { display: grid; gap: 6px; font-size: .9rem; font-weight: 600; color: var(--muted); }
input[type="text"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); width: 100%;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }

.btn {
  font: inherit; font-weight: 700; cursor: pointer; border: 1px solid transparent;
  border-radius: 10px; padding: 10px 18px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-ink); }
.btn-amber { background: var(--amber); color: #2B1D00; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .88rem; }

.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tabs button { font: inherit; font-weight: 700; font-size: .92rem; border: 0; background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow); }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.amber { background: var(--amber-soft); color: var(--amber-ink); }
.chip.brand { background: var(--brand-soft); color: var(--brand-ink); }

.note { font-size: .88rem; color: var(--muted); }
.callout { background: var(--brand-soft); border-radius: 12px; padding: 14px 16px; font-size: .92rem; }
.callout.amber { background: var(--amber-soft); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
thead th { background: var(--surface-2); font-weight: 700; color: var(--muted); font-size: .85rem; }
tbody tr:last-child td { border-bottom: 0; }
tr.total td { font-weight: 800; color: var(--brand-ink); background: var(--brand-soft); }

/* 설명 글 (SEO 콘텐츠) */
.article { max-width: 70ch; display: grid; gap: 14px; margin-top: 40px; }
.article h2 { margin-top: 8px; }
.article p, .article li { color: var(--ink); }
.article ul, .article ol { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }

/* 광고 자리 */
.ad { margin-block: 28px; }
.ad.placeholder {
  border: 1.5px dashed var(--line); border-radius: 12px; min-height: 100px;
  display: grid; place-items: center; color: var(--muted); font-size: .85rem; background: var(--surface-2);
}

/* 토스트 */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: .9rem; font-weight: 600;
  z-index: 50; box-shadow: var(--shadow);
}

/* 푸터 */
.site-footer { border-top: 1px solid var(--line); padding-block: 28px 40px; font-size: .88rem; color: var(--muted); }
.site-footer .wrap { display: grid; gap: 12px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }

/* ───── 메인 ───── */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 16px 28px; align-items: center; margin-bottom: 28px; }
.hero > div { min-width: 0; display: grid; gap: 10px; }
.hero h1 span { color: var(--brand); }
.hero p { color: var(--muted); font-size: 1.05rem; }
.hero img { width: clamp(120px, 22vw, 200px); }
@media (max-width: 560px) { .hero { grid-template-columns: 1fr; } .hero img { justify-self: center; order: -1; width: 140px; } }

.box-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--line); border: 2px solid var(--brand); border-radius: 18px; overflow: hidden;
}
.box-grid > a {
  display: grid; gap: 6px; align-content: start; padding: 22px 18px; min-height: 160px; text-decoration: none; color: var(--ink);
  background: var(--surface); position: relative; min-width: 0; transition: background .15s ease;
}
.box-grid > a:hover { background: var(--brand-soft); }
.box-grid .ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 4px; }
.box-grid .ico svg { width: 22px; height: 22px; }
.box-grid a.hot .ico { background: var(--amber-soft); color: var(--amber-ink); }
.box-grid h3 { font-size: 1.05rem; }
.box-grid p { font-size: .88rem; color: var(--muted); }
.box-grid .freq { position: absolute; top: 18px; right: 14px; }
@media (max-width: 900px) { .box-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .box-grid > a { padding: 18px 14px; min-height: 140px; } .box-grid .freq { position: static; justify-self: start; } }

.today-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; margin-top: 24px; }
.today-strip .panel { display: grid; gap: 10px; }
.soon { display: flex; flex-wrap: wrap; gap: 8px; }
.soon span { font-size: .88rem; padding: 6px 12px; border: 1px dashed var(--line); border-radius: 999px; color: var(--muted); }

/* ───── 로또 ───── */
.balls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ball {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 1rem; color: #fff; font-variant-numeric: tabular-nums;
  box-shadow: inset -3px -4px 0 rgba(0,0,0,.12), inset 2px 3px 0 rgba(255,255,255,.35);
  text-shadow: 0 1px 1px rgba(0,0,0,.25);
}
.ball.y { background: var(--ball-y); } .ball.b { background: var(--ball-b); } .ball.r { background: var(--ball-r); }
.ball.g { background: var(--ball-g); } .ball.n { background: var(--ball-n); }
.ball.dim { opacity: .28; }
.ball.hit { outline: 3px solid var(--ink); outline-offset: 2px; }
.plus { color: var(--muted); font-weight: 800; }
.game-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.game-row:last-child { border-bottom: 0; }
.game-row .tag { width: 22px; font-weight: 800; color: var(--muted); font-size: .9rem; }
.game-row .actions { margin-left: auto; display: flex; gap: 6px; }
.numpad { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; }
.numpad button {
  font: inherit; font-size: .85rem; font-weight: 700; aspect-ratio: 1; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; padding: 0; font-variant-numeric: tabular-nums; max-width: 100%;
}
.numpad button.fix { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.numpad button.ex { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.countdown { font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; color: var(--brand-ink); font-variant-numeric: tabular-nums; }
.rank { font-weight: 800; }

/* ───── 타로 ───── */
.tarot-stage { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: start; }
.tarot-stage > .reading { min-width: 0; }
@media (max-width: 640px) { .tarot-stage { grid-template-columns: 1fr; justify-items: center; } .tarot-stage > .reading { width: 100%; } }
.tcard { width: 190px; aspect-ratio: 2 / 3.3; perspective: 1000px; max-width: 100%; }
.tcard-inner { position: relative; width: 100%; height: 100%; transition: transform .8s cubic-bezier(.2,.7,.2,1); transform-style: preserve-3d; }
.tcard.flipped .tcard-inner { transform: rotateY(180deg); }
.tcard-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 14px; overflow: hidden; }
.tcard-back {
  background: #27367E;
  background-image: radial-gradient(circle at 50% 50%, #F59F00 0 5px, transparent 6px), repeating-linear-gradient(45deg, rgba(255,255,255,.07) 0 8px, transparent 8px 16px);
  border: 6px solid #1B2560; box-shadow: inset 0 0 0 2px #F59F00;
}
.tcard-front {
  transform: rotateY(180deg); background: #FFFDF6; color: #1B2560; border: 6px solid #27367E;
  box-shadow: inset 0 0 0 2px #F59F00; display: grid; grid-template-rows: auto 1fr auto; text-align: center; padding: 12px 8px;
}
.tcard-front .tnum { font-family: var(--font-display); font-weight: 800; font-size: .9rem; letter-spacing: .1em; color: #8A5A00; }
.tcard-front .tsym { display: grid; place-items: center; }
.tcard-front .tsym svg { width: 88px; height: 88px; }
.tcard-front .tname { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; line-height: 1.25; }
.tcard-front .tname small { display: block; font-size: .72rem; font-weight: 600; color: #5B6275; letter-spacing: .04em; }
.tcard.reversed .tsym, .tcard.reversed .tnum { transform: rotate(180deg); }
.reading { display: grid; gap: 14px; }
.reading .kw { display: flex; flex-wrap: wrap; gap: 6px; }
.major-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.major-list details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.major-list summary { cursor: pointer; font-weight: 700; }
.major-list details p { font-size: .92rem; margin-top: 8px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .tcard-inner { transition: none; } }

/* ───── 꿈해몽 ───── */
.dream-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.dream-cats button { font: inherit; font-size: .88rem; font-weight: 700; border: 1px solid var(--line); background: var(--surface); color: var(--muted); padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.dream-cats button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.dream-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.dream { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 8px; align-content: start; }
.dream header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dream p { font-size: .93rem; }
.dream .tip { font-size: .86rem; color: var(--muted); }

/* ───── 연봉 ───── */
.big-result { display: grid; gap: 4px; padding: 20px; border-radius: 14px; background: var(--brand); color: var(--on-brand); }
.big-result .label { font-size: .9rem; opacity: .85; font-weight: 600; }
.big-result .value { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.8rem, 6vw, 2.4rem); font-variant-numeric: tabular-nums; }
.big-result .sub { font-size: .9rem; opacity: .85; }

/* ───── D-day ───── */
.dday-list { display: grid; gap: 10px; }
.dday-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.dday-item .d { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; color: var(--brand-ink); min-width: 88px; font-variant-numeric: tabular-nums; }
.dday-item .d.past { color: var(--muted); }
.dday-item .t { min-width: 0; flex: 1; }
.dday-item .t small { display: block; color: var(--muted); font-size: .85rem; }

/* ───── 기능 요청 ───── */
.roadmap { display: grid; gap: 10px; }
.roadmap li { list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.roadmap li .chip { flex-shrink: 0; }
.roadmap li span.t { flex: 1; min-width: 0; }
.roadmap { padding: 0; margin: 0; }

label.check { display: flex; gap: 8px; align-items: flex-start; font-size: .88rem; color: var(--muted); }
label.check input { margin-top: .3em; flex-shrink: 0; }

/* ───── 환율 ───── */
.fx-box { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: end; }
.fx-box > * { min-width: 0; }
@media (max-width: 640px) { .fx-box { grid-template-columns: 1fr; } .fx-box #fx-swap { justify-self: center; transform: rotate(90deg); } }
.fx-input { position: relative; }
.fx-input input { font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; padding-right: 52px; font-variant-numeric: tabular-nums; min-height: 56px; }
.fx-input .u { position: absolute; right: 14px; bottom: 15px; font-weight: 700; color: var(--muted); }
#fx-swap { width: 44px; height: 44px; padding: 0; border-radius: 50%; margin-bottom: 6px; }
#fx-quick { display: flex; flex-wrap: wrap; gap: 6px; }

/* ───── 쥬크박스 ───── */
.jb-player { display: grid; grid-template-columns: minmax(0, 260px) 1fr; gap: 28px; align-items: center; }
.jb-player > * { min-width: 0; }
@media (max-width: 680px) { .jb-player { grid-template-columns: 1fr; justify-items: center; text-align: center; } .jb-player .jb-info { width: 100%; } .jb-ctrl, .jb-extra, .jb-meta { justify-content: center; } }
.jb-cover-wrap { position: relative; width: 100%; max-width: 260px; aspect-ratio: 1; border-radius: 22px; background: var(--brand-soft); display: grid; place-items: center; overflow: hidden; }
.jb-cover-wrap img { width: 100%; height: 100%; object-fit: cover; }
.jb-cover-wrap img.fallback { width: 78%; height: 78%; object-fit: contain; }
body.jb-playing .jb-cover-wrap img.fallback { animation: jb-bob 1.2s ease-in-out infinite; }
@keyframes jb-bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2deg); } }
@media (prefers-reduced-motion: reduce) { body.jb-playing .jb-cover-wrap img.fallback { animation: none; } }
.jb-info { display: grid; gap: 12px; }
.jb-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.jb-info h2 { font-size: clamp(1.3rem, 3.5vw, 1.7rem); }
.jb-info .artist { color: var(--muted); font-weight: 600; }
.jb-seek-row { display: grid; gap: 4px; }
input[type="range"] { width: 100%; accent-color: var(--brand); height: 24px; margin: 0; }
.jb-time { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.jb-ctrl { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer; padding: 0; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.jb-big { width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; cursor: pointer; padding: 0; }
.jb-big svg { width: 28px; height: 28px; }
.jb-extra { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; font-size: .9rem; color: var(--muted); }
.jb-extra label { display: flex; align-items: center; gap: 8px; }
.jb-extra input[type="range"] { width: 110px; }
.jb-extra select { width: auto; min-height: 36px; padding: 4px 8px; }
.jb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.jb-list button { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.jb-list button:hover { background: var(--surface-2); }
.jb-list button[aria-current="true"] { border-color: var(--brand); background: var(--brand-soft); }
.jb-list .t { flex: 1; min-width: 0; }
.jb-list .t small { display: block; color: var(--muted); font-size: .82rem; }
.jb-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex-shrink: 0; }
.jb-list button[aria-current="true"] .jb-dot { background: var(--amber); }
