/* 한칸시티 화면. 도시가 주인공이고 화면 장치는 귀퉁이로 물러난다.
   밤하늘빛 반투명 판에 가로등 호박색 실선, 제목과 숫자도 또렷한 고딕. */
:root {
  --ink-0: #0c1018;
  --ink-1: #121826;
  --ink-2: #1a2233;
  --ink-3: #28324a;
  --glass: rgba(14, 19, 30, .74);
  --glass-2: rgba(14, 19, 30, .92);
  --text: #eef2fa;
  --text-2: #c9d2e3;
  --line: rgba(255, 184, 77, .42);
  --line-soft: rgba(238, 242, 250, .12);
  --gold: #ffb84d;
  --gold-2: #ffd27a;
  --gold-d: #a8701e;
  --ju: #d8432b;
  --ju-2: #ef6a4f;
  --dan: #1f8a74;
  --dan-2: #4cc2a5;
  --cheong: #2f69a8;
  --cheong-2: #79a9e0;
  /* 집문서 종이 색 */
  --baek: #f7f2e4;
  --paper: #f7f2e4;
  --meok: #1d1b19;
  /* 조선풍 명조는 큰 제목(도시 이름·카드 이름·시트 제목)에만. 나머지 글자는 폰 기본 고딕으로 또렷하게(11/11 「글꼴이 보기 힘들다」) */
  --title: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Noto Sans CJK KR', 'Malgun Gothic', system-ui, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Noto Sans CJK KR', 'Malgun Gothic', system-ui, sans-serif;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --tab: 70px;   /* 아래 탭 높이와 바닥 틈을 합친 값 */
  --net: 0px;
  --kb: 0px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --shadow: 0 10px 28px rgba(0, 0, 0, .42);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  height: 100%;
  background: var(--ink-1);
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--ink-1);
  color: var(--text);
  font: 400 15px/1.6 var(--body);
  font-synthesis: none;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; padding: 0; font-weight: 400; }
ul, ol { list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { padding: 0; border: 0; background: none; cursor: pointer; }
input, textarea { border-radius: 0; }
summary { cursor: pointer; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }
svg { flex: none; }

#world { position: fixed; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; }
#labels { position: fixed; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
/* 위아래 가장자리만 살짝 어둡게 해 글자가 도시 위에서도 읽히게 한다 */
#veil {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(21, 17, 13, .42), rgba(21, 17, 13, 0) 22%, rgba(21, 17, 13, 0) 74%, rgba(21, 17, 13, .38));
}
#ui { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#ui > * { pointer-events: auto; }
#ui[hidden] { display: none; }
.noscript { position: fixed; inset: auto 16px 16px; z-index: 200; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--ink-1); color: var(--text); }

/* 단추 ------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--ink-3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
  color: var(--text);
  font: 700 15px/1.25 var(--body);
  text-align: center;
  text-decoration: none;
}
.btn:active:not([disabled]) { transform: translateY(1px); filter: brightness(.94); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.pri {
  border-color: rgba(255, 236, 190, .55);
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  box-shadow: 0 2px 0 var(--gold-d), inset 0 1px 0 rgba(255, 255, 255, .35);
  color: var(--ink-0);
}
.btn.go { border-color: rgba(76, 194, 165, .5); background: var(--dan); color: #fff; }
.btn.blue { border-color: rgba(121, 169, 224, .5); background: var(--cheong); color: #fff; }
.btn.yellow { border-color: var(--line); background: rgba(226, 182, 79, .16); color: var(--gold-2); }
.btn.quiet { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
.btn.wide { width: 100%; }
.btn.sm { min-height: 44px; padding: 6px 14px; font-size: 14px; }
.btn svg { width: 20px; height: 20px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-row > .btn { flex: 1 1 140px; }

.icon-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--glass-2);
  color: var(--text);
}
.icon-btn:active { transform: translateY(1px); }
.icon-btn.flat { border-color: transparent; background: transparent; color: var(--text-2); }
.icon-btn svg { width: 22px; height: 22px; }

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid rgba(226, 182, 79, .45);
  border-radius: 999px;
  background: rgba(226, 182, 79, .16);
  color: var(--gold-2);
  font: 700 13px/1.5 var(--body);
  white-space: nowrap;
}
.tag.plain { border-color: var(--line-soft); background: rgba(246, 236, 214, .08); color: var(--text-2); }
.tag.red { border-color: rgba(239, 106, 79, .5); background: rgba(216, 67, 43, .22); color: #ffb9a8; }
.tag.blue { border-color: rgba(121, 169, 224, .5); background: rgba(47, 105, 168, .26); color: #bcd6f6; }
.tag.green { border-color: rgba(76, 194, 165, .5); background: rgba(31, 138, 116, .26); color: #a9e6d5; }
/* 창립 시민: 팔로워 100명 전에 들어온 첫 집 */
.tag.gold { border-color: var(--gold-2); background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--ink-0); }
/* 작게 보이는 단추도 손가락이 닿는 자리는 44px로 넓힌다 */
.tag-btn { position: relative; cursor: pointer; }
.tag-btn::after { content: ''; position: absolute; top: -8px; right: -4px; bottom: -8px; left: -4px; }

/* 왼쪽 위와 오른쪽 위 ------------------------------------------------------ */
#hud {
  position: fixed;
  top: calc(var(--sat) + 10px);
  left: calc(var(--sal) + 10px);
  right: calc(var(--sar) + 10px);
  z-index: 12;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
#ui > #hud { pointer-events: none; }
.hud-l {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: 340px;
}
.hud-r {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  transition: transform .26s var(--ease);
}
.hud-top { display: flex; align-items: center; max-width: 100%; }
.medal, .hud-id, .news-pill, .era-chip, .cta, .stat-pill { pointer-events: auto; }

