/* 현상수배(榜 창의 「懸」 탭)·별호 창·동무 창·관인 알림 (public/js/retention.js)
   현상: 방(榜) 한지 위에 풀칠해 붙인 방문(榜文) 쪽지 — 붉은 관인, 먹 글씨의 붙인 글, 흐린 「실은」, 먹줄 진행.
   별호: 옥 낙관 그림(ui/menu_ach.png) 단추 · 나무 명패에 「별호」. 동무: 표주박과 백자 잔(ui/menu_friends.png) · 등불로 접속. */

/* 메뉴 그림: menu.png 아틀라스 밖 따로 (tools/blender/ui_art.py menu_extra extra=friends,ach) */
#hud #tmenu button.mi.mi-ach, #hud #mini button.mi.mi-ach { background: url("../ui/menu_ach.png?v=1") center / 100% 100% no-repeat !important; }
#hud #tmenu button.mi.mi-friends, #hud #mini button.mi.mi-friends { background: url("../ui/menu_friends.png?v=1") center / 100% 100% no-repeat !important; }

/* ───────── 방(榜) 창: 현상 탭 ───────── */
#panel-rank .rt-bty { display: none; }
#panel-rank.rt-on { width: 700px; }
#panel-rank.rt-on .rt-bty { display: block; flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
#panel-rank.rt-on .rk-realm, #panel-rank.rt-on .rk-cls, #panel-rank.rt-on .rk-wrap, #panel-rank.rt-on .rk-me, #panel-rank.rt-on .rk-foot { display: none !important; }
#panel-rank .rk-tabs button[data-k="bty"] { position: relative; }
#panel-rank .rk-tabs button[data-k="bty"] i { background: #c94a32; color: #fff0dc; }
#panel-rank .rk-tabs button[data-badge=""]::after { content: ''; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #e4553a, #9a1a10); border: 1px solid #2a0a06; box-shadow: 0 0 5px rgba(255,90,50,0.8); }

