:root {
  --ink: #17202b;
  --muted: #5f6b7a;
  --line: rgba(23, 32, 43, 0.09);
  --card: rgba(255, 255, 255, 0.9);
  --pink: #ff4f86;
  --pink-soft: #ffe4ee;
  --mint: #19a982;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(10, 20, 35, 0.16), 0 1px 2px rgba(10, 20, 35, 0.08);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #e9b39a;
  color: var(--ink);
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}
#scene.dragging {
  cursor: grabbing;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
button:disabled {
  cursor: default;
}
.btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 700;
  transition: transform 0.12s, background 0.12s, opacity 0.12s;
}
.btn:hover:not(:disabled) {
  background: #f4f6f9;
}
.btn:active:not(:disabled) {
  transform: scale(0.98);
}
.btn.primary {
  background: var(--ink);
  color: #fff;
  border-color: transparent;
}
.btn.primary:hover:not(:disabled) {
  background: #26313f;
}
.btn.primary:disabled {
  opacity: 0.55;
}
.btn.big {
  width: 100%;
  padding: 15px;
  font-size: 17px;
}
.btn.ghost {
  background: transparent;
}
.icon-btn {
  border: none;
  background: transparent;
  min-width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 17px;
  display: grid;
  place-items: center;
}
.icon-btn.wide {
  padding: 0 14px;
  font-size: 14px;
  font-weight: 700;
}
.icon-btn.sm {
  min-width: 28px;
  height: 28px;
  font-size: 13px;
}
.icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}
.card.icon-btn:hover {
  background: #fff;
}
kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-bottom-width: 2px;
  font: 700 11px/1.4 inherit;
  font-family: inherit;
  text-align: center;
  color: var(--ink);
}
.pig-badge {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--pink-soft);
  font-size: 24px;
  flex: none;
}
.pig-badge.lg {
  width: 54px;
  height: 54px;
  border-radius: 17px;
  font-size: 30px;
}
.bump {
  animation: pop 0.6s;
}
@keyframes pop {
  30% {
    transform: scale(1.06);
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ── 출근 화면 ───────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 20;
}
.intro {
  background: linear-gradient(180deg, rgba(12, 22, 36, 0) 0%, rgba(12, 22, 36, 0.45) 100%);
  overflow: auto;
}
.login {
  width: min(860px, 100%);
  padding: 24px;
  display: grid;
  gap: 18px;
}
.login-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.02em;
}
.brand p {
  margin: 2px 0 0;
  color: var(--pink);
  font-weight: 700;
  font-size: 14px;
}
.intro-global {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--pink-soft);
  font-size: 13px;
  font-weight: 600;
  color: #9b2452;
}
.intro-global b {
  font-variant-numeric: tabular-nums;
}
.login-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 22px;
}
.avatar-box {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 14px;
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(160deg, #fff3ea, #eef6ff);
}
.preview {
  width: 170px;
  height: 230px;
  cursor: grab;
}
.opts {
  display: grid;
  gap: 10px;
  align-content: start;
}
/* 꾸미기 탭 */
.look-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
}
.look-tabs button {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 9px;
  padding: 6px 4px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
}
.look-tabs button.on {
  background: var(--ink);
  color: #fff;
}
.look-tabs .look-random {
  flex: none;
  width: 34px;
  font-size: 16px;
  background: #fff;
}
.look-pane {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 150px;
}
.opt-row {
  display: grid;
  gap: 5px;
}
.opt-row > span {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.opt-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.opt {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
}
.opt.on {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.swatches {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.1);
  padding: 0;
}
.swatch.on {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.login-side {
  display: grid;
  gap: 14px;
  align-content: start;
}
.field {
  display: grid;
  gap: 8px;
}
.field > span {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.field input {
  font: inherit;
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
  outline: none;
}
.field input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(23, 32, 43, 0.1);
}
.maps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.map-card {
  display: grid;
  gap: 2px;
  text-align: left;
  padding: 12px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: #fff;
}
.map-card.on {
  border-color: var(--ink);
  background: #f7f8fa;
}
.map-emoji {
  font-size: 24px;
}
.map-card b {
  font-size: 15px;
}
.map-card small {
  color: var(--muted);
  font-size: 12px;
}
/* 준비중인 장소 */
.map-card.soon {
  position: relative;
  cursor: not-allowed;
  background: #f4f5f7;
  border-style: dashed;
}
.map-card.soon > :not(.soon-badge) {
  opacity: 0.45;
}
.map-card.soon .map-emoji {
  filter: grayscale(0.6);
}
.soon-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ffe9b8;
  color: #8a5a00;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}
.map-card.nudge {
  animation: nudge 0.35s;
}
@keyframes nudge {
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}
.lead {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}
.lead b {
  color: var(--ink);
}
.fine {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* ── 이름표 · 말풍선 ─────────────────── */
.labels {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}
.avatar-label {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  justify-items: center;
  gap: 6px;
  transform-origin: 50% 100%;
  will-change: transform;
}
.nametag {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(17, 22, 30, 0.72);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
}
.nametag span {
  color: #ffb3cb;
  font-size: 12px;
  font-weight: 700;
}
.avatar-label.me .nametag {
  background: rgba(255, 79, 134, 0.88);
}
.avatar-label.me .nametag span {
  color: #fff;
}
.bubble {
  position: relative;
  max-width: 220px;
  padding: 8px 12px;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: #fff;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
}
.bubble.pop {
  animation: bubble 0.25s ease-out;
}
@keyframes bubble {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.92);
  }
}

/* ── HUD ───────────────────────────── */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
#hud > *:not(.hud-bc):not(.hud-br):not(.toasts):not(.touch-acts),
.hud-bc > *,
.hud-br > *,
.touch-acts > * {
  pointer-events: auto;
}
.hud-tl {
  position: absolute;
  top: 16px;
  left: 16px;
  padding: 11px 15px;
  max-width: 300px;
}
.loc {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.obj {
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
}
.obj-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffc61a;
  box-shadow: 0 0 0 4px rgba(255, 198, 26, 0.25);
  flex: none;
}
.obj-dist {
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.global {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  padding: 9px 20px 10px;
  border: none;
  min-width: 250px;
}
.global.bump {
  animation: popc 0.6s;
}
@keyframes popc {
  30% {
    transform: translateX(-50%) scale(1.06);
  }
}
.g-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.global b {
  font-size: 21px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--mint);
}
.g-sub {
  font-size: 11.5px;
  color: var(--muted);
}
/* 오른쪽 위: 내 저금통 + 커피 후원 */
.hud-tr {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.bank-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px 11px 11px;
  border: none;
  text-align: left;
}
.bank-text {
  display: grid;
}
.bank-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.bank-total {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--pink);
}
.bank-sub {
  font-size: 12px;
  color: var(--muted);
}
.conn {
  position: absolute;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  background: #fff4d6;
}
.toasts {
  position: absolute;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  justify-items: center;
  width: min(460px, calc(100vw - 32px));
}
.toast {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  animation: rise 0.25s ease-out;
  transition: opacity 0.4s, transform 0.4s;
}
.toast.good {
  background: #fff0f5;
  color: #c2185b;
}
.toast.out {
  opacity: 0;
  transform: translateY(-6px);
}

