/* 데스크펫 v1.0 — 사이트 스타일
 * 톤: 모션 코믹 페이지와 같은 계열. 진갈색 외곽선 + 파스텔, 두꺼운 외곽선 캔디 버튼. 단일 밝은 테마. */
@font-face { font-family: "Jua"; src: url("../assets/fonts/jua-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+2190-21FF, U+266A; font-display: swap; }
@font-face { font-family: "Jua"; src: url("../assets/fonts/jua-korean-400-normal.woff2") format("woff2"); unicode-range: U+1100-11FF, U+3000-303F, U+3130-318F, U+AC00-D7AF, U+FF00-FFEF; font-display: swap; }
@font-face { font-family: "Black Han Sans"; src: url("../assets/fonts/black-han-sans-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; font-display: swap; }
@font-face { font-family: "Black Han Sans"; src: url("../assets/fonts/black-han-sans-korean-400-normal.woff2") format("woff2"); unicode-range: U+1100-11FF, U+3000-303F, U+3130-318F, U+AC00-D7AF, U+FF00-FFEF; font-display: swap; }
@font-face { font-family: "PretendardLocal"; src: url("../assets/fonts/Pretendard-Medium.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }
@font-face { font-family: "PretendardLocal"; src: url("../assets/fonts/Pretendard-ExtraBold.woff2") format("woff2"); font-weight: 700 900; font-display: swap; }

:root {
  --ink: #2B1B17;
  --butter: #FFD93B;
  --butter-d: #F2B705;
  --mint: #BFE8D6;
  --mint-d: #8FD3B6;
  --blush: #FFD6D1;
  --pink: #FF8FA3;
  --sky: #CDE7F7;
  --cream: #FFF6DF;
  --paper: #FFFFFF;
  --sub: #7A645B;
  --f-big: "Black Han Sans", "Jua", "PretendardLocal", system-ui, sans-serif;
  --f-body: "Jua", "PretendardLocal", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --bar-h: 64px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden;
  background-color: var(--cream);
  background-image: radial-gradient(rgba(43,27,23,.07) 1.2px, transparent 1.4px);
  background-size: 14px 14px;
  color: var(--ink); font-family: var(--f-body); font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
img { -webkit-user-drag: none; user-select: none; }
kbd { font-family: var(--f-body); font-size: .72em; border: 2px solid currentColor; border-radius: 6px; padding: 0 .35em; margin-left: .3em; opacity: .7; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }

/* ---------- 캔디 버튼 (v1.3: 힉스필드 젤리 버튼 이미지, 가로 9-slice) ---------- */
.btn {
  --h: 48px; --img: url("../assets/ui/btn_mint.webp");
  appearance: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); min-width: calc(var(--h) * 1.6); padding: 0 calc(var(--h) * .55) calc(var(--h) * .1);
  border: 0 solid transparent; border-radius: 0; background: none; box-shadow: none;
  border-image: var(--img) 0 75 fill / 0 calc(var(--h) * .5) stretch;
  font-size: 18px; line-height: 1; color: var(--ink);
  filter: drop-shadow(0 3px 0 rgba(43,27,23,.22));
  transition: transform .08s, filter .12s; white-space: nowrap;
}
.btn:hover { transform: translateY(-2px) scale(1.02); filter: drop-shadow(0 5px 0 rgba(43,27,23,.22)) brightness(1.04); }
.btn:active { transform: translateY(3px) scale(.98); filter: drop-shadow(0 0 0 rgba(43,27,23,.22)); }
.btn[disabled] { cursor: not-allowed; filter: grayscale(.7) opacity(.6); transform: none; }
.btn img { width: 26px; height: 26px; object-fit: contain; }
.btn-mint { --img: url("../assets/ui/btn_mint.webp"); }
.btn-white { --img: url("../assets/ui/btn_cream.webp"); }
.btn-butter { --img: url("../assets/ui/btn_butter.webp"); }
.btn-pink { --img: url("../assets/ui/btn_pink.webp"); }
.btn-sm { --h: 36px; font-size: 15px; }
.btn-sm img { width: 20px; height: 20px; }
.btn-big { --h: 58px; font-size: 22px; }
.btn-huge { --h: 82px; font-family: var(--f-big); font-size: 34px; }
.btn.glow { animation: glow 1.2s ease-in-out infinite; }
@keyframes glow { 50% { filter: drop-shadow(0 3px 0 rgba(43,27,23,.22)) drop-shadow(0 0 10px rgba(255,200,40,.95)); } }
.card { background: var(--paper); border: 3px solid var(--ink); border-radius: 24px; box-shadow: 0 8px 0 rgba(43,27,23,.18); }

/* ---------- 상단 바 ---------- */
#topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--bar-h); z-index: 50;
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: rgba(255,246,223,.92); border-bottom: 3px solid var(--ink);
  backdrop-filter: blur(6px);
}
.logo { display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; padding: 4px 6px; border-radius: 14px; }
.logo img.logo-art { height: 48px; width: auto; display: block; filter: drop-shadow(0 2px 0 rgba(43,27,23,.18)); transition: transform .18s; }
.logo:hover img.logo-art { transform: rotate(-3deg) scale(1.05); }
.logo b { font-family: var(--f-big); font-weight: 400; font-size: 28px; color: var(--butter); -webkit-text-stroke: 1.6px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); letter-spacing: .02em; }
.bar-mid { flex: 1; display: flex; justify-content: center; }
#pauseBtn, .bar-game { display: none; }
.bar-mid { align-items: center; gap: 14px; }
body[data-scene="game"] #pauseBtn { display: inline-flex; }
body[data-scene="game"] .bar-game { display: block; font-family: var(--f-big); font-weight: 400; font-size: 26px; }
.bar-right { display: flex; align-items: center; gap: 10px; }
.pill {
  display: flex; align-items: center; gap: 6px; height: 42px; padding: 0 14px 0 6px;
  border: 2.5px solid var(--ink); border-radius: 999px; background: var(--paper); box-shadow: 0 3px 0 var(--ink);
  font-size: 20px; font-variant-numeric: tabular-nums;
}
.pill img { width: 32px; height: 32px; object-fit: contain; }
.pill b { font-family: var(--f-big); font-weight: 400; min-width: 2ch; text-align: right; }
.pill.bump { animation: bump .45s; }
@keyframes bump { 40% { transform: scale(1.18); } }
.pill.sound { cursor: pointer; position: relative; padding: 0 10px 0 6px; }
.pill.sound kbd { font-size: 12px; }
.pill.sound:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.pill.sound.off img { opacity: .45; filter: grayscale(1); }
.sound-x { display: none; position: absolute; left: 6px; top: 6px; width: 32px; height: 32px; }
.pill.sound.off .sound-x { display: block; }
.sound-x::before { content: ""; position: absolute; left: 50%; top: -2px; width: 4px; height: 36px; background: var(--pink); border: 1.5px solid var(--ink); border-radius: 3px; transform: translateX(-50%) rotate(45deg); }

.scene { position: fixed; inset: var(--bar-h) 0 0 0; overflow: hidden; }
#scene-intro { inset: 0; }

/* ---------- 인트로 / 모션 코믹 ---------- */
.intro-wrap { position: absolute; inset: 0; display: grid; place-items: center; background: var(--ink); }
.comic-box {
  position: relative; width: min(100vw, calc(100vh * 16 / 9)); aspect-ratio: 16 / 9; overflow: hidden;
  background: var(--ink); cursor: pointer; user-select: none; container-type: inline-size;
}
.intro-skip { position: absolute; right: 18px; top: 16px; z-index: 5; }
.intro-start { position: absolute; left: 50%; bottom: 13%; transform: translateX(-50%); z-index: 6; animation: startIn .5s cubic-bezier(.2,.9,.2,1.3) both, startBob 1.4s .5s ease-in-out infinite; }
.intro-start:hover, .intro-start:active { transform: translateX(-50%); }
@keyframes startIn { from { opacity: 0; transform: translateX(-50%) scale(.4); } }
@keyframes startBob { 50% { transform: translateX(-50%) translateY(-6px); } }
.intro-hint { position: absolute; right: 18px; bottom: 12px; margin: 0; color: #fff; font-size: 14px; background: rgba(43,27,23,.55); border-radius: 999px; padding: 4px 12px; z-index: 5; }

.comic-stage .halftone { position: absolute; inset: 0; background: radial-gradient(rgba(255,255,255,.08) 1.5px, transparent 1.7px) 0 0/12px 12px; }
.comic-stage .c-panels { position: absolute; inset: 0; }
.comic-stage .panel { position: absolute; inset: 0; will-change: transform, opacity; }
.comic-stage .panel .border { position: absolute; inset: 0; background: var(--paper); }
.comic-stage .panel .view { position: absolute; inset: 0; overflow: hidden; background: #000; }
.comic-stage .panel img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform-origin: 50% 50%; will-change: transform; }
.comic-stage .panel.dim .view::after { content: ""; position: absolute; inset: 0; background: rgba(43,27,23,.25); transition: background .3s; }
.comic-stage .layer { position: absolute; inset: 0; pointer-events: none; }
.comic-stage canvas.c-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.comic-stage .cap { position: absolute; font-size: clamp(11px, 1.9cqw, 26px); line-height: 1.25; color: var(--ink); padding: .2em .3em; white-space: pre-line; }
.comic-stage .bub { position: absolute; transform: translate(-50%,-50%); background: var(--paper); border: 3px solid var(--ink); border-radius: 50% / 46%; padding: .7em 1.1em; font-size: clamp(11px, 1.85cqw, 25px); line-height: 1.25; text-align: center; white-space: pre-line; width: max-content; max-width: 34%; min-width: 4.5em; box-shadow: 0 4px 0 rgba(43,27,23,.25); }
.comic-stage .bub::after { content: ""; position: absolute; width: 1.1em; height: 1.1em; background: var(--paper); border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); bottom: -.62em; left: var(--tail, 30%); transform: rotate(45deg) skew(12deg,12deg); }
.comic-stage .bub.up::after { bottom: auto; top: -.62em; transform: rotate(225deg) skew(12deg,12deg); }
.comic-stage .bub.shout { border-radius: 12px; background: var(--butter); }
.comic-stage .bub.shout::after { background: var(--butter); }
.comic-stage .bub .who { display: block; font-size: .62em; opacity: .65; margin-bottom: .15em; }
.comic-stage .sfx { position: absolute; transform: translate(-50%,-50%) rotate(var(--r,-8deg)); font-family: var(--f-big); font-size: clamp(26px, 7cqw, 104px); line-height: 1; color: var(--c, var(--butter)); -webkit-text-stroke: .07em var(--ink); paint-order: stroke fill; text-shadow: .06em .07em 0 var(--ink); white-space: nowrap; }
.comic-stage .c-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.comic-stage .c-logo { position: absolute; left: 50%; bottom: 30%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: .3em; opacity: 0; pointer-events: none; }
.comic-stage .c-logo .name { display: flex; align-items: center; gap: .18em; font-family: var(--f-big); font-size: clamp(34px, 9cqw, 132px); color: var(--butter); -webkit-text-stroke: .06em var(--ink); paint-order: stroke fill; text-shadow: 0 .07em 0 var(--ink); line-height: 1; }
.comic-stage .c-logo .name img { width: .95em; height: .95em; border-radius: .2em; border: .045em solid var(--ink); -webkit-text-stroke: 0; }
.comic-stage .c-logo .name-art { width: clamp(220px, 46cqw, 640px); height: auto; display: block; filter: drop-shadow(0 .5cqw 0 rgba(43,27,23,.35)); }
.comic-stage .c-logo .sub { font-size: clamp(11px, 1.9cqw, 26px); background: var(--paper); border: 3px solid var(--ink); border-radius: 999px; padding: .2em .9em; }

/* ---------- 캐릭터 (pet.js) ---------- */
.pet { position: relative; width: var(--pw, 200px); height: var(--ph, 300px); pointer-events: auto; }
.pet-shadow { position: absolute; left: 50%; bottom: -6px; width: calc(var(--pw, 200px) * .9); height: 16px; transform: translateX(-50%); background: radial-gradient(closest-side, rgba(43,27,23,.28), transparent); border-radius: 50%; }
.pet-move { position: absolute; inset: 0; transform-origin: 50% 100%; }
.pet-body { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); display: flex; align-items: flex-end; justify-content: center; width: max-content; }
.pet-strip { background-repeat: no-repeat; image-rendering: auto; }
.pet-img { display: block; width: auto; max-width: none !important; flex: none; image-rendering: auto; }
.pet-move.breathe .pet-body { animation: breathe 2.4s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes breathe { 0%, 100% { transform: translateX(-50%) scaleY(1); } 50% { transform: translateX(-50%) scaleY(.97); } }
.pet-move.dance-1 { animation: sway 1.1s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
.pet-move.dance-2 { animation: bounce .62s cubic-bezier(.3,0,.4,1) infinite; }
@keyframes bounce { 0%, 100% { transform: translateY(0) scale(1.08, .9); } 15% { transform: translateY(0) scale(1, 1); } 50% { transform: translateY(-18%) scale(.95, 1.06); } 85% { transform: translateY(0) scale(1, 1); } }
.pet-move.dance-3 { animation: party 1.1s cubic-bezier(.3,0,.4,1) infinite; }
@keyframes party { 0% { transform: translateY(0) scale(1.1, .88) rotate(0); } 12% { transform: translateY(0) scale(1, 1) rotate(0); } 45% { transform: translateY(-30%) scale(.95, 1.05) rotateY(180deg); } 75% { transform: translateY(-6%) rotateY(360deg); } 100% { transform: translateY(0) scale(1.1, .88) rotateY(360deg); } }
.pet-move.hop { animation: hop .5s ease-out; }
@keyframes hop { 35% { transform: translateY(-14%) scale(1.03, .97); } 70% { transform: translateY(0) scale(1.06, .94); } }
.pet.oops .pet-body { animation: oops .7s ease-in-out; }
@keyframes oops { 0%, 100% { transform: translateX(-50%); } 25% { transform: translateX(-50%) rotate(-7deg) translateY(4px); } 60% { transform: translateX(-50%) rotate(4deg); } }
@media (prefers-reduced-motion: reduce) { .pet-move, .pet-body { animation: none !important; } }

/* ---------- 메인 ---------- */
.main-bg, .game-bg { position: absolute; inset: 0; background: center / cover no-repeat; }
.main-bg::after, .game-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,246,223,.35), rgba(255,246,223,.55)); }
.main { position: relative; height: 100%; display: grid; grid-template-columns: minmax(340px, 40%) 1fr; gap: 28px; padding: 24px 36px 28px; max-width: 1600px; margin: 0 auto; }
.main-left { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 6px; }
.today { position: absolute; top: 6px; left: 0; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 999px; padding: 6px 16px; font-size: 16px; box-shadow: 0 3px 0 var(--ink); }
.pet-spot { position: relative; display: flex; flex-direction: column; align-items: center; }
.rug { position: absolute; bottom: -22px; width: 330px; height: 84px; border-radius: 50%; background: var(--mint); border: 3px solid var(--ink); box-shadow: 0 6px 0 rgba(43,27,23,.2), inset 0 -8px 0 rgba(43,27,23,.08); }
.main-pet { position: relative; cursor: pointer; display: flex; justify-content: center; }
.speech { position: absolute; top: -18px; left: 50%; transform: translate(10%, -100%); background: var(--paper); border: 3px solid var(--ink); border-radius: 18px; padding: 8px 16px; font-size: 18px; white-space: nowrap; opacity: 0; z-index: 2; box-shadow: 0 4px 0 rgba(43,27,23,.2); }
.speech::after { content: ""; position: absolute; left: 18px; bottom: -10px; width: 14px; height: 14px; background: var(--paper); border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(45deg); }
.speech.show { animation: speech 2.4s ease forwards; }
@keyframes speech { 0% { opacity: 0; transform: translate(10%, -80%) scale(.6); } 10%, 85% { opacity: 1; transform: translate(10%, -100%) scale(1); } 100% { opacity: 0; transform: translate(10%, -110%) scale(1); } }
.pet-tag { margin-top: 40px; display: flex; align-items: center; gap: 10px; background: var(--paper); border: 3px solid var(--ink); border-radius: 999px; padding: 8px 10px 8px 18px; box-shadow: 0 4px 0 var(--ink); cursor: pointer; }
.pet-tag span { font-size: 14px; color: var(--sub); }
.pet-tag b { font-size: 20px; font-weight: 400; }
.pet-tag.rare b { color: #C27C00; }
.pet-tag i { font-style: normal; font-size: 14px; background: var(--butter); border: 2px solid var(--ink); border-radius: 999px; padding: 3px 10px; }
.pet-tag:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }

.main-right { display: flex; flex-direction: column; justify-content: center; gap: 24px; min-width: 0; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.game-card {
  position: relative; cursor: pointer; text-align: left; display: grid; grid-template-rows: auto auto auto auto; gap: 4px;
  background: var(--paper); border: 3.5px solid var(--ink); border-radius: 30px; padding: 16px 16px 18px; box-shadow: 0 8px 0 var(--ink);
  transition: transform .1s, box-shadow .1s;
}
.game-card:hover { transform: translateY(-3px) rotate(-.6deg); box-shadow: 0 11px 0 var(--ink); }
.game-card:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--ink); }
.game-card.snack { background: #FFF1EE; }
.game-card.block { background: #EEF6FB; }
.gc-thumb { display: block; aspect-ratio: 16 / 10; border-radius: 20px; overflow: hidden; border: 3px solid var(--ink); background: var(--cream); margin-bottom: 8px; }
.gc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gc-name { font-family: var(--f-big); font-size: clamp(26px, 2.4vw, 36px); line-height: 1; }
.gc-desc { font-size: 15px; color: var(--sub); }
.gc-best { font-size: 16px; }
.gc-best b { font-family: var(--f-big); font-weight: 400; font-size: 20px; }
.gc-play { position: absolute; right: 16px; bottom: 16px; font-size: 20px; background: var(--butter); border: 3px solid var(--ink); border-radius: 16px; padding: 6px 16px; box-shadow: 0 4px 0 var(--ink); }
.subs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.sub-btn { position: relative; cursor: pointer; display: flex; align-items: center; gap: 10px; background: var(--paper); border: 3px solid var(--ink); border-radius: 20px; padding: 8px 12px; box-shadow: 0 5px 0 var(--ink); font-size: 20px; min-width: 0; }
.sub-btn img { width: 52px; height: 52px; object-fit: contain; flex: none; }
.sub-btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.sub-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.sub-btn em { position: absolute; right: -6px; top: -12px; font-style: normal; font-size: 13px; background: var(--pink); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 9px; }
.sub-btn em:empty { display: none; }
.sub-btn.locked { background: #F1ECE4; color: #8C7A71; }
.sub-btn.locked em { background: #E7E1D8; }

/* ---------- 게임 ---------- */
.game { position: relative; height: 100%; display: grid; grid-template-columns: 300px 1fr; gap: 20px; padding: 16px 24px 18px; }
.game-side { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.game-title b { font-family: var(--f-big); font-weight: 400; font-size: 30px; color: var(--paper); -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); }
.stage-host { display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; }
.game-keys { margin: 0; font-size: 13px; line-height: 1.5; background: rgba(255,255,255,.85); border: 2px solid var(--ink); border-radius: 14px; padding: 6px 10px; }
.game-keys b { font-weight: 400; background: var(--cream); border-radius: 6px; padding: 0 4px; }
.game-main { position: relative; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; }
.game-host { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }

.stage-card { position: relative; flex: 1; min-height: 230px; border: 3px solid var(--ink); border-radius: 24px; overflow: hidden; background: var(--sky); box-shadow: 0 6px 0 rgba(43,27,23,.2); }
.stage-bg { position: absolute; inset: 0; background: center / cover no-repeat; filter: saturate(.9); }
.stage-bg::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 30%; background: linear-gradient(180deg, transparent, rgba(255,246,223,.75)); }
.stage-glow { position: absolute; inset: 0; opacity: 0; transition: opacity .3s; background: radial-gradient(circle at 50% 70%, rgba(255,217,59,.55), transparent 60%); }
.stage-host[data-stage="2"] .stage-glow { opacity: .55; }
.stage-host[data-stage="3"] .stage-glow { opacity: 1; animation: glowPulse .7s ease-in-out infinite; }
@keyframes glowPulse { 50% { filter: hue-rotate(40deg) brightness(1.1); } }
.stage-pet { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; justify-content: center; }
.stage-fx { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.fxp { position: absolute; bottom: 40%; width: 46px; height: auto; opacity: 0; animation: fxUp 1.6s ease-out forwards; }
.fxp.big { width: 64px; }
@keyframes fxUp { 0% { opacity: 0; transform: translate(0, 20px) scale(.5) rotate(0); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), -150px) scale(1.1) rotate(var(--rot)); } }
.stage-banner { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); z-index: 3; font-family: var(--f-big); font-size: 34px; white-space: nowrap; color: var(--butter); -webkit-text-stroke: 1.6px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); opacity: 0; pointer-events: none; }
.stage-banner.s1 { color: var(--mint); }
.stage-banner.s2 { color: var(--pink); }
.stage-banner.s3, .stage-banner.fever { color: var(--butter); font-size: 40px; }
.stage-banner.oops { color: var(--paper); font-size: 26px; }
.stage-banner.show { animation: banner 1.5s cubic-bezier(.2,.9,.2,1.2) forwards; }
@keyframes banner { 0% { opacity: 0; transform: translateX(-50%) scale(2.2) rotate(-8deg); } 18% { opacity: 1; transform: translateX(-50%) scale(.92) rotate(-4deg); } 28% { transform: translateX(-50%) scale(1.05) rotate(-4deg); } 80% { opacity: 1; transform: translateX(-50%) scale(1) rotate(-4deg); } 100% { opacity: 0; transform: translateX(-50%) translateY(-14px) scale(1) rotate(-4deg); } }

.stage-info { padding: 10px 14px 12px; display: grid; gap: 7px; border-radius: 20px; }
.combo-row { display: flex; align-items: baseline; gap: 8px; }
.combo-n { font-family: var(--f-big); font-weight: 400; font-size: 64px; line-height: .9; color: var(--butter); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink); min-width: 1.2ch; font-variant-numeric: tabular-nums; display: inline-block; transform-origin: 50% 80%; }
.combo-n.bump { animation: comboBump .3s cubic-bezier(.2,.9,.2,1.4); }
@keyframes comboBump { 0% { transform: scale(1.5) rotate(-6deg); } 100% { transform: scale(1); } }
.combo-l { font-size: 20px; }
.stage-chip { margin-left: auto; font-size: 16px; border: 2.5px solid var(--ink); border-radius: 999px; padding: 3px 12px; background: #F1ECE4; }
.stage-chip[data-s="1"] { background: var(--mint); }
.stage-chip[data-s="2"] { background: var(--pink); }
.stage-chip[data-s="3"] { background: var(--butter); animation: chipPop .6s ease-in-out infinite; }
@keyframes chipPop { 50% { transform: scale(1.08) rotate(-3deg); } }
.combo-window { height: 8px; border-radius: 99px; background: #F1ECE4; overflow: hidden; border: 2px solid var(--ink); }
.combo-window i { display: block; height: 100%; width: 0; background: var(--mint-d); }
body[data-game="block"] .combo-window { display: none; }
.fever-gauge { position: relative; height: 26px; border-radius: 99px; background: #F1ECE4; border: 2.5px solid var(--ink); overflow: hidden; }
.fever-gauge i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--pink), var(--butter)); transition: width .15s; }
.fever-gauge.on i { background: linear-gradient(90deg, #FF8FA3, #FFD93B, #BFE8D6, #CDE7F7, #FF8FA3); background-size: 200% 100%; animation: rainbowMove 1s linear infinite; }
@keyframes rainbowMove { to { background-position: 200% 0; } }
.fever-text { position: relative; display: block; text-align: center; font-size: 15px; line-height: 21px; }
.mult-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; color: var(--sub); }
.mult-n { font-family: var(--f-big); font-weight: 400; font-size: 24px; color: var(--ink); }
.stage-host.is-fever .mult-n { color: #E0446A; }

.countdown { position: absolute; inset: 0; display: grid; place-items: center; z-index: 30; pointer-events: none; }
.countdown b { font-family: var(--f-big); font-weight: 400; font-size: 150px; color: var(--butter); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 8px 0 var(--ink); animation: cd .6s cubic-bezier(.2,.9,.2,1.3) both; }
.countdown b.go { color: var(--mint); font-size: 110px; }
.countdown b.end { color: var(--pink); }
@keyframes cd { from { opacity: 0; transform: scale(2.4) rotate(-10deg); } to { opacity: 1; transform: scale(1) rotate(-4deg); } }

/* 피버: 화면 테두리 무지개 반짝 */
#feverFrame { position: fixed; inset: 0; pointer-events: none; z-index: 40; opacity: 0; transition: opacity .3s; }
body.fever-on #feverFrame { opacity: 1; }
#feverFrame::before { content: ""; position: absolute; inset: 0; border: 10px solid transparent; border-image: linear-gradient(90deg, #FF8FA3, #FFD93B, #BFE8D6, #CDE7F7, #C9B6FF, #FF8FA3) 1; box-shadow: inset 0 0 40px rgba(255,217,59,.6); animation: feverHue 1.2s linear infinite; }
@keyframes feverHue { to { filter: hue-rotate(360deg); } }
#feverFrame .fc { position: absolute; width: 96px; height: auto; animation: twinkle .8s ease-in-out infinite; }
#feverFrame .tl { left: 0; top: 0; transform: rotate(0deg); }
#feverFrame .tr { right: 0; top: 0; transform: rotate(90deg); animation-delay: .2s; }
#feverFrame .br { right: 0; bottom: 0; transform: rotate(180deg); animation-delay: .4s; }
#feverFrame .bl { left: 0; bottom: 0; transform: rotate(270deg); animation-delay: .6s; }
@keyframes twinkle { 50% { opacity: .55; filter: brightness(1.3); } }
body.fever-on .stage-card { box-shadow: 0 0 0 4px var(--butter), 0 0 24px 6px rgba(255,143,163,.7); }

/* ---------- 간식타임 (legacy 도시락 보드 디자인 그대로, .st-app 한정) ---------- */
.st-app {
  --page: #EEF0FB; --card: #FFFFFF; --ink: #3A3350; --sub: #8A86A0; --accent: #FF7B7B; --ok: #3CC48A;
  --box: #FFF9F0; --rim: #F3D9B8; --slot: #F6EBDD;
  --display: 'Jua', 'PretendardLocal', 'Apple SD Gothic Neo', sans-serif;
  --body: 'Jua', 'PretendardLocal', 'Apple SD Gothic Neo', sans-serif;
  color: var(--ink); font-family: var(--body);
  width: min(100%, calc((100vh - var(--bar-h) - 150px) * 1.62 + 32px));
}
.st-app .st-board { width: 100%; }
.st-app *, .st-app *::before, .st-app *::after { box-sizing: border-box; }
.st-app .fb-root { --fb-bg: var(--card); --fb-text: var(--ink); --fb-sub: var(--sub); --fb-accent: var(--accent); --fb-ok: var(--ok); --fb-line: #6C63D9; --fb-radius: 28px;
  max-width: none; padding: 16px; font-family: var(--body); border: 3px solid #2B1B17; box-shadow: 0 8px 0 rgba(43,27,23,.2); }
.st-app .fb-hud { gap: 14px; }
.st-app .fb-score b, .st-app .fb-time { font-family: var(--display); font-weight: 400; }
.st-app .fb-score b { font-size: 28px; }
.st-app .fb-time { font-size: 22px; min-width: 52px; }
.st-app .fb-timer { height: 14px; background: var(--page); }
.st-app .fb-next { display: none; }
.st-app [data-r="reset"] { display: none; }
.st-app .fb-board { background-color: var(--box); border: 6px solid var(--rim); border-radius: 22px; padding: 8px; cursor: grab; }
.st-app .fb-board:active { cursor: grabbing; }
.st-app .fb-cell { position: relative; padding: 5%; }
.st-app .fb-cell::before { content: ""; position: absolute; inset: 9%; border-radius: 34%; background: var(--slot); }
.st-app .fb-item { border-radius: 34%; background: var(--j, #FF8A8A); font-family: var(--display); font-weight: 400; font-size: calc(var(--fb-cell, 40px) * .5); color: #fff; }
.st-app .fb-item span { -webkit-text-stroke: max(2px, calc(var(--fb-cell, 40px) * .07)) #2B2340; paint-order: stroke fill; text-shadow: none; }
.st-app .fb-item.has-img { background: none; box-shadow: none; border-radius: 0; }
.st-app .fb-item.has-img img { image-rendering: pixelated; }
.st-app .fb-item.has-img span { margin-top: 6%; }
.st-app .fb-v1 { --j: #FF8A8A; } .st-app .fb-v2 { --j: #FFAE6B; } .st-app .fb-v3 { --j: #FFC94D; }
.st-app .fb-v4 { --j: #93D46A; } .st-app .fb-v5 { --j: #4FCFAE; } .st-app .fb-v6 { --j: #62BEF0; }
.st-app .fb-v7 { --j: #8C9EF5; } .st-app .fb-v8 { --j: #B98AF0; } .st-app .fb-v9 { --j: #F58CC8; }
.st-app .fb-cell.sel .fb-item { transform: scale(1.16) translateY(-4%); filter: none; }
.st-app .fb-cell.pop .fb-item { animation: none; visibility: hidden; }
.st-app .fb-sel { border-radius: 14px; border-width: 3px; }
.st-app .fb-sel-sum { font-family: var(--display); font-weight: 400; font-size: 15px; top: -30px; }
.st-app .fb-float { font-family: var(--display); font-weight: 400; font-size: 26px; color: var(--ink); }
.st-app .fb-root.alarm { animation: st-alarm .9s ease-in-out infinite; }
@keyframes st-alarm { 50% { box-shadow: 0 8px 0 rgba(43,27,23,.2), inset 0 0 0 5px rgba(255,90,90,.7); } }
.st-app .fb-root.alarm .fb-time { color: #FF5A5A; animation: st-tick 1s steps(1) infinite; }
@keyframes st-tick { 50% { transform: scale(1.18); } }
.st-app .st-fly { position: fixed; z-index: 1000; pointer-events: none; display: grid; place-items: center; color: #fff; font-family: var(--display); background: center / 100% 100% no-repeat; image-rendering: pixelated; }
.st-app .st-fly span { -webkit-text-stroke: 3px #2B2340; paint-order: stroke fill; }
.st-app .st-drop { position: fixed; z-index: 1001; width: 9px; height: 9px; border-radius: 50%; pointer-events: none; }
body.fever-on .st-app .fb-float { color: #E0446A; font-size: 32px; }

/* ---------- 펫블록 (인게임 그대로, 사이트가 대신하는 부분만 숨김) ---------- */
.pb-host { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.pb-host .pb-root { max-width: 860px; }
.pb-host .pb-duckbox, .pb-host .pb-btns, .pb-host .pb-touch { display: none !important; }
.pb-host .pb-panel, .pb-host .pb-boardwrap { border: 3px solid var(--ink); }

/* ---------- 결과 ---------- */
.result-bg { position: absolute; inset: 0; background: radial-gradient(circle at 50% 40%, var(--paper), var(--cream) 70%); }
.result-card { z-index: 6; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, 92vw); padding: 26px 30px 28px; text-align: center; animation: popIn .45s cubic-bezier(.2,.9,.2,1.25) both; }
@keyframes popIn { from { opacity: 0; transform: translate(-50%, -46%) scale(.85); } }
.res-game { display: inline-block; font-size: 18px; background: var(--sky); border: 2.5px solid var(--ink); border-radius: 999px; padding: 4px 16px; }
.res-record { font-family: var(--f-big); font-size: 40px; color: var(--pink); -webkit-text-stroke: 1.6px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); margin-top: 10px; animation: recordWob .9s ease-in-out infinite; }
@keyframes recordWob { 50% { transform: scale(1.08) rotate(-3deg); } }
.res-score { font-family: var(--f-big); font-size: 92px; line-height: 1.05; margin: 8px 0 6px; color: var(--butter); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--ink); }
.res-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 14px; }
.res-row div { background: var(--cream); border: 2.5px solid var(--ink); border-radius: 16px; padding: 8px 6px; }
.res-row small { display: block; font-size: 14px; color: var(--sub); }
.res-row b { font-family: var(--f-big); font-weight: 400; font-size: 26px; }
.res-coin { display: flex; align-items: center; justify-content: center; gap: 10px; font-family: var(--f-big); font-size: 46px; color: #C27C00; }
.res-coin img { width: 58px; height: 58px; object-fit: contain; animation: coinSpin 1.2s ease-in-out infinite; }
@keyframes coinSpin { 50% { transform: rotateY(180deg); } }
.res-break { font-size: 14px; color: var(--sub); margin: 2px 0 18px; }
.res-btns { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border: 1.5px solid var(--ink); border-radius: 3px; animation: fall var(--d) var(--dl) ease-in forwards; }
@keyframes fall { to { transform: translate(var(--x), 105vh) rotate(var(--r)); } }
.conf-img { position: absolute; top: 8%; width: 90px; opacity: 0; animation: confPop 1.6s ease-out forwards; }
@keyframes confPop { 0% { opacity: 0; transform: scale(.3) translateY(30px); } 25% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0; transform: scale(1) translateY(-40px) rotate(20deg); } }

/* ---------- 패널 (뽑기 / 도감 / 랭킹) ---------- */
.panel-back { position: fixed; inset: var(--bar-h) 0 0 0; z-index: 45; background: rgba(43,27,23,.35); display: grid; place-items: center; padding: 18px; }
.panel-card { width: min(1080px, 100%); height: min(640px, 100%); display: flex; flex-direction: column; overflow: hidden; animation: panelIn .35s cubic-bezier(.2,.9,.2,1.15) both; background: var(--cream); }
@keyframes panelIn { from { opacity: 0; transform: translateY(24px) scale(.96); } }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 3px solid var(--ink); background: var(--paper); }
.panel-head img { width: 40px; height: 40px; object-fit: contain; }
.panel-head h2 { margin: 0; flex: 1; font-family: var(--f-big); font-weight: 400; font-size: 28px; }
.panel-body { flex: 1; min-height: 0; overflow: auto; padding: 16px 20px 20px; }
.tabs { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.tab { cursor: pointer; border: 2.5px solid var(--ink); background: var(--paper); border-radius: 999px; padding: 6px 18px; font-size: 18px; box-shadow: 0 3px 0 var(--ink); }
.tab small { font-size: 14px; opacity: .7; }
.tab[aria-selected="true"] { background: var(--butter); }
.tab-side { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 16px; color: var(--sub); }
.tab-side img { width: 26px; height: 26px; object-fit: contain; }
.tab-side b { font-family: var(--f-big); font-weight: 400; color: var(--ink); font-size: 20px; }

.gacha { height: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: center; }
.gacha-left { display: grid; place-items: center; height: 100%; }
.machine-wrap { position: relative; height: min(500px, 100%); display: flex; align-items: center; }
.machine { height: 100%; max-height: 480px; width: auto; transform-origin: 50% 100%; filter: drop-shadow(0 8px 0 rgba(43,27,23,.18)); }
.machine.shake { animation: machineShake .65s ease-in-out; }
@keyframes machineShake { 15% { transform: rotate(-4deg) scale(1.02); } 35% { transform: rotate(4deg); } 55% { transform: rotate(-3deg) scale(1.03, .97); } 75% { transform: rotate(2deg); } }
.cap-drop { position: absolute; left: 50%; bottom: 6%; width: 0; }
.capsule { width: 90px; height: auto; }
.cap-drop .capsule.roll { position: absolute; left: -45px; bottom: 0; animation: capRoll .6s cubic-bezier(.3,.8,.4,1) both; }
@keyframes capRoll { from { transform: translateY(-70px) scale(.5) rotate(-90deg); opacity: 0; } 60% { transform: translateY(6px) rotate(10deg); opacity: 1; } to { transform: translateX(30px) rotate(40deg); } }
.gacha-right { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.gacha-stage { position: relative; width: 100%; height: 340px; border: 3px solid var(--ink); border-radius: 24px; background: var(--paper); display: grid; place-items: center; overflow: hidden; }
.gacha-stage.golden { background: radial-gradient(circle, #FFF3B0, #FFE27A 45%, #FFD93B); }
.gacha-hello { font-size: 20px; line-height: 1.5; margin: 0; }
.gacha-hello small { color: var(--sub); font-size: 15px; }
.capsule.big { width: 150px; }
.capsule.wobble { animation: wobble .3s ease-in-out infinite; }
@keyframes wobble { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg) translateY(-4px); } }
.capsule.gold { filter: drop-shadow(0 0 18px rgba(255,200,0,.9)); }
.capsule.opened { animation: capOpen .5s cubic-bezier(.2,.9,.2,1.4) both; }
@keyframes capOpen { from { transform: scale(.7); } to { transform: scale(1.15); } }
.reveal { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; animation: popIn2 .45s cubic-bezier(.2,.9,.2,1.3) both; }
@keyframes popIn2 { from { opacity: 0; transform: scale(.4); } }
.reveal-rays { position: absolute; left: 50%; top: 90px; width: 380px; height: 380px; margin: -190px 0 0 -190px; background: repeating-conic-gradient(rgba(255,217,59,.35) 0 10deg, transparent 10deg 20deg); border-radius: 50%; animation: spin 8s linear infinite; z-index: 0; }
.reveal.rare .reveal-rays { background: repeating-conic-gradient(rgba(255,170,0,.55) 0 10deg, rgba(255,255,255,.2) 10deg 20deg); }
@keyframes spin { to { transform: rotate(360deg); } }
.reveal-pet { position: relative; z-index: 1; height: 160px; display: flex; align-items: flex-end; }
.reveal-tag, .reveal-name, .reveal .btn { position: relative; z-index: 1; }
.reveal-tag .new { font-family: var(--f-big); font-size: 30px; color: var(--pink); -webkit-text-stroke: 1.4px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); }
.reveal-tag .dup { font-size: 18px; background: var(--sky); border: 2.5px solid var(--ink); border-radius: 999px; padding: 3px 12px; }
.reveal-name { font-size: 22px; }
.reveal-name em { font-style: normal; font-size: 14px; background: var(--butter); border: 2px solid var(--ink); border-radius: 999px; padding: 1px 8px; vertical-align: middle; }
.gacha-note { margin: 0; min-height: 1.3em; color: #C2445F; font-size: 16px; }
.gacha-rule { margin: 0; font-size: 14px; color: var(--sub); max-width: 40ch; line-height: 1.5; }

.dex-label { font-size: 17px; margin: 4px 0 8px; }
.dex-label.rare { margin-top: 16px; color: #C27C00; }
.dex-label small { color: var(--sub); font-size: 13px; }
.dex-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px; }
.dex-cell { position: relative; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px 5px; border: 2.5px solid var(--ink); border-radius: 16px; background: var(--paper); box-shadow: 0 3px 0 var(--ink); min-width: 0; }
.dex-cell img { width: 100%; height: 66px; object-fit: contain; }
.dex-cell span { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dex-cell.rare { background: #FFF8DC; }
.dex-cell.locked img { filter: brightness(0) opacity(.18); }
.dex-cell.locked span { color: #A99A90; }
.dex-cell.active { background: var(--mint); }
.dex-cell:hover { transform: translateY(-2px); }
.dex-star { position: absolute; top: -9px; right: -6px; font-style: normal; font-size: 11px; background: var(--pink); border: 2px solid var(--ink); border-radius: 999px; padding: 0 6px; }
.comic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.comic-cell { cursor: pointer; display: flex; flex-direction: column; gap: 6px; border: 3px solid var(--ink); border-radius: 18px; background: var(--paper); padding: 8px; box-shadow: 0 4px 0 var(--ink); text-align: left; }
.comic-cell:hover:not([disabled]) { transform: translateY(-2px); }
.comic-cell.locked { cursor: default; background: #F1ECE4; box-shadow: 0 4px 0 #B8ABA1; border-color: #B8ABA1; }
.comic-thumb { display: grid; place-items: center; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #E7E1D8; }
.comic-thumb img { width: 100%; height: 100%; object-fit: cover; }
.comic-thumb b { font-family: var(--f-big); font-size: 48px; color: #B8ABA1; }
.comic-name { font-size: 17px; padding: 0 4px; }
.dex-foot { color: var(--sub); font-size: 14px; margin: 14px 0 0; }
.detail-pet { display: flex; justify-content: center; padding: 10px 0 4px; min-height: 170px; align-items: flex-end; }
.detail-pet.locked .pet-body { filter: brightness(0) opacity(.2); }

table.rank { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: 18px; }
.rank th { font-weight: 400; color: var(--sub); font-size: 15px; text-align: left; padding: 0 14px; }
.rank td { background: var(--paper); padding: 8px 14px; border-top: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); }
.rank td:first-child { border-left: 2.5px solid var(--ink); border-radius: 14px 0 0 14px; width: 80px; }
.rank td:last-child { border-right: 2.5px solid var(--ink); border-radius: 0 14px 14px 0; }
.rank .sc { font-family: var(--f-big); font-size: 22px; }
.rank .dt { color: var(--sub); font-size: 15px; }
.medal { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 2.5px solid var(--ink); background: #F1ECE4; font-size: 16px; }
.rank .r1 .medal { background: var(--butter); }
.rank .r2 .medal { background: #E3E8EE; }
.rank .r3 .medal { background: #F5C9A0; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 0; text-align: center; font-size: 18px; }
.empty img { width: 110px; opacity: .8; }

/* ---------- 만화 다시 보기 ---------- */
.replay { position: fixed; inset: 0; z-index: 60; background: var(--ink); display: grid; place-items: center; }
.replay-close { position: absolute; right: 18px; top: 16px; z-index: 5; }

/* ---------- 모달 / 토스트 / 안내 ---------- */
#modals { position: relative; z-index: 80; }
.modal-back { position: fixed; inset: 0; background: rgba(43,27,23,.4); display: grid; place-items: center; z-index: 80; animation: fadeIn .2s both; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { min-width: 360px; max-width: 480px; padding: 22px 26px; text-align: center; animation: popIn2 .3s cubic-bezier(.2,.9,.2,1.25) both; }
.modal-title { margin: 0 0 6px; font-family: var(--f-big); font-weight: 400; font-size: 30px; }
.modal-text { margin: 6px 0 14px; font-size: 18px; line-height: 1.5; }
.modal-text small { color: var(--sub); font-size: 15px; }
.modal-btns { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
#toasts { position: fixed; left: 50%; top: calc(var(--bar-h) + 14px); transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: var(--cream); border-radius: 999px; padding: 10px 22px; font-size: 18px; box-shadow: 0 6px 18px rgba(43,27,23,.25); animation: toastIn .3s cubic-bezier(.2,.9,.2,1.3) both; }
.toast.out { opacity: 0; transform: translateY(-10px); transition: .35s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(.9); } }
.pc-guard { position: fixed; inset: 0; z-index: 100; background: var(--cream); display: grid; place-items: center; padding: 16px; }
.guard-card { max-width: 420px; padding: 28px 24px; text-align: center; }
.guard-card img { width: 96px; border-radius: 22px; border: 3px solid var(--ink); }
.guard-card h2 { font-family: var(--f-big); font-weight: 400; font-size: 28px; margin: 12px 0 6px; }
.guard-card p { font-size: 16px; line-height: 1.6; margin: 0 0 18px; }

@media (max-height: 760px) {
  .rug { width: 290px; }
  .gc-thumb { aspect-ratio: 16 / 8; }
  .combo-n { font-size: 54px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01s !important; animation-iteration-count: 1 !important; } }

/* 일시정지: 판을 완전히 가린다 (보드를 보며 생각하는 것 방지) */
.game-main { position: relative; }
.game-main::after { content: ""; position: absolute; inset: 0; z-index: 20; border-radius: 22px; opacity: 0; pointer-events: none; transition: opacity .18s;
  background: var(--cream, #FFF6DF); border: 4px solid var(--ink, #2B1B17);
  background-image: radial-gradient(rgba(43,27,23,.06) 1.4px, transparent 1.6px); background-size: 14px 14px; }
#modals { position: relative; z-index: 300; }
.modal .pause-art { display: block; width: 150px; height: auto; margin: -6px auto 4px; }
body.game-paused .game-main::after { opacity: 1; pointer-events: auto; }
body.game-paused .game-main > * { filter: blur(14px); }

/* 배경화면 */
.today-row { display: flex; flex-direction: column; align-items: flex-start; align-self: flex-start; gap: 8px; }
.wp-btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 15px; color: var(--ink); background: var(--white, #fff); border: 2.5px solid var(--ink); border-radius: 999px; padding: 5px 12px 5px 6px; box-shadow: 0 3px 0 var(--ink); cursor: pointer; }
.wp-btn img { width: 26px; height: 26px; object-fit: contain; }
.wp-btn:hover { transform: translateY(-1px); } .wp-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.wp-lead { margin: 0 0 12px; font-size: 15px; opacity: .75; }
.wp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; max-height: 62vh; overflow-y: auto; padding: 4px 6px 10px 2px; }
.wp-item { font: inherit; color: var(--ink); background: var(--white, #fff); border: 3px solid var(--ink); border-radius: 16px; padding: 6px 6px 8px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; box-shadow: 0 4px 0 var(--ink); transition: transform .12s; }
.wp-item:hover { transform: translateY(-2px); }
.wp-item.on { background: var(--butter); }
.wp-item b { font-weight: 400; font-size: 15px; }
.wp-thumb { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 10px; border: 2px solid var(--ink); background: center / cover no-repeat; }
.wp-item.on .wp-thumb::after { content: "✓"; position: absolute; right: 6px; top: 4px; width: 26px; height: 26px; border-radius: 50%; background: var(--mint); border: 2px solid var(--ink); display: grid; place-items: center; font-size: 15px; }
.wp-auto { position: absolute; left: 6px; top: 4px; font-style: normal; font-size: 13px; background: var(--butter); border: 2px solid var(--ink); border-radius: 999px; padding: 0 8px; }

/* 에테르AI 스트립 연출 */
.fx-strip { background-repeat: no-repeat; flex: none; }
.machine-strip { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); filter: drop-shadow(0 8px 0 rgba(43,27,23,.18)); }
.machine-wrap { justify-content: center; }
.gacha-stage .capsule-strip { align-self: end; margin-bottom: -10px; }
.capsule-strip.gold { filter: drop-shadow(0 0 16px rgba(255,200,0,.75)); }

.guard-card .guard-logo { width: 300px; height: auto; border: 0; border-radius: 0; }

/* ---------- v1.3 장식 테두리 (frame.webp 9-slice) + 리본 제목 ---------- */
.panel-card, .result-card, .modal, .guard-card {
  border: 0 solid transparent; border-radius: 0; background: none; box-shadow: none;
  border-image: url("../assets/ui/frame.webp") 120 fill / 60px stretch;
  filter: drop-shadow(0 10px 0 rgba(43,27,23,.16));
}
.panel-card { padding: 30px 32px 30px; }
.panel-head { background: none; border-bottom: 0; padding: 0 6px 6px; }
.panel-head h2, .modal-title {
  flex: 0 1 auto; justify-self: center; display: inline-block; padding: 6px 58px 12px; margin: 0;
  border: 0 solid transparent; border-image: url("../assets/ui/ribbon.webp") 0 150 fill / 0 52px stretch;
  font-size: 26px; line-height: 1.1;
}
.panel-head .btn { margin-left: auto; }
.result-card { padding: 44px 46px 46px; }
.modal { padding: 40px 42px 38px; }
.modal-title { margin-bottom: 8px; }
.guard-card { padding: 44px 40px; }

/* v1.3 AI 레터링 타이틀 */
.gc-name img { display: block; height: clamp(54px, 5.2vw, 76px); width: auto; max-width: 100%; margin: 2px auto 0; filter: drop-shadow(0 3px 0 rgba(43,27,23,.15)); }
.game-card:hover .gc-name img { animation: titleWob .5s ease-in-out; }
@keyframes titleWob { 30% { transform: rotate(-3deg) scale(1.05); } 60% { transform: rotate(2deg); } }
.bar-game .bar-title { height: 42px; width: auto; display: block; }
.res-game { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; font-size: 20px; }
.res-game img { height: 46px; width: auto; }
.res-record { -webkit-text-stroke: 0; text-shadow: none; }
.res-record img { height: 74px; width: auto; }
.stage-banner.fever img { height: 92px; width: auto; display: block; }
/* v1.3 젤리 버튼 이미지: 게임 카드 '플레이!' · 하단 메뉴 */
.gc-play { --h: 46px; height: var(--h); display: inline-flex; align-items: center; padding: 0 24px 5px; border: 0 solid transparent; border-radius: 0; background: none; box-shadow: none;
  border-image: url("../assets/ui/btn_butter.webp") 0 75 fill / 0 23px stretch; filter: drop-shadow(0 3px 0 rgba(43,27,23,.22)); }
.game-card.block .gc-play { border-image-source: url("../assets/ui/btn_mint.webp"); }
.game-card.snack .gc-play { border-image-source: url("../assets/ui/btn_pink.webp"); }
.sub-btn { --h: 72px; height: var(--h); border: 0 solid transparent; border-radius: 0; background: none; box-shadow: none; padding: 0 22px 6px 26px;
  border-image: url("../assets/ui/btn_cream.webp") 0 75 fill / 0 36px stretch; filter: drop-shadow(0 4px 0 rgba(43,27,23,.2)); transition: transform .1s; }
.sub-btn:hover { box-shadow: none; transform: translateY(-2px) scale(1.02); }
.sub-btn:active { box-shadow: none; transform: translateY(3px) scale(.98); }
.sub-btn.locked { background: none; filter: grayscale(.8) opacity(.75); }
#btnGacha { border-image-source: url("../assets/ui/btn_butter.webp"); }
.sub-btn { padding: 0 16px 6px 18px; gap: 8px; }
.sub-btn span { white-space: nowrap; font-size: clamp(16px, 1.4vw, 20px); }
.sub-btn img { width: 46px; height: 46px; }
.logo img.logo-art { height: 52px; }

/* v1.3 캐릭터 스토리 */
.comic-stage .cap.box { background: var(--paper); border: 3px solid var(--ink); border-radius: 10px; box-shadow: 0 4px 0 rgba(43,27,23,.25); padding: .35em .6em; width: auto !important; max-width: 34%; }
.comic-stage .c-logo.ep-end { bottom: 5%; }
.comic-stage .c-logo .end-title { font-family: var(--f-big); font-size: clamp(22px, 5cqw, 72px); color: var(--paper); padding: .25em 1.6em .4em; white-space: nowrap;
  border: 0 solid transparent; border-image: url("../assets/ui/ribbon.webp") 0 150 fill / 0 1.2em stretch; color: var(--ink); filter: drop-shadow(0 .08em 0 rgba(43,27,23,.35)); }
.modal:has(.story-box) { max-width: 560px; }
.story-box { text-align: left; margin: 4px 0 6px; }
.story-head { display: flex; align-items: center; gap: 8px; font-size: 19px; margin-bottom: 8px; }
.story-head small { color: var(--sub); font-size: 14px; }
.story-stamp { font-size: 13px; color: #fff; background: #E0556F; border: 2px solid var(--ink); border-radius: 8px; padding: 1px 8px; transform: rotate(-6deg); }
.story-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.story-row { cursor: pointer; display: flex; align-items: center; gap: 8px; text-align: left; padding: 6px; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 14px; box-shadow: 0 3px 0 var(--ink); transition: transform .1s; min-width: 0; }
.story-row:hover:not([disabled]) { transform: translateY(-2px); }
.story-row.locked { cursor: default; background: #F1ECE4; border-color: #B8ABA1; box-shadow: 0 3px 0 #B8ABA1; color: #8C7A71; }
.story-thumb { flex: none; width: 76px; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #E7E1D8; display: grid; place-items: center; }
.story-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.story-thumb b { font-family: var(--f-big); color: #B8ABA1; font-size: 22px; }
.story-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.story-txt b { font-weight: 400; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story-txt small { font-size: 12px; color: var(--sub); line-height: 1.3; }
.story-txt em { font-style: normal; background: var(--pink); border: 1.5px solid var(--ink); border-radius: 6px; padding: 0 4px; color: var(--ink); font-size: 11px; }
.story-soon { margin: 0; color: var(--sub); font-size: 14px; }
/* v1.5 젤리 버튼 글자 위치 보정: Jua 글리프가 위로 떠서 아래로 내리고, 높이 여유 */
.btn { --h: 50px; padding: calc(var(--h) * .07) calc(var(--h) * .6) 0; line-height: 1; }
.btn-sm { --h: 40px; }
.btn-big { --h: 60px; }
.btn-huge { --h: 84px; }
.gc-play { --h: 50px; padding: 4px 28px 0; line-height: 1; font-size: 19px; border-image-width: 0 25px; }
.sub-btn { padding-top: 4px; padding-bottom: 0; }

/* v1.5 뽑기: 원해상도 격자 시트 + 확대 시 픽셀 유지, 뽑기창 크기 축소 */
.fx-strip.pixel { image-rendering: pixelated; }
.machine-wrap { height: min(420px, 100%); }
.machine { max-height: 400px; }
.gacha-stage { height: 360px; }
.gacha-stage { height: 320px; }
.gacha-right { gap: 10px; }
.gacha-stage { height: 300px; }
.gacha-rule { font-size: 12.5px; max-width: 56ch; }

.test-pill { cursor: pointer; font-size: 14px; background: #EDE7FF; border-style: dashed; }
.modal:has(.modal-btns > :nth-child(4)) { max-width: 560px; }

/* v1.5 게임 설명 카드 */
.howto { position: absolute; inset: 0; z-index: 35; display: grid; place-items: center; background: rgba(43,27,23,.38); backdrop-filter: blur(3px); animation: fadeIn .2s both; padding: 16px; }
.howto-card { width: min(640px, 100%); max-height: 100%; overflow: auto; text-align: center; padding: 44px 48px 40px;
  border: 0 solid transparent; border-image: url("../assets/ui/frame.webp") 120 fill / 60px stretch; filter: drop-shadow(0 10px 0 rgba(43,27,23,.16)); animation: popIn2 .35s cubic-bezier(.2,.9,.2,1.25) both; }
.howto-title { height: 76px; width: auto; display: block; margin: 0 auto; }
.howto-sub { margin: 4px 0 14px; color: var(--sub); font-size: 15px; }
.howto-steps { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; text-align: left; }
.howto-steps li { display: grid; grid-template-columns: 30px 150px 1fr; align-items: center; gap: 12px; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 16px; padding: 8px 14px; box-shadow: 0 3px 0 rgba(43,27,23,.18); }
.ht-n { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--butter); border: 2.5px solid var(--ink); font-family: var(--f-big); }
.ht-art { display: flex; justify-content: center; align-items: center; min-height: 52px; }
.ht-t { font-size: 17px; line-height: 1.35; }
.ht-t b { color: #C2445F; font-weight: 400; }
.ht-row { display: flex; align-items: center; gap: 4px; }
.ht-row i { font-style: normal; font-family: var(--f-big); font-size: 20px; }
.ht-jelly { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; }
.ht-drag { padding: 4px; border: 3px dashed #E0556F; border-radius: 10px; animation: htPulse 1.2s ease-in-out infinite; }
@keyframes htPulse { 50% { transform: scale(1.06); } }
.ht-ten { font-family: var(--f-big); font-weight: 400; font-size: 28px; color: var(--pink); -webkit-text-stroke: 1.2px var(--ink); paint-order: stroke fill; }
.ht-title { height: 46px; width: auto; }
.ht-keys { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.ht-keys kbd { margin: 0; opacity: 1; font-size: 14px; padding: 3px 7px; background: var(--paper); border-width: 2.5px; border-radius: 8px; box-shadow: 0 2px 0 var(--ink); }
.ht-line { display: flex; gap: 2px; padding: 4px; border-radius: 8px; background: #E9F4FB; animation: htLine 1.4s ease-in-out infinite; }
.ht-line i { width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--ink); background: var(--mint); }
.ht-line i:nth-child(2n) { background: var(--pink); } .ht-line i:nth-child(3n) { background: var(--butter); }
@keyframes htLine { 60% { filter: brightness(1); } 75% { filter: brightness(1.6); transform: scaleY(.6); } 90% { opacity: 0; } }
.howto-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 12px; }
.mode-card { cursor: pointer; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 3px solid var(--ink); border-radius: 16px; background: var(--paper); box-shadow: 0 4px 0 var(--ink); text-align: center; }
.mode-card b { font-weight: 400; font-size: 19px; }
.mode-card small { font-size: 13px; color: var(--sub); }
.mode-card[aria-pressed="true"] { background: var(--mint); transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.howto-skip { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--sub); cursor: pointer; margin-bottom: 12px; }
.howto-btns { display: flex; justify-content: center; gap: 12px; }
/* 메인 카드 모드 칩 */
.gc-modes { position: absolute; top: 24px; right: 24px; display: flex; gap: 4px; z-index: 2; }
.mode-chip { cursor: pointer; font-size: 13px; padding: 4px 9px; background: rgba(255,255,255,.92); border: 2.5px solid var(--ink); border-radius: 999px; box-shadow: 0 2px 0 var(--ink); }
.mode-chip[aria-pressed="true"] { background: var(--mint); }
.mode-chip:hover { transform: translateY(-1px); }

/* v1.5 간식 더미 (캐릭터 뒤) */
.stage-pile { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.stage-pet { z-index: 2; }
.stage-fx { z-index: 3; }

/* v1.5 캐릭터 바닥 이미지 */
.rug { height: auto; aspect-ratio: 2 / 1; border: 0; border-radius: 0; box-shadow: none; background: url("../assets/ui/rug_knit.webp") center / contain no-repeat; filter: drop-shadow(0 6px 0 rgba(43,27,23,.12)); image-rendering: pixelated; }
.rug[data-rug="cake"] { aspect-ratio: 614 / 341; }

/* v1.5 인게임 장식 테두리 (레이아웃은 그대로, 바깥으로 그림) */
.st-app .fb-root { border-color: transparent; box-shadow: none; background: none;
  border-image: url("../assets/ui/frame_snack.webp") 120 fill / 50px / 12px stretch; filter: drop-shadow(0 8px 0 rgba(43,27,23,.16)); }
.pb-host .pb-boardwrap { border-color: transparent; box-shadow: none; background: none;
  border-image: url("../assets/ui/frame_block.webp") 120 fill / 44px / 16px stretch; filter: drop-shadow(0 8px 0 rgba(43,27,23,.16)); }
.pb-host .pb-board { border: 3px solid var(--ink); }
/* v1.6 게임 카드: '플레이!' 버튼을 최고점과 같은 줄에 두어 설명과 겹치지 않게 */
.game-card { grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: center; }
.game-card > * { grid-column: 1 / -1; }
.game-card > .gc-best { grid-column: 1; }
.game-card > .gc-play { grid-column: 2; position: static; justify-self: end; margin-top: -2px; }
.game-card > .gc-modes { grid-column: auto; }
.gc-desc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* v1.7 배경음악 토글 */
.pill.music { cursor: pointer; gap: 4px; padding: 0 12px 0 10px; }
.pill.music .music-ico { font-size: 20px; line-height: 1; color: #C2445F; }
.pill.music .music-t { font-size: 14px; }
.pill.music.off { opacity: .75; }
.pill.music.off .music-ico { color: #A99A90; text-decoration: line-through; text-decoration-thickness: 2px; }
.pill.music:not(.off) .music-ico { animation: musicBob 1.2s ease-in-out infinite; }
@keyframes musicBob { 50% { transform: translateY(-2px) rotate(-8deg); } }