.rt-hd { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin: 8px 0 5px; padding-bottom: 3px; border-bottom: 1px solid rgba(60,36,20,0.45); }
.rt-sec { font-family: var(--title); font-size: 16px; letter-spacing: 2px; color: #2a1a10; display: inline-flex; align-items: center; gap: 6px; }
.rt-sec i { font-style: normal; font-size: 13px; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; color: #f6e0c8; background: #3a2416; border-radius: 2px; }
.rt-sec small { font-family: var(--font); font-size: 12px; letter-spacing: 0; color: var(--ink2); }
.rt-cap { font-size: 12px; color: #8e2a22; }
.rt-left { margin-left: auto; font-size: 12px; color: var(--ink2); font-variant-numeric: tabular-nums; }

/* 방문 쪽지: 풀칠한 한지 한 장 (조금씩 비뚤게) */
.rt-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.rt-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 10px 10px 8px 10px; min-height: 172px;
  color: #241a12; background: url("../ui/tex_hanji.png") center / 260px, #efe3c6;
  border: 1px solid rgba(110,80,40,0.55); box-shadow: 1px 2px 0 rgba(60,36,20,0.25), 0 3px 8px rgba(40,24,10,0.25), inset 0 0 18px rgba(150,110,60,0.22); }
.rt-card::before { content: ''; position: absolute; left: 50%; top: -6px; width: 44px; height: 12px; margin-left: -22px;
  background: rgba(240,230,205,0.75); box-shadow: 0 1px 1px rgba(60,36,20,0.25); transform: rotate(-2deg); }   /* 붙인 풀종이 */
.rt-cards .rt-card:nth-child(1) { transform: rotate(-0.8deg); } .rt-cards .rt-card:nth-child(2) { transform: rotate(0.6deg); } .rt-cards .rt-card:nth-child(3) { transform: rotate(-0.4deg); }
.rt-seal { position: absolute; right: 7px; top: 7px; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  font-family: var(--title); font-size: 21px; line-height: 1; color: #f7e4cc; background: #a3281c; border: 1px solid #5a120c; border-radius: 3px;
  box-shadow: inset 0 0 0 2px rgba(255,210,180,0.32); transform: rotate(-5deg); opacity: 0.92; }
.rt-post { font-family: var(--title); font-size: 15px; line-height: 1.38; padding-right: 32px; color: #1e140c; word-break: keep-all; }
.rt-truth { font-size: 12px; line-height: 1.4; color: #54442f; word-break: keep-all; }
.rt-truth em { font-style: normal; font-family: var(--title); color: #8e2a22; margin-right: 5px; padding: 0 3px; border: 1px solid rgba(142,42,34,0.45); border-radius: 2px; font-size: 11px; }
.rt-bar { position: relative; height: 14px; margin-top: auto; background: rgba(90,60,30,0.12); border-bottom: 1px solid rgba(60,36,20,0.4); }
.rt-bar i { position: absolute; left: 0; top: 3px; bottom: 3px; background: linear-gradient(90deg, rgba(30,20,12,0.85), rgba(30,20,12,0.6)); border-radius: 0 6px 6px 0; }   /* 먹줄 */
.rt-bar span { position: absolute; right: 2px; top: -1px; font-size: 11px; color: #3a2a1a; font-variant-numeric: tabular-nums; text-shadow: 0 0 3px #efe3c6, 0 0 3px #efe3c6; }
.rt-rw { font-size: 12px; color: #4a3a2a; margin-top: auto; }
.rt-card.st-on .rt-rw, .rt-card.st-done .rt-rw { margin-top: 0; }
.rt-rw small { color: #8e2a22; }
.rt-act { display: flex; justify-content: flex-end; min-height: 30px; align-items: center; }
.rt-take { min-height: 30px; padding: 3px 12px; font-family: var(--title); font-size: 14px; letter-spacing: 2px; color: #ffe2a0;
  background: url("../ui/tex_bandaji.png") center / 200px, #3a2416; border: 1px solid #1a0e08; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(201,162,79,0.45); touch-action: manipulation; }
.rt-take:hover:not([disabled]) { filter: brightness(1.18); }
.rt-take[disabled] { filter: grayscale(0.7) brightness(0.8); cursor: default; }
.rt-held { font-size: 12px; color: #8e2a22; font-family: var(--title); letter-spacing: 1px; }
.rt-stamp { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; font-family: var(--title); font-size: 24px; color: #b8281c;
  border: 3px double rgba(184,40,28,0.85); border-radius: 50%; transform: rotate(-12deg); opacity: 0.85; }
.rt-card.st-done { filter: saturate(0.8); }
.rt-card.st-done .rt-post { color: #5a4a3a; }
.rt-card.st-on { box-shadow: 0 0 0 2px rgba(163,40,28,0.45), 0 3px 8px rgba(40,24,10,0.25), inset 0 0 18px rgba(150,110,60,0.22); }
.rt-week .rt-card { min-height: 0; transform: rotate(0.3deg); }
.rt-week .rt-card .rt-post { font-size: 16px; }
.rt-other { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 8px; font-size: 12px; color: var(--ink2); }
.rt-other span { font-family: var(--title); color: #8e2a22; }
.rt-other em { font-style: normal; }
.rt-other em.st-done { text-decoration: line-through; opacity: 0.7; }
.rt-allbonus { margin-top: 8px; font-size: 12px; color: var(--ink2); text-align: center; }
.rt-allbonus.got { color: #8e2a22; }

/* 현상금 패 가게 */
.rt-tok { margin-left: auto; font-family: var(--title); font-size: 15px; color: #2a1a10; display: inline-flex; align-items: center; gap: 4px; }
.rt-coin { display: inline-block; width: 14px; height: 18px; vertical-align: -3px; border-radius: 2px 2px 3px 3px;
  background: linear-gradient(180deg, #7a4a24, #4a2a14); box-shadow: inset 0 0 0 1px rgba(201,162,79,0.7), 0 1px 1px rgba(0,0,0,0.35); position: relative; }
.rt-coin::after { content: '懸'; position: absolute; inset: 0; font: 9px/18px var(--title); color: #f3d68a; text-align: center; }
.rt-wares { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.rt-ware { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 1px 8px; align-items: center; padding: 5px 8px;
  background: rgba(255,250,236,0.4); border: 1px solid rgba(90,60,30,0.35); border-radius: 2px; }
.rt-ware b { font-weight: 700; font-size: 13px; color: #2a1a10; }
.rt-ware small { grid-column: 1; font-size: 11px; color: var(--ink2); line-height: 1.3; }
.rt-ware button { grid-column: 2; grid-row: 1 / span 2; min-height: 30px; min-width: 52px; padding: 2px 8px; font-family: var(--title); font-size: 14px; color: #2a1a10;
  background: #e8d8b0; border: 1px solid #8a6a3a; border-radius: 2px; display: inline-flex; align-items: center; gap: 4px; justify-content: center; touch-action: manipulation; }
.rt-ware button:hover:not([disabled]) { background: #8e2a22; color: #f6e0c8; }
.rt-ware button[disabled] { opacity: 0.55; cursor: default; }
.rt-ware.own button { opacity: 1; color: #8e2a22; background: none; border-style: dashed; }
.rt-foot { margin: 8px 0 0; font-size: 11px; color: var(--ink2); text-align: right; font-style: italic; }

@media (max-width: 620px) {
  .rt-cards { grid-template-columns: 1fr; gap: 8px; }
  .rt-card { min-height: 0; }
  .rt-cards .rt-card:nth-child(n) { transform: none; }
  .rt-post { font-size: 14px; }
}
body.short #panel-rank .rt-card { min-height: 0; padding: 7px 8px 6px; }
body.short #panel-rank .rt-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
body.short #panel-rank .rt-post { font-size: 13px; }
body.short #panel-rank .rt-truth { font-size: 11px; }
body.short #panel-rank .rt-hd { margin: 4px 0 3px; }

/* ───────── 두루마리 끝 현상 덩이 ───────── */
#tracker .rt-tq .tq-n { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
body.phone #tracker .rt-tq .tq-n { justify-content: flex-start; }
.rt-tseal { font-family: var(--title); font-size: 12px; line-height: 1; padding: 2px 3px; color: #f3dcc4; background: #8e2a22; border: 1px solid #5a120c; transform: rotate(-4deg); }
.rt-wk { font-size: 11px; color: #e8a878; }
#tracker.fold .rt-tq { display: none; }

/* ───────── 관인 알림 ───────── */
#rt-stamp { position: absolute; left: 50%; top: 90px; z-index: 35; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; pointer-events: none !important;
  padding: 8px 18px 8px 10px; min-width: 240px; max-width: calc(100vw - 24px); box-sizing: border-box;
  background: url("../ui/tex_hanji.png") center / 260px, #e9dcc0; color: #241a12; border: 1px solid #6d5636;
  box-shadow: 0 0 0 2px #2a1f15, 0 0 0 3px #c9a24f, 0 10px 30px rgba(0,0,0,0.7); opacity: 0; }
#rt-stamp.in { animation: rsIn 0.35s ease-out forwards; }
#rt-stamp.out { animation: rsOut 0.5s ease-in forwards; }
@keyframes rsIn { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes rsOut { from { opacity: 1; } to { opacity: 0; transform: translate(-50%, -6px); } }
#rt-stamp .rs-seal { flex: none; width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; font-family: var(--title); font-size: 30px; line-height: 1;
  color: #f7e4cc; background: #a3281c; border: 1px solid #5a120c; border-radius: 3px; box-shadow: inset 0 0 0 2px rgba(255,210,180,0.35); transform: rotate(-6deg); }
#rt-stamp.in .rs-seal { animation: rsSeal 0.45s 0.15s ease-out both; }
@keyframes rsSeal { 0% { transform: scale(2.4) rotate(-14deg); opacity: 0; } 70% { transform: scale(0.92) rotate(-5deg); opacity: 1; } 100% { transform: scale(1) rotate(-6deg); } }
#rt-stamp.ach .rs-seal { background: #2c5a46; border-color: #123024; }
#rt-stamp .rs-body { display: flex; flex-direction: column; min-width: 0; }
#rt-stamp .rs-h { font-family: var(--title); font-weight: 400; font-size: 13px; letter-spacing: 3px; color: #8e2a22; }
#rt-stamp.ach .rs-h { color: #2c5a46; }
#rt-stamp .rs-t { font-family: var(--title); font-size: 19px; line-height: 1.2; color: #1e140c; }
#rt-stamp .rs-s { font-size: 12px; color: #4a3a2a; }
body.phone #rt-stamp { top: 64px; min-width: 0; }
body.phone.portrait #rt-stamp { top: 120px; }

/* ───────── 별호 창 ───────── */
#panel-ach { left: 50%; top: 60px; transform: translateX(-50%); width: 560px; max-width: calc(100vw / var(--uis, 1) - 16px); max-height: calc(100vh / var(--uis, 1) - 80px);
  display: flex; flex-direction: column; overflow: hidden; z-index: 21; }
#panel-ach.hidden { display: none; }
#panel-ach h3, #panel-fr h3 { display: flex; align-items: baseline; gap: 8px; flex: none; }
#panel-ach h3 small, #panel-fr h3 small { font-family: var(--font); font-size: 12px; color: var(--ink2); letter-spacing: 0; }
#panel-ach h3 .close, #panel-fr h3 .close { margin-left: auto; background: none; border: none; color: var(--ink2); font-size: 18px; cursor: pointer; min-width: 32px; min-height: 32px; }
.ach-now { flex: none; display: flex; align-items: center; gap: 10px; margin: 2px 0 8px; }
.ach-plate { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 12px; color: #f3dcb0;
  background: url("../ui/tex_bandaji.png") center / 220px, #3a2416; border: 1px solid #1a0e08; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(201,162,79,0.5), inset 0 0 12px rgba(0,0,0,0.6); }
.ach-plate em { font-style: normal; font-size: 12px; color: #c8b48a; flex: none; }
.ach-plate b { font-family: var(--title); font-weight: 400; font-size: 19px; color: #ffe2a0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ach-none { flex: none; min-height: 32px; padding: 3px 10px; font-size: 12px; background: none; border: 1px solid #8e2a22; color: #8e2a22; border-radius: 2px; }
.ach-none[disabled] { opacity: 0.4; cursor: default; }
.ach-tabs { flex: none; display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.ach-tabs button { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 2px 8px 2px 3px; font-size: 13px; color: var(--ink2);
  background: rgba(255,250,236,0.35); border: 1px solid rgba(90,60,30,0.35); border-radius: 2px; touch-action: manipulation; }
.ach-tabs button i { font-style: normal; font-family: var(--title); font-size: 13px; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center;
  color: #8e2a22; border: 1px solid rgba(142,42,34,0.65); border-radius: 2px; }
.ach-tabs button small { font-size: 10.5px; color: #8a6a4a; margin-left: 2px; }
.ach-tabs button.on { color: #2a1a10; background: rgba(201,162,79,0.3); border-color: #8a6a3a; }
.ach-tabs button.on i { color: #f6e0c8; background: #9a2a1e; border-color: #5e140d; }
.ach-list { flex: 1; min-height: 60px; overflow: auto; -webkit-overflow-scrolling: touch; border-top: 2px solid #3a2416; border-bottom: 2px solid #3a2416; }
.ach-it { display: grid; grid-template-columns: 164px 1fr auto; gap: 10px; align-items: center; padding: 6px 4px; border-bottom: 1px dotted rgba(90,60,30,0.5); }
.ach-it:last-child { border-bottom: none; }
.ach-tag { font-family: var(--title); font-size: 15px; line-height: 1.25; color: #2a1a10; word-break: keep-all; }
.ach-lock { color: rgba(60,40,24,0.38); }
.ach-it:not(.got) .ach-txt b { color: #6a5a46; }
.ach-it.got .ach-tag { color: #8e2a22; }
.ach-it.cur { background: rgba(201,162,79,0.25); box-shadow: inset 3px 0 0 #9a2a1e; }
.ach-txt { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ach-txt b { font-size: 13.5px; color: #1e140c; }
.ach-txt small { font-size: 12px; color: var(--ink2); line-height: 1.35; }
.ach-bar { position: relative; display: block; height: 12px; margin-top: 2px; max-width: 220px; background: rgba(90,60,30,0.12); border-bottom: 1px solid rgba(60,36,20,0.35); }
.ach-bar i { position: absolute; left: 0; top: 3px; bottom: 3px; background: rgba(30,20,12,0.7); border-radius: 0 5px 5px 0; }
.ach-bar em { position: absolute; right: 2px; top: -2px; font-style: normal; font-size: 10.5px; color: #3a2a1a; font-variant-numeric: tabular-nums; }
.ach-it button { min-height: 30px; padding: 2px 12px; font-family: var(--title); font-size: 14px; color: #ffe2a0; background: url("../ui/tex_bandaji.png") center / 200px, #3a2416;
  border: 1px solid #1a0e08; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(201,162,79,0.45); touch-action: manipulation; }
.ach-it button:hover { filter: brightness(1.18); }
.ach-worn { font-family: var(--title); font-size: 13px; color: #8e2a22; padding: 0 6px; }
.ach-foot { flex: none; margin: 6px 0 0; }
@media (max-width: 560px) {
  .ach-now { flex-wrap: wrap; gap: 6px; }
  .ach-plate { flex-basis: 100%; }
  .ach-plate b { font-size: 17px; white-space: normal; }
  .ach-none { margin-left: auto; }
  .ach-it { grid-template-columns: 1fr auto; }
  .ach-tag { grid-column: 1 / -1; }
  .ach-txt { grid-column: 1; }
  .ach-tabs button { font-size: 0; gap: 0; padding: 2px 4px; } .ach-tabs button i { font-size: 13px; } .ach-tabs button small { font-size: 10px; margin-left: 3px; }
}

/* ───────── 동무 창 ───────── */
#panel-fr { left: 50%; top: 70px; transform: translateX(-50%); width: 440px; max-width: calc(100vw / var(--uis, 1) - 16px); max-height: calc(100vh / var(--uis, 1) - 90px);
  display: flex; flex-direction: column; overflow: hidden; z-index: 21; }
#panel-fr.hidden { display: none; }
.fr-add { flex: none; display: flex; gap: 6px; margin: 2px 0 6px; }
.fr-add input { flex: 1; min-width: 0; min-height: 32px; padding: 3px 8px; font-size: 14px; color: #241a12; background: rgba(255,250,236,0.7); border: 1px solid #a88a5a; border-radius: 2px; }
.fr-add button { min-height: 32px; padding: 3px 14px; font-family: var(--title); font-size: 15px; letter-spacing: 2px; color: #ffe2a0;
  background: url("../ui/tex_bandaji.png") center / 200px, #3a2416; border: 1px solid #1a0e08; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(201,162,79,0.45); }
.fr-note { flex: none; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink2); margin-bottom: 6px; min-height: 28px; }
.fr-note input { width: 18px; height: 18px; accent-color: #8e2a22; }
.fr-list { flex: 1; min-height: 50px; overflow: auto; -webkit-overflow-scrolling: touch; border-top: 2px solid #6d5636; border-bottom: 2px solid #6d5636; }
.fr-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-bottom: 1px dotted rgba(90,60,30,0.5); }
.fr-row:last-child { border-bottom: none; }
/* 등불: 접속하면 켜진 청사초롱 빛, 아니면 꺼진 종이등 */
.fr-lamp { flex: none; width: 14px; height: 18px; border-radius: 6px 6px 7px 7px; background: linear-gradient(180deg, #9a8a72, #6a5c48); box-shadow: inset 0 0 0 1px rgba(40,24,10,0.45); position: relative; }
.fr-lamp::before { content: ''; position: absolute; left: 4px; right: 4px; top: -3px; height: 3px; background: #3a2a1a; border-radius: 1px; }
.fr-row.on .fr-lamp { background: radial-gradient(circle at 50% 55%, #fff1c0, #f2b04a 45%, #b8281c 100%); box-shadow: 0 0 8px rgba(255,180,80,0.85), inset 0 0 0 1px rgba(90,20,10,0.5); }
.fr-who { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.fr-who b { font-size: 15px; color: #1e140c; }
.fr-row:not(.on) .fr-who b { color: #6a5a46; }
.fr-who small { font-size: 12px; color: var(--ink2); }
.fr-at { flex-basis: 100%; font-size: 12px; color: #8e2a22; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr-row:not(.on) .fr-at { color: #8a7a64; }
.fr-btns { flex: none; display: flex; gap: 4px; }
.fr-btns button { min-height: 30px; padding: 2px 8px; font-size: 12px; background: #eadfc4; border: 1px solid #a88a5a; color: #4a3a2a; border-radius: 2px; touch-action: manipulation; }
.fr-btns button:hover { background: #8e2a22; color: #f4e6c8; border-color: #3a120c; }
.fr-btns .fr-x { background: none; border-style: dashed; }
.fr-btns .fr-x.arm { background: #8e2a22; color: #f4e6c8; border-style: solid; }
.fr-empty { padding: 14px 6px; text-align: center; }
@media (max-width: 480px) {
  .fr-row { flex-wrap: wrap; }
  .fr-btns { flex-basis: 100%; justify-content: flex-end; }
}
body.phone #panel-ach, body.phone #panel-fr { top: max(8px, env(safe-area-inset-top)); max-height: calc(100vh / var(--uis, 1) - 24px); }

/* 살펴보기 창: 별호 */
#panel-insp .insp-tt { font-family: var(--title); font-size: 14px; color: #8e2a22; margin-right: 2px; }

/* 방(순위) 표: 이름 앞 별호 */
.rk-tbl .rk-tt, .rk-me-row .rk-tt { font-family: var(--title); font-size: 11.5px; color: #8e2a22; margin-right: 4px; }
@media (max-width: 520px) { .rk-tbl .rk-tt { display: block; font-size: 10.5px; line-height: 1.1; margin: 0; } }
/* 후원 별호 (lib/retention.js RD.donor) — 맨 위, 금빛 */
.ach-it.donor { background: linear-gradient(90deg, rgba(232,184,96,0.28), rgba(232,184,96,0.06)); box-shadow: inset 3px 0 0 #c9a24f; }
.ach-it.donor.got .ach-tag { color: #8a5a10; text-shadow: 0 0 6px rgba(255,214,120,0.9); }
.ach-it.donor.cur { box-shadow: inset 3px 0 0 #9a2a1e; }
.ach-tabs[hidden] { display: none; }