/* 시대 고리: 다음 시대까지 얼마나 찼는지 둥글게 보여 준다 */
.medal {
  position: relative;
  z-index: 1;
  flex: none;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .45));
}
.medal:active { transform: scale(.96); }
.medal-ring, .medal-ring svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.medal-ring svg { transform: rotate(-90deg); }
.medal-ring .track { fill: var(--ink-0); stroke: rgba(226, 182, 79, .22); stroke-width: 7; }
.medal-ring .fill { fill: none; stroke: var(--gold); stroke-width: 7; transition: stroke-dashoffset .6s var(--ease); }
.medal-ring .inner { fill: var(--ink-1); stroke: rgba(226, 182, 79, .55); stroke-width: 1.5; }
.medal[aria-current='true'] .medal-ring .inner { stroke: var(--gold-2); stroke-width: 2.5; }
.medal-name {
  position: relative;
  max-width: 40px;
  color: var(--gold-2);
  font: 700 13px/1.05 var(--body);
  letter-spacing: -.02em;
  text-align: center;
}
.medal.long .medal-name { font-size: 11px; }

.hud-id {
  min-width: 0;
  min-height: 50px;
  margin-left: -24px;
  padding: 6px 14px 7px 32px;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 16px 16px 0;
  background: var(--glass);
  box-shadow: var(--shadow);
}
.hud-brand { display: flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.hud-name { color: var(--text); font: 700 17px/1.3 var(--title); letter-spacing: -.01em; }
.day-chip { color: var(--text-2); font-size: 13px; line-height: 1.3; }
.hud-next { overflow: hidden; color: var(--gold-2); font-size: 13px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }

/* 오늘 소식: 가장 새 방송 한 줄 */
.news-pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 44px;
  padding: 4px 14px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  box-shadow: var(--shadow);
  color: var(--text);
  text-align: left;
}
.news-pill:active { transform: translateY(1px); }
.news-mark { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--dan); color: #fff; }
.news-mark svg { width: 18px; height: 18px; }
.news-label { flex: none; color: var(--gold-2); font: 700 13px/1.2 var(--body); white-space: nowrap; }
.news-text { flex: 1; min-width: 0; overflow: hidden; font-size: 14px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.news-dot { position: absolute; top: 3px; left: 30px; width: 10px; height: 10px; border-radius: 50%; background: var(--ju-2); box-shadow: 0 0 0 2px var(--ink-1); }
.news-pill[aria-current='true'] { border-color: var(--gold-2); }

/* 지난 시대를 미리 볼 때만 뜨는 되돌리기 단추 */
.era-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 44px;
  padding: 4px 14px 4px 4px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: var(--glass-2);
  box-shadow: var(--shadow);
  color: var(--text);
  text-align: left;
}
.chip-mark { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: var(--ink-0); }
.chip-mark svg { width: 18px; height: 18px; }
.chip-text { flex: 1; min-width: 0; overflow: hidden; font-size: 14px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }

/* 입주하기: 화면에서 가장 밝은 단추 */
.cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px 0 12px;
  border: 1px solid rgba(255, 236, 190, .6);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  box-shadow: 0 2px 0 var(--gold-d), 0 8px 18px rgba(0, 0, 0, .38);
  color: var(--ink-0);
  font: 700 15px/1.2 var(--body);
  white-space: nowrap;
}
.cta:active { transform: translateY(2px); box-shadow: 0 0 0 var(--gold-d), 0 6px 14px rgba(0, 0, 0, .38); }
.cta[aria-current='true'] { background: linear-gradient(180deg, #fff1c8, var(--gold-2)); }
.cta-icon { display: inline-flex; }
.cta-icon svg { width: 20px; height: 20px; }

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 11px 0 8px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--glass);
  color: var(--text);
  font: 700 13px/1.2 var(--body);
  white-space: nowrap;
}
.pill-icon { display: inline-flex; color: var(--gold); }
.pill-icon svg { width: 15px; height: 15px; }
.tag-pill { padding: 0 11px; border-color: var(--line); color: var(--gold-2); }

/* 아래 탭: 떠 있는 판 하나에 다섯 칸 ------------------------------------------- */
#tabs {
  position: fixed;
  left: 50%;
  bottom: calc(var(--sab) + 10px);
  z-index: 24;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  width: calc(100% - var(--sal) - var(--sar) - 20px);
  max-width: 520px;
  height: calc(var(--tab) - 10px);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--glass-2);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .45);
  transform: translateX(-50%);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  border-radius: 14px;
  color: var(--text-2);
  font: 700 12px/1.2 var(--body);
}
.tab-icon, .tab-name { display: inline-flex; }
.tab-icon svg { width: 22px; height: 22px; }
.tab:active { background: rgba(246, 236, 214, .06); }
.tab[aria-current='true'] { background: rgba(226, 182, 79, .16); color: var(--gold-2); }
/* 나들이는 판을 여는 대신 도시로 걸어 나간다: 아이콘만 금빛으로 눈에 띄게 */
.tab[data-tab='walk'] .tab-icon { color: var(--gold); }
.tab[aria-pressed='true'] { background: rgba(226, 182, 79, .16); color: var(--gold-2); }
/* 폰에서 시트가 열리면 탭 판을 바닥에 붙인다. 중간까지 내린 시트가 탭 판 둘레와 판 너머로
   비쳐 보이지 않게 하려는 것이다. 단추 자리는 떠 있을 때와 같다(옆 패널 배치의 여집합). */
