:root {
  --fg: rgb(241, 235, 223);
  --fg-dim: rgba(241, 235, 223, 0.74);
  --line: rgba(241, 235, 223, 0.26);
  --panel: rgba(10, 13, 22, 0.46);
  --halo: rgba(0, 0, 0, 0.35);
  --accent: #f0c97c;
  --seal: #b4372c;
  --paper: rgba(246, 241, 231, 0.97);
  --ink: #22252a;
  --ink-dim: #6a6d72;
  --serif: "Noto Serif KR", "Nanum Myeongjo", "AppleMyungjo", "Batang", serif;
  --sans: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0c111f;
}

body {
  font-family: var(--sans);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

#scene {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
#scene.dragging { cursor: grabbing; }

.hud-top, .hud-bottom, .toast, .banner, .to-top, .to-wish, .to-find, .minimap { user-select: none; -webkit-user-select: none; }

/* ── 위 ─────────────────────────────── */

.hud-top {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 14px;
  right: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  pointer-events: none;
}

.seal {
  flex: none;
  width: 40px;
  height: 52px;
  display: grid;
  place-items: center;
  writing-mode: vertical-rl;
  letter-spacing: 3px;
  background: var(--seal);
  color: #f6ecdc;
  font: 700 17px/1 var(--serif);
  border-radius: 3px;
  box-shadow: inset 0 0 0 2px var(--seal), inset 0 0 0 3.5px rgba(246, 236, 220, 0.75);
  transform: rotate(-2deg);
  opacity: 0.94;
}

.stats {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding-top: 2px;
  /* 소나무·바위처럼 글자와 같은 계열 색 위에 겹쳐도 읽히게 반대색 번짐을 두른다 */
  text-shadow: 0 0 6px var(--halo), 0 0 14px var(--halo);
}

.channel-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-bottom: 2px; }
.dday {
  padding: 1px 8px;
  border-radius: 3px;
  background: var(--seal);
  color: #f6ecdc;
  font: 600 12px/1.6 var(--serif);
  text-shadow: none;
  font-variant-numeric: tabular-nums;
}

.channel-chip {
  align-self: flex-start;
  pointer-events: auto;
  max-width: min(62vw, 300px);
  padding: 3px 10px 3px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--fg);
  font: 600 12.5px/1.4 var(--sans);
  text-shadow: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.channel-chip span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-chip .caret { font-size: 10px; opacity: 0.75; }

.height {
  font: 600 30px/1.05 var(--serif);
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.height small { font-size: 15px; margin-left: 3px; opacity: 0.8; }

/* 오른쪽 위 버튼들은 첫 줄 높이까지만 차지하므로, 그 아래 글자들은 버튼 밑까지 넓게 쓴다. 미니맵까지는 가지 않는다 */
.meta, .record, .next, .lean-warn { width: max-content; max-width: min(calc(100vw - 106px), 460px); }
.meta { font-size: 12.5px; color: var(--fg-dim); }
.meta b { font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums; }
.lean-warn {
  align-self: flex-start;
  margin: 2px 0;
  padding: 2px 8px;
  border-radius: 3px;
  background: rgba(180, 55, 44, 0.9);
  color: #fff6ea;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  text-shadow: none;
  font-variant-numeric: tabular-nums;
}
.record { font-size: 12px; color: var(--fg-dim); font-variant-numeric: tabular-nums; }
.record-link {
  pointer-events: auto;
  /* 글자는 작아도 손가락으로 누르기 쉽게 누르는 자리를 넓힌다 */
  margin: -4px -4px -4px 2px;
  padding: 4px;
  border: none;
  background: none;
  color: var(--fg);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-shadow: inherit;
  cursor: pointer;
}
.next { margin-top: 3px; font-size: 12px; line-height: 1.45; color: var(--fg-dim); }

.tools { margin-left: auto; display: flex; gap: 8px; pointer-events: auto; }

.chip {
  height: 34px;
  min-width: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--fg);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.chip.icon { padding: 0; width: 34px; }
.chip .count {
  min-width: 18px;
  height: 18px;
  margin-right: -5px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: #2a2216;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.chip svg { width: 18px; height: 18px; fill: currentColor; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.chip svg path:first-child { stroke: none; }
.chip[data-on="1"] .off, .chip[data-on="0"] .on { display: none; }

/* ── 알림 ───────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  top: calc(max(14px, env(safe-area-inset-top)) + 112px);
  transform: translate(-50%, -6px);
  max-width: calc(100vw - 32px);
  padding: 9px 15px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--fg);
  font-size: 13.5px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s, transform 0.35s;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 30;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.banner {
  position: fixed;
  left: 50%;
  top: 36%;
  transform: translate(-50%, -50%) scale(0.96);
  max-width: calc(100vw - 40px);
  padding: 14px 22px;
  border: 1.5px solid var(--seal);
  border-radius: 4px;
  background: var(--panel);
  color: var(--fg);
  font: 600 18px/1.45 var(--serif);
  letter-spacing: 0.4px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s, transform 0.6s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 25;
}
.banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.banner small { display: block; margin-top: 4px; font: 500 12px/1.4 var(--sans); color: var(--fg-dim); }

.to-top {
  position: fixed;
  right: 14px;
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 84px);
}

.to-wish {
  position: fixed;
  left: 14px;
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 84px);
}

.to-find {
  position: fixed;
  left: 14px;
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 124px);
}

/* '떨어진 돌 줍기' 가 '돌 얹기' 아래에 나오면 '돌 얹기' 가 그만큼 올라간다. 겹치지 않게 옆 버튼들도 올린다 */
.has-pickup .to-top, .has-pickup .to-wish { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 128px); }
.has-pickup .to-find { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 168px); }

