/* 광장 화면 전용. 공통 토큰은 styles.css 의 :root 를 쓴다. */
[hidden] { display: none !important; }
:root { --buy: #e8743b; --skip: #2f9e6e; --glass: rgba(255, 255, 255, .94); --shadow: 0 10px 30px rgba(20, 30, 40, .16); }

body.game { overflow: hidden; height: 100dvh; background: #cfe7f2; }
#world { position: fixed; inset: 0; width: 100vw; height: 100dvh; display: block; touch-action: none; cursor: grab; }
#world:active { cursor: grabbing; }

.pill { white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; width: fit-content; padding: 6px 12px; border-radius: 999px; background: var(--glass); box-shadow: var(--shadow); font-weight: 700; font-size: .9375rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #2fbf71; box-shadow: 0 0 0 3px rgba(47, 191, 113, .2); }
.event-banner { margin: 12px 0 0; padding: 10px 14px; border-radius: 12px; background: #fff1c2; color: #6b4a00; font-weight: 700; }
.event-banner.small { margin: 0; padding: 6px 12px; border-radius: 999px; box-shadow: var(--shadow); font-size: .9375rem; }

/* ---------- 입장 ---------- */
.entry { position: fixed; inset: 0; display: flex; justify-content: center; align-items: flex-start; overflow-y: auto; padding: max(16px, env(safe-area-inset-top)) 16px 24px; background: linear-gradient(180deg, rgba(207, 231, 242, 0) 0%, rgba(207, 231, 242, .35) 45%, rgba(250, 249, 246, .85) 100%); }
.entry-card { width: min(100%, 460px); margin-top: min(18vh, 160px); padding: 24px; border-radius: 24px; background: var(--glass); box-shadow: var(--shadow); backdrop-filter: blur(8px); }
.entry-brand { margin: 0 0 8px; font-weight: 800; color: var(--accent); }
.entry-brand a { text-decoration: none; }
.entry h1 { margin: 10px 0 6px; font-size: 2.25rem; letter-spacing: -.04em; }
.entry-lead { margin: 0; color: var(--muted); }
.entry-form { display: grid; gap: 14px; margin-top: 18px; }
.preview-row { display: flex; gap: 14px; align-items: center; }
.preview-fields { flex: 1; display: grid; gap: 4px; }
.preview-fields label, legend { font-weight: 700; font-size: .9375rem; }
.preview-fields input, .chat input { width: 100%; min-height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font: inherit; color: inherit; }
.field-hint { margin: 0; color: var(--muted); font-size: .875rem; }
.wallet-preview { flex: none; display: grid; place-items: center; width: 96px; height: 96px; border-radius: 18px; background: var(--surface-subtle); }
.wallet-preview svg { width: 88px; height: 88px; }
fieldset { margin: 0; padding: 0; border: 0; display: grid; gap: 8px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); }
.acc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.acc-grid button { min-height: 44px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer; color: inherit; }
.acc-grid button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent); }
.acc-grid button:disabled { cursor: not-allowed; color: var(--muted); background: var(--surface-subtle); font-weight: 500; }
.acc-grid small { display: block; font-size: .75rem; }
.button.big { min-height: 52px; font-size: 1.0625rem; border-radius: 14px; width: 100%; cursor: pointer; font-family: inherit; }
.entry-links { display: grid; gap: 8px; margin-top: 16px; }
.entry-links a { display: flex; justify-content: space-between; padding: 12px 14px; border-radius: 12px; background: var(--surface-subtle); text-decoration: none; }
.entry-links b { color: var(--accent); }
.entry-help { margin: 14px 0 0; color: var(--muted); font-size: .875rem; }
.entry-foot { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: .875rem; color: var(--muted); }

/* 입장 카드 맨 아래 광고. 크기를 CSS 로 고정해 화면이 밀리지 않게 하고, 채워지지 않으면 자리째 숨긴다. */
.entry-ad { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.entry-ad-label { margin: 0 0 6px; color: var(--muted); font-size: .75rem; }
.entry-ad .adsbygoogle { display: block; width: 100%; height: 100px; }
.entry-ad:has(.adsbygoogle[data-ad-status="unfilled"]) { display: none; }

/* ---------- HUD ---------- */
.hud { position: fixed; inset: 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-top { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; }
.hud-top > * { pointer-events: auto; }
.hud-left { display: flex; flex-direction: column; gap: 6px; }
.hud-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.icon-button { min-height: 38px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--glass); box-shadow: var(--shadow); font: inherit; font-weight: 700; font-size: .9375rem; color: inherit; text-decoration: none; display: inline-flex; align-items: center; cursor: pointer; }

.deal-card { position: absolute; right: 12px; top: 64px; width: min(360px, calc(100vw - 24px)); padding: 14px; border-radius: 18px; background: var(--glass); box-shadow: var(--shadow); }
.deal-flag { margin: 0 0 8px; font-size: .8125rem; font-weight: 800; color: var(--accent); }
.deal-flag.fresh { color: #fff; background: var(--accent); width: fit-content; padding: 2px 10px; border-radius: 999px; animation: pop .4s ease; }
.deal-body { display: flex; gap: 12px; }
.deal-body img { flex: none; width: 72px; height: 72px; object-fit: cover; border-radius: 12px; background: var(--surface-subtle); }
.deal-merchant { margin: 0; color: var(--muted); font-size: .8125rem; }
.deal-card h2 { margin: 0; font-size: 1rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.deal-price { margin: 4px 0 0; display: flex; gap: 6px; align-items: baseline; }
.deal-price span { color: #c4531f; font-weight: 800; }
.deal-price strong { font-size: 1.375rem; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.vote-bar { display: flex; height: 8px; margin: 12px 0 8px; border-radius: 999px; overflow: hidden; background: var(--surface-subtle); }
.vote-bar span { transition: width .3s ease; }
#bar-buy { background: var(--buy); width: 50%; }
#bar-skip { background: var(--skip); width: 50%; }
.vote-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vote { min-height: 46px; border: 2px solid transparent; border-radius: 12px; font: inherit; font-weight: 800; color: #fff; cursor: pointer; }
.vote b { font-variant-numeric: tabular-nums; opacity: .9; }
.vote.buy { background: var(--buy); }
.vote.skip { background: var(--skip); }
.vote[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 2px #fff; }
.vote:disabled { opacity: .5; cursor: not-allowed; }
.deal-links { display: flex; gap: 8px; margin-top: 8px; }
.link-button { flex: 1; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; font-size: .875rem; font-weight: 700; color: inherit; text-decoration: none; cursor: pointer; }

.chat { position: absolute; left: 12px; bottom: max(12px, env(safe-area-inset-bottom)); width: min(420px, calc(100vw - 24px)); display: grid; gap: 6px; }
.emotes { display: flex; gap: 6px; }
.emotes button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--glass); box-shadow: var(--shadow); font-size: 1.125rem; cursor: pointer; }
.chat-row { display: flex; gap: 6px; padding: 6px; border-radius: 16px; background: var(--glass); box-shadow: var(--shadow); }
.chat-row input { min-height: 40px; border: 0; background: transparent; }
.chat-row button { flex: none; padding: 0 14px; border: 0; border-radius: 10px; background: var(--ink); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }

.sheet { width: min(420px, calc(100vw - 32px)); border: 0; border-radius: 20px; padding: 20px; box-shadow: var(--shadow); }
.sheet::backdrop { background: rgba(10, 20, 30, .35); }
.sheet form { display: grid; gap: 14px; }
.sheet h2 { margin: 0; font-size: 1.25rem; }
.sheet-hint { margin: -8px 0 0; color: var(--muted); font-size: .9375rem; }
.sheet .wallet-preview { width: 100%; height: 120px; }

.toast { position: fixed; left: 50%; bottom: 120px; transform: translate(-50%, 20px); max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 999px; background: rgba(29, 36, 32, .92); color: #fff; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.noscript { position: fixed; inset: auto 16px 16px; padding: 16px; background: #fff; border-radius: 12px; }

/* ---------- 지난 판정 ---------- */
.last-verdict { display: block; width: 100%; margin-top: 10px; padding: 8px 10px; border: 0; border-radius: 10px; background: var(--surface-subtle); font: inherit; font-size: .8125rem; color: var(--muted); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.last-verdict b { color: var(--ink); }
.history-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; max-height: min(60vh, 520px); margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.history-list a { display: flex; gap: 10px; padding: 10px; border-radius: 12px; background: var(--surface-subtle); color: inherit; text-decoration: none; }
.history-list img { flex: none; width: 52px; height: 52px; object-fit: cover; border-radius: 10px; background: #fff; }
.history-list .h-body { min-width: 0; flex: 1; }
.history-list .h-title { margin: 0; font-weight: 700; font-size: .9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-list .h-meta { margin: 2px 0 0; color: var(--muted); font-size: .8125rem; }
.history-list .h-verdict { margin: 4px 0 0; font-weight: 800; font-size: .875rem; }
.history-list .verdict-buy .h-verdict { color: var(--buy); }
.history-list .verdict-skip .h-verdict { color: var(--skip); }
.history-list .vote-bar { height: 6px; margin: 6px 0 0; }
.history-list .bar-buy { background: var(--buy); }
.history-list .bar-skip { background: var(--skip); }
.history-empty { padding: 16px; border-radius: 12px; background: var(--surface-subtle); color: var(--muted); text-align: center; }

/* ---------- 요청 게시판 ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.entry-links button { display: flex; justify-content: space-between; width: 100%; padding: 12px 14px; border: 0; border-radius: 12px; background: var(--surface-subtle); font: inherit; color: inherit; text-align: left; cursor: pointer; }
.entry-links button b { color: var(--accent); }
.sheet-body { display: grid; gap: 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-close { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--surface-subtle); font-size: 1.375rem; line-height: 1; color: inherit; cursor: pointer; }
.request-form { display: grid; gap: 8px; }
.request-form textarea { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 12px; font: inherit; resize: vertical; min-height: 84px; color: inherit; background: #fff; }
.request-row { display: flex; align-items: center; justify-content: space-between; }
.request-count, .request-note { color: var(--muted); font-size: .8125rem; }
.request-note { margin: 0; }
.request-sort { display: flex; gap: 6px; }
.request-sort button { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font: inherit; font-size: .875rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.request-sort button[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); }
.request-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; max-height: min(46vh, 420px); margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.request-list li { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; background: var(--surface-subtle); }
.request-list .r-body { min-width: 0; flex: 1; }
.request-list .r-text { margin: 0; overflow-wrap: anywhere; }
.request-list .r-meta { margin: 4px 0 0; color: var(--muted); font-size: .8125rem; }
.request-list .r-done { color: var(--skip); font-weight: 800; }
.request-like { flex: none; min-width: 52px; min-height: 40px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; font-weight: 700; color: inherit; cursor: pointer; }
.request-like[aria-pressed="true"] { border-color: #d9417b; color: #d9417b; }

@keyframes pop { from { transform: scale(.7); } to { transform: scale(1); } }

@media (max-width: 720px) {
  .entry-card { margin-top: 28vh; padding: 20px; }
  .deal-card { top: auto; right: 12px; left: 12px; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 104px); width: auto; padding: 12px; }
  .deal-body img { width: 56px; height: 56px; }
  .last-verdict { margin-top: 8px; padding: 6px 10px; }
  .count-prefix { display: none; }
  .hud-actions { gap: 4px; }
  .icon-button { min-height: 34px; padding: 0 9px; font-size: .8125rem; }
  .chat { right: 12px; width: auto; }
  .emotes button { width: 36px; height: 36px; font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) { .vote-bar span, .toast { transition: none; } .deal-flag.fresh { animation: none; } }