@media (max-width: 559.98px), (max-width: 959.98px) and (min-height: 480.02px) {
  body.panel-open #tabs {
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    height: calc(var(--tab) + var(--sab));
    padding: 4px max(calc(var(--sar) + 15px), calc((100% - 510px) / 2)) calc(var(--sab) + 15px) max(calc(var(--sal) + 15px), calc((100% - 510px) / 2));
    border-width: 1px 0 0;
    border-color: var(--line-soft);
    border-radius: 0;
    background: var(--ink-1);
    box-shadow: 0 -10px 24px rgba(0, 0, 0, .38);
    transform: none;
  }
}

/* 비행선 따라가기와 소리 단추: 오른쪽 아래 */
#imoogi {
  position: fixed;
  right: calc(var(--sar) + 12px);
  bottom: calc(var(--tab) + var(--sab) + 14px + var(--net));
  z-index: 14;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--glass-2);
  box-shadow: var(--shadow);
  color: var(--gold-2);
  transition: right .26s var(--ease);
}
#imoogi svg { width: 34px; height: 34px; }
#imoogi:active { transform: scale(.96); }
#imoogi[aria-pressed='true'] { border-color: var(--gold-2); background: var(--gold); color: var(--ink-0); }
#sound {
  position: fixed;
  right: calc(var(--sar) + 16px);
  bottom: calc(var(--tab) + var(--sab) + 78px + var(--net));
  z-index: 14;
  border-radius: 50%;
  transition: right .26s var(--ease);
}
#sound[aria-pressed='true'] { border-color: var(--line); color: var(--gold-2); }

/* 나들이: 탭과 비행선 단추를 치우고 왼쪽 아래 막대, 오른쪽 아래 끝 단추 ------------------- */
#stick, #walk-keys, #walk-end { display: none; }
body.walk-on #stick { display: block; }
body.walk-on #walk-end { display: inline-flex; }
body.walk-on:not(.panel-open) #tabs, body.walk-on #imoogi { display: none; }
body.walk-on.panel-open #stick, body.walk-on.panel-open #walk-end,
body.walk-on.card-on #stick, body.walk-on.kb #stick, body.walk-on.kb #walk-end { display: none; }
#stick {
  position: fixed;
  left: calc(var(--sal) + 18px);
  bottom: calc(var(--sab) + 18px);
  z-index: 16;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.stick-ring {
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: rgba(24, 20, 16, .42);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .32);
}
/* 앞쪽 표시: 고리 위쪽의 작은 금빛 삼각 */
.stick-ring::before {
  content: '';
  position: absolute;
  top: 9px;
  left: 50%;
  border: 6px solid transparent;
  border-top: 0;
  border-bottom: 8px solid var(--gold);
  transform: translateX(-50%);
  opacity: .8;
}
.stick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50px;
  height: 50px;
  margin: -25px 0 0 -25px;
  border: 1px solid rgba(255, 236, 190, .6);
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  box-shadow: 0 3px 0 var(--gold-d), 0 8px 16px rgba(0, 0, 0, .4);
  transition: transform .18s var(--ease);
}
#stick.held .stick-knob { transition: none; }
#walk-end {
  position: fixed;
  right: calc(var(--sar) + 14px);
  bottom: calc(var(--sab) + 18px);
  z-index: 16;
  gap: 6px;
  padding: 0 18px 0 13px;
  border-color: var(--line);
  border-radius: 999px;
  background: var(--glass-2);
  box-shadow: var(--shadow);
}
.walk-end-icon { display: inline-flex; }
.walk-end-icon svg { width: 18px; height: 18px; }
#walk-keys {
  position: fixed;
  left: 50%;
  bottom: calc(var(--sab) + 22px);
  z-index: 16;
  gap: 16px;
  padding: 8px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--glass-2);
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
  transform: translateX(-50%);
}
#walk-keys span { display: inline-flex; align-items: center; gap: 3px; }
#walk-keys kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--ink-2);
  color: var(--text);
  font: 700 11px/1 var(--body);
}
/* 마우스로 쓰는 PC는 막대 대신 키 안내 */
@media (hover: hover) and (pointer: fine) {
  body.walk-on #stick { display: none; }
  body.walk-on:not(.panel-open) #walk-keys { display: flex; }
}
/* 좁은 창에서는 「나들이 끝」과 겹치지 않게 왼쪽에 붙이고, 더 좁으면 안내를 줄인다(돌아보기는 화면 끌기로도 된다) */
@media (hover: hover) and (pointer: fine) and (max-width: 760px) {
  #walk-keys { left: calc(var(--sal) + 14px); transform: none; }
}
@media (hover: hover) and (pointer: fine) and (max-width: 520px) {
  #walk-keys span:nth-child(3) { display: none; }
}
@media (hover: hover) and (pointer: fine) and (max-width: 400px) {
  #walk-keys span:nth-child(2) { display: none; }
}

/* 시트: 폰은 아래에서 올라오고, PC와 눕힌 폰은 오른쪽에 붙는다 ----------------- */
#sheet {
  position: fixed;
  left: calc(var(--sal) + 8px);
  right: calc(var(--sar) + 8px);
  bottom: calc(var(--tab) + var(--sab) + 6px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--sat) - var(--tab) - var(--sab) - 14px);
  max-width: 640px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--ink-1);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55);
  color: var(--text);
  transition: transform .26s var(--ease);
  will-change: transform;
}
#sheet.dragging { transition: none; }
.sheet-head {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: 14px 6px 8px 18px;
  border-bottom: 1px solid var(--line-soft);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.sheet-head::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 6px;
  width: 40px;
  height: 4px;
  margin-left: -20px;
  border-radius: 2px;
  background: rgba(246, 236, 214, .28);
}
.sheet-head h2 { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; font: 700 19px/1.25 var(--title); }
.sheet-head h2::before { content: ''; flex: none; width: 9px; height: 9px; background: var(--hd, var(--gold)); transform: rotate(45deg); }
.sheet-head h2:focus { outline: none; }
.sheet-head .icon-btn.flat { width: 44px; height: 44px; }
.c-news { --hd: var(--dan-2); }
.c-find { --hd: var(--cheong-2); }
.c-places { --hd: var(--gold); }
.c-home { --hd: var(--ju-2); }
.c-market { --hd: var(--gold-2); }
.c-raid { --hd: var(--ju); }
.c-era { --hd: var(--gold); }
.sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-color: rgba(246, 236, 214, .22) transparent;
}
.sheet-body:focus-visible { outline: none; }