.hud-bc {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 10px;
}
.prompt {
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  animation: rise 0.25s ease-out;
}
.prompt b {
  color: var(--pink);
  margin-left: 4px;
}
.prompt .act {
  cursor: pointer;
}
.prompt small {
  margin-left: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.prompt .sep {
  display: inline-block;
  width: 1px;
  height: 16px;
  margin: 0 14px;
  vertical-align: -2px;
  background: rgba(23, 32, 43, 0.15);
}
.smoking {
  width: min(470px, calc(100vw - 32px));
  padding: 14px;
  display: grid;
  gap: 12px;
  animation: rise 0.25s ease-out;
}
.smk-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.smk-title {
  font-weight: 800;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.smk-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}
/* 남은 길이 % */
.smk-left {
  display: grid;
  justify-items: end;
  flex: none;
}
.smk-left b {
  font-size: 24px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.smk-left small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
/* 담배 모양 게이지: 필터 | 종이(남은 만큼) · 불씨 · 재 */
.cig {
  display: flex;
  height: 20px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
}
.cig-filter {
  width: 22%;
  border-radius: 6px 0 0 6px;
  background: radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.25) 1px, transparent 2px) 0 0 / 6px 6px, linear-gradient(180deg, #e2aa63, #c98b45);
}
.cig-body {
  position: relative;
  flex: 1;
  border: 1.5px dashed rgba(23, 32, 43, 0.15);
  border-left: none;
  border-radius: 0 6px 6px 0;
}
.cig-paper {
  position: absolute;
  left: 0;
  top: -1.5px;
  bottom: -1.5px;
  min-width: 10px;
  display: flex;
  justify-content: flex-end;
  background: linear-gradient(180deg, #ffffff, #ecebe6);
  transition: width 0.12s linear;
}
.cig-ember {
  width: 5px;
  background: linear-gradient(180deg, #ff8a3d, #e2470f);
  box-shadow: 0 0 6px rgba(255, 106, 26, 0.7);
  transition: width 0.2s, box-shadow 0.2s;
}
.cig-ember.hot {
  width: 7px;
  background: linear-gradient(180deg, #ffd27a, #ff5a12);
  box-shadow: 0 0 14px 3px rgba(255, 110, 30, 0.95);
}
.cig-ash {
  width: 7px;
  margin-right: -7px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #a19d98, #77736e);
}
/* 숨 게이지 */
.lung {
  position: relative;
  height: 24px;
  border-radius: 8px;
  background: rgba(23, 32, 43, 0.06);
  overflow: hidden;
  display: flex;
  align-items: center;
}
.lung i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: #ffc2d6;
  transition: width 0.06s linear;
}
.lung.in i {
  background: linear-gradient(90deg, #ffd0df, #ff8fb2);
}
.lung.warn i {
  background: linear-gradient(90deg, #ffb0a0, #ff5a4a);
}
.lung.out i {
  background: linear-gradient(90deg, #e6ebf0, #c9d3dc);
}
.lung span {
  position: relative;
  padding: 0 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: #4a5562;
  font-variant-numeric: tabular-nums;
}
.smk-mini {
  display: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.smk-hint {
  margin: -4px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
}
.smk-actions {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 8px;
}
.smk-actions .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  font-size: 14px;
}
.btn.puff {
  color: #fff;
  border: none;
  background: var(--pink);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.btn.puff:disabled {
  opacity: 0.6;
}
.btn.puff:hover:not(:disabled) {
  background: #ff3a77;
}
.btn.puff.held,
.btn.puff.active {
  background: #e0306a;
  transform: scale(0.97);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2);
}
.btn.puff kbd,
.btn.auto.on kbd {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}
.btn.auto.on {
  background: var(--mint);
  color: #fff;
  border-color: transparent;
}
.btn.stop {
  color: var(--muted);
}

.chat {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: min(340px, calc(100vw - 32px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 8px;
  gap: 6px;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
  padding: 2px;
}
.chat-tabs button {
  border: none;
  background: transparent;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
}
.chat-tabs button.on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.chat-near {
  font-size: 12px;
  color: var(--mint);
  font-weight: 700;
  margin-left: 4px;
}
#chat-fold {
  margin-left: auto;
}
.chat-list {
  list-style: none;
  margin: 0;
  padding: 2px 4px;
  height: 170px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  line-height: 1.45;
}
.chat-list li {
  overflow-wrap: anywhere;
}
.chat-list li i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: 1px;
}
.chat-list li b {
  margin-right: 6px;
}
.chat-list li em {
  font-style: normal;
  margin-right: 4px;
  font-size: 11px;
}
.chat-list li time {
  margin-left: 6px;
  font-size: 11px;
  color: #9aa3ae;
}
.chat-list li.mine b {
  color: var(--pink);
}
.chat-list li.sys {
  color: var(--muted);
  font-size: 12px;
}
.chat-form {
  display: flex;
  gap: 6px;
}
.chat-form input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  outline: none;
  background: #fff;
}
.chat-form input:focus {
  border-color: var(--ink);
}
.chat-form .btn {
  padding: 8px 12px;
  font-size: 13px;
}
.chat.folded .chat-list,
.chat.folded .chat-form {
  display: none;
}

.hud-br {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: grid;
  justify-items: end;
  gap: 8px;
}
.keys {
  padding: 8px 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px 10px;
  font-size: 11.5px;
  color: var(--muted);
  max-width: 290px;
}
.br-buttons {
  display: flex;
  gap: 8px;
}
.place-wrap {
  position: relative;
}
.place-menu {
  position: absolute;
  right: 0;
  bottom: 48px;
  display: grid;
  padding: 6px;
  min-width: 170px;
}
.place-menu button {
  border: none;
  background: transparent;
  text-align: left;
  padding: 9px 10px;
  border-radius: 10px;
  font-weight: 700;
}
.place-menu button:hover {
  background: #f1f3f6;
}
.place-menu button {
  white-space: nowrap;
}
.place-menu button.soon {
  color: var(--muted);
  cursor: not-allowed;
}
.place-menu button.soon i {
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #ffe9b8;
  color: #8a5a00;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.coin-fly {
  position: fixed;
  z-index: 30;
  font-size: 30px;
  pointer-events: none;
  transform: translate(0, 0);
  transition: transform 0.85s cubic-bezier(0.45, -0.3, 0.6, 1), opacity 0.85s;
  margin: -15px 0 0 -15px;
}
.plus-fly {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  font-weight: 800;
  font-size: 20px;
  color: var(--pink);
  text-shadow: 0 2px 8px rgba(255, 255, 255, 0.9);
  transform: translateX(-50%);
  animation: plus 1.6s ease-out forwards;
}
@keyframes plus {
  0% {
    opacity: 0;
    transform: translate(-50%, 6px);
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -40px);
  }
}

/* ── 저금통 상세 ─────────────────────── */
.modal {
  background: rgba(12, 22, 36, 0.4);
}
.sheet {
  width: min(660px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 22px 24px;
  background: #fff;
}
.sheet h3 {
  margin: 22px 0 10px;
  font-size: 14px;
  color: var(--muted);
}
.sheet h3 small {
  font-weight: 500;
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sheet-title {
  display: flex;
  gap: 12px;
  align-items: center;
}
.sheet-title small {
  color: var(--muted);
  font-weight: 600;
}
.sheet-title h2 {
  margin: 0;
  font-size: 22px;
}
.hero {
  margin-top: 18px;
  padding: 22px;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffe4ee, #fff4e3);
  text-align: center;
}
.hero-amt {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--pink);
  font-variant-numeric: tabular-nums;
}
.hero-sub {
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.stats > div {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 2px;
}
.stats small {
  color: var(--muted);
  font-weight: 600;
}
.stats b {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.stats span {
  font-size: 12px;
  color: var(--muted);
}
.worths {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.worth {
  background: #f6f7f9;
  border-radius: 14px;
  padding: 12px 8px;
  display: grid;
  justify-items: center;
  gap: 2px;
}
.worth-icon {
  font-size: 22px;
}
.worth b {
  font-size: 16px;
}
.worth small {
  color: var(--muted);
  font-size: 12px;
}
.cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.hist,
.lb {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  font-size: 13px;
}
.hist li,
.lb li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: #f6f7f9;
}
.hist li span:first-child {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.hist li b,
.lb li b {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.hist li b {
  color: var(--pink);
}
.lb li.me {
  background: var(--pink-soft);
}
.lb .rank {
  width: 18px;
  font-weight: 800;
  color: var(--muted);
}
.lb i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
}
.lb .who {
  font-weight: 700;
}
.lb .cnt {
  color: var(--muted);
}
.empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  padding: 12px;
  background: #f6f7f9;
  border-radius: 10px;
}
.settings {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
}
.settings label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 6px;
  align-items: center;
}
.settings label span {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.settings label.check {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  order: 3;
}
.settings label.check span {
  font-size: 13px;
}
.settings input[type='number'] {
  font: inherit;
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  font-variant-numeric: tabular-nums;
}
.settings em {
  font-style: normal;
  font-size: 13px;
  color: var(--muted);
}
.note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.sheet-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .keys {
    display: none;
  }
  .global {
    top: 92px;
    min-width: 0;
  }
  .toasts,
  .conn {
    top: 170px;
  }
}
@media (max-width: 760px) {
  .login-grid {
    grid-template-columns: 1fr;
  }
  .avatar-box {
    grid-template-columns: 130px 1fr;
  }
  .preview {
    width: 130px;
    height: 180px;
  }
  .chat-list {
    height: 110px;
  }
  .worths {
    grid-template-columns: repeat(2, 1fr);
  }
  .cols,
  .settings,
  .stats {
    grid-template-columns: 1fr;
  }
}

/* 좁은 화면: 흡연 패널을 오른쪽 아래로 옮겨 채팅과 겹치지 않게 */
@media (max-width: 1180px) {
  .hud-bc {
    left: auto;
    right: 16px;
    bottom: 66px;
    transform: none;
    justify-items: end;
  }
  .smoking {
    width: min(470px, calc(100vw - 404px));
    min-width: 300px;
  }
  .keys {
    display: none;
  }
}
@media (max-width: 720px) {
  .hud-bc {
    left: 16px;
    right: 16px;
    bottom: 260px;
    justify-items: center;
  }
  .smoking {
    width: 100%;
    min-width: 0;
  }
}

/* '이 돈이면' 그룹 · 진행 막대 */
.worth-group {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 12px 2px 6px;
  font-size: 13px;
  font-weight: 700;
}
.worth-group small {
  color: var(--muted);
  font-weight: 500;
  font-size: 11.5px;
}
.worth em {
  font-style: normal;
  font-size: 11px;
  color: #8a94a1;
  text-align: center;
  line-height: 1.35;
}
.worth-bar {
  display: block;
  width: 80%;
  height: 4px;
  margin: 4px 0 2px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}
.worth-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--pink);
}
.worth-icon.lux {
  position: relative;
}
.worth-icon.lux::after {
  content: '✨';
  position: absolute;
  right: -10px;
  top: -6px;
  font-size: 12px;
}

/* ── 로딩 화면 ───────────────────────── */
.splash {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #fff;
  background: radial-gradient(120% 90% at 50% 110%, #f2a27c 0%, #b9718a 28%, #4b4a7a 58%, #1c2433 100%);
  transition: opacity 0.6s ease;
}
.splash.out {
  opacity: 0;
  pointer-events: none;
}
.splash-inner {
  width: min(460px, 100%);
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 12px;
}
.splash-logo {
  font-size: clamp(56px, 12vw, 84px);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.25);
  animation: splash-in 0.8s ease-out both;
}
.splash-sub {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  opacity: 0.92;
  animation: splash-in 0.8s 0.15s ease-out both;
}
.splash-points {
  list-style: none;
  margin: 14px 0 6px;
  padding: 14px 18px;
  display: grid;
  gap: 8px;
  text-align: left;
  font-size: 14px;
  line-height: 1.5;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: splash-in 0.8s 0.3s ease-out both;
}
.splash-bar {
  width: 220px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
  margin-top: 6px;
}
.splash-bar i {
  display: block;
  width: 12%;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #ffd27a, #ff8fb2);
  transition: width 0.5s ease;
}
.splash-status {
  margin: 0;
  font-size: 12.5px;
  opacity: 0.8;
}
.splash-foot {
  position: absolute;
  bottom: 18px;
  left: 16px;
  right: 16px;
  margin: 0;
  text-align: center;
  font-size: 11.5px;
  opacity: 0.7;
}
@keyframes splash-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* 로딩 문구: 한 줄씩 바뀌며 살짝 떠오름 */
.splash-status {
  font-size: 15px;
  font-weight: 600;
  opacity: 0.95;
  min-height: 1.5em;
}
.splash-status.in {
  animation: splash-msg 0.35s ease-out;
}
@keyframes splash-msg {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
.splash-skip {
  margin-top: 6px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  animation: splash-in 0.4s ease-out both;
}
.splash-skip:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ── 입장 화면: 서비스 소개 · 입장 방식 ─── */
.intro-points {
  list-style: none;
  margin: -4px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.intro-points li {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f6f7f9;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
}
.intro-points b {
  color: var(--ink);
  font-size: 13.5px;
}
.welcome-back {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #eefaf5;
}
.welcome-back div {
  display: grid;
  gap: 2px;
}
.welcome-back small {
  color: var(--muted);
  font-size: 12px;
}
.link-btn {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: underline;
  padding: 4px;
  white-space: nowrap;
}
.auth {
  display: grid;
  gap: 10px;
}
.auth-tabs,
.auth-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.05);
}
.auth-tabs button,
.auth-mode button {
  border: none;
  background: transparent;
  padding: 8px 6px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.auth-tabs button.on,
.auth-mode button.on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.auth-mode {
  background: transparent;
  padding: 0;
}
.auth-mode button {
  border: 1px solid var(--line);
  background: #fff;
}
.auth-mode button.on {
  border-color: var(--ink);
  box-shadow: none;
}
.auth-pane {
  display: grid;
  gap: 8px;
}
.auth-fields,
.account-form {
  display: grid;
  gap: 6px;
}
.auth-fields input,
.account-form input {
  font: inherit;
  font-size: 15px;
  padding: 11px 12px;
  border-radius: 11px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  outline: none;
  background: #fff;
}
.auth-fields input:focus,
.account-form input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(23, 32, 43, 0.1);
}
.notice {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff6e0;
  color: #6b5317;
  font-size: 12.5px;
  line-height: 1.55;
}
.notice b {
  color: #4a380c;
}
.notice.soft {
  background: #f3f5f8;
  color: var(--muted);
}
.notice.soft b {
  color: var(--ink);
}
.auth-error {
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: #fdecec;
  color: #b3261e;
  font-size: 13px;
  font-weight: 600;
}
/* 저금통 화면의 계정 칸 */
.account {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.55;
}
.account p {
  margin: 0;
}
.account.guest {
  background: #fffaf0;
  border-color: #f3e2b5;
}
.account-actions {
  display: flex;
  gap: 8px;
}
.account .warn {
  color: #b3261e;
  font-size: 12.5px;
}
.btn.danger:not(.ghost) {
  background: #d23a3a;
  color: #fff;
  border-color: transparent;
}
@media (max-width: 760px) {
  .intro-points {
    grid-template-columns: 1fr;
  }
}

/* ── 개발자 커피 후원 ─────────────────── */
.coffee-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 10px 10px;
  border: none;
  text-align: left;
  transition: transform 0.15s;
}
.coffee-btn:hover {
  transform: translateY(-1px);
}
.coffee-btn:hover .coffee-ico svg {
  animation: wiggle 0.6s ease-in-out;
}
.coffee-ico {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #fff1df;
  flex: none;
}
.coffee-ico svg {
  width: 36px;
  height: 36px;
  overflow: visible;
}
.coffee-ico.lg {
  width: 76px;
  height: 76px;
  border-radius: 24px;
}
.coffee-ico.lg svg {
  width: 60px;
  height: 60px;
}
.coffee-ico .steam {
  fill: none;
  stroke: #c8ae98;
  stroke-width: 2;
  stroke-linecap: round;
  animation: steam 2.4s ease-in-out infinite;
}
.coffee-ico .s2 {
  animation-delay: 0.8s;
}
.coffee-ico .s3 {
  animation-delay: 1.6s;
}
@keyframes steam {
  0% {
    opacity: 0;
    transform: translateY(3px);
  }
  40% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-4px);
  }
}
@keyframes wiggle {
  25% {
    transform: rotate(-8deg);
  }
  75% {
    transform: rotate(8deg);
  }
}
.coffee-text {
  display: grid;
  line-height: 1.25;
}
.coffee-text small {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.coffee-text b {
  font-size: 15px;
  color: #7a4e33;
  white-space: nowrap;
}

.coffee-sheet {
  position: relative;
  width: min(380px, 100%);
  padding: 26px 22px 22px;
  display: grid;
  gap: 14px;
  background: linear-gradient(180deg, #fff6ec 0%, #fff 42%);
}
.coffee-close {
  position: absolute;
  top: 10px;
  right: 10px;
}
.coffee-hero {
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
}
.coffee-hero h2 {
  margin: 6px 0 0;
  font-size: 20px;
}
.coffee-hero p {
  margin: 0;
  color: #6b5446;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.6;
}
.acct {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 14px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #7a4e33, #a26b47);
  color: #fff;
  box-shadow: 0 8px 20px rgba(122, 78, 51, 0.25);
}
.acct-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.acct-text small {
  font-size: 12.5px;
  font-weight: 600;
  opacity: 0.85;
}
.acct-text b {
  font-size: 21px;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  user-select: all;
  -webkit-user-select: all;
  white-space: nowrap;
}
.acct-copy {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: none;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  transition: background 0.15s;
}
.acct-copy:hover {
  background: rgba(255, 255, 255, 0.24);
}
.acct-copy.done {
  background: #fff;
  color: #7a4e33;
}
.qr-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 16px 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}
.qr-tag {
  justify-self: start;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: #2a5bd7;
  font-size: 12px;
  font-weight: 800;
}
.qr-card img {
  width: 200px;
  height: 200px;
  image-rendering: pixelated;
}
.qr-card b {
  font-size: 15px;
}
.qr-card small {
  color: var(--muted);
  font-size: 12px;
}
.toss-link {
  display: none;
  margin-top: 6px;
  text-decoration: none;
  background: #2a5bd7;
  color: #fff;
  border-color: transparent;
}
.toss-link:hover:not(:disabled) {
  background: #2350c2;
}
.coffee-contact {
  margin: 0;
  word-break: keep-all;
  text-align: center;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}
.coffee-contact a {
  color: #7a4e33;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}
/* 휴대폰에선 QR을 찍을 수 없으니 토스 앱 바로가기 버튼을 보여 줌 */
@media (pointer: coarse) {
  .toss-link {
    display: inline-block;
  }
}
@media (max-width: 760px) {
  .hud-tr {
    gap: 8px;
  }
  .coffee-btn {
    padding: 8px;
  }
  .coffee-text {
    display: none;
  }
}
/* 휴대폰: 왼쪽 위 위치 카드와 겹치지 않게 오른쪽 위를 작게 */
@media (max-width: 520px) {
  .hud-tl {
    max-width: calc(100vw - 236px);
    padding: 9px 12px;
  }
  .obj {
    font-size: 13.5px;
  }
  .bank-card {
    gap: 8px;
    padding: 7px 12px 7px 7px;
  }
  .bank-card .pig-badge {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    font-size: 20px;
  }
  .bank-total {
    font-size: 18px;
  }
  .bank-sub {
    display: none;
  }
  .coffee-btn {
    padding: 7px;
  }
  .coffee-btn .coffee-ico {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }
  .coffee-btn .coffee-ico svg {
    width: 30px;
    height: 30px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .coffee-ico .steam,
  .coffee-btn:hover .coffee-ico svg {
    animation: none;
  }
}

/* ── 휴대폰·태블릿 (터치 화면: <html class="touch">) ─────────── */
html {
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  overscroll-behavior: none;
}
button {
  touch-action: manipulation;
}
.sheet {
  max-height: calc(100dvh - 32px);
}
.t-only,
.k-touch {
  display: none;
}
.touch .k-touch {
  display: inline;
}
.touch .k-desk,
.touch .keys,
.touch kbd {
  display: none;
}
.touch #hud {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.touch input:not([type='checkbox']) {
  font-size: 16px; /* iOS가 입력할 때 화면을 확대하지 않도록 */
}

/* 위쪽: 노치·상태바를 피해서 */
.touch .hud-tl {
  top: calc(12px + env(safe-area-inset-top));
  left: calc(12px + env(safe-area-inset-left));
}
.touch .hud-tr {
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
}

/* 왼쪽 아래 조이스틱 */
.touch .joy.t-only {
  display: block;
}
.joy {
  position: absolute;
  left: calc(4px + env(safe-area-inset-left));
  bottom: calc(4px + env(safe-area-inset-bottom));
  width: 176px;
  height: 176px;
  touch-action: none;
}
.joy-base {
  position: absolute;
  left: 28px;
  top: 28px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 6px 18px rgba(10, 20, 35, 0.18);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: background 0.15s;
}
.joy.on .joy-base {
  background: rgba(255, 255, 255, 0.34);
}
.joy-knob {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 12px rgba(10, 20, 35, 0.28);
  transition: transform 0.15s ease-out;
}
.joy.on .joy-knob {
  transition: none;
}

/* 오른쪽 아래 동작 버튼 */
.touch .touch-acts.t-only {
  display: block;
}
.touch-acts {
  position: absolute;
  right: calc(10px + env(safe-area-inset-right));
  bottom: calc(12px + env(safe-area-inset-bottom));
  width: 172px;
  height: 172px;
  pointer-events: none;
}
.t-btn {
  position: absolute;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 18px rgba(10, 20, 35, 0.22);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.1s, background 0.15s, opacity 0.15s;
}
.t-btn.main {
  right: 6px;
  bottom: 6px;
  width: 90px;
  height: 90px;
  align-content: center;
  gap: 1px;
  background: rgba(236, 239, 243, 0.96);
}
.t-btn.main:not(.live) span {
  filter: grayscale(1);
  opacity: 0.65;
}
.t-btn.main:not(.live) small {
  color: var(--muted);
}
.t-btn.main span {
  font-size: 30px;
  line-height: 1.05;
}
.t-btn.main small {
  font-size: 11px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}
.t-btn.main.live {
  background: var(--pink);
}
.t-btn.main.live small {
  color: #fff;
}
.t-btn.held {
  transform: scale(0.92);
}
.t-btn.main.live.held {
  background: #e0306a;
}
.t-btn.sm {
  width: 54px;
  height: 54px;
  font-size: 22px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
}
#t-jump {
  right: 108px;
  bottom: 10px;
  font-weight: 800;
}
#t-sip {
  right: 24px;
  bottom: 108px;
  background: #fff1df;
}
#t-sip::after {
  content: attr(data-left);
  position: absolute;
  right: -4px;
  top: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #7a4e33;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
}

