/* 2027 소원 등불
   규칙: 색은 남색 바탕 + 호박색 하나만 강조. 판은 반투명 남색에 1px 밝은 선, 모서리 20px. 버튼 16px, 알약은 끝까지 둥글게.
   휴대폰이 기본이고 900px부터 PC 배치로 바뀐다. */
:root {
  color-scheme: dark;
  --bg: #070B1F;
  --panel: rgba(13, 19, 46, .78);
  --line: rgba(255, 255, 255, .16);
  --text: #fff;
  --muted: #A9B1D6;
  --amber: #FFB347;
  --amber-ink: #2A1700;
  --r: 20px;
  --r-btn: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text); overflow: hidden;
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Hiragino Sans",
    "PingFang TC", "PingFang SC", "Noto Sans KR", "Noto Sans JP", "Noto Sans TC", "Noto Sans SC", "Malgun Gothic", "Yu Gothic",
    "Microsoft JhengHei", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
h1, h2, p, ol, ul, blockquote { margin: 0; padding: 0; }
ol, ul { list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.muted { color: var(--muted); }

#sky-gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; background: #070B1F; }
#sky { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.pill {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border: 1px solid var(--line);
  border-radius: 999px; background: rgba(13, 19, 46, .55); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 22px;
  border: 1.5px solid rgba(255, 255, 255, .7); border-radius: var(--r-btn); font-weight: 700; font-size: 16px;
  background: rgba(13, 19, 46, .4); transition: transform .12s ease, background-color .15s ease; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 14px; border-radius: 12px; }
.link { color: var(--amber); font-weight: 600; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.chip {
  display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border: 1px solid var(--line);
  border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap;
}
.chip.on, .chip[aria-checked="true"] { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }

/* ---------- 위 막대 ---------- */
.bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 6; display: flex; align-items: center; gap: 10px;
  padding: calc(12px + var(--safe-t)) 16px 10px; pointer-events: none;
}
.bar > * { pointer-events: auto; }
.brand { height: 38px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: rgba(13, 19, 46, .55);
  font-weight: 700; font-size: 15px; white-space: nowrap; }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.bar .count { display: none; }