/* 패널 안쪽 ---------------------------------------------------------------- */
.sec { padding: 16px 18px 18px; }
.sec + .sec { border-top: 1px solid var(--line-soft); }
.sec-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--gold-2); font: 700 15px/1.35 var(--body); }
.sec-title .tag { font-size: 13px; }
.sec-title .right { margin-left: auto; color: var(--text-2); font: 400 14px/1.3 var(--body); }
.lead { font: 700 17px/1.5 var(--title); }
.muted { color: var(--text-2); }
.small { font-size: 14px; line-height: 1.55; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack.tight { gap: 6px; }
.note-box { padding: 10px 12px; border: 1px solid rgba(226, 182, 79, .3); border-radius: 12px; background: rgba(226, 182, 79, .1); font-size: 14px; line-height: 1.55; }
.note-box.bad { border-color: rgba(239, 106, 79, .42); background: rgba(216, 67, 43, .14); }
.note-box.good { border-color: rgba(76, 194, 165, .42); background: rgba(31, 138, 116, .16); }
.empty { padding: 18px 12px; border: 1px dashed rgba(246, 236, 214, .22); border-radius: 12px; color: var(--text-2); text-align: center; }
.empty .btn { margin-top: 10px; }
.wait-line { margin: 8px 0; }

.rows > li { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.rows > li:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title, .row-sub { display: block; }
.row-title { color: var(--text); font: 700 15px/1.4 var(--body); }
.row-sub { color: var(--text-2); font-size: 14px; line-height: 1.45; }
.row-go { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 6px 4px; border-radius: 12px; text-align: left; }
.row-go:active:not([disabled]) { background: rgba(246, 236, 214, .05); }
.row-go[disabled] { opacity: .5; cursor: default; }
.place-mark { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: rgba(226, 182, 79, .14); color: var(--gold-2); }
.place-mark svg { width: 19px; height: 19px; }
.rank-no { flex: none; width: 34px; color: var(--text-2); font: 700 16px/1 var(--body); text-align: center; }
.rank-no.top { color: var(--gold-2); }
.money { flex: none; color: var(--gold-2); font: 700 15px/1.2 var(--body); white-space: nowrap; }

.seg {
  display: flex;
  gap: 4px;
  padding: 6px 12px 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line-soft);
  background: var(--ink-1);
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: 1 0 auto;
  min-height: 44px;
  padding: 6px 10px;
  border-bottom: 2px solid transparent;
  color: var(--text-2);
  font: 700 14px/1.2 var(--body);
  white-space: nowrap;
}
.seg button[aria-selected='true'], .seg button[aria-pressed='true'] { border-bottom-color: var(--gold); color: var(--gold-2); }
.seg.pill { gap: 6px; padding: 0; border: 0; background: none; }
.seg.pill button { border: 1px solid var(--line-soft); border-radius: 999px; }
.seg.pill button[aria-pressed='true'] { border-color: var(--gold); background: var(--gold); color: var(--ink-0); }
.c-home .seg { position: sticky; top: 0; z-index: 2; }

.input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid rgba(246, 236, 214, .2);
  border-radius: 12px;
  background: var(--ink-0);
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: rgba(246, 236, 214, .4); }
.input:focus { border-color: var(--gold); }
textarea.input { min-height: 88px; resize: none; }
.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row .input { flex: 1; min-width: 0; }
.input-row .btn { flex: none; }

