/* 낙월 덱 도감 — 옻칠 흑 · 금박 · 인주 */
:root {
  color-scheme: dark;
  --lacquer: #120e0b;
  --lacquer-2: #1c1612;
  --ink: #2a211b;
  --paper: #efe4cc;
  --paper-dim: #b9ab90;
  --paper-faint: #7d705d;
  --gold: #d2ae63;
  --gold-hi: #f6dd9c;
  --gold-lo: #8a6a2c;
  --seal: #b8352a;
  --seal-hi: #d9573f;
  --line: rgba(210, 174, 99, .22);

  --wei: #4f7fc4;
  --shu: #4f9a5c;
  --wu: #c4513f;
  --qun: #a48a5a;

  --t-cmd: #d2ae63;   /* 지휘 */
  --t-act: #d9573f;   /* 액티브 */
  --t-pas: #5fa39a;   /* 패시브 */
  --t-chg: #9b7fd0;   /* 추격 */

  --f-display: "Song Myung", "Nanum Myeongjo", "Batang", serif;
  --f-body: "Gowun Batang", "Nanum Myeongjo", "Batang", serif;
  --f-ui: "IBM Plex Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(184, 53, 42, .16), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(210, 174, 99, .10), transparent 60%),
    var(--lacquer);
  color: var(--paper);
  font-family: var(--f-ui);
  font-size: 15px;
  line-height: 1.55;
  padding-inline: max(16px, env(safe-area-inset-left, 0px));
  padding-block: env(safe-area-inset-top, 0px) env(safe-area-inset-bottom, 0px);
}
body.locked { overflow: hidden; }
button { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }

/* ── header ───────────────────────────── */
.top { max-width: 1200px; margin: 0 auto; padding-block: 28px 8px; display: grid; gap: 6px; }
.eyebrow { font-size: 12px; letter-spacing: .14em; color: var(--gold); }
.top h1 {
  margin: 0; font-family: var(--f-display); font-weight: 400;
  font-size: clamp(40px, 9vw, 64px); line-height: 1.05; letter-spacing: .02em;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-wrap: balance;
}
.lede { margin: 0; color: var(--paper-dim); font-size: 14px; max-width: 60ch; }

/* ── toolbar ──────────────────────────── */
.toolbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  max-width: 1200px; margin: 12px auto 0; padding-block: 10px;
  display: grid; gap: 10px;
  background: var(--lacquer);
  box-shadow: 0 14px 14px -6px var(--lacquer);
}
.search {
  display: flex; align-items: center; gap: 10px;
  background: var(--lacquer-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 0 14px; height: 46px;
}
.search:focus-within { border-color: var(--gold); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--gold); stroke-width: 2; flex: none; }
.search input {
  flex: 1; min-width: 0; background: none; border: 0; outline: none;
  color: var(--paper); font-size: 16px;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
}
.search input::placeholder { color: var(--paper-faint); }
.filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.filters::-webkit-scrollbar { display: none; }
.fchip {
  flex: none; border: 1px solid var(--line); background: transparent; color: var(--paper-dim);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.fchip[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--lacquer); font-weight: 600; }

main { max-width: 1200px; margin: 0 auto; padding-block: 4px 40px; }
.count { color: var(--paper-faint); font-size: 13px; margin: 4px 0 12px; font-variant-numeric: tabular-nums; }
.grid {
  display: grid; gap: 18px 14px;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
}
@media (min-width: 720px) { .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 26px 22px; } }
.empty { color: var(--paper-dim); text-align: center; padding: 40px 0; }
.foot { max-width: 1200px; margin: 0 auto; padding-block: 20px 36px; color: var(--paper-faint); font-size: 12px; border-top: 1px solid var(--line); }

