/* 가챠팡 공통 스타일 — 라이트: 레트로 게임기 / 다크: 네온 오락실 */
:root {
  --bg: #fff3d1;
  --surface: #fffdf6;
  --surface-2: #ffeab0;
  --thumb: #fff8ea;
  --line: #241a4d;
  --text: #241a4d;
  --text-2: #4f4580;
  --text-3: #7d73ad;
  --accent: #ff3e8a;
  --accent-2: #19b5e0;
  --yellow: #ffc934;
  --green: #22c55e;
  --secret: #8b3dff;
  --screen: #1a1440;
  --screen-2: #261e5c;
  --screen-text: #eef6ff;
  --shadow: 4px 4px 0 var(--line);
  --shadow-lg: 7px 7px 0 var(--line);
  --glow: none;
  --grid: rgba(36,26,77,.06);
  --dash: rgba(36,26,77,.2);
  --pixel: "Galmuri11", "Pretendard", "Malgun Gothic", sans-serif;
  --body: "Pretendard", -apple-system, "Malgun Gothic", sans-serif;
}
:root[data-theme="dark"] {
  --bg: #0b0920;
  --surface: #15113a;
  --surface-2: #201a52;
  --thumb: #1a1543;
  --line: #6d5cff;
  --text: #f3f0ff;
  --text-2: #c2b8ff;
  --text-3: #8f85d0;
  --accent: #ff3ea5;
  --accent-2: #22e4ff;
  --yellow: #ffe14d;
  --green: #39ff88;
  --secret: #c06bff;
  --screen: #070514;
  --screen-2: #120d33;
  --shadow: 4px 4px 0 #000, 0 0 18px rgba(109,92,255,.35);
  --shadow-lg: 7px 7px 0 #000, 0 0 28px rgba(255,62,165,.45);
  --glow: 0 0 8px currentColor;
  --grid: rgba(109,92,255,.12);
  --dash: rgba(109,92,255,.3);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
/* 터치하면 바로 반응: 두 번 탭 확대 대기 없애고, 누를 때 회색 번쩍임 없앰 */
html { scroll-behavior: smooth; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--pixel); color: var(--text); line-height: 1.55; -webkit-font-smoothing: none;
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 2px, transparent 2px), linear-gradient(90deg, var(--grid) 2px, transparent 2px);
  background-size: 32px 32px;
  transition: background-color .25s, color .25s;
}
/* 화면 줄무늬는 배경에만 (사진·카드·창 위에는 안 덮이게) */
:root[data-theme="dark"] body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 1px, transparent 1px 3px);
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.container { max-width: 1360px; margin: 0 auto; padding: 0 20px; }
@keyframes blink { 50% { opacity: 0; } }
.blink { animation: blink 1s steps(1) infinite; }
.pic-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.only-sm, .only-lg { display: none !important; }
/* 헤더가 좁아지면 부가 버튼은 ☰ 메뉴로 */
@media (max-width: 1100px) {
  .hide-lg { display: none !important; }
  .only-lg { display: inline-flex !important; }
}