/* 방송 */
.news-row { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.news-row:last-child { border-bottom: 0; }
.news-row time { color: var(--text-2); font-size: 13px; }
.news-row h4 { font: 700 15px/1.45 var(--body); }
.news-row p { margin-top: 2px; color: rgba(246, 236, 214, .86); font-size: 14px; line-height: 1.6; white-space: pre-line; }
.poll-title { margin-bottom: 10px; font: 700 17px/1.45 var(--title); }
.poll-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.poll-choices .btn { min-height: 64px; flex-direction: column; gap: 2px; }
.poll-choices .btn small { color: inherit; font: 400 13px/1.2 var(--body); opacity: .9; }
.poll-choices .btn[aria-pressed='true'] { border-color: var(--cheong-2); background: var(--cheong); color: #fff; }
.chief { display: flex; gap: 12px; align-items: flex-start; }
.chief-face { flex: none; width: 58px; height: 58px; border-radius: 50%; background: radial-gradient(circle, rgba(246, 236, 214, .2), rgba(246, 236, 214, 0) 70%); }
.chief-face svg, .monster-mask svg { display: block; width: 100%; height: 100%; }
.chief-say { flex: 1; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 4px 14px 14px 14px; background: var(--ink-2); font-size: 15px; }
.cmd-write { display: inline-block; padding: 1px 9px; border: 1px solid var(--line); border-radius: 8px; background: rgba(226, 182, 79, .16); color: var(--gold-2); font: 700 14px/1.55 var(--body); }
details.fold { border-bottom: 1px solid var(--line-soft); }
details.fold:last-child { border-bottom: 0; }
details.fold summary { position: relative; display: flex; align-items: center; min-height: 48px; padding: 8px 26px 8px 0; font: 700 15px/1.4 var(--body); list-style: none; }
details.fold summary::-webkit-details-marker { display: none; }
details.fold summary::after { content: '+'; position: absolute; right: 4px; color: var(--gold); font: 400 20px/1 var(--body); }
details.fold[open] summary::after { content: '\2212'; }
details.fold > :not(summary) { padding-bottom: 12px; color: rgba(246, 236, 214, .86); font-size: 14px; line-height: 1.6; }

/* 내 집 */
.home-top { padding: 14px 18px 12px; border-bottom: 1px solid var(--line-soft); background: linear-gradient(180deg, rgba(226, 182, 79, .1), rgba(226, 182, 79, 0)); }
.home-addr { font: 700 21px/1.3 var(--title); }
.home-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 2px; color: var(--text-2); font-size: 15px; }
.home-stats { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 10px; color: var(--text-2); font-size: 14px; }
.home-stats b { color: var(--gold-2); font: 700 17px/1.2 var(--title); }
.home-top .btn-row { margin-top: 2px; }
.home-top .note-box { margin-bottom: 10px; }
.step-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-bottom: 10px; }
.step { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 2px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--ink-2); color: var(--text-2); font: 700 12px/1.15 var(--body); text-align: center; }
.step.on { border-color: rgba(76, 194, 165, .6); background: var(--dan); color: #fff; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 92px;
  padding: 8px 4px 6px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--ink-2);
  color: var(--text);
}
.swatch span { display: block; }
.swatch:active:not([disabled]) { transform: translateY(1px); }
.swatch[aria-pressed='true'] { border-color: var(--gold); background: var(--ink-3); box-shadow: inset 0 0 0 1px var(--gold); }
.swatch[disabled] { opacity: .55; }
.swatch-house { display: block; width: 44px; height: 34px; }
.swatch-name { font: 700 13px/1.25 var(--body); }
.swatch-cost { color: var(--text-2); font-size: 13px; line-height: 1.2; }
.pick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.pick { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 48px; padding: 8px 12px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--ink-2); color: var(--text); text-align: left; }
.pick:active:not([disabled]) { transform: translateY(1px); }
.pick[disabled] { opacity: .55; cursor: default; }
.pick-name { font: 700 15px/1.3 var(--body); }
.pick-sub { color: var(--text-2); font-size: 13px; line-height: 1.4; }
.pick[aria-pressed='true'] { border-color: var(--gold); background: var(--gold); color: var(--ink-0); }
.pick[aria-pressed='true'] .pick-sub { color: rgba(21, 17, 13, .72); }
.pick.side-uijeok[aria-pressed='true'] { border-color: var(--ju-2); background: var(--ju); color: #fff; }
.pick.side-pojol[aria-pressed='true'] { border-color: var(--cheong-2); background: var(--cheong); color: #fff; }
.pick.side-uijeok[aria-pressed='true'] .pick-sub, .pick.side-pojol[aria-pressed='true'] .pick-sub { color: rgba(255, 255, 255, .82); }
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; text-align: center; }
.stat-grid div { padding: 6px 2px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--ink-2); }
.stat-grid b { display: block; color: var(--gold-2); font: 700 17px/1.2 var(--title); }
.stat-grid span { color: var(--text-2); font-size: 13px; }
.rar-common { color: var(--text-2); }
.rar-rare { color: var(--cheong-2); }
.rar-legend { color: var(--ju-2); }
.story-row { padding: 10px 12px; border-left: 3px solid var(--dan-2); border-radius: 0 12px 12px 0; background: var(--ink-2); font-size: 14px; line-height: 1.65; white-space: pre-line; }
.story-row time { display: block; color: var(--text-2); font-size: 13px; }

/* 로그인 */
.code-box { display: flex; align-items: center; justify-content: center; min-height: 76px; padding: 8px; border: 1px dashed var(--line); border-radius: 14px; background: var(--ink-0); color: var(--gold-2); font: 700 32px/1.1 var(--body); letter-spacing: .06em; user-select: all; -webkit-user-select: all; }
.steps { counter-reset: st; display: flex; flex-direction: column; gap: 8px; }
.steps li { display: flex; gap: 10px; align-items: flex-start; counter-increment: st; font-size: 14px; line-height: 1.55; }
.steps li::before { content: counter(st); flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--gold); color: var(--ink-0); font: 700 13px/1 var(--body); }
.waiting { display: flex; align-items: center; gap: 8px; }
.waiting i { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--dan-2); animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* 상점가 */
.left-bar { height: 6px; margin-top: 5px; overflow: hidden; border-radius: 3px; background: var(--ink-0); }
.left-bar i { display: block; height: 100%; background: var(--ju-2); }