/* 오른쪽 위(저금통 아래): 장소 이동 · 소리 · 채팅 */
.touch .hud-br {
  right: calc(12px + env(safe-area-inset-right));
  bottom: auto;
  top: calc(84px + env(safe-area-inset-top));
}
.touch .g-sub {
  white-space: nowrap;
}
.touch .br-buttons {
  flex-direction: column;
}
.touch .br-buttons .icon-btn {
  width: 46px;
  min-width: 46px;
  height: 46px;
  padding: 0;
  font-size: 19px;
}
.touch #place-btn .lbl {
  display: none;
}
.touch .place-menu {
  right: 54px;
  bottom: auto;
  top: 0;
}
.touch .icon-btn.t-only {
  display: grid;
}
#t-chat {
  position: relative;
}
#t-chat.on {
  background: var(--pink-soft);
}
.badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--pink);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  line-height: 19px;
}

/* 채팅: 💬로 여는 시트 (키보드가 올라와도 가리지 않게 위쪽에) */
.touch .chat {
  display: none;
}
.touch .chat.open {
  display: grid;
  z-index: 6;
  left: calc(10px + env(safe-area-inset-left));
  right: calc(10px + env(safe-area-inset-right));
  top: calc(84px + env(safe-area-inset-top));
  bottom: auto;
  width: auto;
  max-width: 440px;
}
.touch .chat-list {
  height: 30vh;
}

