/* =====================================================================
   2026 올해의 오너먼트 · 참여자 화면
   퀴즈쇼(동숲 버전)의 도트 판·말풍선(assets/pixel-ui.js)을 그대로 씁니다.
   ===================================================================== */
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #3c5690; }
body { font-family: var(--font); color: var(--ink); -webkit-font-smoothing: none; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
#host { position: fixed; inset: 0; }
#host > canvas.world3d { position: absolute; inset: 0; width: 100% !important; height: 100% !important; image-rendering: pixelated; touch-action: manipulation; }
#fallback { position: fixed; inset: 0; display: grid; place-items: center; background: linear-gradient(#0e1c4e, #6f9fd8 70%, #e6eef8 70%); }
#fallback[hidden] { display: none; }
.fb-tree { font-size: min(60vw, 46vh); line-height: 1; filter: drop-shadow(0 8px 0 rgba(0,0,0,.2)); margin-top: -6vh; }

/* ---------- 도트 판 ---------- */
.wood { border-image: var(--pf-box-wood) 8 fill / 20px stretch; color: #fff8e2; text-shadow: 0 3px 0 #5e3a1c; font-weight: 700; filter: drop-shadow(0 5px 0 rgba(10, 20, 50, .35)); }
.cream { border-image: var(--pf-box-cream) 8 fill / 20px stretch; filter: drop-shadow(0 5px 0 rgba(10, 20, 50, .3)); }
.paper { border-image: var(--pf-box-paper) 8 fill / 16px stretch; }
.pill-cream { border-image: var(--pf-pill-cream) 10 fill / 22px stretch; filter: drop-shadow(0 4px 0 rgba(10, 20, 50, .3)); }
.pill-cloud { border-image: var(--pf-pill-cloud) 10 fill / 22px stretch; filter: drop-shadow(0 4px 0 rgba(10, 20, 50, .25)); }
.pill-yellow { border-image: var(--pf-pill-yellow) 10 fill / 26px stretch; filter: drop-shadow(0 5px 0 rgba(10, 20, 50, .3)); }
.pill-white { border-image: var(--pf-pill-white) 10 fill / 22px stretch; }
.tag-pink { border-image: var(--pf-tag-pink) 10 fill / 22px stretch; color: #4a2a3a; }
.tag-green { border-image: var(--pf-tag-green) 10 fill / 22px stretch; color: #2c4018; }
.tag-blue { border-image: var(--pf-tag-blue) 10 fill / 22px stretch; color: #1f3a5a; }
.cloud { border-image: var(--pf-cloud) 12 fill / 30px round; filter: drop-shadow(0 5px 0 rgba(20, 40, 60, .25)); }
.disc { border-image: var(--pf-disc-cream) 10 fill / 18px stretch; }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.center { display: grid; place-items: center; }
.b { font-weight: 700; }
.quiet { color: var(--ink-2); }
.dot { display: inline-block; width: 10px; height: 10px; background: #ffd84a; box-shadow: 0 0 0 2px #c9a22a; flex: none; }

/* ---------- 트리 위 정보 (가운데 세로 기둥, PC에서도 같은 폭) ---------- */
#ui { position: fixed; inset: 0; pointer-events: none; display: flex; justify-content: center; }
#ui[hidden] { display: none; }
#ui > * { pointer-events: auto; }
.top { position: absolute; top: max(10px, env(safe-area-inset-top)); width: min(100vw, 460px); padding: 0 14px; text-align: center; pointer-events: none; }
.top > * { pointer-events: auto; }
.hchip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; font-size: 13px; color: var(--ink); white-space: nowrap; max-width: 62%; overflow: hidden; text-overflow: ellipsis; }
.hchip .coin { width: 22px; height: 22px; font-size: 11px; color: #2c4a12; margin-left: -6px; }
.title { display: inline-block; margin: 10px 0 0; padding: 12px 24px 13px; font-size: 21px; letter-spacing: -.02em; line-height: 1.2; }
.status { margin: 12px auto 0; width: max-content; max-width: 100%; padding: 8px 18px; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.menu { position: absolute; right: 14px; top: 42px; z-index: 5; padding: 8px; }
.menu button { display: block; padding: 10px 18px; font-size: 14px; }
.menu[hidden] { display: none; }

.talkbox { position: absolute; bottom: calc(168px + env(safe-area-inset-bottom)); width: min(100vw, 460px); height: 0; }
.foxpic { position: absolute; left: 4px; bottom: -8px; width: 92px; image-rendering: auto; z-index: 2; pointer-events: none; }
.bubble { position: absolute; left: 92px; right: 18px; bottom: 0; padding: 12px 16px 14px; font-size: 13.5px; line-height: 1.5; word-break: keep-all; }
.bubble b { color: #c4405a; }
.nm { position: absolute; left: -6px; top: -18px; height: 30px; padding: 0 16px; font-size: 13px; }
.bottom { position: absolute; bottom: calc(26px + env(safe-area-inset-bottom)); width: min(100vw, 460px); padding: 0 18px; display: flex; flex-direction: column; gap: 12px; }
.bigbtn { height: 62px; font-size: 21px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--ink); }
.smallrow { display: flex; gap: 10px; }
.smallrow button { flex: 1; height: 48px; font-size: 14px; color: var(--ink); }

/* ---------- 창 ---------- */
#sheet { position: fixed; inset: 0; z-index: 30; display: flex; justify-content: center; align-items: flex-start; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#sheet[hidden] { display: none; }
#sheet .dim { position: fixed; inset: 0; background: rgba(14, 28, 78, .5); }
.sheet-body { position: relative; width: min(100vw, 460px); padding: calc(64px + env(safe-area-inset-top)) 14px calc(40px + env(safe-area-inset-bottom)); }
.panel2 { position: relative; padding: 44px 22px 22px; }
.ptag { position: absolute; left: 24px; top: -18px; height: 38px; padding: 0 22px; font-size: 17px; font-weight: 700; }
.closex { position: absolute; right: 14px; top: 12px; width: 34px; height: 34px; font-size: 18px; color: var(--ink-2); }
.label { font-size: 13px; color: var(--ink-2); margin: 0 0 7px 2px; }
.field { height: 48px; padding: 0 18px; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-family: var(--font); font-size: 16px; color: var(--ink); }
.hint { min-height: 20px; margin: 0 4px 12px; font-size: 12.5px; line-height: 1.5; word-break: keep-all; }
.hint.ok { color: #2f7a1e; font-weight: 700; }
.hint.bad { color: #c4405a; font-weight: 700; }
.letter { position: relative; width: 100%; height: 260px; padding: 16px 18px 26px; font-family: var(--font); font-size: 15px; line-height: 30px; color: #3b3128; resize: none; outline: 0;
  background: repeating-linear-gradient(#fff9e8 0 29px, #ead8ac 29px 30px) 0 16px / 100% 30px, #fff9e8; border: 3px solid #b8925e; box-shadow: 0 4px 0 rgba(94,58,28,.25); word-break: keep-all; border-radius: 0; -webkit-appearance: none; }
.cnt { text-align: right; font-size: 12px; color: var(--ink-2); margin: 6px 2px 0; }
.toggle { display: flex; gap: 8px; margin: 16px 0 14px; }
.toggle button { flex: 1; height: 42px; font-size: 14px; color: var(--ink-2); border-image: var(--pf-pill-white) 10 fill / 22px stretch; }
.toggle button.on { border-image: var(--pf-tag-green) 10 fill / 22px stretch; color: #2c4018; font-weight: 700; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.55; color: var(--ink); word-break: keep-all; text-align: left; width: 100%; }
.box { flex: none; width: 22px; height: 22px; margin-top: 0; background: #fff; border: 3px solid #8a6a44; display: grid; place-items: center; font-size: 14px; line-height: 1; color: #2f7a1e; font-weight: 700; }
.note { margin-top: 14px; padding: 10px 12px; font-size: 12px; line-height: 1.6; color: #6a4a30; background: #fff1cc; border: 2px dashed #d8b878; word-break: keep-all; }
.go { width: 100%; height: 58px; margin-top: 18px; font-size: 19px; font-weight: 700; color: var(--ink); }
.go2 { width: 100%; height: 50px; margin-top: 10px; font-size: 16px; color: var(--ink); }
.lead { font-size: 14px; line-height: 1.7; margin-bottom: 16px; word-break: keep-all; }
.msg { min-height: 20px; margin-top: 10px; font-size: 13px; color: #c4405a; font-weight: 700; text-align: center; word-break: keep-all; }

/* 내가 쓴 편지 목록 */
.card { position: relative; margin-bottom: 12px; padding: 14px 16px; background: #fff9e8; border: 3px solid #b8925e; box-shadow: 0 4px 0 rgba(94,58,28,.2); }
.card .to { font-size: 15px; font-weight: 700; margin-bottom: 6px; word-break: break-all; }
.card .tx { font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: keep-all; color: #3b3128; }
.card .meta { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.badge { font-size: 11.5px; padding: 3px 8px; background: #efe3c4; color: #6a4a30; }
.card .acts { display: flex; gap: 8px; margin-top: 10px; }
.card .acts button { height: 38px; padding: 0 16px; font-size: 13px; color: var(--ink); border-image: var(--pf-pill-cream) 10 fill / 18px stretch; }
.card .acts button.warn { color: #c4405a; font-weight: 700; }
.empty { text-align: center; padding: 30px 10px; font-size: 14px; color: var(--ink-2); line-height: 1.7; word-break: keep-all; }

/* 받은 편지 */
.lcard { position: relative; margin-top: 26px; padding: 34px 24px 24px; background: #fff9e8; border: 4px solid #b8925e; box-shadow: 0 8px 0 rgba(30,20,10,.35); }
.lcard::before { content: ''; position: absolute; left: 50%; top: -22px; width: 40px; height: 40px; margin-left: -20px; background: #ffe25a; border: 4px solid #c9a22a; transform: rotate(45deg); }
.lcard .to { font-size: 17px; font-weight: 700; margin-bottom: 14px; word-break: break-all; }
.lcard .body { font-size: 16px; line-height: 31px; min-height: 186px; white-space: pre-wrap; word-break: keep-all; background: repeating-linear-gradient(transparent 0 30px, #ead8ac 30px 31px); }
.lcard .from { margin-top: 16px; text-align: right; font-size: 15px; font-weight: 700; color: #7a6248; word-break: break-all; }
.nav { display: flex; justify-content: center; align-items: center; gap: 18px; margin-top: 18px; font-size: 15px; color: #fff8e2; }
.nav button { width: 46px; height: 46px; font-size: 18px; color: var(--ink); }

/* 안내 */
.guide h3 { font-size: 15px; margin: 16px 0 6px; }
.guide p, .guide li { font-size: 13.5px; line-height: 1.7; word-break: keep-all; }
.guide ul { margin: 0; padding-left: 18px; }

/* 알림, 날아가는 편지 */
#toast2 { position: fixed; left: 50%; top: 40%; z-index: 50; transform: translate(-50%, 10px); padding: 12px 20px; font-size: 14px; color: var(--ink); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; border-image: var(--pf-pill-cloud) 10 fill / 22px stretch; white-space: nowrap; filter: drop-shadow(0 4px 0 rgba(10,20,50,.25)); }
#toast2.show { opacity: 1; transform: translate(-50%, 0); }
.flying { position: fixed; z-index: 40; font-size: 40px; pointer-events: none; transition: transform 1s cubic-bezier(.3,.7,.3,1), opacity 1s; }

body.sheet-open #ui { opacity: 0; pointer-events: none; transition: opacity .15s; }