/* 토벌 */
.monster { display: flex; gap: 14px; align-items: center; }
.monster-mask { flex: none; width: 116px; height: 116px; border-radius: 50%; background: radial-gradient(circle, rgba(246, 236, 214, .18), rgba(246, 236, 214, 0) 70%); }
.monster-name { font: 700 21px/1.3 var(--title); }
.monster-line { margin-top: 4px; color: rgba(246, 236, 214, .86); font-size: 14px; line-height: 1.55; }
.tier { display: inline-flex; gap: 3px; vertical-align: middle; }
.tier i { width: 10px; height: 10px; border: 1px solid var(--line); border-radius: 50%; }
.tier i.on { border-color: var(--ju-2); background: var(--ju-2); }
.team-bar { display: flex; height: 12px; overflow: hidden; border-radius: 6px; background: var(--ink-0); }
.team-bar i { display: block; height: 100%; }
.team-bar .t-tteok, .team-key .t-tteok { background: var(--dan-2); }
.team-bar .t-gukbap, .team-key .t-gukbap { background: var(--gold-2); }
.team-bar .t-song, .team-key .t-song { background: var(--cheong-2); }
.team-bar .t-massage, .team-key .t-massage { background: var(--ju-2); }
.team-key { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; color: var(--text-2); font-size: 14px; }
.team-key span { display: inline-flex; align-items: center; gap: 5px; }
.team-key i { width: 10px; height: 10px; border-radius: 3px; }
.raid-log { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-left: 3px solid var(--gold); border-radius: 0 12px 12px 0; background: var(--ink-2); font-size: 14px; line-height: 1.55; }
.result { display: inline-flex; padding: 0 9px; border-radius: 999px; color: #fff; font: 700 13px/1.7 var(--body); }
.result.calm { background: var(--dan); }
.result.sulk { background: var(--ju); }
.result.tie, .result.none { background: var(--ink-3); }
.hint-line { margin-top: 10px; padding: 9px 12px; border-left: 3px solid var(--gold); border-radius: 0 12px 12px 0; background: var(--ink-2); font-size: 14px; line-height: 1.55; }
.hint-line b { color: var(--gold-2); }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 8px; }
.dex { padding: 8px 4px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--ink-2); text-align: center; font-size: 13px; line-height: 1.35; }
.dex-mask { width: 56px; height: 56px; margin: 0 auto 4px; filter: grayscale(1) brightness(.35); opacity: .7; }
.dex.on .dex-mask { filter: none; opacity: 1; }
.dex-mask svg { display: block; width: 100%; height: 100%; }

/* 시대 */
.era-row { display: flex; gap: 12px; align-items: stretch; width: 100%; min-height: 72px; padding: 10px 6px; border-bottom: 1px solid var(--line-soft); color: var(--text); text-align: left; }
.era-row:last-child { border-bottom: 0; }
.era-row[aria-pressed='true'] { border-radius: 12px; background: rgba(226, 182, 79, .1); }
.era-mark { flex: none; display: flex; align-items: center; justify-content: center; width: 46px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--ink-2); color: var(--text-2); font: 700 13px/1.1 var(--body); writing-mode: vertical-rl; }
.era-mark.long { font-size: 11px; }
.era-row.now .era-mark { border-color: var(--gold-2); background: var(--gold); color: var(--ink-0); }
.era-row.past .era-mark { border-color: rgba(76, 194, 165, .6); background: var(--dan); color: #fff; }

/* 집 카드 ------------------------------------------------------------------ */
#card {
  position: fixed;
  left: calc(var(--sal) + 10px);
  right: calc(var(--sar) + 10px);
  bottom: calc(var(--tab) + var(--sab) + 10px + var(--net));
  z-index: 22;
  max-width: 460px;
  margin: 0 auto;
  padding: 14px 8px 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--glass-2);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .5);
  color: var(--text);
}
.card-top { display: flex; align-items: flex-start; gap: 6px; }
.card-main { flex: 1; min-width: 0; }
.card-addr { color: var(--text-2); font-size: 14px; line-height: 1.4; }
.card-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font: 700 20px/1.3 var(--title); }
.card-line { margin-top: 4px; color: rgba(246, 236, 214, .88); font-size: 14px; line-height: 1.55; }
.card-act { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 8px 0 0; }
.card-act .btn { flex: 1 1 130px; }
body.card-on #imoogi, body.card-on #sound { display: none; }

/* 입장 카드 ---------------------------------------------------------------- */
#entry {
  position: fixed;
  left: calc(var(--sal) + 12px);
  right: calc(var(--sar) + 12px);
  bottom: calc(var(--sab) + 12px);
  z-index: 30;
  max-width: 440px;
  max-height: calc(100dvh - var(--sat) - var(--sab) - 24px);
  margin: 0 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--glass-2);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .55);
  color: var(--text);
}
.sk-strip { display: block; width: 100%; height: 100%; }
.entry-strip { height: 26px; overflow: hidden; }
.entry-body { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px 18px; }
.entry-brand { display: flex; align-items: center; gap: 8px; }
.entry-brand strong { color: var(--gold-2); font: 700 15px/1.2 var(--title); }
.entry-hook { font: 700 clamp(27px, 7.8vw, 34px)/1.22 var(--title); letter-spacing: -.02em; }
.entry-hook span { display: block; }
.entry-sub { color: var(--text-2); font-size: 15px; line-height: 1.55; }
.entry-nums { display: flex; flex-wrap: wrap; gap: 2px 20px; padding: 10px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.entry-nums div { display: flex; align-items: baseline; gap: 4px; color: var(--text-2); font-size: 14px; }
.entry-nums b { color: var(--gold-2); font: 700 21px/1.2 var(--title); }
body.entry-on #hud, body.entry-on #tabs, body.entry-on #imoogi, body.entry-on #sound { visibility: hidden; }
.entry-act { display: flex; gap: 8px; }
.entry-act .btn { flex: 1 1 0; width: auto; min-width: 0; padding-right: 10px; padding-left: 10px; }
/* 오늘 찾아온 관광객: 매일 바뀌는 할 일. 누르면 관광객 대접 탭이 열린다 */
.entry-today { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px 8px 8px; border: 1px solid var(--line-soft); border-radius: 14px; background: rgba(246, 236, 214, .05); text-align: left; }
.entry-today:active { background: rgba(246, 236, 214, .1); }
.entry-today-mask { flex: none; width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle, rgba(246, 236, 214, .18), rgba(246, 236, 214, 0) 70%); }
.entry-today-mask svg { display: block; width: 100%; height: 100%; }
.entry-today-main { display: flex; flex: 1; flex-direction: column; gap: 1px; min-width: 0; }
.entry-today-main b { color: var(--text); font: 700 14.5px/1.35 var(--body); }
.entry-today-main span { color: var(--text-2); font-size: 13.5px; line-height: 1.45; }
.entry-today-main .entry-today-meta { display: flex; flex-wrap: wrap; column-gap: 10px; }
.entry-today-meta span { white-space: nowrap; }
.entry-today-main .entry-today-how { color: var(--gold-2); font-size: 13px; letter-spacing: -.01em; }
.entry-today-go { flex: none; color: var(--text-2); font-size: 24px; line-height: 1; }
.entry-find .input { min-height: 44px; }