/* 흡연 패널 · 안내: 조작 버튼 위쪽에 */
.touch .hud-bc {
  left: calc(12px + env(safe-area-inset-left));
  right: calc(12px + env(safe-area-inset-right));
  bottom: calc(196px + env(safe-area-inset-bottom));
  transform: none;
  justify-items: center;
}
.touch .smoking {
  width: 100%;
  min-width: 0;
  max-width: 470px;
  padding: 11px 12px;
  gap: 8px;
}
.touch .smk-hint,
.touch #puff-btn {
  display: none;
}
.touch .smk-actions {
  grid-template-columns: 1fr auto;
}
.touch .prompt {
  font-size: 14px;
  padding: 9px 14px;
  white-space: normal;
  text-align: center;
}

/* 가로로 눕힌 휴대폰: 높이가 낮으니 흡연 패널을 조이스틱과 버튼 사이 아래쪽에 */
@media (orientation: landscape) and (max-height: 520px) {
  .touch .hud-bc {
    left: calc(190px + env(safe-area-inset-left));
    right: calc(190px + env(safe-area-inset-right));
    bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .touch .smk-top,
  .touch .lung {
    display: none;
  }
  .touch .chat.open {
    top: calc(76px + env(safe-area-inset-top));
    max-width: 380px;
  }
  .touch .chat-list {
    height: calc(100vh - 200px);
  }
  .touch .hud-br {
    top: calc(80px + env(safe-area-inset-top));
  }
  .touch .br-buttons {
    flex-direction: row;
  }
  .touch .place-menu {
    right: 0;
    top: 54px;
  }
  .touch .global {
    top: calc(12px + env(safe-area-inset-top));
    padding: 6px 16px 7px;
  }
}
/* 터치 화면에선 커피 후원은 아이콘만 (공간 절약) */
.touch .coffee-text {
  display: none;
}
.touch .coffee-btn {
  padding: 8px;
}

/* 휴대폰 세로: 입장 화면을 촘촘하게 (스크롤 줄이기) */
@media (max-width: 520px) {
  .intro {
    padding: calc(10px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom));
  }
  .login {
    padding: 18px 16px;
    gap: 14px;
  }
  .brand {
    gap: 10px;
  }
  .brand h1 {
    font-size: 24px;
  }
  .brand p {
    font-size: 12.5px;
  }
  .intro-points {
    gap: 6px;
  }
  .intro-points li {
    padding: 8px 11px;
    font-size: 12px;
    line-height: 1.4;
  }
  .intro-points b {
    font-size: 13px;
  }
  .avatar-box {
    grid-template-columns: 112px 1fr;
    gap: 10px;
    padding: 10px;
  }
  .preview {
    width: 112px;
    height: 160px;
  }
}

