/* ETERNAL TCG - スマホ縦画面を最優先。PCでは中央に縦長の画面を表示する */
:root {
  --bg: #0b0d17; --panel: #151a2c; --panel2: #1c2238; --line: #2c3454; --text: #eceff8; --sub: #9aa3c0;
  --gold: #f0c869; --accent: #6aa8ff; --good: #6fd66a; --bad: #ff6b6b;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #05060b; color: var(--text); overscroll-behavior: none;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif; font-size: 15px; line-height: 1.5; }
body { -webkit-user-select: none; user-select: none; touch-action: manipulation; }
[data-act] { cursor: pointer; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input, textarea, select { font: inherit; color: var(--text); background: #0d1122; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; -webkit-user-select: text; user-select: text; }
h1, h2, h3 { margin: 0; font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif; letter-spacing: .04em; }
h2 { font-size: 1.25rem; } h3 { font-size: 1.02rem; }
p { margin: 0; }
[hidden] { display: none !important; }

#app, #battle, #overlay, #packview { position: fixed; top: 0; bottom: 0; left: 50%; width: 100%; max-width: 480px; transform: translateX(-50%); }
#app { display: flex; flex-direction: column; background: radial-gradient(120% 60% at 50% 0%, #1a2142 0%, var(--bg) 60%); }
#top { flex: none; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) 14px 8px; border-bottom: 1px solid var(--line); background: rgba(8, 10, 20, .7); font-size: .86rem; }
#top .date { color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#top .cur { display: flex; gap: 12px; font-weight: 700; flex: none; }
.coin::before { content: "◎"; color: var(--gold); margin-right: 3px; }
.shard::before { content: "◆"; color: #8fd3ff; margin-right: 3px; }
#screen { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px 14px 24px; -webkit-overflow-scrolling: touch; }
#nav { flex: none; display: flex; border-top: 1px solid var(--line); background: #090b15; padding-bottom: var(--safe-b); }
#nav button { flex: 1; padding: 8px 0 7px; font-size: .68rem; color: var(--sub); display: flex; flex-direction: column; align-items: center; gap: 2px; }
#nav button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#nav button.on { color: var(--gold); }
#nav button .dot { position: absolute; margin-left: 22px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }

/* ---- 汎用部品 ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px; border-radius: 12px; font-weight: 700;
  background: linear-gradient(180deg, #2a3358, #1b2140); border: 1px solid #3b4675; color: var(--text); }
.btn:active { transform: translateY(1px); filter: brightness(1.15); }
.btn.gold { background: linear-gradient(180deg, #f6d57e, #c9962a); border-color: #ffe9a8; color: #2b1d00; }
.btn.blue { background: linear-gradient(180deg, #5c9dff, #2c5fc4); border-color: #9cc4ff; color: #fff; }
.btn.red { background: linear-gradient(180deg, #d85a5a, #8f2323); border-color: #ff9c9c; }
.btn.small { min-height: 34px; padding: 4px 10px; font-size: .82rem; border-radius: 9px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.sub { color: var(--sub); font-size: .82rem; }
.tiny { font-size: .74rem; }
.center { text-align: center; }
.mt { margin-top: 10px; } .mb { margin-bottom: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: .72rem; background: #232a48; border: 1px solid var(--line); white-space: nowrap; }
.tag.new { background: #5a1d1d; border-color: #c04a4a; color: #ffd9d9; }
.tag.ok { background: #1d4a2a; border-color: #3d9a58; color: #d5ffd9; }
.elb { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%; font-size: .78rem; font-weight: 800; color: #fff; text-shadow: 0 1px 2px #000; border: 1px solid rgba(255, 255, 255, .5); }
.e0 { background: linear-gradient(135deg, #ff7a45, #b3261e); } .e1 { background: linear-gradient(135deg, #4fb3ff, #1d5fbf); } .e2 { background: linear-gradient(135deg, #6fd66a, #23803a); }
.e3 { background: linear-gradient(135deg, #ffe27a, #c9962a); } .e4 { background: linear-gradient(135deg, #b07cff, #5b2bb0); } .e5 { background: linear-gradient(135deg, #9fc3d1, #4b6f80); }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button { flex: 1; padding: 9px 0; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); color: var(--sub); font-weight: 700; }
.tabs button.on { background: #2a3358; color: var(--gold); border-color: #56629a; }
.stepper { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.stepper .mid { flex: 1; min-width: 0; text-align: center; }
.stepper .mid b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 8px; border-radius: 99px; background: #0d1122; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #6aa8ff, #b07cff); }

/* ---- カード ---- */
.card { --f1: #3a4160; --f2: #171b2e; --rc: #b8c0cc; position: relative; flex: none; width: 15em; height: 21em; border-radius: .9em; font-size: var(--fs, 16px);
  background: linear-gradient(160deg, var(--f1), var(--f2)); box-shadow: 0 0 0 .12em var(--rc), 0 .3em .8em rgba(0, 0, 0, .55); color: #fff; overflow: hidden; }
.card.el0 { --f1: #b8432a; --f2: #3a100c; } .card.el1 { --f1: #2f78c9; --f2: #0a2147; } .card.el2 { --f1: #3a9a4e; --f2: #0b2d16; }
.card.el3 { --f1: #c9a23a; --f2: #40300a; } .card.el4 { --f1: #7446c4; --f2: #1c0d3a; } .card.el5 { --f1: #6b8d9c; --f2: #162229; }
.card.r1 { --rc: #5aa9ff; } .card.r2 { --rc: #c77dff; } .card.r3 { --rc: #ffcc4d; }
.c-art { position: absolute; left: .55em; right: .55em; top: .55em; height: 9.4em; border-radius: .55em; background-size: cover; background-position: center; box-shadow: inset 0 0 0 .08em rgba(255, 255, 255, .3); }
.card.spell .c-art { border-radius: 50% 50% .55em .55em / 30% 30% .55em .55em; }
.c-cost { position: absolute; left: .25em; top: .25em; width: 1.9em; height: 1.9em; border-radius: 50%; display: grid; place-items: center; font-size: 1.35em; font-weight: 900;
  background: radial-gradient(circle at 35% 30%, #9fe1ff, #1e62c0 70%); box-shadow: 0 0 0 .1em #dff4ff, 0 .1em .3em #000; text-shadow: 0 .05em .1em #002; z-index: 2; }
.c-name { position: absolute; left: .5em; right: .5em; top: 9.75em; font-weight: 800; font-size: 1.04em; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 .08em .15em #000; }
.c-type { position: absolute; left: 0; right: 0; top: 16em; font-size: .72em; text-align: center; color: rgba(255, 255, 255, .8); }
.c-text { position: absolute; left: .6em; right: .6em; top: 17em; bottom: 2.9em; font-size: .74em; line-height: 1.38; padding: .45em .6em; border-radius: .6em; background: rgba(4, 6, 14, .55); overflow: hidden; }
.c-text b { color: #ffe9a8; font-weight: 700; }
.c-atk, .c-hp { position: absolute; bottom: .25em; width: 1.9em; height: 1.9em; display: grid; place-items: center; font-size: 1.3em; font-weight: 900; text-shadow: 0 .05em .1em #000; z-index: 2; }
.c-atk { left: .25em; background: radial-gradient(circle at 35% 30%, #ffd98a, #b86a12 70%); border-radius: 30% 30% 50% 50%; box-shadow: 0 0 0 .08em #fff0c9; }
.c-hp { right: .25em; background: radial-gradient(circle at 35% 30%, #ff9a9a, #a01d2c 70%); border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%; box-shadow: 0 0 0 .08em #ffd9d9; }
.c-rar { position: absolute; left: 50%; bottom: .5em; transform: translateX(-50%); font-size: .7em; font-weight: 800; letter-spacing: .1em; color: var(--rc); text-shadow: 0 0 .4em var(--rc); }
.c-kw { display: none; }
.c-n { position: absolute; right: .3em; top: .3em; padding: 0 .5em; border-radius: 99px; background: rgba(0, 0, 0, .75); font-size: 1.3em; font-weight: 800; z-index: 3; border: 1px solid rgba(255, 255, 255, .35); }
.c-new { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%) rotate(-8deg); padding: .1em .6em; background: #e33; border-radius: .4em; font-weight: 900; font-size: 1.6em; z-index: 4; box-shadow: 0 .1em .4em #000; }
/* 高レアリティの箔 */
.card.r2::after, .card.r3::after { content: ""; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; opacity: .55;
  background: linear-gradient(115deg, transparent 30%, rgba(199, 125, 255, .55) 45%, rgba(255, 255, 255, .7) 50%, rgba(122, 200, 255, .55) 55%, transparent 70%); background-size: 250% 250%; animation: foil 3.6s linear infinite; }
.card.r3::after { background: linear-gradient(115deg, transparent 25%, rgba(255, 90, 90, .5) 38%, rgba(255, 220, 90, .6) 46%, rgba(255, 255, 255, .8) 50%, rgba(90, 255, 170, .5) 54%, rgba(90, 150, 255, .5) 62%, transparent 75%); background-size: 250% 250%; opacity: .7; }
@keyframes foil { from { background-position: 120% 0; } to { background-position: -120% 0; } }
/* 小さいカード(一覧・手札): 文章は省き、絵と数値だけ */
.card.mini .c-art { height: 13.2em; }
.card.mini .c-name { font-size: 1.5em; top: 9.3em; left: .2em; right: .2em; }
.card.mini .c-type, .card.mini .c-text, .card.mini .c-rar { display: none; }
.card.mini .c-cost, .card.mini .c-atk, .card.mini .c-hp { font-size: 1.8em; }
.card.mini .c-kw { display: flex; gap: .15em; position: absolute; left: 2.6em; right: 2.6em; bottom: .5em; justify-content: center; font-size: 1.45em; }
.c-kw i, .u-kw i { font-style: normal; font-weight: 800; background: rgba(0, 0, 0, .7); border: 1px solid rgba(255, 255, 255, .5); border-radius: .3em; padding: 0 .15em; line-height: 1.25; }
.card.unowned { filter: grayscale(1) brightness(.45); }
.card.dim { filter: brightness(.5) saturate(.6); }
.cardgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; --fs: calc((min(100vw, 480px) - 28px - 24px) / 4 / 15); }
.cardgrid.c3 { grid-template-columns: repeat(3, 1fr); --fs: calc((min(100vw, 480px) - 28px - 16px) / 3 / 15); }
.cardgrid .card { cursor: pointer; }
.cardgrid .card:active { transform: scale(.96); }

/* ---- ホーム ---- */
.title { text-align: center; padding: 4px 0 10px; }
.title h1 { font-size: 1.7rem; background: linear-gradient(90deg, #f6d57e, #fff, #9cc4ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero { display: flex; gap: 12px; align-items: center; }
.pack { --p1: #5c9dff; --p2: #7446c4; position: relative; flex: none; width: 8.4em; height: 12em; font-size: var(--fs, 12px); border-radius: .5em; overflow: hidden; color: #fff; text-align: center;
  background: linear-gradient(150deg, var(--p1), var(--p2)); box-shadow: 0 0 0 .1em rgba(255, 255, 255, .5), 0 .4em 1em rgba(0, 0, 0, .6); }
.pack::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .0) 0 .5em, rgba(255, 255, 255, .08) .5em .6em), linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .5) 50%, transparent 65%); background-size: auto, 250% 250%; animation: foil 4s linear infinite; }
.pack::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: .9em; background: repeating-linear-gradient(90deg, rgba(0, 0, 0, .35) 0 .2em, transparent .2em .4em); }
.pack .p-no { position: absolute; left: 0; right: 0; top: 1.5em; font-size: .9em; letter-spacing: .2em; opacity: .9; }
.pack .p-sym { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -55%); font-size: 4.2em; font-family: serif; font-weight: 700; text-shadow: 0 .05em .2em rgba(0, 0, 0, .6); }
.pack .p-name { position: absolute; left: .3em; right: .3em; bottom: .9em; font-size: .92em; font-weight: 800; line-height: 1.2; text-shadow: 0 .1em .2em #000; }

/* ---- 敵カード ---- */
.enemy { display: flex; gap: 10px; align-items: center; }
.portrait { flex: none; width: 64px; height: 64px; border-radius: 14px; background-size: cover; background-position: center 20%; border: 2px solid rgba(255, 255, 255, .5); }
.portrait.boss { border-color: var(--gold); box-shadow: 0 0 12px rgba(240, 200, 105, .6); }
.enemy h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- デッキ編集 ---- */
.decklist { max-height: 30vh; overflow-y: auto; border-radius: 10px; background: #0d1122; border: 1px solid var(--line); }
.drow { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-bottom: 1px solid #1a2038; font-size: .86rem; }
.drow .dc { flex: none; width: 1.7em; height: 1.7em; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: #1e62c0; }
.drow .dn { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.curve { display: flex; align-items: flex-end; gap: 4px; height: 44px; }
.curve div { flex: 1; text-align: center; font-size: .66rem; color: var(--sub); }
.curve i { display: block; margin: 0 auto 2px; width: 70%; background: linear-gradient(180deg, #6aa8ff, #2c5fc4); border-radius: 3px 3px 0 0; min-height: 1px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chip { padding: 5px 10px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); font-size: .8rem; color: var(--sub); }
.chip.on { background: #2a3358; color: #fff; border-color: #7f8fd0; }

/* ---- モーダル ---- */
#overlay { z-index: 50; background: rgba(3, 4, 9, .82); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: 100%; max-height: 92%; overflow-y: auto; background: var(--panel); border: 1px solid #47528a; border-radius: 18px; padding: 16px; box-shadow: 0 10px 40px #000; animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
.modal .card { margin: 0 auto 10px; }
.gloss { font-size: .82rem; color: #cfd6ee; margin: 3px 0; }
.gloss b { color: var(--gold); }
#toast { position: fixed; left: 50%; bottom: calc(86px + var(--safe-b)); transform: translateX(-50%); z-index: 90; pointer-events: none; display: flex; flex-direction: column; gap: 6px; align-items: center; width: 90%; max-width: 440px; }
#toast div { background: rgba(10, 12, 24, .95); border: 1px solid #56629a; border-radius: 12px; padding: 8px 14px; font-size: .86rem; animation: toast 2.4s forwards; text-align: center; }
@keyframes toast { 0% { opacity: 0; transform: translateY(10px); } 10%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* ---- パック開封 ---- */
#packview { z-index: 60; background: radial-gradient(circle at 50% 40%, #232b55, #05060b 75%); display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; }
#packview .pv-top { position: absolute; top: calc(12px + var(--safe-t)); left: 0; right: 0; text-align: center; color: var(--sub); font-size: .86rem; }
#packview .pack { --fs: 22px; animation: packIdle 1.4s ease-in-out infinite; cursor: pointer; }
@keyframes packIdle { 0%, 100% { transform: rotate(-2deg) scale(1); } 50% { transform: rotate(2deg) scale(1.04); } }
#packview .pack.rip { animation: rip .55s ease-in forwards; }
@keyframes rip { 0% { transform: scale(1); } 40% { transform: scale(1.15) rotate(-4deg); filter: brightness(1.6); } 100% { transform: scale(2.4); opacity: 0; filter: brightness(4); } }
.pv-hint { margin-top: 26px; font-weight: 700; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.pv-cards { display: grid; grid-template-columns: repeat(3, auto); gap: 30px 10px; justify-content: center; --fs: calc(min(100vw, 480px) / 3.5 / 15); }
.pv-cards.many { grid-template-columns: repeat(5, auto); gap: 5px 5px; --fs: calc(min(100vw, 480px) / 5.4 / 15); max-height: 70vh; overflow-y: auto; padding: 6px; }
.flip { position: relative; width: 15em; height: 21em; font-size: var(--fs); perspective: 60em; cursor: pointer; animation: deal .35s backwards; }
.flip:nth-child(4) { grid-column: 1 / span 1; margin-left: 50%; } .flip:nth-child(5) { margin-left: 50%; }
.pv-cards.many .flip:nth-child(n) { margin-left: 0; grid-column: auto; }
@keyframes deal { from { transform: translateY(40vh) scale(.4) rotate(20deg); opacity: 0; } }
.flip .inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.3, 1.4, .5, 1); }
.flip.open .inner { transform: rotateY(180deg); }
.flip .back, .flip .front { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flip .front { transform: rotateY(180deg); }
.flip .front .card { font-size: 1em; }
.flip .back { border-radius: .9em; background: radial-gradient(circle at 50% 45%, #2c3566, #0c0f20 75%); box-shadow: 0 0 0 .12em #56629a, 0 .3em .8em #000; display: grid; place-items: center; }
.flip .back span { font-size: 6em; font-family: serif; color: #7f8fd0; }
.flip.h1 .back { box-shadow: 0 0 0 .12em #5aa9ff, 0 0 1.2em #5aa9ff; }
.flip.h2 .back { box-shadow: 0 0 0 .14em #c77dff, 0 0 1.8em #c77dff; animation: pulse 1s infinite; }
.flip.h3 .back { box-shadow: 0 0 0 .16em #ffcc4d, 0 0 2.6em #ffcc4d; animation: pulse .6s infinite; }
.flip.h3 .back span { color: #ffcc4d; text-shadow: 0 0 .3em #ffcc4d; }
@keyframes pulse { 50% { filter: brightness(1.5); } }
.flip .note { position: absolute; left: 0; right: 0; bottom: -1.9em; text-align: center; font-size: 1.4em; font-weight: 800; opacity: 0; transition: opacity .3s .3s; white-space: nowrap; }
.flip.open .note { opacity: 1; }
.pv-cards.many .flip .note { display: none; }
.pv-foot { margin-top: 34px; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; padding: 0 12px; }
.flash { position: absolute; inset: 0; background: #fff; pointer-events: none; animation: flash .7s forwards; z-index: 5; }
.flash.gold { background: radial-gradient(circle, #fff, #ffcc4d 40%, transparent 75%); animation-duration: 1.1s; }
@keyframes flash { from { opacity: .95; } to { opacity: 0; } }
.rays { position: absolute; left: 50%; top: 50%; width: 200vmax; height: 200vmax; margin: -100vmax; pointer-events: none; z-index: 1; opacity: 0;
  background: repeating-conic-gradient(rgba(255, 204, 77, .28) 0 8deg, transparent 8deg 20deg); animation: rays 2.2s ease-out forwards; }
@keyframes rays { 0% { opacity: 0; transform: rotate(0) scale(.3); } 20% { opacity: 1; } 100% { opacity: 0; transform: rotate(60deg) scale(1); } }

/* ---- 対戦画面 ---- */
#battle { z-index: 20; display: flex; flex-direction: column; background: radial-gradient(100% 50% at 50% 45%, #1d2547, #080a14 80%); padding-top: var(--safe-t); padding-bottom: var(--safe-b); }
.b-lead { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: rgba(6, 8, 16, .75); position: relative; }
.b-lead .portrait { width: 46px; height: 46px; border-radius: 12px; }
.b-lead .nm { font-weight: 700; font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-lead .st { font-size: .74rem; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-hp { flex: none; min-width: 58px; text-align: center; font-size: 1.5rem; font-weight: 900; color: #ff9a9a; text-shadow: 0 0 8px rgba(255, 80, 80, .6); line-height: 1; }
.b-hp small { display: block; font-size: .6rem; color: var(--sub); font-weight: 400; text-shadow: none; margin-top: 2px; }
.b-en { display: flex; gap: 2px; flex-wrap: wrap; max-width: 150px; }
.b-en i { width: 11px; height: 11px; border-radius: 50%; background: #1b2748; border: 1px solid #3c5aa8; }
.b-en i.on { background: radial-gradient(circle at 35% 30%, #c8f0ff, #2a86ff); box-shadow: 0 0 5px #5cb3ff; }
.b-en i.ex { border-color: var(--gold); }
.b-field { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 4px 8px; }
.b-row { display: flex; justify-content: center; gap: 6px; flex: 1; min-height: 0; max-height: 150px; }
.b-mid { flex: none; height: 22px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: .72rem; color: var(--sub); }
.b-mid::before, .b-mid::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, #47528a, transparent); }
.slot { position: relative; flex: 1; max-width: 108px; border-radius: 10px; border: 1.5px dashed #2f3963; background: rgba(10, 13, 26, .5); min-width: 0; }
.slot.can { border: 2px solid #7dffb0; box-shadow: 0 0 12px rgba(125, 255, 176, .7), inset 0 0 14px rgba(125, 255, 176, .25); animation: pulse 1s infinite; cursor: pointer; }
.slot.can.swap { border-color: #ffb45c; box-shadow: 0 0 12px rgba(255, 180, 92, .7); }
.slot.tgt { border: 2px solid #ff7d7d; box-shadow: 0 0 14px rgba(255, 90, 90, .8); animation: pulse .8s infinite; cursor: pointer; }
.slot.tgt.ally { border-color: #7dc8ff; box-shadow: 0 0 14px rgba(90, 170, 255, .8); }
.unit { position: absolute; inset: 0; border-radius: 9px; overflow: hidden; background-size: cover; background-position: center 25%; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .55), 0 3px 8px #000; }
.unit.sleep { filter: saturate(.55) brightness(.75); }
.unit.frozen::after { content: "❄"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 2rem; background: rgba(120, 200, 255, .45); color: #fff; text-shadow: 0 0 6px #08f; }
.unit.barrier { box-shadow: 0 0 0 2px #fff3a8, 0 0 14px #ffe66a; }
.unit.guard { border-bottom: 4px solid #d8e2ff; }
.u-atk, .u-hp { position: absolute; bottom: 2px; min-width: 24px; height: 24px; padding: 0 3px; display: grid; place-items: center; font-weight: 900; font-size: .95rem; text-shadow: 0 1px 2px #000; border-radius: 8px; }
.u-atk { left: 2px; background: rgba(184, 106, 18, .92); border: 1px solid #ffe0a0; }
.u-hp { right: 2px; background: rgba(160, 29, 44, .92); border: 1px solid #ffc4c4; }
.u-hp.hurt { color: #ffb0b0; } .u-atk.up, .u-hp.up { color: #9dffb0; }
.u-kw { position: absolute; top: 2px; left: 2px; right: 2px; display: flex; flex-wrap: wrap; gap: 2px; font-size: .64rem; }
.u-ab { position: absolute; top: 2px; right: 2px; font-size: .64rem; background: rgba(240, 200, 105, .92); color: #2b1d00; font-weight: 900; border-radius: 4px; padding: 0 3px; }
.u-zz { position: absolute; left: 0; right: 0; top: 40%; text-align: center; font-size: .7rem; font-weight: 800; color: #cfe1ff; text-shadow: 0 1px 3px #000; }
.u-aim { position: absolute; left: 50%; transform: translateX(-50%); font-size: .7rem; font-weight: 900; color: #ffe9a8; text-shadow: 0 1px 3px #000; white-space: nowrap; }
.me .u-aim { top: -15px; } .foe .u-aim { bottom: -15px; }
.b-info { flex: none; min-height: 58px; margin: 0 8px; padding: 6px 10px; border-radius: 10px; background: rgba(6, 8, 16, .8); border: 1px solid var(--line); font-size: .78rem; line-height: 1.4; display: flex; gap: 8px; align-items: center; }
.b-info .it { flex: 1; min-width: 0; }
.b-info b { color: var(--gold); }
.b-hand { flex: none; height: 124px; display: flex; justify-content: center; align-items: flex-end; padding: 0 6px 6px; --fs: 5.4px; }
.b-hand .card { margin-left: var(--ov, 4px); transition: transform .15s; cursor: pointer; }
.b-hand .card:first-child { margin-left: 0; }
.b-hand .card.sel { transform: translateY(-16px) scale(1.08); box-shadow: 0 0 0 2px #fff, 0 0 18px #9cc4ff; z-index: 5; }
.b-hand .card.no { filter: brightness(.5) saturate(.5); }
.b-hand .card.ok { box-shadow: 0 0 0 1.5px #7dffb0, 0 0 10px rgba(125, 255, 176, .6); }
.b-end { flex: none; }
.b-menu { position: absolute; right: 8px; top: 8px; width: 34px; height: 34px; border-radius: 9px; background: #1b2140; border: 1px solid #3b4675; font-weight: 900; }
.float { position: absolute; left: 50%; top: 35%; transform: translateX(-50%); font-weight: 900; font-size: 1.3rem; pointer-events: none; z-index: 30; white-space: nowrap; text-shadow: 0 0 4px #000, 0 2px 3px #000; animation: floatUp .9s ease-out forwards; }
.float.dmg { color: #ff5a5a; font-size: 1.6rem; } .float.heal { color: #7dffb0; } .float.txt { color: #ffe9a8; font-size: .85rem; }
@keyframes floatUp { from { opacity: 0; transform: translate(-50%, 6px) scale(.6); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.15); } to { opacity: 0; transform: translate(-50%, -28px) scale(1); } }
.shake { animation: shake .3s; }
@keyframes shake { 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
.popin { animation: popin .28s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes popin { from { transform: scale(.3); opacity: 0; } }
.banner { position: absolute; left: 0; right: 0; top: 42%; z-index: 40; text-align: center; padding: 10px 0; font-size: 1.3rem; font-weight: 900; letter-spacing: .2em; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(10, 12, 26, .95) 25%, rgba(10, 12, 26, .95) 75%, transparent); border-top: 1px solid var(--gold); border-bottom: 1px solid var(--gold); animation: banner .9s forwards; }
.banner.foe { border-color: #ff7d7d; color: #ffb0b0; }
@keyframes banner { 0% { opacity: 0; transform: scaleY(.2); } 15%, 75% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.showcard { position: absolute; left: 50%; top: 40%; z-index: 41; transform: translate(-50%, -50%); --fs: 13px; pointer-events: none; animation: showcard 1.1s forwards; }
@keyframes showcard { 0% { opacity: 0; transform: translate(-50%, -70%) scale(.5); } 15%, 80% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.1); } }
.result { text-align: center; }
.result h1 { font-size: 2.2rem; margin: 6px 0 10px; }
.result.win h1 { color: var(--gold); text-shadow: 0 0 18px rgba(240, 200, 105, .8); }
.result.lose h1 { color: #9aa3c0; }
.rw { display: flex; justify-content: space-between; padding: 5px 4px; border-bottom: 1px solid var(--line); }

@media (min-height: 760px) { .b-hand { height: 156px; --fs: 6.6px; } .b-row { max-height: 168px; } .b-mid { height: 30px; } }
@media (max-height: 600px) { .b-hand { height: 104px; --fs: 4.5px; } .b-info { min-height: 46px; font-size: .72rem; } .b-lead .portrait { width: 36px; height: 36px; } }
@media (prefers-reduced-motion: reduce) { .card::after, .pack::before { animation: none; } }