/* 입주하면 생기는 것: 입장 카드와 입주 화면이 같이 쓴다. 첫 집 모집만 금빛으로 눈에 띄게 둔다. */
.perks { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.perk { display: flex; align-items: flex-start; gap: 10px; }
.perk-icon { display: grid; flex: none; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line-soft); border-radius: 50%; color: var(--gold-2); }
.perk-icon svg { width: 17px; height: 17px; }
.perk-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.perk-text b { color: var(--text); font: 700 14.5px/1.35 var(--body); }
.perk-text span { color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.perk.gold { padding: 10px 12px; border: 1px solid rgba(243, 210, 124, .55); border-radius: 14px; background: rgba(226, 182, 79, .13); }
.perk.gold .perk-icon { border-color: transparent; background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--ink-0); }
.perk.gold b { color: var(--gold-2); }

/* 집문서 */
#deed { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: calc(var(--sat) + 10px) 12px calc(var(--sab) + 12px); overflow-y: auto; background: rgba(21, 17, 13, .95); }
#deed .deed-img { display: block; width: auto; max-width: 100%; height: auto; max-height: calc(100dvh - var(--sat) - var(--sab) - 170px); border: 1px solid var(--line); border-radius: 6px; }
#deed .deed-bar { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; max-width: 440px; }
#deed .deed-bar .btn { flex: 1 1 120px; }
#deed .deed-hint { max-width: 440px; color: var(--text-2); font-size: 14px; text-align: center; }

/* 안내 노선과 끊김 알림 */
#toasts { position: fixed; left: 12px; right: 12px; top: calc(var(--sat) + 12px); z-index: 70; display: flex; justify-content: center; pointer-events: none; }
.toast { max-width: 460px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--ink-1); box-shadow: 0 10px 26px rgba(0, 0, 0, .5); color: var(--text); font-size: 15px; line-height: 1.5; }
.toast.bad { border-color: rgba(239, 106, 79, .6); background: #3a1912; }
.toast.good { border-color: rgba(76, 194, 165, .6); background: #12302a; }
body.offline { --net: 36px; }
#net { position: fixed; left: 50%; bottom: calc(var(--tab) + var(--sab) + 6px); z-index: 26; max-width: calc(100% - 24px); padding: 5px 14px; border-radius: 999px; background: #3a1912; color: var(--text); font-size: 13px; text-align: center; white-space: nowrap; transform: translateX(-50%); }

/* 로딩 화면: 밤 빌딩 창문에 불이 하나씩 켜진다 ------------------------------------ */
#loader { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; overflow: hidden; background: var(--ink-0); color: var(--text); }
.sky { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity .42s ease-in, transform .42s ease-in; }
.sky .w { opacity: 0; animation: sk-in .36s ease-out forwards; }
.d0 { --d: 0; } .d1 { --d: 1; } .d2 { --d: 2; } .d3 { --d: 3; } .d4 { --d: 4; } .d5 { --d: 5; }
.d6 { --d: 6; } .d7 { --d: 7; } .d8 { --d: 8; } .d9 { --d: 9; } .d10 { --d: 10; } .d11 { --d: 11; }
.sky .w { animation-delay: calc(var(--d) * 96ms); }
@keyframes sk-in { from { opacity: 0; } to { opacity: 1; } }
#loader.lift { background: transparent; pointer-events: none; }
#loader.lift .sky { opacity: 0; transform: translateY(4%); }
#loader.lift .loader-plate { opacity: 0; transition: opacity .18s; }
.loader-plate {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: min(320px, 100%);
  padding: 18px 20px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--glass-2);
  box-shadow: var(--shadow);
  text-align: center;
}
.loader-title { font: 700 28px/1.25 var(--title); }
.loader-msg { font-size: 15px; line-height: 1.5; }
.loader-plate .btn { margin-top: 10px; }

/* 옆 패널 배치: PC와 가로로 눕힌 폰 ---------------------------------------------- */
@media (min-width: 960px), (min-width: 560px) and (max-height: 480px) {
  :root { --panel: min(400px, 46vw); --imoogi-room: 76px; }
  #sheet {
    top: calc(var(--sat) + 12px);
    right: calc(var(--sar) + 12px);
    bottom: calc(var(--sab) + 12px);
    left: auto;
    width: var(--panel);
    max-width: none;
    height: auto;
    margin: 0;
  }
  .sheet-head { touch-action: auto; padding-top: 10px; }
  .sheet-head::before { display: none; }
  #tabs {
    width: min(520px, calc(100vw - 2 * var(--imoogi-room) - 40px));
    transition: left .26s var(--ease), width .26s var(--ease);
  }
  body.panel-open #tabs {
    --room: calc(100vw - var(--panel) - 36px - var(--imoogi-room));
    left: calc(12px + var(--room) / 2);
    width: min(520px, var(--room));
  }
  #imoogi { right: calc(var(--sar) + 16px); bottom: calc(var(--sab) + 12px + var(--net)); }
  #sound { right: calc(var(--sar) + 20px); bottom: calc(var(--sab) + 76px + var(--net)); }
  body.panel-open #imoogi { right: calc(var(--panel) + 36px); }
  body.panel-open #sound { right: calc(var(--panel) + 40px); }
  /* 오른쪽 위 단추는 패널이 열리면 패널 왼쪽으로 비켜선다 */
  body.panel-open .hud-r { transform: translateX(calc(-1 * (var(--panel) + 14px))); }
  #card { left: calc(var(--sal) + 16px); right: auto; bottom: calc(var(--sab) + 86px + var(--net)); width: 360px; margin: 0; }
  #entry { left: calc(var(--sal) + 40px); right: auto; bottom: 50%; width: 420px; margin: 0; transform: translateY(50%); }
  #net { left: calc(var(--sal) + 16px); bottom: calc(var(--sab) + 84px); transform: none; }
}

