* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0b1424; color: #f4f1ea;
  font-family: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }

/* 라벨 */
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.label { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; font-size: 11px; font-weight: 600;
  padding: 3px 7px; border-radius: 999px; background: rgba(10, 18, 34, .72); color: #e9edf5; }
.label.me { background: #ffcf3d; color: #2a1f00; }
.label.loss2 { color: #9ec5ff; }
.label.loss3 { color: #ffd76a; }
.label.me.loss2, .label.me.loss3 { color: #2a1f00; } /* 내 이름표는 노란 바탕이라 항상 진한 글씨 */
.bubble { position: absolute; width: max-content; transform: translate(-50%, -100%); font-size: 14px; font-weight: 700; padding: 5px 10px;
  border-radius: 12px; background: #fff; color: #1d2433; animation: pop 2.2s ease forwards; }
@keyframes pop { 0% { opacity: 0; margin-top: 6px } 10% { opacity: 1; margin-top: 0 } 80% { opacity: 1 } 100% { opacity: 0; margin-top: -12px } }

/* 입장 */
.overlay { position: fixed; inset: 0; display: flex; flex-direction: column; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; background: rgba(6, 12, 24, .55); backdrop-filter: blur(6px); z-index: 20; padding: 16px; }
.overlay > * { margin: auto; flex-shrink: 0; } /* 공간이 남으면 가운데, 모자라면 위에서부터 스크롤 */
.card { width: min(380px, 100%); background: #f6f2e8; color: #1f2633; border-radius: 22px; padding: 26px 22px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .4); text-align: center; }
.logo { font-size: 40px; }
h1 { font-size: 26px; letter-spacing: -.5px; margin-top: 4px; }
.sub { font-size: 13px; color: #5c6476; margin-top: 4px; }
.market-pill { margin: 14px auto 16px; display: inline-block; font-size: 13px; padding: 7px 12px; border-radius: 999px;
  background: #1f2a44; color: #fff; }
.market-pill .down { color: #7fb2ff; font-weight: 700; } .market-pill .up { color: #ff7f7f; font-weight: 700; }
.field { display: block; text-align: left; margin-top: 10px; position: relative; }
.field span { font-size: 12px; font-weight: 700; color: #3c4456; }
.field input { width: 100%; margin-top: 5px; font-size: 16px; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid #d8d2c4; background: #fff; color: #1f2633; outline: none; }
.field input:focus { border-color: #ff9d2e; }
.dropdown { list-style: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 5; background: #fff; border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18); max-height: 200px; overflow: auto; margin-top: 4px; }
.dropdown:empty { display: none; }
.dropdown li { padding: 10px 14px; font-size: 14px; cursor: pointer; display: flex; justify-content: space-between; }
.dropdown li small { color: #8a90a0; }
.dropdown li:hover, .dropdown li.on { background: #fff3e2; }
.preview { min-height: 22px; font-size: 14px; font-weight: 700; margin-top: 10px; color: #2d5bd8; }
.preview.escaped { color: #d8482d; }
input, textarea, select { font-family: inherit; }
button { font-family: inherit; cursor: pointer; border: 0; }
.primary { display: block; width: 100%; padding: 14px; border-radius: 14px; background: #ff9d2e; color: #241400;
  font-size: 16px; font-weight: 800; margin-top: 6px; text-align: center; text-decoration: none; }
.ghost { display: block; width: 100%; padding: 11px; margin-top: 6px; background: none; color: #5c6476; font-size: 14px; }
.fine { font-size: 11px; color: #7a8193; margin-top: 12px; line-height: 1.5; }
.fine.sample { margin-top: 6px; color: #b06a00; }

/* HUD */
#hud { position: fixed; top: 10px; left: 10px; right: 10px; display: flex; gap: 8px; flex-wrap: wrap; z-index: 5; pointer-events: none; }
.pill { background: rgba(10, 18, 34, .78); padding: 8px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.pill .down { color: #7fb2ff; } .pill .up { color: #ff8686; }

/* 행동 바 */
#actions { position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%); display: flex; gap: 6px; z-index: 5;
  background: rgba(10, 18, 34, .82); padding: 8px; border-radius: 20px; max-width: calc(100% - 16px); overflow-x: auto; scrollbar-width: none; }
#actions button { flex: 0 0 auto; width: 62px; padding: 7px 2px; border-radius: 14px; background: rgba(255, 255, 255, .06);
  color: #eef1f7; display: flex; flex-direction: column; align-items: center; gap: 3px; }
#actions button b { font-size: 21px; font-weight: 400; line-height: 1; }
#actions button span { font-size: 10.5px; white-space: nowrap; }
#actions button:active { transform: scale(.94); }
#actions button.on { background: #ff9d2e; color: #241400; }
#actions button.disabled { opacity: .35; }

/* 시트 */
.sheet { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); width: min(400px, calc(100% - 20px));
  background: #f6f2e8; color: #1f2633; border-radius: 20px; padding: 16px; z-index: 10; box-shadow: 0 16px 50px rgba(0, 0, 0, .4);
  max-height: calc(100% - 180px); overflow: auto; }
.sheet.daily { bottom: auto; top: 50%; transform: translate(-50%, -50%); z-index: 12; text-align: center; }
.daily .d-stock { font-size: 15px; font-weight: 700; margin-top: 10px; }
.daily .d-stock em { font-style: normal; }
.daily .up { color: #d8372f; } .daily .down { color: #2f6fd8; }
.daily .d-loss { font-size: 30px; font-weight: 800; margin: 8px 0 2px; letter-spacing: -.5px; }
.daily .d-loss small { font-size: 15px; font-weight: 600; color: #8a90a0; margin-right: 6px; }
.daily .d-msg { font-size: 15px; font-weight: 700; margin: 8px 0 4px; }
.daily .d-sub { font-size: 13px; color: #5c6476; line-height: 1.6; }
.daily .d-foot { font-size: 11px; color: #8a90a0; margin: 10px 0 12px; }
.daily .primary { width: 100%; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet h2 { font-size: 17px; }
.x { background: none; font-size: 24px; color: #5c6476; width: 32px; height: 32px; }
.tabs { display: flex; gap: 6px; margin: 12px 0 8px; overflow-x: auto; }
.tabs button { flex: 0 0 auto; padding: 7px 10px; border-radius: 999px; background: #e7e1d3; font-size: 12px; font-weight: 700; color: #3c4456; }
.tabs button.on { background: #1f2a44; color: #fff; }
#rankList { list-style: none; counter-reset: r; }
#rankList li { counter-increment: r; display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid #e3ddcf; font-size: 14px; }
#rankList li::before { content: counter(r); width: 22px; height: 22px; border-radius: 50%; background: #1f2a44; color: #fff;
  font-size: 11px; display: grid; place-items: center; flex: 0 0 auto; }
#rankList li.big::before { display: none; }
#rankList li .n { margin-left: auto; font-weight: 800; }
#rankList li .loss { color: #2d5bd8; font-weight: 800; margin-left: auto; }
#rankList .empty { color: #7a8193; justify-content: center; }
#rankList .empty::before { display: none; }
.big-num { font-size: 40px; font-weight: 900; color: #d8482d; text-align: center; width: 100%; padding: 16px 0 4px; }
#cardImg { max-width: 100%; max-height: 52vh; border-radius: 14px; margin: 12px auto 6px; display: block; }
#cardInvite { margin-top: 8px; width: 100%; }

/* 줌 버튼 */
#zoomBtns { position: fixed; right: 10px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 5; }
#zoomBtns button { width: 40px; height: 40px; border-radius: 12px; border: 0; background: rgba(10, 18, 34, .78); color: #fff;
  font-size: 20px; font-weight: 700; cursor: pointer; font-family: inherit; }
/* 채팅 미니창 */
#chatFeed { position: fixed; left: 10px; bottom: 150px; width: min(270px, calc(100% - 70px)); z-index: 4; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; }
#chatFeed .cf-line { font-size: 12.5px; line-height: 1.4; padding: 5px 9px; border-radius: 10px; background: rgba(10, 18, 34, .72);
  color: #f4f1ea; align-self: flex-start; max-width: 100%; word-break: keep-all; overflow-wrap: anywhere; transition: opacity .4s; }
#chatFeed .cf-line b { color: #ffcf3d; font-weight: 700; margin-right: 4px; }
#chatFeed .cf-line.stock b::before { content: '📈 '; }
#chatFeed .cf-line.old { opacity: .55; }
#chatFeed .cf-more { font-size: 11px; color: #c9d2e3; padding: 2px 6px; }
#toast { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); background: #fff; color: #1f2633; padding: 10px 16px;
  border-radius: 999px; font-size: 13px; font-weight: 700; z-index: 30; opacity: 0; transition: opacity .25s; pointer-events: none;
  max-width: calc(100% - 30px); text-align: center; }
#toast.show { opacity: 1; }
#help { position: fixed; bottom: 8px; left: 0; right: 0; text-align: center; font-size: 11px; color: rgba(255, 255, 255, .6); z-index: 4; }
#help a { color: #fff; font-weight: 700; }
#hint { position: fixed; top: 54px; left: 50%; transform: translateX(-50%); font-size: 12px; background: rgba(10, 18, 34, .7);
  padding: 6px 12px; border-radius: 999px; z-index: 4; pointer-events: none; }

/* 난간 한 줄 */
.note-label { position: absolute; transform: translate(-50%, -100%); max-width: 170px; white-space: normal; text-align: center;
  font-size: 11.5px; font-weight: 700; line-height: 1.35; padding: 6px 9px; border-radius: 6px; color: #2b2410;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .35); pointer-events: auto; cursor: pointer; word-break: keep-all; }
.note-label.mine { outline: 2px solid #ffcf3d; }
.c-yellow { background: #fff1a8; } .c-pink { background: #ffd0dc; } .c-mint { background: #c9f2dc; } .c-sky { background: #cfe5ff; } .c-white { background: #ffffff; }
.note-edit { position: relative; margin-top: 12px; }
.note-edit textarea { width: 100%; resize: none; font: inherit; font-size: 16px; padding: 12px 14px 22px; border-radius: 12px;
  border: 1.5px solid #d8d2c4; background: #fff; color: #1f2633; outline: none; }
.note-edit textarea:focus { border-color: #ff9d2e; }
#noteCount, .edit-count { position: absolute; right: 12px; bottom: 9px; font-size: 11px; color: #8a90a0; }
.chips { display: flex; gap: 8px; margin: 10px 0 2px; }
.chips button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .12); }
.chips button.on { border: 3px solid #1f2a44; }
.chips [data-color=yellow] { background: #fff1a8; } .chips [data-color=pink] { background: #ffd0dc; } .chips [data-color=mint] { background: #c9f2dc; }
.chips [data-color=sky] { background: #cfe5ff; } .chips [data-color=white] { background: #fff; }
.note-error { min-height: 18px; font-size: 13px; font-weight: 700; color: #d8482d; margin: 8px 0 2px; line-height: 1.45; }
.note-error.care { color: #2d5bd8; background: #e8efff; padding: 10px 12px; border-radius: 12px; }
.note-error a { color: inherit; }
.sub-h { font-size: 14px; margin: 16px 0 6px; }
.note-list { list-style: none; }
.note-list li { padding: 9px 10px; border-radius: 10px; margin-bottom: 6px; font-size: 13.5px; cursor: pointer; color: #2b2410; }
.note-list .empty { background: none; color: #7a8193; cursor: default; text-align: center; }
.note-card { margin: 12px 0; padding: 18px 16px; border-radius: 10px; font-size: 17px; font-weight: 800; line-height: 1.5; color: #2b2410; text-align: center; word-break: keep-all; }
.row-btns { display: flex; gap: 8px; }
.ghost-btn { flex: 1; padding: 11px; border-radius: 12px; background: #e7e1d3; color: #3c4456; font-size: 13px; font-weight: 700; }

/* 대화 */
.bubble.chat { animation-duration: 4.5s; max-width: 200px; white-space: normal; word-break: keep-all; text-align: center; font-size: 13px; }
.chat-list { list-style: none; margin-top: 4px; max-height: 38vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.chat-list li { font-size: 13.5px; line-height: 1.45; padding: 7px 10px; border-radius: 12px; background: #fff; align-self: flex-start; max-width: 88%; word-break: keep-all; }
.chat-list li b { font-size: 11px; color: #6a7183; display: block; font-weight: 700; }
.chat-list li.mine { align-self: flex-end; background: #ffe2b8; }
.chat-list li.day { background: none; align-self: center; font-size: 11px; color: #8a90a0; padding: 2px; }
.chat-list li.empty { background: none; align-self: center; color: #7a8193; }
.chat-list li .hide { margin-left: 6px; font-size: 11px; color: #a0a6b4; background: none; text-decoration: underline; }
.chat-form { display: flex; gap: 6px; margin-top: 6px; }
.chat-form input { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 11px 13px; border-radius: 12px; border: 1.5px solid #d8d2c4; outline: none; background: #fff; color: #1f2633; }
.chat-form input:focus { border-color: #ff9d2e; }
.chat-form .send { padding: 0 16px; border-radius: 12px; background: #ff9d2e; color: #241400; font-weight: 800; font-size: 14px; }

/* 뽑기 · 꾸미기 */
#actions button[data-badge]:not([data-badge=""]) { position: relative; }
#actions button[data-badge]:not([data-badge=""])::after { content: attr(data-badge); position: absolute; top: 2px; right: 6px; min-width: 16px; height: 16px;
  border-radius: 8px; background: #ff4d5e; color: #fff; font-size: 10px; font-weight: 800; line-height: 16px; padding: 0 4px; }
.g-wallet { display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin: 4px 0 10px; gap: 8px; flex-wrap: wrap; }
.g-wallet b { font-size: 16px; }
.mini { margin-left: 4px; padding: 4px 8px; border-radius: 8px; background: #1f2a44; color: #fff; font-size: 11px; font-weight: 700; }
.mini:disabled { opacity: .35; }
.g-result { border-radius: 16px; padding: 16px; text-align: center; background: #fff; display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 120px; justify-content: center; }
.g-result.empty { color: #8a90a0; font-size: 15px; font-weight: 700; }
.g-result.spin { animation: shake .7s ease; }
@keyframes shake { 0%,100% { transform: rotate(0) } 20% { transform: rotate(-4deg) scale(1.03) } 40% { transform: rotate(4deg) } 60% { transform: rotate(-3deg) } 80% { transform: rotate(2deg) scale(1.05) } }
.g-result.r-rare { background: linear-gradient(160deg, #e6f0ff, #fff); box-shadow: inset 0 0 0 2px #4a7fe0; }
.g-result.r-legend { background: linear-gradient(160deg, #fff3c4, #fff); box-shadow: inset 0 0 0 2px #e0a800; }
.g-rar { font-size: 11px; font-weight: 800; color: #6a7183; }
.r-rare .g-rar { color: #2d5bd8; } .r-legend .g-rar { color: #b07a00; }
.g-name { font-size: 17px; font-weight: 900; }
.g-sub { font-size: 12px; color: #6a7183; }
.g-result .primary { width: auto; padding: 9px 18px; font-size: 14px; }
#gDrawBtn:disabled { background: #d9d3c4; color: #7a8193; }
.swatch { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; flex: 0 0 auto; color: #1f2633; font-weight: 900; background: #e7e1d3; }
.swatch.ring { -webkit-mask: radial-gradient(circle, transparent 34%, #000 35%); mask: radial-gradient(circle, transparent 34%, #000 35%); }
.g-earn { list-style: none; font-size: 13px; line-height: 1.9; }
.g-earn li.done { color: #7a8193; }
.g-odds { background: #fff; border-radius: 12px; padding: 10px 12px; font-size: 12px; line-height: 1.6; }
.odds-row + .odds-row { margin-top: 6px; }
.odds-row b { display: block; }
.odds-row.r-rare b { color: #2d5bd8; } .odds-row.r-legend b { color: #b07a00; }
.sub-h small { font-weight: 500; color: #8a90a0; font-size: 11px; margin-left: 4px; }
.closet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.closet-item { background: #fff; border-radius: 14px; padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; color: #1f2633; word-break: keep-all; line-height: 1.3; }
.closet-item.on { box-shadow: inset 0 0 0 3px #ff9d2e; }
.closet-item.locked { opacity: .45; }
.closet-item.r-rare { background: #eef4ff; } .closet-item.r-legend { background: #fff6d6; }

/* 조이스틱 (화면을 누른 채 끌면 그 자리에 나타남) */
#stick { position: fixed; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; z-index: 6; pointer-events: none;
  background: rgba(255, 255, 255, .14); border: 2px solid rgba(255, 255, 255, .45); }
#stickKnob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%;
  background: rgba(255, 255, 255, .85); box-shadow: 0 4px 12px rgba(0, 0, 0, .3); }

/* ===== 휴대폰 (세로 좁은 화면) ===== */
html, body { height: 100dvh; }
#help { bottom: calc(6px + env(safe-area-inset-bottom)); }
#actions { bottom: calc(30px + env(safe-area-inset-bottom)); }
@media (max-width: 800px) {
  /* 버튼을 6개씩 두 줄로: 스크롤 없이 전부 보이게 */
  #actions { flex-wrap: wrap; justify-content: center; overflow: visible; width: calc(100% - 12px); max-width: 380px; gap: 5px; padding: 7px; border-radius: 18px; }
  #actions button { width: calc(16.66% - 5px); padding: 6px 0; }
  #actions button b { font-size: 19px; }
  #actions button span { font-size: 10px; }
  #hud { top: calc(8px + env(safe-area-inset-top)); left: 8px; right: 8px; gap: 6px; }
  .pill { font-size: 11.5px; padding: 6px 10px; }
  #toast { top: calc(84px + env(safe-area-inset-top)); font-size: 12.5px; border-radius: 16px; }
  #hint { top: calc(84px + env(safe-area-inset-top)); font-size: 11px; }
  .sheet { bottom: calc(var(--act-top, 150px) + env(safe-area-inset-bottom)); max-height: calc(100dvh - var(--act-top, 150px) - 100px); padding: 14px; }
  .sheet.daily { bottom: auto; }
  #chatFeed { bottom: calc(var(--act-top, 150px) + env(safe-area-inset-bottom)); }
  .card { padding: 22px 18px 16px; }
  .label { font-size: 10px; padding: 2px 6px; }
  .note-label { max-width: 130px; font-size: 10.5px; }
}

/* 초대 안내 · 입장 화면 순위판 */
.invite-banner { background: #fff3c4; border: 1.5px solid #f0c64a; border-radius: 14px; padding: 10px 12px; margin: 0 0 12px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.invite-banner b { font-size: 14px; } .invite-banner em { font-style: normal; font-weight: 800; color: #d8482d; }
.invite-banner small { color: #8a6a00; font-weight: 700; }
.entry-rank { background: #fff; border-radius: 14px; padding: 10px 10px 6px; margin: 0 0 14px; text-align: left; font-size: 13px; }
.er-head { font-weight: 800; display: flex; align-items: baseline; gap: 6px; margin-bottom: 6px; }
.er-head small { margin-left: auto; font-weight: 500; color: #7a8193; font-size: 11px; }
.er-king { background: #eef3ff; border-radius: 10px; padding: 6px 8px; margin-bottom: 6px; font-size: 12px; }
.er-king b { color: #2d5bd8; }
.er-row { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-top: 1px solid #eee7d6; cursor: pointer; }
.er-no { width: 18px; height: 18px; border-radius: 50%; background: #1f2633; color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.er-n { margin-left: auto; font-weight: 800; }
.er-me { font-size: 11px; font-weight: 800; color: #d8482d; border: 1.5px solid #d8482d; border-radius: 999px; padding: 1px 7px; }
.er-esc { border-top: 1px solid #eee7d6; padding: 6px 4px 2px; font-size: 12px; color: #7a8193; }
.g-earn li.invite { display: flex; align-items: center; gap: 6px; }
.g-earn li.invite .mini { margin-left: auto; }
.exit-pill { pointer-events: auto; border: 0; cursor: pointer; color: #fff; font-family: inherit; }
.away-card { text-align: center; }
.away-card h2 { margin: 6px 0 6px; font-size: 20px; }
.away-card .sub { margin-bottom: 16px; }
.invite-pill { pointer-events: auto; border: 0; cursor: pointer; background: #ffcf3d; color: #1f2633; font-family: inherit; font-weight: 800; margin-left: auto; }

/* 같은 종목 개미 · 연속 출석 */
.label.same { box-shadow: 0 0 0 1.5px #ffcf3d; }
/* 오늘 다녀간 개미의 빈 튜브 이름표 */
.label.trace { background: rgba(10, 18, 34, .42); color: rgba(233, 237, 245, .75); font-weight: 500; font-size: 10px; pointer-events: auto; cursor: pointer; }
.label.trace.same { box-shadow: 0 0 0 1px rgba(255, 207, 61, .7); }
.closet-item.r-streak { box-shadow: inset 0 0 0 2px #ffd9a8; }
.closet-item.r-streak.on { box-shadow: inset 0 0 0 3px #ff9d2e; }
.g-earn li.streak { color: #c2410c; font-weight: 700; }
#chatTabs { flex-wrap: wrap; }
#hudMarket { pointer-events: auto; cursor: pointer; }

/* 닉네임 + 뱃지 이름표: 위에 닉네임, 아래에 종목·수익률 뱃지 */
.label.named { text-align: center; line-height: 1.15; }
.label .nm { display: block; }
.label .bd { display: inline-block; margin-top: 2px; padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; font-style: normal; letter-spacing: 0;
  background: rgba(10, 18, 34, .82); color: #e9edf5; border: 1px solid rgba(255, 255, 255, .28); -webkit-text-stroke: 0; }
.label.loss2 .bd { color: #a9d0ff; } .label.loss3 .bd { color: #ffd76a; border-color: rgba(255, 215, 106, .7); }
.label.me .bd { background: #18213a; color: #ffcf3d; border-color: #ffcf3d; }
.label.trace .bd { display: none; }
.field span small { font-weight: 500; opacity: .6; }

/* 창이 열려 있을 때: 걷는 법 안내는 숨기고, 알림은 맨 위로 올려서 창 제목을 가리지 않게 */
body:has(.sheet:not(.hidden)) #hint { display: none !important; }
body:has(.sheet:not(.hidden)) #toast { top: calc(8px + env(safe-area-inset-top)) !important; z-index: 30; }

/* 이어하기 코드 */
.link-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 6px; padding: 12px 14px; border-radius: 14px; background: rgba(120, 150, 200, .14); }
.link-box small { flex-basis: 100%; font-size: 12px; opacity: .75; }
.link-box b { flex: 1; font-size: 26px; letter-spacing: 2px; font-variant-numeric: tabular-nums; user-select: all; -webkit-user-select: all; }
.link-box button { flex: none; width: auto; margin: 0; padding: 8px 14px; }
.link-label { display: block; margin: 14px 0 6px; font-size: 13px; font-weight: 700; }
#linkInput { width: 100%; box-sizing: border-box; font-size: 20px; letter-spacing: 2px; text-transform: uppercase; padding: 12px 14px; border: 2.5px solid #18213a; border-radius: 14px; background: #fff; color: #18213a; outline: none; }
#linkInput:focus { border-color: #ff9a1f; }
#linkInput::placeholder { letter-spacing: 1px; text-transform: none; color: #9aa3b5; }
.link-box button.ghost { border: 2.5px solid #18213a; border-radius: 12px; background: #fff; color: #18213a; font-weight: 700; }

/* 이모지 */
#emojiBar { position: fixed; left: 50%; bottom: calc(116px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 6; display: flex; gap: 4px; padding: 6px 8px;
  border-radius: 999px; background: #fff; border: 2.5px solid #18213a; box-shadow: 0 4px 0 #18213a; max-width: calc(100% - 16px); }
#emojiBar.hidden { display: none; }
#emojiBar button { width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: none; font-size: 24px; line-height: 1; cursor: pointer; }
#emojiBar button:active { transform: scale(1.3); background: #eef2fa; }
.bubble.emo, .ui2 .bubble.emo { background: none; border: 0; box-shadow: none; padding: 0; font-size: 40px; line-height: 1; animation: emoUp 2.2s ease forwards; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
@keyframes emoUp { 0% { opacity: 0; margin-top: 14px; scale: .3 } 12% { opacity: 1; margin-top: 0; scale: 1.25 } 22% { scale: 1 } 75% { opacity: 1; margin-top: -10px } 100% { opacity: 0; margin-top: -34px } }

/* 뽑기 연출: 캡슐 흔들림 → 등급 색 빛 → 터지며 결과 */
.g-result { position: relative; overflow: hidden; }
.g-result.rolling { min-height: 170px; gap: 12px; }
.g-cap { width: 72px; height: 88px; border-radius: 36px; border: 3px solid #18213a; background: linear-gradient(#7fd0f5 0 50%, #ffd23d 50%); position: relative; animation: capShake .9s ease-in-out infinite; box-shadow: 0 5px 0 rgba(24, 33, 58, .18); display: grid; place-items: center; }
.g-cap i { font-style: normal; font-weight: 900; font-size: 34px; line-height: 1; color: #18213a; -webkit-text-stroke: 5px #fff; paint-order: stroke fill; }
.g-cap::after { content: ''; position: absolute; left: 12px; top: 10px; width: 10px; height: 22px; border-radius: 6px; background: rgba(255, 255, 255, .7); transform: rotate(18deg); }
.g-roll { font-weight: 700; font-size: 15px; color: #5c6476; }
@keyframes capShake { 0%, 100% { transform: rotate(0) } 15% { transform: rotate(-14deg) translateX(-4px) } 30% { transform: rotate(12deg) translateX(4px) } 45% { transform: rotate(-9deg) } 60% { transform: rotate(8deg) translateY(-6px) } 80% { transform: rotate(-4deg) } }
.g-result.glow .g-cap { animation: capGlow .32s ease-in-out infinite alternate; }
.g-result.glow.r-common .g-cap { --gc: #b9c2d6; } .g-result.glow.r-rare .g-cap { --gc: #4a8dff; } .g-result.glow.r-legend .g-cap { --gc: #ffc21f; }
.g-result.glow.r-legend { background: radial-gradient(circle at 50% 42%, #fff3c4, #fff 70%); } .g-result.glow.r-rare { background: radial-gradient(circle at 50% 42%, #e6f0ff, #fff 70%); }
.g-result.glow.r-legend .g-roll { color: #b07a00; } .g-result.glow.r-rare .g-roll { color: #2f6fe0; }
@keyframes capGlow { from { transform: scale(1) rotate(-5deg); box-shadow: 0 0 0 4px var(--gc), 0 0 18px 4px var(--gc); } to { transform: scale(1.14) rotate(5deg); box-shadow: 0 0 0 9px var(--gc), 0 0 42px 14px var(--gc); } }
.g-result.reveal > :not(.g-conf) { animation: gPop .45s cubic-bezier(.2, 1.6, .4, 1) both; }
.g-result.reveal > :nth-child(2) { animation-delay: .06s; } .g-result.reveal > :nth-child(3) { animation-delay: .12s; } .g-result.reveal > :nth-child(4) { animation-delay: .18s; } .g-result.reveal > :nth-child(5) { animation-delay: .24s; }
@keyframes gPop { from { opacity: 0; transform: scale(.4) } to { opacity: 1; transform: scale(1) } }
.g-conf { position: absolute; top: 46%; width: 8px; height: 12px; border-radius: 2px; pointer-events: none; animation: gConf 1.3s cubic-bezier(.15, .7, .3, 1) forwards; }
@keyframes gConf { 0% { opacity: 1; transform: translate(0, 0) rotate(0) } 60% { opacity: 1; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) } 100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 150px)) rotate(var(--rot)) } }

/* 칭호 */
.tt { display: inline-block; font-style: normal; font-weight: 800; font-size: 10px; line-height: 1.5; letter-spacing: .2px; padding: 0 7px; border-radius: 3px; white-space: nowrap;
  --tc: #ffad55; color: var(--tc); background: linear-gradient(#27324f, #141b30); border: 1.5px solid var(--tc); box-shadow: 0 1px 0 rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(0, 0, 0, .35); text-shadow: none; }
.tt::before, .tt::after { content: '◆'; font-size: 6px; vertical-align: 1.5px; margin: 0 4px 0 0; opacity: .9; } .tt::after { margin: 0 0 0 4px; }
.tt.g2 { --tc: #dfe6f2; } .tt.g3 { --tc: #ffd23d; background: linear-gradient(#4a3510, #241803); }
/* 명패: 칭호 띠 + 이름 + 수익률을 한 판에 묶음 */
.label.plate, .ui2 .label.plate { --tc: #ffad55; padding: 0; border: 1.5px solid var(--tc); border-radius: 7px; overflow: hidden; background: rgba(20, 27, 48, .92); box-shadow: 0 2px 0 rgba(0, 0, 0, .35); -webkit-text-stroke: 0; text-decoration: none; line-height: 1.2; }
.label.plate.g2 { --tc: #dfe6f2; } .label.plate.g3 { --tc: #ffd23d; }
.label.plate .tt { --tc: inherit; display: block; margin: 0; padding: 1px 10px; border: 0; border-radius: 0; box-shadow: none; background: var(--tc); color: #18213a; font-size: 10px; font-weight: 800; line-height: 1.45; }
.label.plate .tt::before, .label.plate .tt::after { color: rgba(24, 33, 58, .55); }
.label.plate .nm { display: block; padding: 2px 10px 0; text-shadow: none; }
.label.plate .nm:last-child { padding-bottom: 3px; }
.label.plate .bd, .label.plate.me .bd { display: block; margin: 0; padding: 0 10px 3px; border: 0; border-radius: 0; background: none; font-size: 10px; font-weight: 700; color: #ffd98a; }
.label.plate.loss2 .bd { color: #a9d0ff; }
.title-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 4px; }
.title-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 10px; border-radius: 12px; border: 2px solid #d5dbe8; background: #fff; color: #18213a; text-align: left; cursor: pointer; font: inherit; }
.title-item b { font-size: 14px; } .title-item b.tt { font-size: 12px; } .title-item small { font-size: 11px; color: #6b7386; }
.title-item.on { border-color: #ff9a1f; background: #fff6e6; box-shadow: inset 0 0 0 1px #ff9a1f; }
.title-item.locked { background: #f3f5fa; color: #9aa3b5; cursor: default; }

/* 남의 명패는 한 단계 작게, 멀거나 겹치면 칭호 띠를 접음 */
.label.plate:not(.me) .tt { padding: 0 7px; font-size: 9px; }
.label.plate:not(.me) .tt::before, .label.plate:not(.me) .tt::after { display: none; }
.label.plate:not(.me) .nm { padding: 1px 7px 0; font-size: 11.5px; }
.label.plate:not(.me) .nm:last-child { padding-bottom: 2px; }
.label.plate:not(.me) .bd { padding: 0 7px 2px; font-size: 9.5px; }
.label.plate.slim .tt { display: none; }