/* ── card shell ───────────────────────── */
.slot { perspective: 900px; display: grid; }
.grid .card, .grid .flipper, .grid .face { height: 100%; }
.card {
  --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 50%; --hyp: 0; --bgx: 50%; --bgy: 50%;
  position: relative; display: grid; width: 100%;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .5s cubic-bezier(.2, .8, .2, 1);
  border-radius: 14px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.card.live { transition: none; }
.card .flipper {
  grid-area: 1 / 1; display: grid; transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.3, 1.3, .4, 1);
}
.card.flipped .flipper { transform: rotateY(180deg); }
.face {
  grid-area: 1 / 1; position: relative; border-radius: 14px; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  padding: 7px;
  background: var(--frame);
  box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, 0 18px 40px -18px rgba(0,0,0,.9), 0 2px 6px rgba(0,0,0,.5);
}
.face.back { transform: rotateY(180deg); }
.card:not(.flipped) .back, .card.flipped .front { pointer-events: none; }
.face-in {
  position: relative; height: 100%; border-radius: 9px; overflow: hidden;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'%3E%3Cpath d='M4 22h8v-8h8v16h-8M40 22h-8v8h-8V14h8' fill='none' stroke='%23d2ae63' stroke-opacity='.07' stroke-width='1.2'/%3E%3C/svg%3E"),
    linear-gradient(170deg, #241b15, #140f0c 70%);
  box-shadow: 0 0 0 1px rgba(0,0,0,.6) inset, 0 0 0 2px var(--edge) inset;
  display: flex; flex-direction: column;
}

/* tier foils */
.tier-ten { --frame: linear-gradient(135deg, #fff1b8, #d2ae63 18%, #8a6a2c 35%, #f6dd9c 50%, #b58a3c 68%, #fff1b8 85%, #9c7a38); --edge: rgba(246,221,156,.7); }
.tier-chi { --frame: linear-gradient(135deg, #f0d48c, #a07a33 30%, #e8c77a 52%, #7a5a22 75%, #d9b565); --edge: rgba(210,174,99,.55); }
.tier-jin { --frame: linear-gradient(135deg, #e6e6e0, #8d8f92 30%, #d8d8d2 52%, #5f6164 75%, #c9c9c3); --edge: rgba(220,220,214,.45); }

/* ── front ───────────────────────────── */
.front .face-in { min-height: 100%; }
.stage-card .art { aspect-ratio: auto; flex: 1 1 0; min-height: 0; }
.fr-head { display: flex; align-items: flex-start; gap: 8px; padding: 9px 10px 7px; position: relative; z-index: 2; }
.seal {
  flex: none; width: 38px; height: 38px; border-radius: 5px; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 25%, var(--seal-hi), var(--seal) 60%, #7e2019);
  color: #fbe9d8; font-family: var(--f-display); line-height: 1; text-align: center;
  box-shadow: 0 0 0 1.5px rgba(251,233,216,.55) inset, 0 3px 8px rgba(0,0,0,.5);
  transform: rotate(-4deg);
}
.seal b { font-size: 17px; font-weight: 400; display: block; }
.seal small { font-family: var(--f-ui); font-size: 9px; letter-spacing: .02em; display: block; margin-top: 2px; font-variant-numeric: tabular-nums; }
.fr-title { min-width: 0; }
.fr-title h3 {
  margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 19px; line-height: 1.15;
  color: var(--paper); text-shadow: 0 1px 0 #000; text-wrap: balance; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.fr-title .alias { font-size: 11px; color: var(--gold); letter-spacing: .12em; font-family: var(--f-body); }

.art { position: relative; flex: 1 0 auto; display: flex; gap: 3px; margin: 0 7px; aspect-ratio: 1.02; max-width: 100%; }
.art .p {
  position: relative; flex: 1; overflow: hidden; border-radius: 4px;
  background: #0b0908;
  box-shadow: 0 0 0 1px rgba(0,0,0,.7), 0 0 0 1px var(--edge) inset;
}
.art .p img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; transform: scale(1.03); }
.art .p::after { content: ""; position: absolute; inset: 55% 0 0; background: linear-gradient(transparent, rgba(8,6,5,.95)); }
.art .p .nm {
  position: absolute; left: 0; right: 0; bottom: 5px; z-index: 1; text-align: center;
  font-family: var(--f-display); font-size: 14px; line-height: 1.1; text-shadow: 0 1px 2px #000;
}
.art .p .nm i { display: block; font-style: normal; font-family: var(--f-ui); font-size: 9px; color: var(--gold-hi); letter-spacing: .04em; margin-bottom: 1px; }
.art .p .fac {
  position: absolute; top: 4px; left: 4px; z-index: 1; width: 17px; height: 17px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--f-display); font-size: 11px; color: #fff;
  background: var(--fc); box-shadow: 0 0 0 1px rgba(0,0,0,.5);
}
.fac-위 { --fc: var(--wei); } .fac-촉 { --fc: var(--shu); } .fac-오 { --fc: var(--wu); } .fac-군 { --fc: var(--qun); }

.fr-foot { margin-top: auto; padding: 8px 10px 9px; display: grid; gap: 5px; position: relative; z-index: 2; }
.formation { display: flex; align-items: baseline; gap: 6px; font-family: var(--f-display); font-size: 14px; color: var(--gold-hi); }
.formation span { font-size: 11px; color: var(--paper-faint); font-family: var(--f-body); letter-spacing: .1em; }
.flavor {
  margin: 0; font-family: var(--f-body); font-size: 11.5px; line-height: 1.45; color: var(--paper-dim);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 10px; padding: 1px 6px; border-radius: 3px; border: 1px solid var(--line); color: var(--gold); }

/* holo layers */
.shine, .glare { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; z-index: 3; }
.glare {
  background: radial-gradient(farthest-corner circle at var(--mx) var(--my), rgba(255,250,230,.55) 0%, rgba(255,240,200,.12) 22%, transparent 55%);
  mix-blend-mode: overlay; opacity: calc(.25 + var(--hyp) * .75);
}
.tier-ten .shine {
  background:
    repeating-linear-gradient(115deg, rgba(255,0,110,.0) 0%, hsla(330,90%,65%,.55) 4%, hsla(50,100%,65%,.55) 8%, hsla(160,90%,60%,.55) 12%, hsla(210,100%,65%,.55) 16%, hsla(280,90%,65%,.55) 20%, rgba(255,0,110,.0) 24%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Cg fill='%23fff'%3E%3Ccircle cx='8' cy='12' r='.9'/%3E%3Ccircle cx='41' cy='7' r='.6'/%3E%3Ccircle cx='27' cy='33' r='1'/%3E%3Ccircle cx='52' cy='44' r='.7'/%3E%3Ccircle cx='14' cy='51' r='.6'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 300% 300%, 60px 60px;
  background-position: var(--bgx) var(--bgy), calc(var(--bgx) * .3) calc(var(--bgy) * .3);
  mix-blend-mode: color-dodge; opacity: calc(.14 + var(--hyp) * .42);
  filter: saturate(1.2) contrast(1.1);
}
.tier-chi .shine {
  background: linear-gradient(110deg, transparent 30%, rgba(255,226,150,.55) 45%, rgba(255,250,220,.75) 50%, rgba(255,226,150,.55) 55%, transparent 70%);
  background-size: 250% 250%; background-position: var(--bgx) var(--bgy);
  mix-blend-mode: soft-light; opacity: calc(.35 + var(--hyp) * .6);
}
.tier-jin .shine { display: none; }
.front .art .shine { border-radius: 4px; }
/* 天 등급은 초상 위에도 홀로가 한 겹 더 */
.tier-ten .art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: 4px; z-index: 1;
  background: linear-gradient(125deg, transparent 20%, hsla(190,90%,70%,.35) 38%, hsla(300,90%,70%,.3) 50%, hsla(50,100%,70%,.35) 62%, transparent 80%);
  background-size: 260% 260%; background-position: var(--bgx) var(--bgy);
  mix-blend-mode: color-dodge; opacity: calc(.06 + var(--hyp) * .32);
}

/* grid idle shimmer for 天 */
@media (prefers-reduced-motion: no-preference) {
  .grid .tier-ten { animation: sway 7s ease-in-out infinite; }
  .grid .slot:nth-child(2n) .tier-ten { animation-delay: -3s; }
}
@keyframes sway {
  0%, 100% { --bgx: 20%; --bgy: 30%; --mx: 25%; --my: 20%; }
  50% { --bgx: 80%; --bgy: 70%; --mx: 75%; --my: 80%; }
}
@property --bgx { syntax: "<percentage>"; inherits: true; initial-value: 50%; }
@property --bgy { syntax: "<percentage>"; inherits: true; initial-value: 50%; }
@property --mx { syntax: "<percentage>"; inherits: true; initial-value: 50%; }
@property --my { syntax: "<percentage>"; inherits: true; initial-value: 50%; }

/* ── back ─────────────────────────────── */
.back .face-in { padding: 10px 10px 12px; gap: 8px; }
.bk-head { display: flex; align-items: center; gap: 8px; }
.bk-head .seal { width: 32px; height: 32px; }
.bk-head .seal b { font-size: 14px; }
.bk-head h3 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 18px; line-height: 1.15; }
.bk-head .sub { font-size: 11px; color: var(--paper-faint); }
.bk-head .sub b { color: var(--gold-hi); font-weight: 500; font-family: var(--f-display); font-size: 13px; }

.off { display: grid; gap: 5px; padding: 8px; border-radius: 7px; background: rgba(0,0,0,.28); border: 1px solid rgba(210,174,99,.12); }
.off-h { display: flex; align-items: center; gap: 8px; }
.av { flex: none; width: 38px; height: 38px; border-radius: 50%; overflow: hidden; background: #000; box-shadow: 0 0 0 2px var(--fc), 0 0 0 3px rgba(0,0,0,.6); }
.av img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 10%; transform: scale(1.35) translateY(8%); }
.off-n { min-width: 0; flex: 1; }
.off-n strong { font-family: var(--f-display); font-weight: 400; font-size: 16px; line-height: 1.1; }
.off-n .mini { display: block; font-size: 10.5px; color: var(--paper-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.off-n .mini em { font-style: normal; color: var(--paper-dim); }
.pill { font-size: 9.5px; padding: 0 5px; border-radius: 3px; background: rgba(210,174,99,.16); color: var(--gold-hi); margin-left: 4px; vertical-align: 2px; font-family: var(--f-ui); }

.row { display: flex; align-items: flex-start; gap: 6px; }
.row > .k { flex: none; width: 26px; font-size: 10px; color: var(--paper-faint); padding-top: 4px; letter-spacing: .04em; }
.row > .v { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.or { font-size: 10px; color: var(--paper-faint); align-self: center; }
.chip {
  --tc: var(--paper-dim);
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  border: 1px solid color-mix(in srgb, var(--tc) 55%, transparent);
  background: color-mix(in srgb, var(--tc) 13%, transparent);
  color: var(--paper); border-radius: 5px; padding: 2px 7px; font-size: 12px; line-height: 1.35;
  cursor: pointer; text-align: left; white-space: nowrap;
}
.chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--tc); flex: none; }
.chip.ty1 { --tc: var(--t-cmd); } .chip.ty2 { --tc: var(--t-act); } .chip.ty3 { --tc: var(--t-pas); } .chip.ty4 { --tc: var(--t-chg); }
.chip.alt { border-style: dashed; background: transparent; color: var(--paper-dim); }
.chip.book::before { border-radius: 1px; transform: rotate(45deg); }
.chip.book.gold { --tc: var(--gold); background: linear-gradient(180deg, rgba(246,221,156,.22), rgba(138,106,44,.18)); color: var(--gold-hi); }
.chip.book.gold .g { font-family: var(--f-display); font-size: 11px; color: var(--gold-hi); }
.chip.nodata { cursor: default; opacity: .75; }
.chip .mk { font-size: 9.5px; background: var(--seal); color: #fff; border-radius: 2px; padding: 0 3px; }
.gear span { white-space: nowrap; }
.gear { font-size: 10.5px; color: var(--paper-dim); display: flex; flex-wrap: wrap; gap: 2px 10px; padding-left: 32px; }
.gear b { color: var(--paper-faint); font-weight: 400; margin-right: 3px; }
.extra { font-size: 11px; color: var(--paper-dim); }
.extra summary { cursor: pointer; color: var(--gold); padding: 4px 0; }
.extra[open] > .row, .extra[open] > .gear { margin-top: 6px; }
.extra .gear { padding-left: 0; }
.extra .gear span { white-space: normal; overflow-wrap: anywhere; }
.extra-content { display: grid; gap: 12px; padding: 12px 0 20px; }
.extra-content .gear { padding: 0; font-size: 13px; }
.extra-content .gear span { white-space: normal; overflow-wrap: anywhere; }
.variant-list { display: grid; gap: 8px; margin: 12px 0 20px; }
.variant-option { text-align: left; display: grid; gap: 5px; }
.variant-option span { font-size: 11px; color: var(--paper-dim); }
.variant-option[aria-pressed="true"] { border-color: var(--gold); }
.review-text { white-space: pre-line; line-height: 1.7; }
.back .glare { display: none; }

.notes { margin: 2px 0 0; padding: 8px 10px 2px; list-style: none; border-top: 1px dashed var(--line); font-family: var(--f-body); font-size: 12px; color: var(--paper-dim); display: grid; gap: 3px; }
.notes li::before { content: "·"; color: var(--gold); margin-right: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 10px; color: var(--paper-faint); padding-left: 2px; }
.legend i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; }
.stamp { position: absolute; right: 12px; bottom: 8px; font-family: var(--f-display); font-size: 10px; color: var(--paper-faint); letter-spacing: .2em; }

/* ── stage (overlay) ──────────────────── */
.stage { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }
.stage-bg { position: absolute; inset: 0; background: rgba(6,4,3,.86); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.stage-inner {
  position: relative; width: min(94vw, 430px); max-height: 100%; overflow-y: auto;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 0 calc(env(safe-area-inset-bottom, 0px) + 18px);
  display: grid; gap: 14px; justify-items: center; scrollbar-width: none;
}
.stage-card { width: 100%; perspective: 1100px; touch-action: pan-y; }
.stage-card .card { cursor: grab; }
.stage-card .fr-title h3 { font-size: 26px; }
.stage-card .seal { width: 48px; height: 48px; } .stage-card .seal b { font-size: 21px; } .stage-card .seal small { font-size: 10px; }
.stage-card .art .p .nm { font-size: 19px; bottom: 8px; } .stage-card .art .p .nm i { font-size: 11px; }
.stage-card .art .p .fac { width: 22px; height: 22px; font-size: 13px; }
.stage-card .flavor { font-size: 13px; -webkit-line-clamp: 3; }
.stage-card .tag { font-size: 11px; }
.stage-card .formation { font-size: 17px; }
.stage-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.btn { border: 1px solid var(--line); background: var(--lacquer-2); color: var(--paper); border-radius: 8px; padding: 9px 16px; font-size: 14px; cursor: pointer; }
.btn-gold { background: linear-gradient(180deg, var(--gold-hi), var(--gold)); color: #231a0e; border-color: var(--gold); font-weight: 600; }
.btn-ghost { background: transparent; color: var(--paper-dim); }
.stage-hint { margin: 0; font-size: 12px; color: var(--paper-faint); }

/* ── sheet ────────────────────────────── */
.sheet { position: fixed; inset: 0; z-index: 70; display: grid; align-items: end; justify-items: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.sheet-panel {
  position: relative; width: min(100%, 520px); max-height: 80vh; overflow-y: auto;
  background: linear-gradient(180deg, #2a2019, #18120e); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 18px 18px 0 0; padding: 8px 20px calc(env(safe-area-inset-bottom, 0px) + 22px);
  animation: up .28s cubic-bezier(.2,.9,.3,1);
}
@media (min-width: 720px) { .sheet { align-items: center; } .sheet-panel { border-radius: 16px; border-bottom: 1px solid var(--line); } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--paper-faint); margin: 4px auto 14px; opacity: .6; }
.sh-top { display: flex; gap: 14px; align-items: center; }
.sh-top img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; box-shadow: 0 0 0 1px var(--line); flex: none; background: #000; }
.sh-top h2 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 26px; line-height: 1.15; }
.sh-kind { font-size: 12px; color: var(--gold); letter-spacing: .08em; }
.sh-desc { font-family: var(--f-body); font-size: 16px; line-height: 1.65; margin: 16px 0 12px; }
.sh-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; }
.sh-meta li { font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 3px 9px; color: var(--paper-dim); font-variant-numeric: tabular-nums; }
.sh-meta li b { color: var(--paper); font-weight: 500; }
.sh-used { border-top: 1px dashed var(--line); padding-top: 12px; }
.sh-used p { margin: 0 0 8px; font-size: 13px; color: var(--paper-dim); }
.sh-used .v { display: flex; flex-wrap: wrap; gap: 6px; }
.sh-used button { border: 1px solid var(--line); background: transparent; color: var(--paper); border-radius: 999px; padding: 4px 11px; font-size: 13px; cursor: pointer; }
.sh-miss { color: var(--paper-faint); font-size: 13px; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); transform: translateX(-50%); z-index: 90;
  background: var(--paper); color: var(--lacquer); padding: 9px 16px; border-radius: 8px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}

/* 캡처 중에는 기울기 해제 */
.capturing .card, .capturing .flipper { transition: none !important; }

@media (hover: hover) and (pointer: fine) {
  .grid .card:hover { z-index: 2; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .card .flipper { transition: none; }
  .sheet-panel { animation: none; }
}

body.locked .grid .card { animation-play-state: paused; }

@media (max-width: 600px), (hover: none), (pointer: coarse) {
  .stage-inner {
    width: 100%; height: 100%; box-sizing: border-box; overflow: hidden;
    padding: calc(env(safe-area-inset-top, 0px) + 24px) 18px calc(env(safe-area-inset-bottom, 0px) + 16px);
    grid-template-rows: minmax(0, 1fr) auto auto; gap: 10px;
  }
  .stage-card { width: min(92vw, 430px); align-self: center; }
  .stage-card .flipper { height: auto; min-height: 80svh; }
  .stage-card .face, .stage-card .face-in { min-height: 0; }
  .stage .stage-inner {
    display: flex; flex-direction: column; align-items: center; overflow-y: auto;
    padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
  }
  .stage .stage-card { flex: none; }
  .stage .front { position: absolute; inset: 0; }
  .stage .back { min-height: 80svh; }
  .stage .back .face-in { height: auto; min-height: 100%; overflow: visible; gap: 6px; }
  .stage .off { flex: none; gap: 4px; padding: 7px; }
  .stage .stage-bar { flex: none; position: sticky; bottom: 0; background: var(--bg, #120e0b); padding: 6px; border-radius: 10px; }
  .stage .stage-hint { flex: none; }
  .stage-bar { gap: 6px; }
  .stage-bar .btn { padding: 9px 10px; font-size: 12px; }
  .stage-hint { margin: 0; font-size: 11px; text-align: center; }
}

@media (hover: none), (pointer: coarse) {
  .grid .tier-ten { animation: none; }
  .stage-bg { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .card .shine, .tier-ten .art::after { display: none; }
  .card .glare {
    inset: -25%;
    background: linear-gradient(115deg, transparent 30%, rgba(255,240,200,.24) 50%, transparent 70%);
    mix-blend-mode: normal;
    opacity: .32;
    filter: none;
    transform: translate3d(var(--light-x, 0%), var(--light-y, 0%), 0);
  }
  .stage-card .card.live, .stage-card .card.live .glare { will-change: transform; }
}