/* 가로로 눕힌 폰은 높이가 모자란다 */
@media (max-height: 480px) {
  :root { --tab: 60px; }
  #tabs { bottom: calc(var(--sab) + 8px); border-radius: 16px; }
  .tab { font-size: 11px; }
  .tab-icon svg { width: 20px; height: 20px; }
  .medal { width: 50px; height: 50px; }
  .medal-name { max-width: 34px; font-size: 11px; }
  .medal.long .medal-name { font-size: 10px; }
  .hud-id { min-height: 42px; margin-left: -20px; padding: 5px 12px 5px 26px; }
  .hud-next { display: none; }
  .hud-l { gap: 6px; }
  #entry { top: calc(var(--sat) + 8px); bottom: calc(var(--sab) + 8px); transform: none; }
  .entry-strip { display: none; }
  .entry-hook { font-size: 24px; }
  /* 패널을 연 눕힌 폰은 자리가 좁아 꼭 필요한 것만 남긴다 */
  body.panel-open { --imoogi-room: 0px; }
  body.panel-open #imoogi, body.panel-open #sound { display: none; }
  body.panel-open .hud-id, body.panel-open .news-pill, body.panel-open .stat-pill { display: none; }
  #card { bottom: calc(var(--sab) + 70px + var(--net)); max-height: calc(100dvh - var(--sat) - var(--sab) - 186px); overflow-y: auto; overscroll-behavior: contain; }
}

/* 작은 폰 */
@media (max-width: 350px) {
  .medal { width: 52px; height: 52px; }
  .medal-name { max-width: 36px; font-size: 12px; }
  .hud-id { margin-left: -20px; padding: 6px 10px 6px 26px; }
  .hud-name { font-size: 15px; }
  .news-text { display: none; }
  .cta { padding: 0 12px 0 10px; font-size: 14px; }
  .pick-grid { grid-template-columns: 1fr; }
}
@media (max-width: 374px), (min-width: 560px) and (max-height: 480px) { .seg-more { display: none; } }
/* 눕힌 폰의 좁은 옆 패널에서도 내 집 다섯 칸이 한 줄에 들어가게 한다 */
@media (min-width: 560px) and (max-height: 480px) {
  .seg:not(.pill) { padding: 6px 6px 0; }
  .seg button { min-width: 44px; padding: 6px 4px; font-size: 13px; }
}

/* 키보드가 올라오면 탭을 치우고 시트를 키보드 위에 붙인다 */
body.kb #tabs, body.kb #imoogi, body.kb #sound, body.kb #net { display: none; }
body.kb #sheet { bottom: var(--kb); height: calc(100dvh - var(--kb) - var(--sat) - 8px); }
body.kb #card { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .sky .w { opacity: 1; animation: none; }
  #loader.lift { opacity: 0; transition: opacity .2s !important; }
  #loader.lift .sky { transition: none; }
  .waiting i { animation: none; }
}

/* 「내일 다시 올 이유」 카드: 오늘 밤 00:05 정산 방송(client/ui/tonight.js) */
#tonight {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: calc(var(--sat) + 16px) calc(var(--sar) + 16px) calc(var(--sab) + 16px) calc(var(--sal) + 16px);
  background: rgba(6, 9, 16, .58);
  animation: tonight-in .28s var(--ease);
}
.tonight-card {
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 12px;
  padding: 22px 20px 18px;
  border: 1px solid var(--line); border-radius: 22px;
  background: var(--glass-2); box-shadow: 0 18px 44px rgba(0, 0, 0, .55);
  color: var(--text);
}
.tonight-kicker { color: var(--gold-2); font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.tonight-title { font: 800 clamp(24px, 7vw, 30px)/1.25 var(--title); letter-spacing: -.02em; }
.tonight-count { color: var(--text-2); font-size: 15px; }
.tonight-left { color: var(--gold-2); font: 800 clamp(26px, 8vw, 34px)/1.1 var(--title); margin-left: 4px; }
.tonight-lines { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); list-style: none; }
.tonight-lines li { position: relative; padding-left: 18px; font-size: 15.5px; line-height: 1.45; }
.tonight-lines li::before { content: ''; position: absolute; left: 2px; top: .5em; width: 8px; height: 8px; border-radius: 2px; background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.tonight-foot { color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.tonight-act { display: flex; gap: 8px; }
.tonight-act .btn { flex: 1 1 0; min-width: 0; }
@keyframes tonight-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #tonight { animation: none; } }

/* 친구 초대 카드(client/ui/invite.js) */
.invite-card { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 184, 77, .07); }
.invite-title { color: var(--gold-2); font: 700 16px/1.35 var(--title); }
.invite-steps { display: flex; flex-direction: column; gap: 4px; padding-left: 20px; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.invite-code { color: var(--text-2); font-size: 14px; }
.invite-code b { color: var(--text); font: 700 17px/1.2 ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: .08em; }
.invite-card.landing { margin-top: 10px; }

/* 깊숙이 둔 계정 관리(지우기) */
details.deep { border-top: 1px solid var(--line-soft); padding-top: 8px; }
details.deep > summary { cursor: pointer; color: var(--text-2); font-size: 13px; list-style: none; padding: 6px 0; }
details.deep > summary::-webkit-details-marker { display: none; }
details.deep > summary::after { content: ' ›'; }
details.deep[open] > summary::after { content: ' ⌄'; }
details.deep > * + * { margin-top: 8px; }