.sound { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(13, 19, 46, .55); color: var(--muted, rgba(255, 255, 255, .7)); }
.sound .on, .sound[aria-pressed="true"] .off { display: none; }
.sound[aria-pressed="true"] { color: var(--amber); border-color: var(--amber); }
.sound[aria-pressed="true"] .on { display: inline; }
.lang select { height: 38px; padding: 0 34px 0 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; font-weight: 600;
  appearance: none; -webkit-appearance: none;      /* 기본 화살표는 오른쪽 여백이 없어서 직접 그린다 */
  background: rgba(13, 19, 46, .55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.5 1.5 6 6l4.5-4.5'/%3E%3C/svg%3E") no-repeat right 14px center / 11px 8px; }

.tabs { display: flex; }
.tab { font-weight: 600; white-space: nowrap; }
.tab[aria-current="page"] { color: var(--amber); }
.tabs-top { display: none; }
.tabs-bottom {
  position: fixed; z-index: 6; left: 16px; right: 16px; bottom: calc(12px + var(--safe-b)); height: 60px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.tabs-bottom .tab { flex: 1; font-size: 15px; position: relative; }
.tabs-bottom .tab[aria-current="page"]::after {
  content: ""; position: absolute; left: 28%; right: 28%; bottom: 9px; height: 3px; border-radius: 2px; background: var(--amber);
}

/* ---------- 화면 공통 ---------- */
main { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.view { position: absolute; inset: 0; }
.view > *, .view .wrap > * { pointer-events: auto; }
.view.scroll { overflow-y: auto; pointer-events: auto; padding: calc(74px + var(--safe-t)) 16px calc(96px + var(--safe-b)); }
.wrap { max-width: 980px; margin: 0 auto; }

/* ---------- 밤하늘 ---------- */
.hero { position: absolute; top: calc(70px + var(--safe-t)); left: 0; right: 0; text-align: center; pointer-events: none !important;
  text-shadow: 0 2px 18px rgba(7, 11, 31, .7); }
.dday { font-size: clamp(54px, 17vw, 84px); font-weight: 800; line-height: 1.05; color: var(--amber); letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; }
.dsub { margin-top: 6px; font-size: 16px; font-weight: 500; padding: 0 20px; }
.hero-count { margin-top: 12px; }
.find { position: absolute; left: 16px; right: 16px; bottom: calc(84px + var(--safe-b)); min-height: 58px; font-size: 18px;
  border-radius: var(--r); box-shadow: 0 10px 30px rgba(255, 150, 40, .22); }
.side { display: none; }

/* 보는 곳 바꾸기: 호숫가 · 드론 · 우주 */
.cams { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(156px + var(--safe-b)); display: flex; gap: 2px; padding: 4px;
  border: 1px solid var(--line); border-radius: 999px; background: rgba(13, 19, 46, .7); }
.cams button { height: 34px; padding: 0 16px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.cams button[aria-pressed="true"] { background: var(--amber); color: var(--amber-ink); }
.picked .cams, .cd .cams { display: none; }
.ny .cams { bottom: calc(232px + var(--safe-b)); }
.picked .hero, .picked .find, .picked .tabs-bottom, .picked .side { display: none; }
.ny .hero, .ny .find, .ny .side, .cd .hero, .cd .find, .cd .side { display: none; }

/* 작은 순위·소원 목록 */
.side h2, .cat-wishes h2 { font-size: 20px; font-weight: 700; margin-bottom: 14px; }
.mini-rank li { display: grid; grid-template-columns: 30px 1fr auto; gap: 4px 10px; align-items: center; margin-bottom: 14px; }
.mini-rank .no { grid-row: span 2; width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid rgba(255, 179, 71, .6);
  border-radius: 50%; font-weight: 700; font-size: 14px; }
.mini-rank .n { font-size: 14px; font-variant-numeric: tabular-nums; }
.track { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.track i { display: block; height: 100%; border-radius: 4px; background: var(--amber); }
.mini-rank .track { grid-column: 2 / 4; }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.wishes li { border-top: 1px solid var(--line); }
.wishes li:first-child { border-top: 0; }
.wishes button { display: flex; gap: 10px; width: 100%; padding: 13px 0; text-align: left; font-size: 15px; }
.wishes .u { flex: none; max-width: 44%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.wishes .w { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.wishes .none { padding: 14px 0; color: var(--muted); font-size: 15px; }

/* ---------- 소원 순위 ---------- */
.rank-head { text-align: center; }
.rank-head h1 { font-size: clamp(34px, 9vw, 52px); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.rank-head p { margin-top: 6px; font-size: 15px; }
.banner { margin: 22px auto; padding: 15px 18px; max-width: 780px; border: 1.5px solid var(--amber); border-radius: 18px;
  background: rgba(13, 19, 46, .6); color: var(--amber); font-weight: 700; font-size: 17px; text-align: center; }
.rank-cols { display: grid; gap: 16px; }
.rank { padding: 6px 18px; }
.rank li { border-top: 1px solid var(--line); }
.rank li:first-child { border-top: 0; }
.rank button { display: grid; grid-template-columns: 22px minmax(52px, auto) 1fr auto; gap: 12px; align-items: center; width: 100%;
  padding: 17px 0; text-align: left; font-size: 18px; font-weight: 600; }
.rank .n { font-variant-numeric: tabular-nums; font-size: 16px; }
.rank .track { height: 10px; border-radius: 5px; }
.rank .track i { border-radius: 5px; }
.rank button[aria-pressed="true"] .name { color: var(--amber); }
.rank li.other button { color: var(--muted); }
.cat-wishes { padding: 20px 18px 8px; }

/* ---------- 내 등불 ---------- */
.mine { display: grid; gap: 22px; }
.mine-head { text-align: center; padding-top: 6px; pointer-events: none !important; text-shadow: 0 2px 18px rgba(7, 11, 31, .7); }
.mine-head h1 { font-size: clamp(30px, 8.4vw, 52px); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.nth { margin-top: 6px; color: var(--amber); font-size: clamp(22px, 6vw, 34px); font-weight: 700; }
.mine-head .muted { margin-top: 8px; font-size: 15px; }
.mine-form { padding: 22px 18px; display: grid; gap: 20px; }
.field { display: grid; gap: 10px; }
.label { font-weight: 700; font-size: 16px; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row input { flex: 1; min-width: 0; height: 52px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--r-btn);
  background: rgba(7, 11, 31, .45); font-size: 17px; font-weight: 600; }
.input-row input::placeholder { color: var(--muted); font-weight: 400; }
.warn { padding: 12px 14px; border: 1px solid rgba(255, 179, 71, .5); border-radius: 12px; color: var(--amber); font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-weight: 600; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle i { flex: none; width: 52px; height: 30px; border-radius: 15px; background: rgba(255, 255, 255, .2); position: relative;
  transition: background-color .15s ease; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  transition: transform .15s ease; }
.toggle input:checked + i { background: var(--amber); }
.toggle input:checked + i::after { transform: translateX(22px); }
.toggle input:focus-visible + i { outline: 2px solid var(--amber); outline-offset: 2px; }
.actions { display: grid; gap: 10px; }
.how-body { padding: 22px 18px; }
.how-body h2 { font-size: 22px; font-weight: 800; margin-bottom: 16px; }
.how-body ol { display: grid; gap: 14px; margin-bottom: 20px; counter-reset: step; }
.how-body li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; font-weight: 500; counter-increment: step; }
.how-body li::before { content: counter(step); width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%;
  background: var(--amber); color: var(--amber-ink); font-weight: 800; font-size: 14px; }
.how-body .btn { width: 100%; }
/* 인스타 아이디로 등불 찾기 */
.finder { display: grid; gap: 10px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.finder .input-row .btn { width: auto; min-height: 52px; padding: 0 20px; font-size: 16px; border-radius: var(--r-btn); }
.finder .muted { font-size: 14px; line-height: 1.5; }
.finder .warn { line-height: 1.5; }
:lang(ko) .finder .warn, :lang(ko) .finder .muted { word-break: keep-all; }

/* ---------- 등불 상세 카드 (휴대폰: 아래에서 올라오는 판) ---------- */
.card { position: fixed; z-index: 8; left: 0; right: 0; bottom: 0; padding: 30px 20px calc(22px + var(--safe-b));
  border-radius: 26px 26px 0 0; border-bottom: 0; animation: up .32s cubic-bezier(.2, .8, .2, 1); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.handle { position: absolute; top: 10px; left: 50%; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px;
  background: rgba(255, 255, 255, .35); }
.x { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; font-size: 26px; line-height: 1; color: var(--muted); }
.who { display: flex; align-items: center; gap: 10px; padding-right: 40px; }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; background:
  radial-gradient(circle at 50% 38%, #DADDEA 0 22%, transparent 23%), radial-gradient(circle at 50% 105%, #DADDEA 0 44%, transparent 45%), #6D7391; }
.name { font-size: 18px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.badge { min-height: 30px; padding: 5px 12px; display: inline-flex; align-items: center; border-radius: 999px;
  background: var(--amber); color: var(--amber-ink); font-size: 13px; font-weight: 800; }
.badge.five { background: linear-gradient(90deg, #FF7A7D, #FFD95A, #5FE0AE, #6DB8FF, #D2A2FF); color: #1A1330; }
.mine-head .badges { justify-content: center; text-shadow: none; }
.card h2 { margin-top: 16px; font-size: 30px; font-weight: 800; letter-spacing: -.01em; }
.card blockquote { margin-top: 8px; font-size: 22px; font-weight: 600; overflow-wrap: anywhere; }
.card blockquote.q::before { content: "\201C"; }
.card blockquote.q::after { content: "\201D"; }
.meta { margin-top: 14px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 14px; }
.meta .chip { height: 30px; padding: 0 12px; font-size: 13px; }
.card .actions { margin-top: 20px; grid-template-columns: 1fr 1fr; }
.card .actions .btn { padding: 0 10px; }
.sheet { padding: 22px 2px calc(8px + var(--safe-b)); }

/* ---------- 새해 0시 ---------- */
/* 마지막 10초: 화면 가운데 큰 숫자. 숫자가 바뀔 때마다 새로 튀어나온다 */
.countdown { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none !important; }
.countdown span { font-size: clamp(190px, 62vw, 440px); font-weight: 800; line-height: 1; color: var(--amber); letter-spacing: -.04em;
  font-variant-numeric: tabular-nums; text-shadow: 0 0 70px rgba(255, 179, 71, .6), 0 6px 40px rgba(7, 11, 31, .7); animation: count 1s ease-out both; }
@keyframes count { from { transform: scale(1.5); opacity: 0; } 16% { opacity: 1; } 70% { transform: scale(1); opacity: 1; } to { transform: scale(.95); opacity: .2; } }
/* 0시: 섬광이 가라앉으면서 연도와 문구가 차례로 나온다 */
.newyear .ny-year { animation: ny-in 1.5s cubic-bezier(.2, .8, .2, 1) .2s both; }
.newyear > .pill, .newyear .ny-count, .newyear .ny-foot { animation: ny-fade 1.1s ease 1.4s both; }
@keyframes ny-in { from { transform: translateY(70px) scale(.6); opacity: 0; } }
@keyframes ny-fade { from { opacity: 0; } }
.newyear { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: calc(72px + var(--safe-t)) 20px calc(96px + var(--safe-b)); pointer-events: none !important; text-shadow: 0 2px 24px rgba(7, 11, 31, .8); }
.ny-year { margin-top: 22px; font-size: clamp(92px, 28vw, 190px); font-weight: 800; line-height: 1; color: var(--amber); letter-spacing: -.03em; }
.ny-count { margin-top: 8px; font-size: clamp(19px, 5.4vw, 30px); font-weight: 700; }
.ny-foot { margin-top: auto; display: grid; gap: 14px; justify-items: center; width: 100%; }
.ny-foot .btn { pointer-events: auto; width: min(100%, 360px); min-height: 58px; font-size: 18px; border-radius: var(--r); }

.toast { position: fixed; z-index: 10; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 999px; background: rgba(13, 19, 46, .94); border: 1px solid var(--line); font-size: 15px; font-weight: 600;
  text-align: center; }

/* ---------- PC ---------- */
@media (min-width: 900px) {
  .bar { padding: 14px 24px; gap: 16px; background: linear-gradient(rgba(7, 11, 31, .55), rgba(7, 11, 31, 0)); }
  .brand { border: 0; background: none; padding: 0; font-size: 22px; height: 44px; }
  .tabs-top { display: flex; gap: 6px; position: absolute; left: 50%; transform: translateX(-50%); }
  .tabs-top .tab { height: 42px; padding: 0 22px; border-radius: 999px; font-size: 17px; }
  .tabs-top .tab[aria-current="page"] { background: var(--amber); color: var(--amber-ink); font-weight: 700; }
  .tabs-bottom { display: none; }
  .bar .count { display: inline-flex; border-color: rgba(255, 179, 71, .8); height: 40px; font-size: 16px; }
  .hero-count { display: none; }

  .hero { top: auto; left: 40px; right: auto; bottom: 112px; text-align: left; display: flex; align-items: baseline; gap: 20px; }
  .dday { font-size: 76px; }
  .dsub { margin: 0; padding: 0; font-size: 20px; }
  .cams { left: calc((100% - 380px) / 2); bottom: 44px; }
  .ny .cams { left: 50%; bottom: 176px; }
  .find { left: 40px; right: auto; bottom: 40px; min-height: 54px; padding: 0 30px; border-radius: var(--r-btn); }
  .side { display: block; position: absolute; top: 84px; right: 24px; width: 372px; max-height: calc(100% - 116px); overflow-y: auto; padding: 24px 22px 12px; }
  .picked .hero, .picked .find { display: flex; }
  .picked .find { display: inline-flex; }
  .picked .hero .dday { font-size: 30px; }
  .picked .hero { bottom: 40px; align-items: center; }
  .picked .find { display: none; }

  .view.scroll { padding: 96px 24px 40px; }
  .banner { font-size: 22px; padding: 18px 24px; }
  .rank-cols { grid-template-columns: 1.75fr 1fr; align-items: start; }
  .rank { padding: 8px 26px; }
  .rank button { grid-template-columns: 28px 80px 1fr auto; font-size: 21px; }
  .cat-wishes { padding: 24px 22px 10px; }

  .mine { grid-template-columns: 1fr 480px; align-items: center; gap: 40px; min-height: calc(100vh - 140px); max-width: 1180px; }
  .mine-head { text-align: left; padding: 0 0 12vh 40px; }
  .mine-head .muted { font-size: 18px; }
  .mine-form { padding: 30px 28px; gap: 24px; }
  .mine-form .actions { grid-template-columns: 1fr 1fr; }
  .how-body { padding: 30px 28px; }

  .card { left: min(calc(30vw + 270px), calc(100vw - 452px)); right: auto; bottom: auto; top: 50%; width: 428px; padding: 28px 26px 26px;
    border-radius: var(--r); border-bottom: 1px solid var(--line); transform: translateY(-50%); animation: fade .28s ease; }
  @keyframes fade { from { opacity: 0; } }
  .handle { display: none; }
  .sheet { left: 50%; width: 440px; padding: 14px 6px 10px; transform: translate(-50%, -50%); }
  .newyear { padding-bottom: 60px; }
  .toast { bottom: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .btn, .toggle i, .toggle i::after, .countdown span, .newyear * { animation: none; transition: none; }
}
