.scroll-x { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x .chip { flex: none; }

.editor { grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; }
.editor-main { min-width: 0; }
.editor-head { align-items: center; justify-content: flex-start; gap: 12px; margin-bottom: 16px; }
.editor-head .deck-name { flex: 1; max-width: 420px; height: 44px; font-family: var(--display); font-size: 22px; font-weight: 700; background: transparent; border-color: transparent; padding-left: 8px; }
.editor-head .deck-name:hover { border-color: var(--line); }
.editor-head .deck-name:focus { background: var(--bg-2); border-color: var(--accent); }
.editor .filters { flex-direction: column; align-items: stretch; gap: 8px; }
.editor .filters .search { width: 100%; max-width: 420px; }
.editor-side { position: sticky; top: 76px; padding: 0; overflow: hidden; display: flex; flex-direction: column; max-height: calc(100vh - 96px); gap: 0; }
.side-toggle { display: none; }
.side-body { display: flex; flex-direction: column; gap: 14px; padding: 16px; min-height: 0; flex: 1; overflow: hidden; }
.deck-count { display: flex; flex-direction: column; gap: 8px; }
.deck-count b { font-family: var(--display); font-size: 26px; color: var(--text); }
.deck-count .bar i { width: 100%; transform-origin: left; transition: transform .25s; }
.deck-count.full .bar i { background: var(--ok); }
.deck-rows { flex: 1; min-height: 80px; overflow-y: auto; margin: 0 -6px; padding: 0 6px; gap: 6px; }
.deck-row { height: 42px; padding: 0 6px 0 0; cursor: default; }
.deck-row:hover { transform: none; }
.dr-ctrl { display: flex; align-items: center; gap: 6px; flex: none; }
.dr-ctrl b { min-width: 14px; text-align: center; font-size: 14px; }
.editor-actions { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; }
.editor-actions .btn { flex: initial; }
.qbtn {
  all: unset; box-sizing: border-box; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; cursor: pointer;
  background: var(--surface-3); border: 1px solid var(--line-2); font-size: 18px; font-weight: 700; line-height: 1; color: var(--text);
  transition: background .12s, border-color .12s;
}
.qbtn:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
.qbtn:disabled { opacity: .3; cursor: not-allowed; }
.qbtn.sm { width: 26px; height: 26px; font-size: 16px; border-radius: 7px; }
.pool-cell { display: flex; flex-direction: column; gap: 8px; cursor: default; }
.pool-cell .card { cursor: pointer; }
.pool-cell .qty { display: none; }
.pool-cell.in-deck .card-front { box-shadow: 0 0 0 2px var(--accent), 0 .4em 1.2em rgba(0, 0, 0, .45); }
.pool-cell.maxed .card { opacity: 1; }
.pool-cell.maxed .card-front { filter: saturate(.75); }
.pool-ctrl { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.qnum { font-size: 13px; color: var(--muted); }
.qnum b { color: var(--text); font-size: 15px; }
.ok-dot, .warn-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 6px; vertical-align: middle; }
.ok-dot { background: var(--ok); }
.warn-dot { background: var(--gold); }

@media (max-width: 860px) {
  .topbar { height: auto; flex-wrap: wrap; row-gap: 0; padding: 8px 12px 0; gap: 8px; }
  .brand { order: 1; }
  .top-right { order: 2; gap: 6px; }
  .nav { order: 3; flex: 0 0 calc(100% + 24px); min-width: 0; max-width: calc(100% + 24px); margin: 0 -12px; padding: 4px 8px 6px; border-top: 1px solid var(--line); overflow-x: auto; }
  .top-right { min-width: 0; }
  .brand { min-width: 0; }
  .nav a { padding: 8px 10px; font-size: 14px; }
  .nav a.active::after { bottom: 0; }
  .coin-pill { height: 32px; padding: 0 10px; }
  .user-pill { padding: 2px; }
  .btn-live { display: none; }

  .editor { grid-template-columns: 1fr; padding-bottom: 96px; }
  .editor-side { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 60; max-height: 78vh; border-radius: 16px 16px 0 0; border-bottom: 0; box-shadow: 0 -10px 30px rgba(0, 0, 0, .5); transform: translateY(calc(100% - 60px)); transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
  .editor-side.open { transform: none; }
  .side-toggle { all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 60px; padding: 0 16px; cursor: pointer; border-bottom: 1px solid var(--line); flex: none; }
  .side-sum { font-size: 15px; color: var(--muted); }
  .side-sum b { font-family: var(--display); font-size: 22px; color: var(--text); }
  .side-open { font-size: 14px; font-weight: 600; color: var(--accent); }
  .side-body { overflow-y: auto; }
  .editor-head .deck-name { font-size: 19px; }
  .card-grid.compact { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
}

@media (max-width: 600px) {
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 26px; }
  .balance { font-size: 13px; padding: 6px 10px; }
  .tabs-inline { display: flex; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tabs-inline .tab { flex: none; }
  .table th, .table td { padding: 10px 10px; }
  .home-hero { gap: 18px; }
  .hero-actions .btn-lg { height: 42px; padding: 0 16px; }
  .stat > b { font-size: 22px; }
  .pve-card h3 { font-size: 21px; }
  .deck-tile { flex-direction: column; align-items: stretch; }
  .deck-cover { align-self: center; }
  .shop-pack { padding: 22px 0 18px; }
  .detail-info h2 { font-size: 26px; }
  .modal { padding: 20px 16px; }
  .gen-preview .card { --cw: min(300px, 86vw); }
  .op-head { padding: 12px 14px; gap: 10px; flex-wrap: wrap; }
  .op-title { font-size: 17px; }
  .end-box { min-width: 0; width: calc(100vw - 32px); padding: 26px 18px; }
  .end-box h2 { font-size: 46px; }
  .match-side { gap: 8px; }
  .energy-box { flex: 1 1 100%; }
  .atk-list { flex: 1 1 100%; }
  .side-actions { flex: 1 1 100%; }
}

html, body { max-width: 100%; overflow-x: clip; }

/* Phone match layout (2026-11-17): the whole match fits the screen, no page scroll.
   Card size follows the screen height (--aw = active card width); the hand is a
   horizontal strip above the controls. */
.only-mobile { display: none !important; }
.more-menu { display: none; }
@media (max-width: 860px) {
  .only-mobile { display: inline-flex !important; }
  body.in-match { overflow: hidden; }
  body.in-match .topbar { display: none; }
  body.in-match #view { height: 100vh; height: 100dvh; min-height: 0; }
  .match { --aw: clamp(58px, calc((100dvh - 380px) / 4.5), 124px); display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; }
  .arena { flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto 1fr auto 1fr auto auto; grid-template-areas: "oinfo obench" "oactive oactive" "center center" "mactive mactive" "minfo mbench" "hand hand"; align-items: center; gap: 0; padding: 6px 8px 0; }
  .arena .side-bar { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; text-align: left; gap: 4px 8px; padding: 0 6px 0 0; min-width: 0; }
  .arena .side-bar .who { font-size: 14px; gap: 6px; min-width: 0; max-width: 100%; }
  .arena .side-bar .who b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .arena .side-bar .counts { flex: 1 1 100%; justify-content: flex-start; font-size: 11px; gap: 4px; }
  .arena .side-bar .counts span { padding: 1px 6px; }
  .arena .points i { width: 12px; height: 12px; }
  .arena .bench { gap: 5px; padding: 0; justify-content: flex-end; }
  .arena .active-zone { padding: 3px 0; }
  .arena .center-line { margin: 5px 24px; }
  .match .mini { width: calc(var(--aw) * .6); border-radius: 8px; }
  .match .mini-active { width: var(--aw); border-width: 2px; }
  .match .mini-name { font-size: 10px; }
  .match .mini-active .mini-name { font-size: 13px; }
  .match .mini-hp b { font-size: 12px; }
  .match .mini-active .mini-hp b { font-size: 16px; }
  .match .mini:not(.mini-active) .mini-hp small, .match .mini:not(.mini-active) .mini-rar { display: none; }
  .match .mini-status .st { font-size: 8px; padding: 1px 3px; }
  .arena .hand { height: auto; min-height: 108px; flex: none; display: flex; justify-content: flex-start; align-items: center; gap: 6px; padding: 6px 2px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain; }
  .arena .hand::-webkit-scrollbar { display: none; }
  .arena .hand-card { margin: 0; transform: none; flex: none; }
  .arena .hand-card:active { transform: scale(.96); }
  .arena .hand-card .card { --cw: 68px !important; }
  .match-side { position: static; flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--bg-2); border-top: 1px solid var(--line-2); border-left: 0; }
  .match-side .log, .match-side .guide { display: none; }
  .match-side .turn-box { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 2px 8px; padding: 6px 10px; min-width: 0; flex: none; }
  .match-side .turn-num { font-size: 10px; }
  .match-side .turn-box b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .match-side .turn-timer { flex: 1 1 100%; order: 3; margin: 0; }
  .match-side .timer-txt { margin-left: auto; font-size: 11px; }
  .match-side .energy-box { flex: none; padding: 4px 10px 4px 4px; gap: 6px; border: 1px solid var(--line); background: var(--surface); }
  .match-side .energy-orb { width: 40px; height: 40px; }
  .match-side .energy-orb .ti { width: 28px !important; height: 28px !important; }
  .match-side .energy-info { display: flex; }
  .match-side .energy-info b { font-size: 12px; }
  .match-side .energy-info small { display: none; }
  .match-side .guide-now { grid-column: 1 / -1; margin: 0; font-size: 12px; line-height: 1.3; color: var(--muted); }
  .match-side .atk-list { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; overflow: visible; }
  .match-side .atk-btn { grid-template-columns: auto minmax(0, 1fr) auto; padding: 6px 8px; gap: 2px 6px; min-width: 0; }
  .match-side .atk-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .match-side .atk-dmg { font-size: 17px; }
  .match-side .atk-btn small { display: block; font-size: 10px; margin-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .match-side .side-actions { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; }
  .match-side .row-between { display: none !important; }
  .more-menu { display: block; position: relative; }
  .more-menu summary { list-style: none; height: 40px; width: 44px; padding: 0; justify-content: center; font-size: 20px; }
  .more-menu summary::-webkit-details-marker { display: none; }
  .more-pop { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 60; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
  .more-pop .btn { justify-content: flex-start; white-space: nowrap; }
  .match-side .side-actions .btn { height: 40px; padding: 0 12px; font-size: 13px; }
  .match-side .side-actions .btn-end { height: 40px; font-size: 16px; }
  .match-side .row-between { grid-column: 1 / -1; display: flex; justify-content: center; gap: 16px; }
  .match-side .row-between .btn { height: 26px; font-size: 12px; }
  .match-side [data-concede] { grid-column: auto; height: 26px; }
  .match .mode-hint { display: none; }
  .match-side .guide-now.is-mode { color: var(--text); }
  .match-side .guide-now.only-mobile { display: block !important; }
  .turn-banner span { font-size: 30px; padding: 8px 30px; }
}
@media (max-width: 860px) and (max-height: 700px) {
  .match-side .guide-now:not(.is-mode) { display: none !important; }
  .match-side .turn-box { padding: 4px 8px; }
  .match-side .turn-box b { font-size: 13px; }
  .match-side .energy-orb { width: 34px; height: 34px; }
  .match-side .side-actions .btn, .match-side .side-actions .btn-end, .more-menu summary { height: 36px; }
  .match { --aw: clamp(54px, calc((100dvh - 345px) / 4.5), 124px); }
}

.pk-rarity { position: absolute; left: .4em; bottom: .4em; z-index: 2; display: inline-flex; align-items: center; gap: .3em; font-size: .56em; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding: .2em .6em; border-radius: 99px; color: var(--rc); background: rgba(8, 10, 14, .82); border: 1px solid color-mix(in srgb, var(--rc) 70%, transparent); white-space: nowrap; }
.card.r-secret .pk-rarity { background: linear-gradient(90deg, rgba(8, 10, 14, .85), rgba(30, 60, 70, .85)); }
.pk-bottom .pk-rar { display: none; }
.mini-rar { position: absolute; z-index: 2; right: 6px; top: 26px; font-size: 11px; font-weight: 900; color: var(--rc); text-shadow: 0 1px 2px #000; letter-spacing: -1px; }
.mini-active .mini-rar { font-size: 14px; top: 30px; }

.ultimate { position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr 280px; gap: 22px; align-items: center; margin: 0 0 28px; padding: 22px 24px; border-radius: 16px; border: 1px solid #5a1e2a; background: radial-gradient(600px 220px at 15% 0%, rgba(239, 90, 80, .22), transparent 70%), linear-gradient(135deg, #1a0d12, #120a10 60%, #0c0a10); }
.ultimate.locked { filter: saturate(.4); border-color: var(--line-2); }
.ultimate-tag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #ff8a80; margin-bottom: 6px; }
.ultimate h3 { font-size: 30px; letter-spacing: .02em; }
.ultimate p { color: var(--muted); margin-top: 6px; font-size: 14px; max-width: 560px; }
.ultimate-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; font-size: 13px; }
.ultimate-meta span { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); }
.ultimate-steps { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.ultimate-steps li.done { color: var(--ok); }
.ultimate-wait { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.btn-ultimate { background: linear-gradient(180deg, #ff6b5e, #c7322a); color: #fff; height: 46px; font-size: 15px; }
.btn-ultimate:hover:not(:disabled) { box-shadow: 0 0 0 3px rgba(239, 90, 80, .25), 0 8px 24px rgba(239, 90, 80, .3); }
.ultimate-count { color: #ff8a80; }
@media (max-width: 760px) { .ultimate { grid-template-columns: 1fr; } }

/* Market and trades (2026-11-17) */
.market-tabs .tab { display: inline-flex; align-items: center; gap: 6px; }
.tab-dot { font-style: normal; font-size: 11px; font-weight: 800; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--danger); color: #fff; }
.listing { display: flex; flex-direction: column; gap: 8px; }
.listing [data-view] { cursor: pointer; }
.listing-info { display: flex; flex-direction: column; gap: 4px; }
.listing-price { font-family: var(--display); font-size: 20px; font-weight: 700; color: var(--gold); }
.market-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; }
.market .section-title { margin-top: 26px; font-size: 19px; }
.mk-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mk-history li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--surface); font-size: 14px; flex-wrap: wrap; }
.mk-history li > b { margin-left: auto; font-family: var(--display); font-size: 16px; }
.mk-history .link-btn { margin: 0; color: var(--text); }
.pos { color: var(--ok); }
.neg { color: #ff8a80; }
.rdot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--rc); }
.market-card-view { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.market-card-view .card { --cw: min(300px, 78vw) !important; }
.trows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 420px; overflow-y: auto; }
.trow { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.trow.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.trow.pickable { cursor: pointer; }
.trow-type { display: inline-flex; }
.trow-name { flex: 1; min-width: 0; margin: 0; color: var(--text); font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow-qty { font-size: 12px; }
.trow-ctrl { display: inline-flex; align-items: center; gap: 6px; }
.trow-ctrl b { min-width: 14px; text-align: center; }
.sell-dialog { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; margin-top: 12px; }
.sell-pick { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sell-form { display: flex; flex-direction: column; gap: 10px; }
.sell-preview { display: flex; justify-content: center; }
.trade-new { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 6px; }
.trade-new .field { flex: 1 1 220px; max-width: 320px; }
.trade-list { display: grid; gap: 10px; }
.trade { padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.trade.incoming { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.trade.history { opacity: .75; }
.trade header { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.trade-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.trade-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.tchips { display: flex; flex-wrap: wrap; gap: 6px; }
.tchip { margin: 0; padding: 3px 9px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--text); background: var(--bg-2); border: 1px solid color-mix(in srgb, var(--rc, var(--line-2)) 60%, transparent); }
.trade-actions { display: flex; justify-content: flex-end; gap: 8px; }
.trade-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.tpanel { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); min-width: 0; }
.tpanel h2 { font-size: 18px; }
.trade-summary { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 14px -4px 0; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); border-radius: 12px 12px 0 0; background: rgba(14, 17, 22, .97); border: 1px solid var(--line-2); border-bottom: 0; }
@media (max-width: 760px) {
  .sell-dialog, .trade-editor, .trade-sides { grid-template-columns: 1fr; }
  .trows { max-height: 300px; }
  .trade-summary .btn { width: 100%; }
}

/* Sign-in steps (mail verification) */
.auth-step { font-size: 22px; }
.auth-note { text-align: center; margin: 0; }
.code-input { font-size: 26px !important; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }

/* Deck builder: big card preview (hover on desktop, magnifier on touch). */
.pool-cell { position: relative; }
.peek-btn { position: absolute; z-index: 3; top: 6px; right: 6px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(10, 12, 16, .82); color: var(--text); cursor: pointer; padding: 0; }
.peek-btn svg { width: 16px; height: 16px; }
@media (hover: hover) and (pointer: fine) {
  .peek-btn { opacity: 0; transition: opacity .15s; }
  .pool-cell:hover .peek-btn, .peek-btn:focus-visible { opacity: 1; }
}
.deck-peek { position: fixed; z-index: 300; width: 300px; pointer-events: none; opacity: 0; transform: scale(.96); transition: opacity .12s, transform .12s; filter: drop-shadow(0 18px 40px rgba(0, 0, 0, .6)); }
.deck-peek.show { opacity: 1; transform: none; }
.peek-modal { display: flex; justify-content: center; padding: 6px; }

/* Deck builder: big card preview (hover on desktop, magnifier on touch). */
.pool-cell { position: relative; }
.peek-btn { position: absolute; z-index: 3; top: 6px; right: 6px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(10, 12, 16, .82); color: var(--text); cursor: pointer; padding: 0; }
.peek-btn svg { width: 16px; height: 16px; }
@media (hover: hover) and (pointer: fine) {
  .peek-btn { opacity: 0; transition: opacity .15s; }
  .pool-cell:hover .peek-btn, .peek-btn:focus-visible { opacity: 1; }
}
.deck-peek { position: fixed; z-index: 300; width: 300px; pointer-events: none; opacity: 0; transform: scale(.96); transition: opacity .12s, transform .12s; filter: drop-shadow(0 18px 40px rgba(0, 0, 0, .6)); }
.deck-peek.show { opacity: 1; transform: none; }
.peek-modal { display: flex; justify-content: center; padding: 6px; }
