:root {
  --void: #08080c;
  --panel: rgba(14, 14, 20, 0.86);
  --panel-solid: #12121a;
  --line: rgba(255, 255, 255, 0.10);
  --text: #f2f2f5;
  --muted: #9a9aa8;
  --accent: #c6ff3d;
  --accent-ink: #10140a;
  --danger: #ff5c6c;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--void); color: var(--text);
  font-family: "Space Grotesk", system-ui, -apple-system, Segoe UI, Roboto, sans-serif; font-size: 15px; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---------- Screens ---------- */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b)); z-index: 10; }
#screen-loading { background: radial-gradient(ellipse at 50% 55%, #120c1d 0%, #05030a 70%); }
.logo { font-weight: 700; font-size: clamp(30px, 9vw, 52px); letter-spacing: 0.14em; text-shadow: 0 0 28px rgba(155, 123, 214, 0.45); }
.logo span { color: var(--accent); }
.logo.title { font-size: clamp(32px, 10vw, 58px); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#screen-select { justify-content: space-between; pointer-events: none; }
#screen-select > * { pointer-events: auto; }
.select-head { text-align: center; }
.select-head h1 { margin: 0; }
.select-head p { margin: 6px 0 0; }
.select-stage { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 520px; margin-top: auto; }
.select-name { white-space: nowrap; font-size: clamp(17px, 5.6vw, 26px); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 20px; }
.nav-arrow { width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel);
  font-size: 30px; line-height: 1; }
.dots { display: flex; gap: 8px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--accent); }