/* 상단 전광판 */
.marquee { background: var(--screen); color: var(--yellow); border-bottom: 3px solid var(--line); overflow: hidden; position: relative; font-size: 13px; height: 34px; display: flex; align-items: center; }
.marquee-track { display: flex; gap: 60px; white-space: nowrap; animation: scroll 32s linear infinite; padding-left: 100%; }
.marquee-track span { text-shadow: 0 0 6px currentColor; }
.marquee-track .hot { color: #ff7ad1; }
@keyframes scroll { to { transform: translateX(-100%); } }
.marquee button { position: absolute; right: 0; top: 0; bottom: 0; width: 40px; background: var(--screen); color: var(--screen-text); }
.marquee.hide { display: none; }

/* 버튼: 오락실 버튼처럼 눌리는 느낌 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; text-decoration: none;
  height: 40px; padding: 0 14px; border-radius: 6px; font-size: 13px; font-weight: 700;
  background: var(--surface); border: 3px solid var(--line); box-shadow: 0 4px 0 var(--line);
  transition: transform .05s, box-shadow .05s, filter .2s; position: relative;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
.btn-pink { background: var(--accent); color: #fff; }
.btn-cyan { background: var(--accent-2); color: #0b0920; }
.btn-yellow { background: var(--yellow); color: #241a4d; }
.btn-dark { background: var(--screen); color: var(--screen-text); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: 0 4px 0 var(--line); filter: grayscale(.6); }
.icon-btn { width: 40px; padding: 0; }
.btn.full { width: 100%; height: 44px; }

/* 헤더 */
header { position: sticky; top: 0; z-index: 50; background: var(--bg); border-bottom: 3px solid var(--line); }
.nav { display: flex; align-items: center; gap: 16px; height: 72px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; flex: none; }
/* 픽셀 뽑기통 마크 (16×19 도트) */
.logo-mark { width: 40px; height: 47.5px; flex: none; image-rendering: pixelated; filter: drop-shadow(2px 2px 0 rgba(26, 16, 48, .25)); }
.logo:hover .logo-mark { animation: pxjig .4s steps(2) 1; }
/* 가챠팡: 어두운 간판 위 노랑 네온 글씨. 가끔 지지직 깜빡임 */
.logo b {
  display: inline-block; padding: 4px 10px 5px; border: 3px solid var(--line); border-radius: 6px;
  background: radial-gradient(ellipse at 50% 60%, #2e2350 0%, #140c26 75%);
  box-shadow: 2px 2px 0 var(--line), inset 0 0 12px rgba(255, 238, 70, .18), 0 0 14px rgba(255, 230, 40, .35);
  font-size: 22px; line-height: 1.05; letter-spacing: .02em; font-family: "Galmuri14", var(--pixel);
  color: #fff7a8;
  text-shadow: 0 0 2px #fffbe0, 0 0 6px #fff035, 0 0 12px #ffe600, 0 0 22px #ffcc00, 0 0 34px rgba(255, 190, 0, .7);
  animation: neon 6s infinite;
}
@keyframes neon {
  0%, 89%, 93%, 96%, 100% { opacity: 1; }
  90%, 94.5% { opacity: .45; text-shadow: 0 0 2px #fff035; }
}
.logo small { display: block; margin-top: 3px; font-size: 11px; color: var(--accent-2); letter-spacing: .06em; font-weight: 700; font-family: "Galmuri11", var(--pixel); }
.search-box { flex: 1; max-width: 300px; position: relative; }
.search-box::before { content: "🔍"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; }
.search {
  width: 100%; height: 40px; padding: 0 12px 0 36px; border-radius: 6px; font-size: 13px;
  background: var(--surface); border: 3px solid var(--line); outline: none;
}
.search:focus, .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.auth-area { display: flex; align-items: center; gap: 8px; }
.nick { font-size: 13px; color: var(--accent); font-weight: 700; white-space: nowrap; }
.led {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 6px;
  background: var(--screen); border: 3px solid var(--line); color: var(--yellow); font-size: 14px; white-space: nowrap;
}
.led small { font-size: 10px; color: var(--accent-2); letter-spacing: .1em; }
.led b { text-shadow: 0 0 6px currentColor; font-weight: 400; }
.led-plus { display: none; width: 16px; height: 16px; border-radius: 3px; background: var(--yellow); color: #241a4d; font-size: 13px; line-height: 15px; text-align: center; font-weight: 700; }
.led .tk { font-size: 11px; color: var(--screen-text); padding-left: 8px; border-left: 2px solid var(--line); display: inline-flex; gap: 3px; }
.signup-cta { padding: 0 16px; font-size: 14px; }
.nick-btn { color: var(--accent); }
#soundBtn, #themeBtn { width: 34px; height: 34px; font-size: 13px; }
#soundBtn .pi { height: 22px; width: auto; display: block; }
.cnt { min-width: 20px; height: 20px; padding: 0 5px; border-radius: 4px; background: var(--accent); color: #fff; font-size: 11px; display: grid; place-items: center; border: 2px solid var(--line); }
.bell .cnt { position: absolute; top: -8px; right: -8px; }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: inline; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
.mobile-search { display: none; padding: 0 16px 12px; }

/* 히어로: 오락기 화면 */
.hero { padding: 26px 0 0; }
.cabinet { border: 4px solid var(--line); border-radius: 14px; padding: 12px; background: var(--surface-2); box-shadow: var(--shadow-lg); }
.slider { position: relative; border-radius: 8px; overflow: hidden; height: 240px; background: var(--screen); border: 3px solid var(--line); touch-action: pan-y; user-select: none; }
.slider::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0,0,0,.22) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.45)); z-index: 3; }
.stars { position: absolute; inset: 0; background-image: radial-gradient(2px 2px at 20% 30%, #fff, transparent), radial-gradient(2px 2px at 70% 20%, #fff, transparent), radial-gradient(2px 2px at 40% 80%, #fff, transparent), radial-gradient(2px 2px at 85% 65%, #fff, transparent), radial-gradient(2px 2px at 10% 75%, #fff, transparent), radial-gradient(2px 2px at 55% 50%, #fff, transparent); opacity: .6; animation: twinkle 2s steps(2) infinite; }
@keyframes twinkle { 50% { opacity: .25; } }
.slide {
  position: absolute; inset: 0; padding: 20px 48px 30px; color: var(--screen-text); display: grid; grid-template-columns: 1.4fr 1fr; align-items: center;
  opacity: 0; transition: opacity .35s ease; pointer-events: none; z-index: 2;
}
.slide.active { opacity: 1; pointer-events: auto; }
.slide .eyebrow { display: inline-block; padding: 4px 10px; border: 2px solid currentColor; font-size: 11px; letter-spacing: .12em; color: var(--yellow); text-shadow: 0 0 6px currentColor; }
.slide h1 { font-family: "Galmuri14", var(--pixel); font-size: 30px; line-height: 1.25; margin: 10px 0 6px; font-weight: 400; color: #fff; text-shadow: 3px 3px 0 var(--accent), 0 0 18px rgba(255,62,165,.6); }
.s2 h1 { text-shadow: 3px 3px 0 #1c7ed6, 0 0 18px rgba(34,228,255,.6); }
.slide p { font-family: var(--body); opacity: .85; font-size: 14px; line-height: 1.45; max-width: 600px; }
.slide .cta { display: flex; gap: 10px; margin-top: 14px; align-items: center; flex-wrap: wrap; }
.slide .cta .btn { height: 40px; font-size: 14px; border-color: #000; box-shadow: 0 4px 0 #000; }
.press { font-size: 12px; color: var(--yellow); margin-left: 6px; }
.slide-visual { position: relative; height: 160px; }
.pix .pi { width: 1em; }
.pix { position: absolute; font-size: 64px; animation: bob 1.2s steps(2) infinite; filter: drop-shadow(4px 4px 0 rgba(0,0,0,.5)); }
@keyframes bob { 50% { transform: translateY(-10px); } }
.dots { position: absolute; right: 24px; bottom: 18px; display: flex; gap: 8px; z-index: 4; }
.dots button { width: 12px; height: 12px; background: rgba(255,255,255,.35); border: 2px solid #000; }
.dots button.active { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }

/* 3단 레이아웃 */
.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr) 300px; gap: 24px; padding-top: 28px; align-items: start; }
.left { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 18px; }
.right { display: flex; flex-direction: column; gap: 18px; }

/* 게임 창 스타일 패널 */
.panel { background: var(--surface); border: 3px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.panel-head, .win-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--line); color: #fff; font-size: 13px;
}
:root[data-theme="dark"] .panel-head, :root[data-theme="dark"] .win-head { background: linear-gradient(90deg, #3b2bb5, #6d5cff); }
.panel-head h3, .win-head h3 { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.panel-head h3::before, .win-head h3::before { content: "■"; color: var(--yellow); font-size: 10px; }
.panel-head .sub { font-size: 11px; opacity: .85; color: #fff; }
.panel-head button.sub:hover { color: var(--yellow); opacity: 1; }
.win-head button { width: 28px; height: 28px; background: var(--accent); border: 2px solid #000; color: #fff; font-size: 12px; flex: none; }
.panel-body { padding: 14px; }
.panel-head .win { display: flex; gap: 4px; }
.panel-head .win i { width: 9px; height: 9px; background: rgba(255,255,255,.45); display: block; }
.live { font-size: 11px; color: var(--yellow); display: inline-flex; align-items: center; gap: 5px; }
.live::before { content: ""; width: 8px; height: 8px; background: #ff4040; box-shadow: 0 0 6px #ff4040; animation: blink 1s steps(1) infinite; }

/* 정렬: 게임 메뉴 선택 */
.sort-list { display: flex; flex-direction: column; gap: 6px; }
.sort { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; text-align: left; width: 100%; border: 3px solid transparent; }
.sort:hover { background: var(--surface-2); }
.sort.active { background: var(--surface-2); border-color: var(--line); box-shadow: 0 3px 0 var(--line); }
.sort .cursor { width: 12px; color: var(--accent); visibility: hidden; flex: none; }
.sort.active .cursor { visibility: visible; animation: blink .8s steps(1) infinite; }
.sort .ic { font-size: 18px; flex: none; display: inline-flex; }
.sort b { font-size: 14px; display: block; line-height: 1.2; font-weight: 700; }
.sort small { color: var(--text-3); font-size: 11px; }

/* 실시간 로그: 오락기 화면 */
.log-screen { background: var(--screen); padding: 10px; }
/* 스크롤 없이 5칸 고정. 새 로그가 오면 목록 전체가 한 칸 아래로 밀리고 맨 아래 로그는 칸 밖으로 사라짐 */
.log { --log-h: 66px; --log-gap: 6px; display: flex; flex-direction: column; gap: var(--log-gap); height: calc(var(--log-h) * 5 + var(--log-gap) * 4); overflow: hidden; }
.log.push > .log-item { animation: logpush .35s ease-out; }
.log.push > .log-item.fresh { animation: logpush .35s ease-out, flash .6s steps(3); }
@keyframes logpush { from { transform: translateY(calc(-1 * (var(--log-h) + var(--log-gap)))); } }
.log-item { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; padding: 7px 8px; border-left: 3px solid var(--accent-2); background: var(--screen-2); color: #c9c2ff; line-height: 1.45; height: var(--log-h); flex: none; overflow: hidden; }
.log-item > div { min-width: 0; }
/* 시간은 문장 끝에 붙여서 세 줄 안에 다 들어가게 */
.log-item .msg { margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.log-item.fresh { animation: flash .6s steps(3); }
@keyframes flash { 0%, 66% { background: var(--accent); color: #fff; } }
.log-item .le { width: 24px; height: 24px; font-size: 18px; line-height: 24px; text-align: center; flex: none; overflow: hidden; border-radius: 4px; }
.log-item b { color: #fff; font-weight: 400; }
.log-item .who { color: var(--accent-2); }
.log-item time { font-size: 10px; color: #8a80d0; margin-left: 2px; white-space: nowrap; }
.log-item.me { border-left-color: var(--yellow); }
.log-item.me .who { color: var(--yellow); }
.log-item.secret { border-left-color: var(--secret); background: linear-gradient(90deg, rgba(192,107,255,.25), var(--screen-2)); }
.log-empty { color: #8f86d6; font-size: 12px; text-align: center; padding: 22px 0; line-height: 1.8; }

/* 상품 목록 */
.list-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
.list-head h2 { font-family: "Galmuri14", var(--pixel); font-size: 24px; font-weight: 400; }
.list-head h2 span { color: var(--accent); text-shadow: var(--glow); }
.list-head h2 em { font-style: normal; }
#wishOff { height: 34px; font-size: 12px; flex: none; }
.list-head p { color: var(--text-3); font-size: 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip { height: 34px; padding: 0 12px; border: 3px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 12px; font-weight: 700; box-shadow: 0 3px 0 var(--line); }
.chip:hover { background: var(--surface-2); }
.chip.active { background: var(--accent); color: #fff; }
.chip:active { transform: translateY(3px); box-shadow: none; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card {
  background: var(--surface); border: 3px solid var(--line); border-radius: 10px; overflow: hidden;
  cursor: pointer; transition: transform .12s ease-out, box-shadow .12s ease-out; display: flex; flex-direction: column; text-align: left;
  box-shadow: var(--shadow);
}
.card:hover { transform: translate(-3px, -3px); box-shadow: var(--shadow-lg); }
.card:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--line); }
.card { content-visibility: auto; contain-intrinsic-size: auto 360px; }
.thumb { background: var(--thumb); position: relative; aspect-ratio: 3 / 4; display: grid; place-items: center; container-type: inline-size; border-bottom: 3px solid var(--line); }
.thumb .machine { width: 80%; margin-top: 4%; }
/* 마우스를 올리면 기계 사진만 크게. 카드보다 조금 크게 떠서 옆 칸을 살짝 덮음 (마우스 없는 기기에서는 안 씀) */
.thumb-photo { display: none; }
@media (hover: hover) {
  .thumb-photo {
    display: block; position: absolute; left: 50%; top: 50%; z-index: 5; width: 125%; aspect-ratio: 5 / 6;
    transform: translate(-50%, -50%) scale(.85); opacity: 0; pointer-events: none;
    background: #fff; border: 3px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-lg);
    transition: opacity .15s ease, transform .15s ease;
  }
  .thumb-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .card:has(.thumb-photo):hover { position: relative; z-index: 10; overflow: visible; content-visibility: visible; }
  .card:hover .thumb-photo { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* 휴대폰: 기계 그림을 누르면 그 칸에서 사진으로 바뀜 */
@media (hover: none) {
  .card { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  .thumb-photo {
    display: block; position: absolute; left: 6%; right: 6%; top: 50%; z-index: 3; aspect-ratio: 5 / 6;
    transform: translateY(-50%); opacity: 0; pointer-events: none;
    background: #fff; border: 3px solid var(--line); border-radius: 8px; overflow: hidden;
  }
  .thumb-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .card.photo-on .thumb-photo { opacity: 1; }
  .card.photo-on .thumb .machine { visibility: hidden; }
  .thumb .heart { z-index: 4; }
}
/* 사진을 꾹 눌러도 '이미지 저장·복사·공유' 메뉴가 뜨지 않게 (사진은 터치를 받지 않고 카드가 받음) */
.card img, .d-photo img { pointer-events: none; -webkit-touch-callout: none; -webkit-user-drag: none; user-select: none; }

/* 휴대폰 머신 상세: 사진이 있으면 기계 대신 사진을 크게, 누르면 서로 바뀜 */
.d-photo, .d-swap { display: none; }
.thumb .tags { position: absolute; top: 8px; left: 8px; right: 44px; display: flex; gap: 4px; z-index: 2; flex-wrap: wrap; }
.heart { position: absolute; top: 8px; right: 8px; z-index: 2; width: 30px; height: 30px; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line); border-radius: 6px; font-size: 15px; color: var(--text-3); }
.heart:hover { color: var(--accent); }
.heart.on { color: #fff; background: var(--accent); }
.tag { padding: 2px 6px; font-size: 10px; color: #fff; background: var(--accent); white-space: nowrap; border: 2px solid var(--line); font-weight: 700; }
.tag.new { background: var(--accent-2); color: #0b0920; }
.tag.secret { background: var(--secret); }
.tag.low { background: var(--yellow); color: #241a4d; }
.tag.dup { background: var(--accent-2); color: #0b0920; }
.card.soldout .machine { filter: grayscale(1); opacity: .5; }
.card.soldout .thumb::after { content: "GAME OVER"; position: absolute; font-family: "Galmuri14", var(--pixel); font-size: 22px; color: #fff; background: rgba(0,0,0,.7); padding: 6px 12px; border: 3px solid #fff; transform: rotate(-8deg); }
.card-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
/* 기계 이름: 굵은체는 획이 뭉쳐서 보통체 + 0.5px 그림자로 굵기를 중간쯤으로 */
.card-title { font-size: 15px; line-height: 1.4; font-weight: 400; text-shadow: .5px 0 0 currentColor; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 40px; }
.card-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; }
.coin-price { display: inline-flex; align-items: center; gap: 4px; background: var(--screen); color: var(--yellow); padding: 3px 8px; border: 2px solid var(--line); font-size: 14px; }
.coin-price b { font-weight: 400; text-shadow: 0 0 6px currentColor; }
/* 잔여 수량: HP 바 */
.hp { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 11px; color: var(--text-2); font-family: var(--body); }
.hp-left { white-space: nowrap; }
.hp b { font-size: 13px; color: var(--text); }
.hp-bar { display: flex; gap: 2px; }
.hp-bar i { width: 6px; height: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.hp-bar i.on { background: var(--green); }
.hp-bar.mid i.on { background: var(--yellow); }
.hp-bar.low i.on { background: #ff4040; }
.more { width: 100%; margin-top: 20px; height: 50px; font-size: 14px; }
.empty { grid-column: 1 / -1; text-align: center; padding: 40px 0; color: var(--text-3); font-size: 14px; line-height: 1.8; }

/* 우측 패널 */
.inv-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.inv-stats div { background: var(--screen); border: 2px solid var(--line); padding: 10px; text-align: center; }
.inv-stats b { font-size: 24px; display: block; line-height: 1.2; color: var(--yellow); font-weight: 400; text-shadow: 0 0 6px currentColor; }
.inv-stats span { font-size: 11px; color: #a79fe0; }
.hint { font-size: 11px; color: var(--text-3); margin-top: 12px; font-family: var(--body); }
.invite .big { font-family: "Galmuri14", var(--pixel); font-size: 24px; color: var(--accent); text-shadow: 2px 2px 0 var(--line); }
:root[data-theme="dark"] .invite .big { text-shadow: 0 0 10px var(--accent); }
.invite p { font-family: var(--body); font-size: 13px; color: var(--text-2); margin: 4px 0 10px; }
.invite .ref { font-size: 11px; color: var(--text-3); margin-bottom: 12px; }
.mini-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; }
.mini-item + .mini-item { border-top: 2px dashed var(--dash); }
.mini-item:hover .mini-text b { color: var(--accent); }
.rank-num { width: 34px; font-size: 12px; text-align: center; flex: none; font-weight: 700; }
.rank-1 { color: #f5b300; text-shadow: var(--glow); }
.rank-2 { color: #9aa3b5; }
.rank-3 { color: #d4844a; }
.mini-thumb { width: 42px; height: 42px; border: 2px solid var(--line); display: grid; place-items: center; font-size: 22px; flex: none; overflow: hidden; border-radius: 4px; }
.mini-text { flex: 1; min-width: 0; }
.mini-text b { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.mini-text small { color: var(--text-3); font-size: 11px; }
#ranking .mini-text b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
.mini-right { font-size: 12px; white-space: nowrap; color: var(--accent); }
.placeholder { font-size: 12px; color: var(--text-3); text-align: center; padding: 14px 0; line-height: 1.8; }

footer { margin-top: 64px; border-top: 3px solid var(--line); padding: 32px 0 48px; color: var(--text-3); font-size: 12px; background: var(--surface); }
footer .row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
footer .links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
footer .links button { color: var(--text-2); font-size: 12px; }
footer .links button:hover { color: var(--accent); }
.biz { font-family: var(--body); line-height: 1.8; }
.biz .biz-name { font-family: var(--pixel); color: var(--accent); font-size: 14px; display: block; margin-bottom: 4px; }
.biz span { margin: 0 8px; opacity: .4; }
.biz i { font-style: normal; opacity: .6; }
.biz a { color: var(--accent-2); margin-left: 6px; }

/* 픽셀 아트 뽑기 기계 (pixel-machine.js가 SVG로 그림) · 유리창 가운데에 프로필 사진 */
.machine { position: relative; width: 100%; aspect-ratio: 48 / 71; container-type: inline-size; }
.machine svg { width: 100%; height: 100%; display: block; }
/* 사진 칸: 실제 가챠 대지와 같은 세로 5:6 비율이라 대지 사진이 잘리지 않음 */
.machine .px-photo { position: absolute; left: 25%; top: 16.9%; width: 50%; aspect-ratio: 5 / 6; display: grid; place-items: center; overflow: hidden; background: #fff; font-size: 28cqw; line-height: 1; }
.machine .px-photo img { width: 100%; height: 100%; object-fit: cover; }
.machine.px-empty .px-caps { opacity: .25; }
.machine .px-knob { transform-box: fill-box; transform-origin: center; }
/* 카드에 올리면 손잡이가 까딱, 뽑을 때는 한 바퀴 돌고 캡슐·사진이 들썩 */
.card:hover .machine .px-knob { animation: pxwig .45s steps(3); }
@keyframes pxwig { 33% { transform: rotate(-45deg); } 66% { transform: rotate(20deg); } }
.machine.turning .px-knob { animation: pxturn 1.2s steps(8); }
@keyframes pxturn { to { transform: rotate(360deg); } }
.machine.turning .px-caps { animation: pxjig .16s steps(1) infinite alternate; }
@keyframes pxjig { to { transform: translateY(-1px); } }
.machine.turning .px-photo { animation: pxjigPhoto .16s steps(1) infinite alternate; }
@keyframes pxjigPhoto { to { transform: translateY(-2px); } }

/* 모달: 게임 창 */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(8,6,24,.7);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.overlay.open { display: flex; animation: fade .14s ease-out; }
/* 창·보관함·메뉴가 열려 있으면 뒤 페이지는 스크롤 안 되게, 창 안 스크롤이 끝까지 가도 뒤로 넘어가지 않게 */
html:has(.overlay.open, .drawer.open, .sheet.open) body { overflow: hidden; }
.overlay, .modal, .machine-side, .detail-main, .drawer, .drawer-list, .sheet { overscroll-behavior: contain; }
#result { z-index: 120; }
.overlay.top { z-index: 130; }
@keyframes fade { from { opacity: 0; } }
.modal {
  position: relative; width: 100%; max-width: 1000px; max-height: calc(100vh - 40px); overflow: hidden;
  background: var(--surface); border-radius: 10px; border: 4px solid var(--line); box-shadow: var(--shadow-lg);
  display: grid; grid-template-columns: 380px 1fr; animation: pop .18s cubic-bezier(.2, .9, .3, 1.15);
}
.modal.sm { max-width: 460px; display: block; overflow: auto; }
.modal.wide { max-width: 760px; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
@keyframes sheetIn { from { transform: translateY(24px); opacity: .6; } }
.d-head { display: none; }
.modal-pad { padding: 20px; }
.machine-side { padding: 28px 24px 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; position: relative; border-right: 4px solid var(--line); overflow: auto; max-height: calc(100vh - 48px); }
.machine-side .machine { width: 300px; flex: none; }
.m-wins { width: 100%; background: var(--surface); border: 3px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.m-wins .sub-title { font-size: 12px; margin-bottom: 4px; }
.win-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 12px; }
.win-row + .win-row { border-top: 2px dashed var(--dash); }
.win-row .le { width: 24px; height: 24px; font-size: 18px; line-height: 24px; text-align: center; flex: none; overflow: hidden; border-radius: 4px; }
.win-row .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-row b { color: var(--accent); }
.win-row time { font-size: 10px; color: var(--text-3); flex: none; }
.m-wins .placeholder { padding: 8px 0; }
.detail-main { display: flex; flex-direction: column; overflow: auto; max-height: calc(100vh - 48px); }
.detail-main > .win-head { position: sticky; top: 0; z-index: 2; }
.detail-inner { padding: 22px 24px 0; display: flex; flex-direction: column; gap: 16px; }
.detail-inner h3 { font-family: "Galmuri14", var(--pixel); font-size: 24px; font-weight: 400; line-height: 1.3; }
.detail-inner .meta { color: var(--text-3); font-size: 12px; }
.stats { display: flex; gap: 10px; }
.stat { flex: 1; background: var(--screen); border: 3px solid var(--line); padding: 10px 14px; }
.stat span { display: block; font-size: 11px; color: var(--accent-2); }
.stat b { font-size: 20px; color: var(--yellow); font-weight: 400; text-shadow: 0 0 6px currentColor; }
.sub-title { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.sub-title::before { content: "▶"; color: var(--accent); font-size: 11px; }
.items { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.item { border: 3px solid var(--line); border-radius: 6px; padding: 14px 8px 10px; text-align: center; position: relative; background: var(--surface-2); }
.item .e { width: 64px; height: 64px; margin: 0 auto; display: grid; place-items: center; font-size: 40px; overflow: hidden; border-radius: 6px; }
.item .e img { border: 2px solid var(--line); border-radius: 6px; }
.item .p { font-size: 12px; color: #15803d; margin-top: 6px; font-weight: 700; }
:root[data-theme="dark"] .item .p { color: var(--green); }
.item .nm { font-size: 13px; font-weight: 700; }
.item .lf { font-size: 11px; color: var(--text-3); }
.item.secret { background: linear-gradient(160deg, color-mix(in srgb, var(--secret) 25%, var(--surface-2)), var(--surface-2)); border-color: var(--secret); }
.item.secret .p { color: var(--secret); }
.item.out { opacity: .4; }
.item .tag { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); }
.draw-bar { position: sticky; bottom: 0; margin-top: 18px; padding: 14px 24px 16px; background: var(--surface); border-top: 3px solid var(--line); }
.draw-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.draw-btns .btn { height: 58px; flex-direction: column; gap: 0; line-height: 1.3; font-size: 15px; }
.draw-btns .btn small { font-size: 11px; opacity: .9; }
.notice { font-family: var(--body); font-size: 11px; color: var(--text-3); margin-top: 10px; line-height: 1.6; }
.notice b { color: var(--text-2); }

/* 결과 */
.results { max-width: 720px; display: flex; flex-direction: column; gap: 20px; padding: 28px; overflow: auto; background: var(--screen); color: var(--screen-text); }
.results h3 { text-align: center; font-family: "Galmuri14", var(--pixel); font-size: 32px; font-weight: 400; color: var(--yellow); text-shadow: 3px 3px 0 var(--accent), 0 0 18px rgba(255,225,77,.6); animation: bob .6s steps(2) infinite; }
.results .close-x { position: absolute; top: 12px; right: 12px; }
.results .close-x, .results [data-skip] { color: var(--text); }
/* 결과 제목이 ✕ 위를 덮어 클릭이 안 먹던 문제: 버튼을 맨 앞으로, 네모 전체가 눌리게 */
.results .close-x { z-index: 6; width: 44px; height: 44px; font-size: 16px; }
.res-title:not(.done) { color: #fff; animation: blink .5s steps(1) infinite; }
.res-hint { text-align: center; font-size: 12px; color: #a79fe0; font-family: var(--body); margin-top: -8px; }
.results.flash::after { content: ""; position: absolute; inset: 0; background: #fff; pointer-events: none; z-index: 5; animation: whiteflash .6s forwards; }
@keyframes whiteflash { from { opacity: .9; } to { opacity: 0; } }
/* 캡슐: 위(색)·아래(흰색) 반쪽이 갈라지며 상품이 튀어나옴 */
.cap-stage { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 30px 22px; min-height: 190px; padding: 18px 0 10px; }
.cap { position: relative; font-size: 10px; width: 9.6em; height: 9.6em; flex: none; }
.cap-stage.one .cap { font-size: 20px; }
.cap-top, .cap-bot { position: absolute; left: 0; right: 0; height: 50%; z-index: 2; transition: transform .45s cubic-bezier(.3, 1.6, .5, 1), opacity .45s; }
.cap-top { top: 0; }
.cap-bot { bottom: 0; }
.cap-top svg, .cap-bot svg { width: 100%; height: 100%; display: block; }
.cap { filter: drop-shadow(.35em .35em 0 rgba(0,0,0,.35)); }
/* 5·10회: 눌러서 여는 캡슐은 통통 튀며 기다림 */
.cap.wait:not(.shaking):not(.charging) { animation: capbob 1s steps(2) infinite; cursor: pointer; }
.cap.wait:nth-child(2n):not(.shaking) { animation-delay: .5s; }
@keyframes capbob { 50% { transform: translateY(-.5em); } }
.cap.shaking { animation: capshake .26s steps(4) infinite; }
.cap-stage.one .cap.shaking { animation-duration: .52s; }
@keyframes capshake { 25% { transform: rotate(-12deg) translateX(-.3em); } 75% { transform: rotate(12deg) translateX(.3em); } }
/* 레어 예고: 무지개(시크릿)·황금(LAST ONE)으로 물들며 빛줄기 */
.cap-glow {
  position: absolute; inset: -2.6em; border-radius: 50%; z-index: 0; opacity: 0; pointer-events: none;
  background: repeating-conic-gradient(rgba(192,107,255,.65) 0 12deg, transparent 12deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%); mask: radial-gradient(circle, #000 30%, transparent 70%);
}
.cap.charging .cap-glow, .cap.open.rare .cap-glow { opacity: 1; animation: spin 3s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.cap.charging { animation: capshake .12s steps(4) infinite; filter: drop-shadow(0 0 1.2em #ffe14d); }
.cap.charging .cap-top svg { animation: rainbow .5s steps(6) infinite; }
@keyframes rainbow { to { filter: hue-rotate(360deg); } }
.cap.open { animation: none; filter: none; }
.cap.open .cap-top { transform: translate(-1.6em, -4.2em) rotate(-35deg); opacity: 0; }
.cap.open .cap-bot { transform: translate(1.2em, 3.2em) rotate(22deg); opacity: 0; }
.cap-item {
  position: absolute; inset: -1em; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4em;
  opacity: 0; transform: scale(.2); pointer-events: none; transition: transform .4s cubic-bezier(.3, 1.8, .5, 1) .08s, opacity .2s .08s;
}
.cap.open .cap-item { opacity: 1; transform: none; }
.cap-item .e { font-size: 4.6em; width: 1.3em; height: 1.3em; display: grid; place-items: center; overflow: hidden; border-radius: .15em; line-height: 1; filter: drop-shadow(0 .05em 0 rgba(0,0,0,.4)); }
/* 사진은 정사각형으로 자르지 않고, 올린 사진의 가로세로 비율 그대로 (긴 쪽만 맞춤) */
.cap-item .e:has(img) { width: auto; height: auto; overflow: visible; }
.cap-item .e img { width: auto; height: auto; max-width: 1.6em; max-height: 1.6em; object-fit: contain; border-radius: .1em; }
.cap-item .n { font-size: 1.2em; color: #fff; text-align: center; line-height: 1.25; max-width: 9em; }
.spark { position: absolute; left: 50%; top: 50%; width: .9em; height: .9em; margin: -.45em; background: var(--yellow); z-index: 1; pointer-events: none; animation: spark .7s ease-out forwards; }
.spark:nth-child(odd) { background: var(--accent-2); }
@keyframes spark { from { transform: rotate(var(--a)); opacity: 1; } to { transform: rotate(var(--a)) translateX(8em) scale(.3); opacity: 0; } }
.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* 폼 */
.tabs { display: flex; border-bottom: 3px solid var(--line); }
.tab { flex: 1; height: 42px; font-size: 13px; font-weight: 700; background: var(--surface-2); border-right: 3px solid var(--line); }
.tab:last-child { border-right: 0; }
.tab.active { background: var(--accent); color: #fff; }
.form { display: flex; flex-direction: column; gap: 12px; }
.field label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.field .help { font-family: var(--body); font-size: 11px; color: var(--text-3); margin-top: 3px; }
.social { display: grid; gap: 10px; text-align: center; }
.social-lead { font-family: var(--body); font-size: 14px; line-height: 1.6; margin: 4px 0 6px; }
.social .help { font-family: var(--body); font-size: 11px; color: var(--text-3); }
.btn-social { display: flex; align-items: center; justify-content: center; gap: 10px; height: 52px; border: 3px solid var(--line); border-radius: 8px; font-family: var(--body); font-weight: 800; font-size: 16px; text-decoration: none; box-shadow: 0 4px 0 var(--line); transition: transform .08s, box-shadow .08s; }
.btn-social:hover { transform: translateY(-1px); }
.btn-social:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.btn-social .ico { width: 24px; text-align: center; font-size: 18px; }
.btn-social.kakao { background: #fee500; color: #191919; }
.btn-social.naver { background: #03c75a; color: #fff; }
.btn-social.naver .ico { font-weight: 900; font-family: Arial, sans-serif; }
.input { width: 100%; height: 42px; padding: 0 12px; border: 3px solid var(--line); border-radius: 6px; background: var(--surface); font-family: var(--body); font-size: 14px; outline: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 12px; font-family: var(--body); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.check button { color: var(--accent); text-decoration: underline; font-size: 11px; margin-left: auto; }
.form-error { color: #ff4040; font-size: 12px; min-height: 18px; font-family: var(--body); }
.amounts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.amount { height: 58px; border: 3px solid var(--line); border-radius: 6px; background: var(--surface-2); font-size: 16px; box-shadow: 0 3px 0 var(--line); }
.amount { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.amount.active { background: var(--yellow); color: #241a4d; outline: 3px solid var(--accent); outline-offset: 2px; }
.box-note { border: 2px dashed var(--line); padding: 10px 12px; font-family: var(--body); font-size: 12px; color: var(--text-2); background: var(--surface-2); line-height: 1.7; }
.box-note.warn { border-color: var(--accent); }

/* 보관함 드로어 */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 100%; z-index: 150;
  background: var(--surface); border-left: 4px solid var(--line);
  transform: translateX(100%); transition: transform .22s cubic-bezier(.2, .8, .3, 1); display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-info { margin: 14px 16px 0; }
.drawer-list { flex: 1; overflow: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.inv-item { display: flex; align-items: center; gap: 10px; padding: 8px; border: 2px solid var(--line); background: var(--surface-2); border-radius: 6px; }
.inv-item input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.inv-item .e { font-size: 24px; width: 42px; height: 42px; display: grid; place-items: center; background: var(--screen); border: 2px solid var(--line); flex: none; overflow: hidden; }
.inv-item .t { flex: 1; min-width: 0; font-size: 13px; line-height: 1.35; font-weight: 700; }
.inv-item .t small { display: block; color: var(--text-3); font-size: 11px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-item .t .tag { margin-left: 4px; vertical-align: 1px; }
.inv-item .btn { height: 32px; padding: 0 8px; font-size: 11px; box-shadow: 0 3px 0 var(--line); border-width: 2px; }
.drawer-foot { padding: 14px 16px; border-top: 3px solid var(--line); display: flex; gap: 8px; }
.drawer-foot .btn { height: 48px; font-size: 13px; }
.drawer-foot .grow { flex: 1; }
.ship-card { border: 2px solid var(--line); border-radius: 6px; padding: 10px 12px; background: var(--surface-2); font-size: 12px; display: flex; flex-direction: column; gap: 6px; }
.ship-card .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ship-card .items-line { font-family: var(--body); color: var(--text-2); }
.st { font-size: 10px; padding: 2px 6px; border: 2px solid var(--line); font-weight: 700; white-space: nowrap; }
.st-requested { background: var(--surface); }
.st-preparing { background: var(--accent-2); color: #0b0920; }
.st-shipped { background: var(--yellow); color: #241a4d; }
.st-delivered { background: var(--green); color: #0b0920; }
.scrim { position: fixed; inset: 0; z-index: 140; background: rgba(8,6,24,.5); display: none; }
.scrim.open { display: block; }

/* 알림함 / 모바일 메뉴 */
.noti-panel { position: fixed; top: 80px; right: 16px; width: 340px; max-width: calc(100% - 32px); max-height: 60vh; overflow: auto; z-index: 160; background: var(--surface); border: 3px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lg); display: none; }
.noti-panel.open { display: block; }
.noti { padding: 10px 14px; font-size: 12px; border-top: 2px dashed var(--dash); font-family: var(--body); cursor: default; }
.noti[data-mid] { cursor: pointer; }
.noti.unread { background: var(--surface-2); }
.noti time { display: block; font-size: 10px; color: var(--text-3); }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 160; background: var(--surface); border-top: 4px solid var(--line); padding: 16px 16px 24px; display: none; flex-direction: column; gap: 10px; border-radius: 14px 14px 0 0; }
.sheet.open { display: flex; }
.sheet .btn { width: 100%; justify-content: flex-start; height: 46px; }
/* 넓은 화면에서는 닉네임 아래 드롭다운으로 */
@media (min-width: 1101px) {
  .sheet { left: auto; right: 16px; bottom: auto; top: 112px; width: 280px; border: 3px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lg); gap: 8px; padding: 14px; }
  .sheet .btn { height: 40px; }
}
/* 좁은 화면의 메뉴: 오른쪽에서 밀려 나오는 화면 1/3보다 조금 넓은 창 */
@media (max-width: 1100px) {
  #menuSheet {
    display: flex; left: auto; top: 0; right: 0; bottom: 0; width: clamp(165px, 44vw, 340px);
    border: 0; border-left: 4px solid var(--line); border-radius: 0; box-shadow: var(--shadow-lg);
    padding: 16px 10px calc(16px + env(safe-area-inset-bottom)); gap: 8px; overflow-y: auto;
    transform: translateX(100%); visibility: hidden; transition: transform .22s cubic-bezier(.2, .8, .3, 1), visibility 0s .22s;
  }
  #menuSheet.open { transform: none; visibility: visible; transition: transform .22s cubic-bezier(.2, .8, .3, 1); }
  #menuSheet .btn { height: auto; min-height: 42px; padding: 8px 10px; font-size: 12px; line-height: 1.3; white-space: normal; text-align: left; flex: none; }
  #menuSheet .nick { font-size: 12px; line-height: 1.5; }
  /* 가입 버튼 문구는 한 줄로 */
  #menuSheet [data-act="signup"] { white-space: nowrap; font-size: 11px; padding: 8px 4px; justify-content: center; gap: 0; }
  #menuSheet [data-act="signup"] .arr { font-size: 8px; margin-right: 3px; }
}
@media (max-width: 640px) {
  /* 휴대폰은 스탬프가 하단 탭의 보관함에 있고, 메뉴 창이 좁아서 뺌 */
  #menuSheet .stamp { display: none; }
}

/* 시크릿·라스트원 전체 알림 */
.big-alert { position: fixed; top: 86px; left: 50%; transform: translate(-50%, -20px); z-index: 350; background: var(--screen); color: #fff; border: 3px solid var(--yellow); padding: 12px 20px; font-size: 14px; box-shadow: 0 0 24px rgba(255,225,77,.6), 5px 5px 0 #000; opacity: 0; pointer-events: none; transition: .22s ease-out; text-align: center; width: max-content; max-width: calc(100% - 32px); }
.big-alert.show { opacity: 1; transform: translate(-50%, 0); }
.big-alert b { color: var(--yellow); }
.big-alert small { display: block; font-size: 11px; color: #a79fe0; }

/* 안내 페이지 */
.info { font-family: var(--body); font-size: 14px; line-height: 1.75; color: var(--text-2); }
.info h4 { font-family: var(--pixel); color: var(--text); margin: 18px 0 6px; font-size: 14px; }
.info ul { padding-left: 18px; }
.odds { border-top: 2px dashed var(--dash); }
.odds summary { cursor: pointer; padding: 10px 0; font-family: var(--pixel); font-size: 13px; color: var(--text); }
.odds-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 12px; }
.odds-table th { text-align: left; padding: 6px; background: var(--surface-2); border: 1px solid var(--dash); }
.odds-table td { padding: 6px; border: 1px solid var(--dash); }

/* 토스트: 게임 대화창 */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); z-index: 500;
  background: var(--screen); color: #fff; padding: 12px 18px; border: 3px solid var(--yellow); font-size: 13px;
  box-shadow: 4px 4px 0 #000; opacity: 0; pointer-events: none; transition: .18s ease-out; max-width: calc(100% - 32px); text-align: center;
}
.toast::before { content: "▶ "; color: var(--yellow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 반응형 */
@media (max-width: 1200px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .right { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .hide-md { display: none !important; }
  .layout { grid-template-columns: 1fr; }
  .left { position: static; }
  .sort-list { flex-direction: row; }
  .sort { flex-direction: column; text-align: center; gap: 2px; }
  .sort small, .sort .cursor { display: none; }
  .log { max-height: 220px; }
  .modal:not(.sm) { grid-template-columns: 1fr; overflow: auto; }
  .machine-side { border-right: 0; max-height: none; overflow: visible; }
  /* 한 줄로 쌓일 때는 머신 이름·정보를 머신 위에 */
  .d-head { display: block; width: 100%; }
  .d-head h3 { font-family: "Galmuri14", var(--pixel); font-size: 22px; font-weight: 400; line-height: 1.3; }
  .d-head .meta { color: var(--text-3); font-size: 12px; }
  .d-title { display: none; }
  .detail-main { max-height: none; overflow: visible; }
  .machine-side .machine { width: 240px; }
  /* 한 줄로 쌓이면 머신 번호·✕가 기계 아래로 밀려나서, 맨 위로 올려 고정 */
  #detailBody { display: flex; flex-direction: column; }
  #detailBody .detail-main { display: contents; }
  #detailBody .win-head { order: -1; position: sticky; top: 0; z-index: 3; flex: none; }
  #detailBody .machine-side, #detailBody .detail-inner, #detailBody .draw-bar { flex: none; }
  /* 첫 화면에 머신이 보이도록: 정렬은 한 줄, 로그는 최신 1건만 */
  .layout { gap: 12px; padding-top: 16px; }
  .layout > * { min-width: 0; }
  .left { gap: 12px; }
  .sort-panel .panel-head { display: none; }
  .sort-panel .panel-body { padding: 6px; }
  .sort-list { gap: 4px; }
  .sort { padding: 6px 4px; flex-direction: row; justify-content: center; gap: 6px; flex: 1; min-width: 0; width: auto; }
  .sort .ic { font-size: 15px; }
  .log-panel { display: flex; align-items: stretch; }
  .log-panel .panel-head { flex: none; padding: 0 10px; }
  .log-panel .panel-head h3 { display: none; }
  .log-panel .log-screen { flex: 1; min-width: 0; padding: 6px; }
  .log-panel .log-item:not(:first-child) { display: none; }
  .log-panel .log { height: auto; }
  .log-panel .log.push > .log-item { animation: none; }
  .log-panel .log-item { padding: 4px 8px; height: auto; }
  .log-panel .log-item > div, .log-panel .log-item .msg { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .log-panel .log-item time { display: none; }
  .log-panel .log-empty { padding: 4px 0; }
}
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  /* 휴대폰은 화면이 좁아서 상단이 따라 내려오면 머신 볼 자리가 줄어듦 → 맨 위에만 둠 */
  header { position: static; }
  /* 머신 상세: 휴대폰 화면 전체를 쓰는 창으로. 100dvh는 주소창을 뺀 실제 보이는 높이라 아래 안내문이 안 잘림 */
  #detail { padding: 0; align-items: stretch; }
  #detail .modal { max-width: none; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; border: 0; animation: sheetIn .16s ease-out; }
  #detail .draw-bar { padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); }
  #detail .draw-btns .btn { height: 52px; }
  .machine-side.has-photo .d-swap { display: block; font-size: 11px; color: var(--text-3); margin: -8px 0 0; }
  .machine-side.show-photo .machine { display: none; }
  .machine-side.show-photo .d-photo {
    display: block; width: 100%; max-width: 360px; aspect-ratio: 5 / 6; padding: 0; flex: none;
    background: #fff; border: 3px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow);
  }
  .d-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .only-sm { display: inline-flex !important; }
  .hide-sm { display: none !important; }
  .nav { gap: 8px; height: 64px; }
  .nav-right { gap: 5px; }
  .nav .btn { height: 36px; padding: 0 9px; }
  .nav .icon-btn { width: 36px; padding: 0; }
  .lbl { display: none; }
  .led { height: 36px; padding: 0 8px; font-size: 12px; }
  .led small { display: none; }
  .logo b { font-size: 17px; padding: 3px 7px 4px; }
  .logo small, .search-box { display: none; }
  .logo-mark { width: 28px; height: 33px; }
  .mobile-search { display: block; }
  .noti-panel { top: 120px; }
  .big-alert { top: 128px; }
  .hero { padding-top: 14px; }
  .cabinet { padding: 6px; border-width: 3px; }
  .slider { height: 175px; }
  .slide { grid-template-columns: 1fr; padding: 16px 18px 40px; }
  .slide .eyebrow { font-size: 10px; padding: 2px 8px; }
  .slide h1 { font-size: 20px; margin: 8px 0 0; }
  .slide p, .press { display: none; }
  /* 버튼 두 개가 한 줄에 들어가야 배너 밖으로 넘치지 않음 */
  .slide .cta { margin-top: 12px; gap: 6px; flex-wrap: nowrap; }
  .slide .cta .btn { height: 36px; font-size: 12px; padding: 0 7px; }
  .slide-visual { display: none; }
  .marquee { height: 28px; font-size: 12px; }
  .mobile-search { padding-bottom: 8px; }
  .list-head { margin-bottom: 8px; }
  .list-head h2 { font-size: 18px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px 4px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .signup-cta { padding: 0 10px; font-size: 12px; }
  .led .tk { display: none; }
  .led-plus { display: inline-block; }
  .charge-btn { display: none !important; }
  .nav .btn-cyan[data-act="inv"] { width: 36px; padding: 0; }
  .nav .btn-cyan[data-act="inv"] .cnt { position: absolute; top: -8px; right: -8px; }
  .led { gap: 5px; }
  .dots { right: 16px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card-meta { flex-direction: column; align-items: flex-start; }
  .card-meta .hp { align-items: flex-start; }
  .right { grid-template-columns: 1fr; }
  .items { grid-template-columns: repeat(2, 1fr); }
  .cap { font-size: 8px; }
  .cap-stage.one .cap { font-size: 16px; }
  .row2 { grid-template-columns: 1fr; }
}
/* 휴대폰 하단 탭 바 (tabbar.js) */
.tabbar, .tab-scrim, .tab-sheet { display: none; }

@media (max-width: 640px) {
  :root { --tabbar-h: 60px; }
  /* 기계 목록 밑에 있던 칸들은 탭 창으로 옮김 */
  .right { display: none; }
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  footer { margin-top: 32px; }
  .toast { bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); }

  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 96;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 3px solid var(--line);
  }
  .tabbar button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    font-family: 'Galmuri11', sans-serif; font-size: 11px; color: var(--text-3);
    position: relative;
  }
  .tabbar button .pi { height: 22px; width: auto; display: block; opacity: .7; }
  .tabbar button.on { color: var(--accent); }
  .tabbar button.on .pi { opacity: 1; filter: none; }
  .tabbar button.on::before {
    content: ""; position: absolute; top: -3px; left: 22%; right: 22%; height: 3px; background: var(--yellow);
    box-shadow: 0 0 8px var(--yellow);
  }

  .tab-scrim.open { display: block; position: fixed; inset: 0; z-index: 94; background: rgba(8,6,24,.55); }
  /* 탭 창은 탭 바 바로 위에서 올라와서, 열린 채로 다른 탭을 눌러 바로 바꿀 수 있음 */
  .tab-sheet {
    z-index: 95; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    max-height: calc(100dvh - var(--tabbar-h) - 70px); padding: 0; gap: 0;
    border: 3px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; overflow: hidden;
  }
  .tab-sheet.open { display: flex; animation: tabUp .18s ease-out; }
  .tab-sheet .win-head { flex: none; }
  .tab-sheet .win-head button { width: 40px; height: 40px; margin: -8px -10px -8px 0; }
  .tab-body { overflow: auto; overscroll-behavior: contain; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
}
@keyframes tabUp { from { transform: translateY(30px); opacity: .5; } }
/* 손가락으로 쓰는 기기: 마우스 올림 효과가 탭할 때마다 무겁게 다시 그려져서 끔 */
@media (hover: none) {
  .card:hover { transform: none; box-shadow: var(--shadow); }
  .card:hover .machine .px-knob, .logo:hover .logo-mark { animation: none; }
  .btn:hover, .btn-social:hover { filter: none; transform: none; }
  .card:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--line); transition: none; }
  .btn:active { transition: none; }
  /* 화면 전체를 덮는 줄무늬 층은 스크롤·탭마다 다시 그려져서 휴대폰에선 뺌 */
  :root[data-theme="dark"] body::after { display: none; }
  .overlay.open, .modal { animation: none; }
  /* 아이폰은 16px보다 작은 입력칸을 누르면 화면을 확대함 */
  .search, .input, input, select, textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition: none !important; } }

/* 픽셀 아이콘 */
.pi { display: inline-block; width: 1.25em; height: auto; vertical-align: -.25em; flex: none; image-rendering: pixelated; }
.btn .pi { width: 18px; }
.tag .pi { width: 10px; vertical-align: -1px; margin-right: 2px; }
.coin-price .pi { width: 16px; }
.led .tk .pi { width: 16px; }
.sort .ic .pi { width: 22px; }
.res-title .pi { width: .9em; vertical-align: -.1em; }
.btn-social .ico .pi { width: 20px; }

/* 뽑기 스탬프 */
.stamp { border: 2px solid var(--line); border-radius: 6px; background: var(--surface-2); padding: 8px 10px; margin-bottom: 12px; font-family: var(--body); }
.stamp-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; margin-bottom: 6px; }
.stamp-head span { font-family: var(--pixel); color: var(--accent); }
.stamp-dots { display: grid; grid-template-columns: repeat(10, minmax(0, 24px)); justify-content: space-between; gap: 3px; }
/* 스탬프 칸: 각진 도트 칸, 채워지면 네온 노랑 + 위·왼쪽 밝은 픽셀, 아래·오른쪽 어두운 픽셀 */
.stamp-dots i {
  aspect-ratio: 1; border: 2px solid var(--line); border-radius: 0; background: var(--surface); display: grid; place-items: center;
  box-shadow: inset 2px 2px 0 rgba(26, 16, 48, .12);
}
.stamp-dots i.on {
  background: #fff035;
  box-shadow: inset 3px 3px 0 #fffbc2, inset -3px -3px 0 #e0c400, 0 0 6px rgba(255, 236, 40, .8), 0 0 12px rgba(255, 210, 0, .45);
}
.stamp-dots i .pi { width: 80%; }
.stamp small { display: block; margin-top: 6px; font-size: 11px; color: var(--text-2); }
.sheet .stamp { margin: 0; }
.stamp-line { font-family: var(--body); font-size: 12px; color: var(--text-2); margin: 8px 0 0; text-align: center; }
.stamp-line .pi { width: 14px; }