/* 배경음악 버튼: 꺼지면 흐리게 + 사선 */
#bgm {
  position: relative;
}
#bgm.off {
  opacity: 0.55;
}
#bgm.off::after {
  content: '';
  position: absolute;
  left: 22%;
  right: 22%;
  top: 50%;
  height: 2px;
  border-radius: 2px;
  background: #5f6b7a;
  transform: rotate(-40deg);
}

/* ── 휴대폰 흡연 패널: 아바타를 가리지 않게 ───────────────
   세로 화면 = 왼쪽 가장자리의 가는 세로 막대 (담배도 세로로 서서 위에서부터 탐)
   가로 화면 = 아래쪽 한 줄
   숨 게이지는 💨 버튼 둘레의 고리로 대신 보여 줌 */
.t-btn.main::before {
  content: '';
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color, #ff8fb2) calc(var(--fill, 0) * 1turn), rgba(255, 255, 255, 0.4) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px));
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.t-btn.main.ring-in {
  --ring-color: #ff8fb2;
}
.t-btn.main.ring-warn {
  --ring-color: #ff4a3a;
}
.t-btn.main.ring-out {
  --ring-color: #c9d3dc;
}
.t-btn.main.ring-in::before,
.t-btn.main.ring-warn::before,
.t-btn.main.ring-out::before {
  opacity: 1;
}
.touch .lung {
  display: none;
}

@media (orientation: portrait) {
  .touch #smoking {
    position: fixed;
    left: calc(10px + env(safe-area-inset-left));
    bottom: calc(198px + env(safe-area-inset-bottom));
    width: 76px;
    max-width: none;
    padding: 10px 8px;
    gap: 8px;
    justify-items: center;
  }
  .touch .smk-top {
    display: block;
  }
  .touch .smk-top > div:first-child {
    display: none;
  }
  .touch .smk-left {
    justify-items: center;
  }
  .touch .smk-left b {
    font-size: 19px;
  }
  .touch .smk-left small {
    font-size: 10px;
  }
  /* 가로 담배 게이지를 세워서: 필터가 아래, 불씨가 위 */
  .touch #smoking .cig {
    width: 150px;
    height: 18px;
    transform: rotate(-90deg);
    margin: 66px -66px;
  }
  .touch .smk-mini {
    display: block;
  }
  .touch .smk-actions {
    grid-template-columns: 1fr;
    width: 100%;
    gap: 6px;
  }
  .touch .smk-actions .btn {
    padding: 8px 2px;
    font-size: 11.5px;
    white-space: normal;
    line-height: 1.2;
    word-break: keep-all;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .touch #smoking {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
  }
  .touch #smoking[hidden] {
    display: none;
  }
  .touch #smoking .cig {
    flex: 1;
    height: 16px;
  }
  .touch .smk-mini {
    display: block;
  }
  .touch .smk-actions {
    display: flex;
    gap: 6px;
  }
  .touch .smk-actions .btn {
    padding: 7px 10px;
    font-size: 12px;
  }
}

/* 위치 카드의 바로가기 버튼 (사무실 ↔ 옥상) */
.quick-go {
  margin-top: 8px;
  padding: 6px 11px;
  border: none;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  white-space: nowrap;
  transition: transform 0.12s, background 0.15s;
}
.quick-go:hover {
  background: #26313f;
}
.quick-go:active {
  transform: scale(0.96);
}
.touch .quick-go {
  padding: 7px 10px;
  font-size: 12px;
}
/* 이동할 때 잠깐 어두워짐 */
.fade {
  position: fixed;
  inset: 0;
  z-index: 15;
  background: #0b1220;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s;
}
.fade.on {
  opacity: 1;
}
/* 휴대폰 세로: 위치 카드(바로가기 버튼 포함)와 겹치지 않게 모두의 저금통·안내를 조금 아래로 */
@media (orientation: portrait) {
  .touch .global {
    top: calc(150px + env(safe-area-inset-top));
  }
  .touch .toasts,
  .touch .conn {
    top: calc(222px + env(safe-area-inset-top));
  }
}