/* ---------- Buttons ---------- */
.btn { border: 1px solid var(--line); background: #1c1c26; border-radius: 10px; padding: 10px 14px; font-weight: 500; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
.btn.ghost { background: transparent; }
.btn.big { font-size: 20px; padding: 14px 40px; white-space: nowrap; border-radius: 999px; letter-spacing: 0.08em; text-transform: uppercase; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-size: 17px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.small-btn { margin-top: 10px; width: 100%; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: auto; }
.topbar { position: absolute; top: calc(10px + var(--safe-t)); left: 10px; right: 10px; display: flex; justify-content: space-between;
  align-items: center; gap: 8px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.room-tag { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-weight: 500;
  max-width: 60vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-tag.visiting { border-color: var(--accent); }
.top-actions { display: flex; align-items: center; gap: 8px; }

/* First-person crosshair and the context button that appears when you look at a wall */
.crosshair { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: rgba(255,255,255,0.9); box-shadow: 0 0 0 2px rgba(8,8,12,0.55); pointer-events: none !important; transition: transform .12s; }
.crosshair.target { transform: scale(1.6); background: var(--accent); }
.look-btn { position: absolute; left: 50%; top: calc(50% + 34px); transform: translateX(-50%); border: 0; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px; padding: 12px 22px; box-shadow: 0 6px 24px rgba(0,0,0,0.35); }
.look-btn.danger { background: #1c1c26; color: #fff; border: 1px solid var(--danger); }
.hint { position: absolute; bottom: calc(66px + var(--safe-b)); left: 50%; transform: translateX(-50%); background: var(--panel);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--muted); white-space: nowrap; pointer-events: none; }
.hint:empty { display: none; }


/* Sit / Stand: bottom-center (above the phone controls) */
.seat-btn { position: absolute; left: 50%; bottom: calc(112px + var(--safe-b)); transform: translateX(-50%); border: 0; border-radius: 999px;
  background: #f2f2f5; color: #111; font-weight: 700; font-size: 16px; padding: 12px 24px; box-shadow: 0 6px 24px rgba(0,0,0,0.35); white-space: pre; }
.seat-btn.ghost { background: rgba(14,14,20,0.86); color: #fff; border: 1px solid var(--line); }
.seat-btn:disabled { opacity: 0.7; }
body.touch .seat-btn { bottom: calc(196px + var(--safe-b)); }

/* ---------- Controls ---------- */
body:not(.touch) .touch-only { display: none !important; }
body.touch .desk-only { display: none !important; }

/* Phone: walk arrows, bottom-left */
.dpad { position: absolute; left: 16px; bottom: calc(18px + var(--safe-b)); width: 156px; height: 156px; touch-action: none; user-select: none; -webkit-user-select: none; }
.dpad .arrow { position: absolute; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; font-size: 18px; color: #fff;
  background: rgba(10, 10, 16, 0.45); border: 1px solid var(--line); backdrop-filter: blur(4px); transition: background .08s, transform .08s; }
.dpad .up { left: 52px; top: 0; } .dpad .down { left: 52px; bottom: 0; }
.dpad .left { left: 0; top: 52px; } .dpad .right { right: 0; top: 52px; }
.dpad .arrow.on { background: var(--accent); color: var(--accent-ink); transform: scale(0.94); }

/* Phone: look joystick, bottom-right */
.joystick { position: absolute; right: 18px; bottom: calc(22px + var(--safe-b)); width: 136px; height: 136px; border-radius: 50%;
  background: rgba(10, 10, 16, 0.38); border: 1px solid var(--line); touch-action: none; backdrop-filter: blur(4px); }
.joystick .knob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%;
  background: rgba(242, 242, 245, 0.9); box-shadow: 0 2px 10px rgba(0,0,0,0.3); }
.joystick.active .knob { background: var(--accent); }
.stick-label { position: absolute; left: 0; right: 0; bottom: -20px; text-align: center; font-size: 10px; letter-spacing: 0.12em; color: rgba(255,255,255,0.55); }
.jump-btn { position: absolute; right: 54px; bottom: calc(184px + var(--safe-b)); width: 60px; height: 60px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(10, 10, 16, 0.45); font-size: 24px; backdrop-filter: blur(4px); }

/* PC: controls line */
.pc-help { position: absolute; right: 10px; bottom: calc(14px + var(--safe-b)); max-width: calc(100vw - 420px); text-align: right; font-size: 12.5px; line-height: 1.5;
  color: rgba(255,255,255,0.85); background: rgba(10,10,16,0.55); border: 1px solid var(--line); border-radius: 14px; padding: 6px 14px; pointer-events: none !important; }
@media (max-width: 760px) { .pc-help { display: none; } }   /* small windows: the chat bar needs the room */
.pc-help b { color: var(--accent); font-weight: 500; }
.pc-help.cta { top: 50%; bottom: auto; transform: translate(-50%, -88px); font-size: 14px; padding: 9px 18px; }

/* Desktop browser: Telegram login */
.tg-login { text-align: center; max-width: 340px; }
.tg-login p { margin: 8px 0; }
#tg-login-widget { min-height: 48px; display: flex; justify-content: center; margin: 14px 0; }

/* Settings button on the left side of the screen */
.side-btn { position: absolute; left: 10px; top: calc(60px + var(--safe-t)); width: 58px; height: 54px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 20px; gap: 1px; }
.side-btn span { font-size: 10.5px; color: var(--muted); }

/* Add NFT sheet: no dark backdrop and shorter, so you can watch your hands on the wall while choosing */
#sheet-nfts { background: transparent; }
#sheet-nfts .sheet-card { max-height: 56vh; }

/* ---------- Settings ---------- */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.char-card { position: relative; border: 1px solid var(--line); border-radius: 12px; background: #0b0b11; padding: 0 0 6px; overflow: hidden; }
.char-card img { width: 100%; aspect-ratio: 4 / 5; object-fit: contain; display: block; background: radial-gradient(circle at 50% 70%, #1c1c26, #0b0b11 70%); }
.char-card .ph { width: 100%; aspect-ratio: 4 / 5; }
.char-card b { display: block; font-size: 13px; font-weight: 500; margin-top: 4px; }
.char-card.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.char-card.on::after { content: "✓"; position: absolute; top: 6px; right: 8px; color: var(--accent-ink); background: var(--accent);
  border-radius: 999px; width: 20px; height: 20px; font-size: 12px; line-height: 20px; font-weight: 700; }
.char-card:disabled { opacity: 0.6; }
.wallet-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wallet-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; font-family: ui-monospace, Menlo, monospace; font-size: 13.5px; }
.wallet-list li .tag { font-family: inherit; font-size: 11px; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 1px 8px; }
.wallet-list li button { background: none; border: 0; color: var(--muted); font-size: 12px; }

/* ---------- Chat ---------- */
.chat { position: absolute; left: 10px; bottom: calc(10px + var(--safe-b)); width: min(380px, calc(100vw - 20px));
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; backdrop-filter: blur(8px); }
.chat-toggle { width: 100%; text-align: left; background: none; border: 0; padding: 10px 14px; font-weight: 500; display: flex; gap: 8px; align-items: center; }
.badge { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 7px; font-size: 12px; }
.chat.collapsed .chat-body { display: none; }
.chat-log { list-style: none; margin: 0; padding: 0 14px; height: 30vh; max-height: 260px; overflow-y: auto; overscroll-behavior: contain; }
.chat-log li { padding: 3px 0; font-size: 14px; line-height: 1.35; word-wrap: break-word; }
.chat-log li b { color: var(--accent); font-weight: 500; margin-right: 6px; }
.chat-log li.me b { color: #fff; }
.chat-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; background: #0b0b11; border: 1px solid var(--line); border-radius: 10px; color: var(--text); padding: 9px 11px; font: inherit; }
.chat-form input:focus { outline: none; border-color: var(--accent); }

/* Phone: chat lives under Settings (bottom-left is for the walk arrows) */
body.touch .chat { top: calc(122px + var(--safe-t)); bottom: auto; width: auto; max-width: calc(100vw - 20px); }
body.touch .chat.collapsed .chat-title { display: none; }
body.touch .chat.collapsed .chat-toggle { width: 58px; height: 54px; padding: 0; justify-content: center; font-size: 20px; position: relative; }
body.touch .chat.collapsed .badge { position: absolute; top: 4px; right: 4px; }
body.touch .chat:not(.collapsed) { width: min(360px, calc(100vw - 20px)); }
body.touch .chat-log { height: 26vh; }
body.touch .hint { bottom: auto; top: calc(60px + var(--safe-t)); max-width: calc(100vw - 160px); white-space: normal; text-align: center; }

/* ---------- Sheets ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.5); display: flex; align-items: flex-end; justify-content: center; }
.sheet-card { width: min(560px, 100%); max-height: 86vh; overflow-y: auto; background: var(--panel-solid); border: 1px solid var(--line);
  border-radius: 18px 18px 0 0; padding: 16px 16px calc(20px + var(--safe-b)); }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet-card { border-radius: 18px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { margin: 0; font-size: 20px; }
.sheet h3 { margin: 18px 0 8px; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 8px 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { background: none; border: 0; padding: 8px 14px; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.invite-box { background: #0b0b11; border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; overflow-x: auto; }
.invite-box code { font-size: 12.5px; white-space: nowrap; }
.room-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.room-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.room-list .meta { font-size: 12.5px; color: var(--muted); }
.nft-group h4 { margin: 16px 0 8px; font-size: 13px; font-weight: 500; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
.nft-group h4 b { color: var(--text); }
.nft-actions { margin-top: 16px; }
.nft-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.nft-grid button { padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #0b0b11; aspect-ratio: 1; position: relative; }
.nft-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nft-grid span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 11px; padding: 3px 5px; background: rgba(0,0,0,0.6);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }

.toast { position: fixed; left: 50%; top: 38%; transform: translateX(-50%); z-index: 30; background: var(--panel-solid);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; max-width: 90vw; text-align: center; }
.toast.error { border-color: var(--danger); }

/* ---- Welcome popups (first visit) ---- */
.intro { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: rgba(4, 4, 8, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.intro.hidden { display: none; }
.intro-card { width: min(460px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: #12121a; border: 1px solid var(--line);
  border-radius: 18px; padding: 26px 22px 18px; box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 40px rgba(155,123,214,0.15); text-align: center; }
.intro-step h2 { margin: 6px 0 10px; font-size: 21px; }
.intro-step p { margin: 0 0 6px; line-height: 1.5; color: #d6d6de; }
.intro-step a { color: var(--accent); font-weight: 600; }
.intro-logo { font-size: 30px; margin-bottom: 6px; }
.intro-icon { font-size: 38px; line-height: 1; margin-bottom: 4px; }
.intro-check { display: flex; gap: 10px; align-items: flex-start; text-align: left; margin-top: 16px; padding: 12px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,0.03); font-size: 14px; line-height: 1.4; }
.intro-check input { width: 20px; height: 20px; flex: none; margin: 1px 0 0; accent-color: var(--accent); cursor: pointer; }
.intro-check.nudge { border-color: #ff6b6b; animation: introShake 0.3s; }
@keyframes introShake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.intro-img { display: block; width: 100%; margin-top: 12px; border-radius: 12px; border: 1px solid var(--line); }
.intro-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.intro-dots { margin: 0; }
#intro-ok { min-width: 120px; padding: 12px 18px; }
#intro-ok.off { opacity: 0.4; cursor: not-allowed; }
.intro-card.pop-in { animation: introPopIn 0.28s cubic-bezier(.2,.9,.3,1.25); }
.intro-card.pop-out { animation: introPopOut 0.22s ease-in forwards; }
@keyframes introPopIn { from { opacity: 0; transform: scale(0.8) translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes introPopOut { to { opacity: 0; transform: scale(0.85); } }

/* ---- Wallet verification steps ---- */
.verify-steps { list-style: none; counter-reset: vs; margin: 14px 0 12px; padding: 0; display: grid; gap: 10px; }
.verify-steps li { counter-increment: vs; position: relative; padding: 10px 12px 10px 46px; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255,255,255,0.03); line-height: 1.45; font-size: 14px; }
.verify-steps li::before { content: counter(vs); position: absolute; left: 12px; top: 10px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 13px; }
.verify-steps code { background: rgba(255,255,255,0.08); padding: 1px 6px; border-radius: 6px; color: var(--accent); }
.verify-result { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; font-size: 14px; border: 1px solid var(--line); }
.verify-result.ok { border-color: var(--accent); color: var(--accent); background: rgba(198,255,61,0.07); }

/* "My room" button next to the room name while visiting someone */
.go-home-btn { margin-left: 8px; border: 1px solid var(--accent); background: var(--panel); color: var(--text); border-radius: 999px;
  padding: 7px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.top-left { display: flex; align-items: center; gap: 0; flex-wrap: wrap; pointer-events: auto; }
.go-home-btn.hidden { display: none; }
/* falling into the void: a quick fade back in */
.void-flash { position: fixed; inset: 0; background: #05030a; opacity: 0; pointer-events: none; z-index: 40; }
.void-flash.on { animation: voidFlash 0.9s ease-out; }
@keyframes voidFlash { 0% { opacity: 1; } 100% { opacity: 0; } }

/* small second line inside a big button, e.g. "Generate Box (this cannot be undone)" */
.btn-note { display: block; font-size: 12px; letter-spacing: 0.02em; text-transform: none; font-weight: 500; opacity: 0.75; margin-top: 2px; }

/* Emotes in Settings */
.emote-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.emote-btn { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border-radius: 12px;
  border: 1px solid var(--line); background: #1c1c26; font-weight: 600; font-size: 14px; cursor: pointer; }
.emote-btn span { font-size: 26px; line-height: 1; }
.emote-btn small { position: absolute; top: 6px; right: 8px; font-size: 11px; opacity: 0.55; font-weight: 500; }
.emote-btn:active { transform: scale(0.97); }
body.touch .desk-only { display: none; }

/* Info card for the hung NFT you're looking at */
.nft-info { position: absolute; left: 50%; top: calc(50% + 84px); transform: translateX(-50%); display: flex; align-items: center; gap: 12px;
  max-width: min(92vw, 460px); background: rgba(12,12,18,0.88); border: 1px solid var(--line); border-radius: 14px; padding: 9px 10px 9px 14px;
  backdrop-filter: blur(8px); box-shadow: 0 8px 28px rgba(0,0,0,0.4); pointer-events: auto; }
.nft-info-text { display: flex; flex-direction: column; min-width: 0; }
.nft-info-text b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nft-info-text span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nft-info-text span:empty { display: none; }
.nft-info-btn { flex: none; border: 0; border-radius: 999px; padding: 9px 14px; font-weight: 700; font-size: 13.5px; cursor: pointer;
  background: #2081e2; color: #fff; }                 /* OpenSea blue */
.nft-info-btn small { font-weight: 500; opacity: 0.8; }

/* Hub */
.nft-info-btn.hub-visit { background: var(--accent); color: var(--accent-ink); }
.nft-info-btn.hidden { display: none; }
.hub-go { width: 100%; margin-top: 4px; }

/* Settings tabs */
.tabs { display: flex; gap: 4px; margin: 14px 0 12px; padding: 4px; background: rgba(255,255,255,0.04); border: 1px solid var(--line); border-radius: 12px; }
.tab { flex: 1; border: 0; background: none; color: var(--muted); padding: 9px 4px; border-radius: 9px; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.tab.on { background: #2a2a38; color: var(--text); }
.tab-panel.hidden { display: none; }
@media (max-width: 380px) { .tab { font-size: 12px; } }
/* Coins */
.coin-pill { margin-left: 8px; border: 1px solid rgba(255,206,77,0.55); background: var(--panel); color: #ffd66b; border-radius: 999px; padding: 7px 12px; font-size: 13px; cursor: pointer; }
.coin-pill b { color: #fff; }
.coin-balance { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 2px; }
.coin-balance span { font-size: 26px; }
.coin-balance b { font-size: 30px; }
.coin-balance small { color: var(--muted); font-size: 14px; }
.coin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 10px 0; }
.coin-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #17171f; display: flex; flex-direction: column; }
.coin-card img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #222230; display: block; }
.coin-card .cc-body { padding: 7px 8px 8px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.coin-card .cc-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coin-card .cc-coll { font-size: 11px; color: var(--muted); }
.coin-card button { margin-top: auto; border: 0; border-radius: 8px; padding: 7px 4px; font-weight: 700; font-size: 12.5px; cursor: pointer; background: #ffd66b; color: #2a1d00; }
.coin-card button:disabled { background: #2a2a36; color: var(--muted); cursor: default; }

/* Companion Shop (Hub) + companion picker (Settings → Character) */
.nft-info-btn.shop-buy { background: #ffd66b; color: #2a1d00; }
.nft-info-btn.shop-buy.need { background: #2a2a38; color: var(--text); }
.nft-info-btn.shop-buy:disabled { opacity: 0.6; cursor: default; }
.sub-head { font-size: 14px; margin: 16px 0 8px; }
.pet-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pet-btn { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: #17171f; color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; }
.pet-btn span { font-size: 17px; line-height: 1; }
.pet-btn.on { border-color: #ffd66b; background: #2b2410; }

/* Welcome popups: free-to-play note, coin rates, shop prices */
.intro-note { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,0.03); }
.intro-note p { margin: 0 0 4px; font-size: 14px; }
.intro-note p:last-child { margin: 0; }
.ens-copy { border: 0; background: rgba(198,255,61,0.12); color: var(--accent); font: inherit; font-weight: 700; padding: 1px 8px; border-radius: 999px; cursor: pointer; }
.intro-rates { list-style: none; margin: 8px 0 6px; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.intro-rates li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; font-size: 14px; }
.intro-rates li + li { border-top: 1px solid var(--line); }
.intro-rates b { color: #ffd66b; white-space: nowrap; }
.intro-small { font-size: 13px; color: var(--muted) !important; }

/* Settings → Character → Companions */
.pet-card .ph.none { display: grid; place-items: center; font-size: 34px; }
#pet-note.empty-note { padding: 14px; border: 1px dashed var(--line); border-radius: 12px; text-align: center; color: var(--text); }
#pet-note a { color: var(--accent); font-weight: 700; }
#char-more { margin-top: 8px; }

/* Coins tab: Coin Checker */
.coin-check { margin: 12px 0 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,0.03); }
.coin-check .cc-head { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.coin-check .cc-head small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); margin-top: 2px; }
.coin-check .cc-row { display: flex; gap: 6px; }
.coin-check select, .coin-check input { min-width: 0; background: #0b0b11; color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font: inherit; font-size: 14px; }
.coin-check select { flex: 1; padding-right: 4px; }
.coin-check input { flex: none; width: 76px; }
.coin-check .btn { flex: none; padding: 9px 14px; }
.coin-check .cc-result { margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: 13px; background: #17171f; }
.coin-check .cc-result b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.coin-check .cc-result span { color: var(--muted); }
.coin-check .cc-result.yes { background: rgba(198,255,61,0.08); border: 1px solid rgba(198,255,61,0.35); }
.coin-check .cc-result.no { background: rgba(255,107,107,0.08); border: 1px solid rgba(255,107,107,0.35); }
.coin-check .cc-result.hidden { display: none; }

/* Coins: rarity tags */
.coin-card .cc-tags { display: flex; flex-wrap: wrap; gap: 4px; min-height: 0; }
.coin-card .cc-tags span { font-size: 10.5px; padding: 1px 6px; border-radius: 999px; background: #22222e; color: var(--muted); white-space: nowrap; }
.coin-card .cc-tags .rar { font-weight: 700; color: #111; }
.rar.legendary { background: #ffd66b !important; }
.rar.epic { background: #c79bff !important; }
.rar.rare { background: #7cc7ff !important; }
.rar.trait { background: #8ef0b0 !important; }
.coin-check .cc-result .cc-rank { display: block; margin-top: 4px; font-size: 12px; }

/* Trading */
.trade-btn { bottom: calc(168px + var(--safe-b)); background: #ffd66b; color: #2a1d00; }
body.touch .trade-btn { bottom: calc(252px + var(--safe-b)); }
.trade { position: fixed; left: 50%; top: calc(64px + var(--safe-t, 0px)); transform: translateX(-50%); z-index: 25; width: min(540px, calc(100% - 20px)); }
.trade.hidden { display: none; }
.trade-card { background: var(--panel-solid); border: 1px solid var(--line); border-radius: 16px; padding: 14px; max-height: calc(100vh - 150px); overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5); animation: introPopIn 0.25s cubic-bezier(.2,.9,.3,1.2); }
.trade-head b { display: block; font-size: 16px; }
.trade-head span { display: block; font-size: 13px; color: var(--muted); margin-top: 3px; }
.trade-head span:empty { display: none; }
.trade-body:empty { display: none; }
.trade-body { margin-top: 10px; }
.trade-sec { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 10px 0 6px; }
.trade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 8px; }
.trade-item { position: relative; border: 1px solid var(--line); border-radius: 10px; background: #0b0b11; padding: 0 0 5px; color: var(--text); cursor: pointer; overflow: hidden; }
.trade-item img, .trade-item .ph { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; background: radial-gradient(circle at 50% 70%, #1c1c26, #0b0b11 70%); }
.trade-item b { display: block; font-size: 11.5px; font-weight: 600; padding: 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trade-item small { display: block; font-size: 10px; color: var(--muted); }
.trade-item.on { border-color: #ffd66b; box-shadow: inset 0 0 0 1px #ffd66b; }
.trade-item.on::after { content: "✓"; position: absolute; top: 4px; right: 6px; background: #ffd66b; color: #2a1d00; border-radius: 999px; width: 18px; height: 18px;
  font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.trade-item:disabled { opacity: 0.35; cursor: default; }
.trade-empty { font-size: 13px; color: var(--muted); padding: 8px 0; }
.trade-actions { display: flex; gap: 8px; margin-top: 12px; }
.trade-actions .btn { flex: 1; padding: 11px 10px; }
.trade-actions .btn.danger { background: #2a1a1f; border-color: #5a2a33; color: #ffb3b3; }
.trade-wait { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--muted); border-top-color: transparent; border-radius: 50%; vertical-align: -2px;
  margin-right: 6px; animation: spin 0.9s linear infinite; }

/* Settings: Go to the Hub + How to play */
.settings-top { flex-wrap: nowrap; }
.settings-top .hub-go { flex: 1.4; width: auto; margin-top: 4px; }
.settings-top .how-to { flex: 1; margin-top: 4px; white-space: nowrap; }

.nft-info-btn.shop-sell { background: #2a2a38; color: var(--text); border: 1px solid var(--line); }
.nft-info-btn.shop-sell.hidden { display: none; }
.nft-info-btn.shop-sell.need { opacity: .75; }
/* shop card: name + price on top, the buttons (Use / Buy another / Sell 1 extra) in a row underneath */
#shop-info { flex-wrap: wrap; justify-content: center; gap: 8px; padding: 10px 12px; width: min(94vw, 440px); box-sizing: border-box; }
#shop-info .nft-info-text { flex: 1 0 100%; align-items: center; text-align: center; }
#shop-info .nft-info-text span { white-space: normal; }
#shop-info .nft-info-btn { padding: 9px 11px; font-size: 13px; }