/* 미니맵: 탑 전체를 줄인 세로 막대 */
.minimap {
  position: fixed;
  z-index: 5;
  width: 24px;
  border-radius: 12px;
  background: var(--panel);
  touch-action: none;
  cursor: ns-resize;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
/* 손가락으로 잡기 쉽게 잡는 자리를 양옆으로 넓힌다 */
.minimap::before { content: ''; position: absolute; inset: 0 -8px; }
.minimap canvas { position: relative; display: block; pointer-events: none; }
.minimap-label {
  position: absolute;
  right: calc(100% + 10px);
  transform: translateY(-50%);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(20, 16, 12, 0.82);
  color: #f6f1e7;
  font-size: 12.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* ── 아래 ───────────────────────────── */

.hud-bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 10px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.pill {
  max-width: calc(100vw - 32px);
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--panel);
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.hint { font-size: 13px; color: var(--fg); }

.actions { display: flex; align-items: center; gap: 10px; pointer-events: auto; }

.place {
  position: relative;
  overflow: hidden;
  height: 54px;
  min-width: 180px;
  padding: 0 24px 0 18px;
  border: none;
  border-radius: 999px;
  background: #2a2e34;
  color: #f3eee4;
  font-size: 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.15s;
}
.place:active { transform: scale(0.97); }
.place:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.place .fill {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  transform-origin: left center;
  opacity: 0;
}
.place.cooling { color: rgba(243, 238, 228, 0.7); font-weight: 500; font-size: 14px; }
.place.cooling .fill { opacity: 1; }
.place > span:not(.fill) { position: relative; }

.pebble {
  width: 28px;
  height: 19px;
  flex: none;
  border-radius: 52% 48% 46% 54% / 58% 54% 46% 42%;
  background: radial-gradient(circle at 34% 30%, #d2ccc1, #938e86 55%, #5e5a55);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
  transform: rotate(-6deg);
}
.place.cooling .pebble { opacity: 0.45; }

/* ── 종이 창 공통 ─────────────────────── */

.sheet-card, .panel, .intro .card {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

/* 창 내용이 길어지면 버튼이 찌그러지지 않고 창이 스크롤되게 한다 */
.sheet-card > *, .panel > * { flex-shrink: 0; }

.sheet-head, .panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.sheet-head h2, .panel-head h2 { margin: 0; font: 700 20px/1.3 var(--serif); word-break: break-all; }

.x {
  flex: none;
  width: 34px;
  height: 34px;
  margin: -6px -6px 0 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-dim);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.x:hover { background: rgba(0, 0, 0, 0.06); }

.row { display: flex; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.row input { flex: 1; min-width: 0; }

input[type="text"], input:not([type]), textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(34, 37, 42, 0.2);
  border-radius: 10px;
  background: #fffdf8;
  color: var(--ink);
  font-size: 15px;
  outline: none;
}
input:focus, textarea:focus { border-color: #8d6b3a; box-shadow: 0 0 0 3px rgba(240, 201, 124, 0.35); }
textarea { resize: none; line-height: 1.55; }

.primary {
  width: 100%;
  height: 46px;
  border: none;
  border-radius: 12px;
  background: #2a2e34;
  color: #f3eee4;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.primary:disabled { background: #8f9196; cursor: default; }

.small {
  height: 38px;
  padding: 0 14px;
  border: none;
  border-radius: 10px;
  background: #2a2e34;
  color: #f3eee4;
  font-size: 13.5px;
  white-space: nowrap;
  cursor: pointer;
}
.small.ghost { background: rgba(34, 37, 42, 0.08); color: var(--ink); }

.square {
  flex: none;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(34, 37, 42, 0.2);
  border-radius: 10px;
  background: #fffdf8;
  font-size: 18px;
  cursor: pointer;
}

.link {
  padding: 0;
  border: none;
  background: none;
  color: #8a5a22;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link.center { display: block; margin: 10px auto 0; }
.panel > .link { align-self: flex-start; }

.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: #3a3d42; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: #2a2e34; }

/* ── 돌 고르기 ───────────────────────── */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(8, 10, 16, 0.38);
}

.sheet-card {
  width: min(400px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 20px 20px 18px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: -6px 0 -6px; }
.preview canvas { width: 240px; height: 104px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #4a4d52; }
.field > span:first-child { display: flex; justify-content: space-between; }
.field small { color: var(--ink-dim); font-variant-numeric: tabular-nums; }

/* 모양: 가로·세로 배율 */
.slider { display: grid; grid-template-columns: 30px 1fr 42px; align-items: center; gap: 8px; color: #4a4d52; cursor: pointer; }
.slider input { width: 100%; margin: 0; accent-color: #8d6b3a; cursor: pointer; }
.slider output { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.field .hint-line { font-size: 12px; line-height: 1.5; word-break: keep-all; }
.field > span:first-child .link { font-size: 12.5px; }

.note { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--ink-dim); }

/* 채널 목록 */
.list-head { margin-top: 2px; font-size: 13px; font-weight: 600; color: #4a4d52; }
.channel-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.list-count { font-weight: 400; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.custom-wrap { display: flex; flex-direction: column; gap: 6px; }
/* 채널이 많아도 아래의 링크·만들기 칸이 멀어지지 않게 이 칸 안에서 넘긴다. 위아래 여백은 지금 채널의 테두리가 잘리지 않게 한다 */
.custom-list { max-height: min(42dvh, 340px); overflow-y: auto; padding: 3px; margin: -3px; }
.custom-list li { flex: none; }
.channel-item {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid rgba(34, 37, 42, 0.14);
  border-radius: 10px;
  background: #fffdf8;
  color: var(--ink);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 10px;
  text-align: left;
  cursor: pointer;
}
.channel-item[aria-current="true"] { border-color: #8d6b3a; background: #fff3dc; box-shadow: 0 0 0 2px rgba(240, 201, 124, 0.6); }
.channel-item .ch-name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-item .ch-meta { flex: none; font-size: 12px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.channel-item .ch-live { color: #b0442f; font-weight: 600; }
.channel-item .ch-name { flex: 1 1 0; min-width: 0; }
.channel-item .ch-record { flex-basis: 100%; font-size: 11.5px; color: #9c4a3a; font-variant-numeric: tabular-nums; }
#share-url { font-size: 13px; color: #4a4d52; }
.channel-form { display: flex; flex-direction: column; gap: 8px; }
.channel-lock { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.channel-lock .link { align-self: flex-start; }
.form-error { margin: 0; font-size: 13px; color: #b0442f; }
#find-form { min-height: min(320px, 60dvh); }

/* 내 돌 목록 */
.mine-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mine-item {
  width: 100%;
  padding: 6px 12px 6px 4px;
  border: 1px solid rgba(34, 37, 42, 0.14);
  border-radius: 10px;
  background: #fffdf8;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
  text-align: left;
  cursor: pointer;
}
.mine-item[aria-current="true"] { border-color: #8d6b3a; background: #fff3dc; box-shadow: 0 0 0 2px rgba(240, 201, 124, 0.6); }
.mine-item canvas { flex: none; display: block; }
.m-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.m-name { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-meta { font-size: 12px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.mine-item.fell .m-meta { color: #b0442f; }
.m-title { align-self: flex-start; margin: 1px 0; padding: 0 6px; border-radius: 3px; background: var(--seal); color: #f6ecdc; font: 600 11px/1.6 var(--serif); }
.m-wish { font-size: 12.5px; color: #4a4d52; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 12px; font-weight: 600; color: #8a5a22; }
.m-prays { color: #a8791f; }

/* 꾸미기 칸: 한눈에 다 보이는 격자. 가로로 넘기는 줄은 마우스로는 뒤쪽에 닿기 어렵다 */
.decos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  gap: 6px;
  padding: 2px;
}
.deco {
  min-width: 0;
  padding: 4px 2px 4px;
  border: 1px solid rgba(34, 37, 42, 0.14);
  border-radius: 10px;
  background: #fffdf8;
  color: #4a4d52;
  font-size: 11.5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  cursor: pointer;
}
.deco[aria-checked="true"] { border-color: #8d6b3a; background: #fff3dc; box-shadow: 0 0 0 2px rgba(240, 201, 124, 0.6); color: var(--ink); font-weight: 600; }
.deco canvas { display: block; }

/* 돌 고르기: 꾸미기를 쌓으면 창이 길어져 아래 칸이 밀려나므로 한 줄로 두고 옆으로 넘긴다. 오른쪽 끝에 걸친 칸이 더 있음을 알려 준다 */
#compose-decos { display: flex; gap: 6px; margin: 0 -20px; padding: 3px 20px; overflow-x: auto; scrollbar-width: none; }
#compose-decos::-webkit-scrollbar { display: none; }
#compose-decos .deco { flex: none; width: 68px; }
#compose-form { padding-bottom: 0; scroll-padding-bottom: 96px; } /* 입력 칸으로 옮겨 갈 때 아래 버튼에 가리지 않게 한다 */
/* 내용이 길어도 버튼은 늘 보이게 창 아래에 붙인다 */
.compose-actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  margin: 0 -20px;
  padding: 8px 20px var(--sheet-pad-bottom, 18px);
  border-top: 1px solid rgba(34, 37, 42, 0.08);
  background: #f6f1e7;
}
.compose-actions .primary { width: 100%; }
/* 키가 작은 화면에서는 버튼만 보고 소원 칸을 지나치지 않게 이름·소원을 먼저 보여 준다 */
@media (max-height: 760px) {
  #compose-form > .sheet-head { order: -3; }
  #compose-form > .preview { order: -2; }
  #compose-form > .compose-text { order: -1; }
}

/* ── 돌 보기 ─────────────────────────── */

.panel {
  position: fixed;
  z-index: 15;
  top: calc(max(14px, env(safe-area-inset-top)) + 66px);
  right: 14px;
  width: min(350px, calc(100vw - 28px));
  max-height: calc(100dvh - 100px);
  overflow: auto;
  padding: 18px 18px 16px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.detail-nav { display: flex; align-items: center; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid rgba(34, 37, 42, 0.1); }
.detail-nav .small { height: 32px; padding: 0 10px; font-size: 13px; }
.detail-nav .small:disabled { opacity: 0.38; cursor: default; }
.nav-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.nav-pos { font-size: 12.5px; color: var(--ink-dim); white-space: nowrap; font-variant-numeric: tabular-nums; }
.detail-nav > .link { flex: none; margin-left: 2px; }
/* 글자는 작아도 손가락으로 누르기 쉽게 누르는 자리를 넓힌다 */
.nav-mid .link { padding: 3px 8px; margin: -1px 0 -3px; font-size: 12px; white-space: nowrap; }
.titles { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.stone-title { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: 12.5px; color: #8c3a2c; }
.stone-title b { padding: 1px 8px; border-radius: 3px; background: var(--seal); color: #f6ecdc; font: 600 12.5px/1.6 var(--serif); }
.stone-gold { padding: 1px 8px; border-radius: 3px; background: linear-gradient(135deg, #f7dc92, #e2ad45); color: #4e3408; font: 600 12.5px/1.6 var(--serif); }
.detail-meta { font-size: 12.5px; color: var(--ink-dim); min-width: 0; }
.meta-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
/* 글자는 작아도 손가락으로 누르기 쉽게 누르는 자리를 넓힌다 */
.report { flex: none; padding: 5px 2px; margin: -5px -2px; font-size: 12px; color: var(--ink-dim); }
.report[data-armed] { color: var(--seal); }
.report:disabled { text-decoration: none; cursor: default; opacity: 0.75; }

.wish-note {
  position: relative;
  padding: 14px 16px;
  border-radius: 6px;
  background: #fffaf0;
  border-left: 3px solid var(--seal);
  font: 500 16px/1.65 var(--serif);
  white-space: pre-wrap;
  word-break: break-word;
}
.wish-note.empty { color: var(--ink-dim); font: italic 400 14px/1.6 var(--sans); }
.wish-note[data-badge]::after {
  content: attr(data-badge);
  position: absolute;
  top: 6px;
  right: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(34, 37, 42, 0.08);
  color: var(--ink-dim);
  font: 500 11px/1.6 var(--sans);
}

.pray-row { display: flex; align-items: center; gap: 10px; }
.pray {
  flex: none;
  height: 36px;
  padding: 0 14px 0 12px;
  border: 1px solid #b98f4a;
  border-radius: 999px;
  background: #fff3dc;
  color: #6b4714;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.pray:hover:not(:disabled) { background: #ffe9c2; }
.pray:disabled { opacity: 0.6; cursor: default; }
.pray[aria-pressed="true"] { opacity: 1; border-color: transparent; background: rgba(240, 201, 124, 0.28); }
.pray .spark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff7e0;
  box-shadow: 0 0 0 2px #e6b75c, 0 0 8px 2px rgba(240, 180, 80, 0.9);
}
.pray-count { min-width: 0; font-size: 12.5px; line-height: 1.4; color: var(--ink-dim); font-variant-numeric: tabular-nums; }

#wish-form { display: flex; flex-direction: column; gap: 8px; }

.comments-head { margin-top: 4px; font-size: 13px; color: #4a4d52; }
.comments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.comments.empty::after { content: '아직 댓글이 없어요. 첫 응원을 남겨 주세요.'; font-size: 13px; color: var(--ink-dim); }
.comments li { padding-bottom: 10px; border-bottom: 1px solid rgba(34, 37, 42, 0.08); }
.comments p { margin: 3px 0 0; font-size: 14px; line-height: 1.55; word-break: break-word; }
.c-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 12.5px; }
.c-head b { font-weight: 600; }
.c-head time { color: var(--ink-dim); }
.c-actions { margin-left: auto; display: inline-flex; gap: 12px; }
.c-head .del { font-size: 12px; color: var(--ink-dim); }

.comment-form { display: flex; flex-direction: column; gap: 8px; padding-top: 2px; }
.as { font-size: 12.5px; color: var(--ink-dim); }

@media (max-width: 640px) {
  .sheet { place-items: end center; padding: 0; }
  .sheet-card { --sheet-pad-bottom: max(18px, env(safe-area-inset-bottom)); width: 100%; max-height: 92dvh; border-radius: 18px 18px 0 0; padding-bottom: var(--sheet-pad-bottom); }
  .panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 72dvh;
    border-radius: 18px 18px 0 0;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  /* 창 높이는 돌마다 달라지므로 위쪽에 두면 넘길 때마다 버튼이 움직인다. 화면 아래에 고정한다 */
  .detail-nav {
    order: 9;
    position: sticky;
    bottom: calc(-1 * max(16px, env(safe-area-inset-bottom)));
    z-index: 1;
    margin: 0 -18px calc(-1 * max(16px, env(safe-area-inset-bottom)));
    padding: 8px 18px max(10px, env(safe-area-inset-bottom));
    background: #f5f0e6;
    border-bottom: none;
    border-top: 1px solid rgba(34, 37, 42, 0.1);
  }
}

/* ── 처음 방문 안내 ───────────────────── */

.intro {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(8, 10, 16, 0.4);
}
.intro .card {
  width: min(350px, calc(100vw - 40px));
  padding: 26px 24px 20px;
  border-radius: 14px;
  text-align: center;
}
.intro .seal { margin: 0 auto; }
.intro h1 { margin: 14px 0 10px; font: 700 22px/1.3 var(--serif); }
.intro p { margin: 0 0 10px; font-size: 14px; line-height: 1.7; color: #3a3d42; }
.intro p.sub { font-size: 12.5px; color: var(--ink-dim); }
.intro button {
  margin-top: 8px;
  width: 100%;
  height: 44px;
  border: none;
  border-radius: 10px;
  background: #2a2e34;
  color: #f3eee4;
  font-size: 15px;
  cursor: pointer;
}

.noscript { position: fixed; inset: 0; display: grid; place-items: center; color: #eee; }

@media (prefers-reduced-motion: reduce) {
  .toast, .banner, .place { transition: none; }
}
