/* Real-rules Yu-Gi-Oh! duel board. Phone-first, Master Duel-style: opponent's field mirrored on top, yours below,
   hand fanned along the bottom edge. Gold = you can act with it. Cyan = pick it for the current question. */

.duel {
  --cw: clamp(38px, min(calc((100vw - 20px) / 7.3), calc((100dvh - 372px) / 7.6)), 74px);
  --ch: calc(var(--cw) * 1.4);
  --gold: #f2c55c; --gold-2: #ffdf8e; --cyan: #5fe1ff; --deep: #070a16; --line: rgba(160, 190, 255, .16);
  --ink: #eef1fb; --ink-2: #a9b1c9; --red: #ff5a4a; --heal: #57e3a1;
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; color: var(--ink); overflow: hidden;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  background:
    radial-gradient(90% 38% at 50% 50%, rgba(86, 72, 210, .28), transparent 70%),
    radial-gradient(70% 30% at 50% 100%, rgba(242, 197, 92, .10), transparent 70%),
    linear-gradient(180deg, #0b0f24 0%, #0a0d1d 46%, #0c1024 54%, #090c1a 100%);
  user-select: none; -webkit-user-select: none; font-family: var(--body);
}
.duel::before {               /* faint duel-disk grid */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .55;
  background: repeating-linear-gradient(60deg, rgba(120, 140, 255, .045) 0 1px, transparent 1px 34px), repeating-linear-gradient(-60deg, rgba(120, 140, 255, .045) 0 1px, transparent 1px 34px);
  mask-image: radial-gradient(80% 60% at 50% 50%, #000 40%, transparent 85%);
}
.duel button { font-family: inherit; }

/* top bar */
.duel-bar { position: relative; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 8px 10px; flex: none; }
.duel-bar > button { border: 1px solid var(--line); background: rgba(255, 255, 255, .06); color: var(--ink); border-radius: 999px; min-width: 40px; height: 38px; padding: 0 12px; font-weight: 700; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.duel-bar svg { width: 18px; height: 18px; }
.duel-title { flex: 1; min-width: 0; display: grid; line-height: 1.2; }
.duel-title b { font-family: var(--display); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.duel-title small { color: var(--ink-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* field */
.duel-field { position: relative; z-index: 1; flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 0 6px; }
.dz-grid { display: grid; gap: 5px; }
.dz-row, .dz-mid { display: grid; grid-template-columns: repeat(7, var(--cw)); gap: 4px; justify-content: center; align-items: center; }
.dz-mid { position: relative; }
.dz-mid::before { content: ""; position: absolute; left: 4%; right: 4%; top: 50%; height: 1px; background: linear-gradient(90deg, transparent, rgba(242, 197, 92, .5), transparent); }
.dz {
  position: relative; width: var(--cw); height: var(--ch); border-radius: 7px; border: 1px solid var(--line); background: rgba(14, 20, 46, .55);
  display: flex; align-items: center; justify-content: center; padding: 0; color: inherit; cursor: pointer;
}
.dz.empty { background: linear-gradient(160deg, rgba(40, 52, 110, .35), rgba(14, 20, 46, .35)); }
.dz.fzone { border-style: dashed; }
.dz.emz { border-color: rgba(242, 197, 92, .35); }
.dz-card { width: calc(var(--cw) - 4px); height: calc(var(--ch) - 4px); border-radius: 5px; overflow: hidden; position: relative; transition: transform .25s; background: #10142a; box-shadow: 0 3px 10px rgba(0, 0, 0, .5); }
.dz-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dz.empty .dz-card, .dz-card:empty { display: none; }
.dz-card.theirs { transform: rotate(180deg); }
.dz-card.def { transform: rotate(90deg) scale(.7); }
.dz-card.def.theirs { transform: rotate(270deg) scale(.7); }
.dz-card.down img { filter: brightness(.55) saturate(.6); }
.dz-back, .oh-card, .hc .dz-back {
  display: block; width: 100%; height: 100%; border-radius: inherit;
  background: radial-gradient(circle at 50% 50%, #e9a24b 0 14%, #7a3510 15% 18%, transparent 19%),
    repeating-radial-gradient(circle at 50% 50%, #3b1d0e 0 6px, #4f2812 6px 12px);
  box-shadow: inset 0 0 0 2px #2a1308, inset 0 0 0 4px #b7782f;
}
.dz-name { display: flex; align-items: center; justify-content: center; text-align: center; width: 100%; height: 100%; padding: 3px; font-size: 9px; font-weight: 700; line-height: 1.15; background: linear-gradient(160deg, #2b2f55, #171a33); color: var(--ink); }
.dz-set { position: absolute; left: 50%; bottom: 3px; transform: translateX(-50%); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; background: rgba(0, 0, 0, .7); color: var(--ink-2); padding: 1px 5px; border-radius: 4px; }
.dz-stat { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); white-space: nowrap; font: 700 10px var(--mono); background: rgba(5, 8, 20, .92); border: 1px solid rgba(255, 255, 255, .14); padding: 1px 5px; border-radius: 6px; color: var(--ink-2); z-index: 2; }
.dz-stat b { color: #fff; }
.dz-mats { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--gold); color: #2a1a00; font: 800 11px var(--mono); display: flex; align-items: center; justify-content: center; z-index: 2; }
.dz.pile { flex-direction: column; justify-content: flex-start; }
.dz.pile .dz-card { height: calc(var(--ch) - 18px); width: calc(var(--cw) - 8px); margin-top: 3px; }
.dz-count { position: absolute; bottom: 2px; left: 0; right: 0; text-align: center; font-size: 9.5px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.dz-phase { grid-column: span 1; text-align: center; display: grid; line-height: 1.1; z-index: 1; background: rgba(8, 11, 26, .9); border: 1px solid var(--line); border-radius: 10px; padding: 6px 2px; }
.dz-phase b { font-size: 10px; font-weight: 800; letter-spacing: .02em; }
.dz-phase small { font-size: 9.5px; color: var(--ink-2); }
.dz-phase.mine { border-color: rgba(242, 197, 92, .6); box-shadow: 0 0 18px rgba(242, 197, 92, .18); }

/* states: can act / can be picked / picked / just arrived */
.dz.can, .hc.can { box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(242, 197, 92, .55); animation: d-glow 1.6s ease-in-out infinite; border-color: transparent; }
.dz.pickable { box-shadow: 0 0 0 2px var(--cyan), 0 0 16px rgba(95, 225, 255, .5); animation: d-glow-c 1.3s ease-in-out infinite; border-color: transparent; }
.dz.picked { box-shadow: 0 0 0 3px var(--cyan), 0 0 22px rgba(95, 225, 255, .9); animation: none; }
.dz.picked::after { content: "✓"; position: absolute; top: -7px; left: -7px; width: 20px; height: 20px; border-radius: 50%; background: var(--cyan); color: #022; font-weight: 900; font-size: 12px; display: flex; align-items: center; justify-content: center; z-index: 3; }
.dz.arrive .dz-card { animation: d-arrive .55s cubic-bezier(.2, .9, .3, 1.2); }
.dz-card.def { animation: none; }
@keyframes d-glow { 50% { box-shadow: 0 0 0 2px var(--gold-2), 0 0 26px rgba(242, 197, 92, .85); } }
@keyframes d-glow-c { 50% { box-shadow: 0 0 0 2px #b6f3ff, 0 0 26px rgba(95, 225, 255, .9); } }
@keyframes d-arrive { from { transform: translateY(-14px) scale(1.35); filter: brightness(2.2); opacity: 0; } to { opacity: 1; } }

/* players */
.duel-seat { display: flex; align-items: center; gap: 8px; padding: 2px 4px; min-height: 40px; }
.duel-seat.opp { order: -1; }
.ds-who { display: flex; align-items: center; gap: 7px; min-width: 0; }
.ds-who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
.ds-avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font: 800 10px var(--body); background: linear-gradient(135deg, #3b3f8f, #1c1f47); border: 1px solid var(--line); }
.me .ds-avatar { background: linear-gradient(135deg, #b48322, #6b4a0c); color: #fff6dc; }
.ds-turn { display: block; font-size: 10.5px; color: var(--gold); font-weight: 700; }
.opp-hand { display: flex; flex: 1; justify-content: center; min-width: 0; }
.oh-card { width: 20px; height: 28px; border-radius: 3px; margin-left: -6px; flex: none; overflow: hidden; }
.oh-card.shown { background: none; box-shadow: 0 0 0 1px var(--gold); }
.oh-card.shown img { width: 100%; height: 100%; object-fit: cover; }
.me .ds-banish { margin-left: auto; }
.ds-banish { border: 1px solid var(--line); background: rgba(255, 255, 255, .05); color: var(--ink-2); border-radius: 999px; padding: 4px 9px; font-size: 11px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.ds-lp { position: relative; display: grid; grid-template-columns: auto auto; align-items: baseline; column-gap: 5px; text-align: right; min-width: 92px; }
.ds-lp small { font-size: 10px; font-weight: 800; color: var(--gold); letter-spacing: .08em; }
.ds-lp b { font: 700 22px var(--mono); letter-spacing: -.02em; }
.ds-lpbar { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .1); overflow: hidden; margin-top: 2px; }
.ds-lpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width .6s; margin-left: auto; }
.ds-lp.hit b { animation: d-shake .45s; color: var(--red); }
.ds-lp.heal b { color: var(--heal); }
.lp-fx { position: absolute; right: 0; top: -6px; font: 800 18px var(--mono); pointer-events: none; animation: d-float 1.4s ease-out forwards; }
.lp-fx.hit { color: var(--red); text-shadow: 0 0 12px rgba(255, 90, 74, .7); }
.lp-fx.heal { color: var(--heal); }
@keyframes d-float { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-34px); opacity: 0; } }
@keyframes d-shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

/* chain stack + phase dock */
.dz-chain { position: absolute; left: 4px; top: 50%; transform: translateY(-50%); display: grid; gap: 4px; z-index: 3; }
.dz-link { display: flex; align-items: center; gap: 3px; background: rgba(8, 11, 26, .92); border: 1px solid rgba(242, 197, 92, .6); border-radius: 8px; padding: 3px; }
.dz-link span { font: 800 11px var(--mono); color: var(--gold); width: 14px; text-align: center; }
.dz-link img.xs, .dz-link .dz-name { width: 26px; height: 36px; border-radius: 3px; object-fit: cover; font-size: 6px; }
.duel-dock { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: grid; gap: 6px; z-index: 3; }
.duel-dock button { border: 1px solid rgba(242, 197, 92, .7); background: linear-gradient(180deg, rgba(60, 46, 12, .95), rgba(30, 22, 4, .95)); color: var(--gold-2); border-radius: 12px; padding: 9px 10px; font-weight: 800; font-size: 12px; cursor: pointer; box-shadow: 0 6px 18px rgba(0, 0, 0, .45); max-width: 92px; line-height: 1.1; }
.duel-dock button.end { border-color: rgba(255, 255, 255, .25); background: rgba(20, 24, 48, .95); color: var(--ink); }

/* hand */
.duel-hand { position: relative; z-index: 2; flex: none; height: calc(min(19vw, 80px) * 1.4 + 18px); display: flex; justify-content: center; align-items: flex-end; padding: 0 12px 6px; }
.hc {
  --w: min(19vw, 80px);
  width: var(--w); height: calc(var(--w) * 1.4); flex: none; border-radius: 7px; overflow: hidden; margin: 0 calc(var(--w) * -.18);
  transform: rotate(var(--tilt)) translateY(calc(var(--tilt) * var(--tilt) * .35px)); transform-origin: 50% 120%;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .6); cursor: pointer; transition: transform .18s, margin .18s; background: #10142a; position: relative;
}
.hc img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hc.can { transform: rotate(var(--tilt)) translateY(-10px); z-index: 2; }
.hc:active { transform: translateY(-18px) scale(1.06); z-index: 3; }

/* status bar */
.duel-status { position: relative; z-index: 3; margin: 0 8px 6px; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 14px; background: rgba(9, 12, 28, .94); border: 1px solid var(--line); min-height: 48px; flex: none; }
.duel-status .grow { flex: 1; min-width: 0; }
.duel-status b { display: block; font-size: 13.5px; }
.duel-status small { display: block; font-size: 12px; color: var(--ink-2); }
.duel-status.go { border-color: rgba(242, 197, 92, .45); flex-direction: column; align-items: flex-start; gap: 0; }
.duel-status.ask { border-color: rgba(95, 225, 255, .5); font-family: var(--body); color: var(--ink); gap: 8px; flex: none; }   /* "ask" is also a sell-screen class in app.css */
.duel-status.wait { color: var(--ink-2); font-size: 13px; justify-content: center; }
.duel .btn.sm, .duel-sheet .btn.sm { padding: 8px 14px; font-size: 13px; min-height: 0; width: auto; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); animation: d-dot 1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes d-dot { 50% { opacity: .2; transform: translateY(-3px); } }

/* event banner (activations, summons, turns) */
.duel-banner { position: absolute; left: 50%; top: 44%; z-index: 20; transform: translate(-50%, -50%) scale(.9); opacity: 0; pointer-events: none; transition: opacity .18s, transform .25s cubic-bezier(.2, .9, .3, 1.3);
  display: flex; align-items: center; gap: 12px; padding: 12px 16px 12px 12px; border-radius: 16px; width: min(86vw, 380px);
  background: linear-gradient(120deg, rgba(14, 18, 44, .97), rgba(30, 24, 70, .97)); border: 1px solid rgba(242, 197, 92, .55); box-shadow: 0 20px 60px rgba(0, 0, 0, .6), 0 0 40px rgba(120, 90, 255, .25); }
.duel-banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.duel-banner.turn { width: auto; padding: 14px 26px; border-color: rgba(242, 197, 92, .9); }
.duel-banner.attack { border-color: rgba(255, 90, 74, .8); }
.db-art { width: 64px; height: 90px; border-radius: 6px; overflow: hidden; flex: none; box-shadow: 0 6px 18px rgba(0, 0, 0, .5); }
.db-art img { width: 100%; height: 100%; object-fit: cover; }
.db-text { display: grid; min-width: 0; line-height: 1.25; }
.db-text small { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.db-text b { font-family: var(--display); font-size: 17px; }
.db-text span { font-size: 12px; color: var(--ink-2); }
.db-text.solo b { font-size: 22px; letter-spacing: .02em; color: var(--gold-2); }

/* living cards (duel-fx.js): a layer over the board, under sheets; taps go straight through it */
.duel-fx { position: fixed; inset: 0; z-index: 62; pointer-events: none; overflow: hidden; }
.duel-fx > * { position: absolute; pointer-events: none; }
.fx-canvas { left: 0; top: 0; width: 100%; height: 100%; }
.fx-dim { inset: 0; opacity: 0; background: radial-gradient(70% 50% at 50% 45%, rgba(20, 14, 60, .5), rgba(3, 4, 12, .92)); }
.fx-cap { left: 50%; display: grid; justify-items: center; text-align: center; opacity: 0; color: #eef1fb; text-shadow: 0 2px 12px rgba(0, 0, 0, .9); max-width: 86vw; }
.fx-cap small { font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: #f2c55c; }
.fx-cap b { font-family: var(--display); font-size: 20px; line-height: 1.15; }
.fx-flash { width: 120vmin; height: 120vmin; border-radius: 50%; transform: translate(-50%, -50%); mix-blend-mode: screen;
  background: radial-gradient(circle, rgba(255, 250, 230, .95) 0, rgba(242, 197, 92, .55) 18%, rgba(95, 225, 255, .18) 38%, transparent 62%); }
.fx-art { border-radius: 6px; box-shadow: 0 0 0 1px rgba(242, 197, 92, .6), 0 0 40px rgba(242, 197, 92, .35); }
.fx-art.tilt { transform-origin: 50% 50%; will-change: transform; }
.fx-ring { border-radius: 50%; transform: translate(-50%, -50%) perspective(500px) rotateX(64deg); opacity: 0;
  background: radial-gradient(circle, rgba(95, 225, 255, .35) 0 8%, transparent 9% 46%, rgba(95, 225, 255, .9) 47% 48%, transparent 49% 68%, rgba(242, 197, 92, .95) 69% 70%, transparent 71% 92%, rgba(242, 197, 92, .9) 93% 95%, transparent 96%);
  box-shadow: 0 0 30px rgba(95, 225, 255, .45); }
.fx-atk { border-radius: 5px; overflow: hidden; box-shadow: 0 0 0 2px rgba(255, 90, 74, .9), 0 0 24px rgba(255, 90, 74, .7), 0 10px 26px rgba(0, 0, 0, .6); background: #10142a; }
.fx-atk img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fx-streak { height: 6px; margin-top: -3px; transform-origin: 0 50%; border-radius: 3px; background: linear-gradient(90deg, transparent, rgba(255, 140, 90, .6) 40%, #fff3d6); box-shadow: 0 0 16px rgba(255, 110, 70, .8); }
.fx-hit { width: 120px; height: 120px; border-radius: 50%; transform: translate(-50%, -50%); border: 3px solid rgba(255, 233, 190, .95);
  background: radial-gradient(circle, rgba(255, 240, 210, .9), rgba(255, 110, 70, .35) 45%, transparent 70%); }
.fx-hit.banish { border-color: rgba(160, 235, 255, .95); background: radial-gradient(circle, rgba(220, 250, 255, .9), rgba(95, 225, 255, .3) 45%, transparent 70%); }
.fx-shatter { transform-origin: 50% 50%; }
.fx-shard { position: absolute; inset: 0; border-radius: 5px; overflow: hidden; }
.fx-shard img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dz.fx-hold .dz-card, .dz.fx-hold .dz-stat, .dz.fx-hold .dz-mats { visibility: hidden; }
.dz.fx-land .dz-card { animation: d-land .5s ease-out; }
@keyframes d-land { from { filter: brightness(2.4) drop-shadow(0 0 10px #f2c55c); } to { filter: none; } }

/* game over */
.duel-end { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(4, 6, 14, .72); backdrop-filter: blur(4px); animation: fade .3s; }
.duel-end-card { width: min(92vw, 360px); text-align: center; padding: 26px 20px 18px; border-radius: 22px; background: linear-gradient(170deg, #161b3e, #0b0e22); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.duel-end-card small { color: var(--ink-2); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: 11px; }
.duel-end-card h2 { font-family: var(--display); font-size: 44px; margin: 4px 0 6px; letter-spacing: -.02em; }
.duel-end.won h2 { background: linear-gradient(90deg, var(--gold), #fff1c4, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.duel-end.lost h2 { color: #c7cbe0; }
.duel-end-card p { color: var(--ink-2); margin: 0 0 18px; }

/* sheets (shared sheet component, duel contents) */
.duel-sheet { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: start; }
.dsh-card { border-radius: 8px; overflow: hidden; aspect-ratio: 59 / 86; background: #10142a; box-shadow: 0 8px 22px rgba(0, 0, 0, .3); }
.dsh-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dsh-card .dz-name { font-size: 12px; }
.dsh-body h2 { margin: 0 0 4px; font-size: 19px; }
.dsh-text { font-size: 13.5px; line-height: 1.45; white-space: pre-line; margin: 12px 0 0; color: var(--ink-2); max-height: 38vh; overflow: auto; }
.dsh-acts { display: grid; gap: 8px; margin-top: 12px; }
.dsh-acts .btn small, .dsh-pick small { display: block; font-weight: 500; font-size: 12px; opacity: .8; margin-top: 2px; text-align: left; white-space: normal; }
.dsh-acts .btn { text-align: left; justify-content: flex-start; flex-direction: column; align-items: flex-start; }
.dsh-list { display: grid; gap: 8px; max-height: 56vh; overflow: auto; }
.dsh-pick { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; padding: 8px; border-radius: 12px; border: 1px solid var(--line, #ddd); background: var(--card, #fff); color: var(--ink); cursor: pointer; }
.dsh-pick .dp-art { width: 46px; height: 64px; border-radius: 5px; overflow: hidden; flex: none; background: #10142a; }
.dsh-pick .dp-art img { width: 100%; height: 100%; object-fit: cover; }
.dsh-pick .dp-t { min-width: 0; }
.dsh-pick b { font-size: 14px; }
.dsh-pos { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; padding: 6px 0 4px; }
.dsh-posbtn { border: 0; background: none; color: var(--ink); display: grid; justify-items: center; gap: 8px; cursor: pointer; width: 112px; }
.dsh-posbtn .dp-card { width: 70px; height: 98px; border-radius: 6px; overflow: hidden; display: block; box-shadow: 0 6px 16px rgba(0, 0, 0, .35); transition: transform .2s; }
.dsh-posbtn .dp-card img { width: 100%; height: 100%; object-fit: cover; }
.dsh-posbtn .dp-card.def { transform: rotate(90deg) scale(.85); margin: 0 0 -6px; }
.dsh-posbtn small { font-size: 12px; font-weight: 600; text-align: center; }
.dsh-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { border: 1px solid var(--line, #ddd); background: var(--card, #fff); color: var(--ink); border-radius: 999px; padding: 8px 13px; font-weight: 600; cursor: pointer; }
.chip-btn.on { background: var(--ink); color: var(--paper, #fff); }
.dsh-rps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.duel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; max-height: 56vh; overflow: auto; padding: 4px; }
.dg-card { position: relative; border: 0; padding: 0; border-radius: 7px; overflow: hidden; aspect-ratio: 59 / 86; background: #10142a; cursor: pointer; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); }
.dg-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dg-card.pick.on { box-shadow: 0 0 0 3px #12a9d1, 0 0 16px rgba(18, 169, 209, .6); }
.dg-card.pick.on::after { content: "✓"; position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: #12a9d1; color: #fff; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.dg-amt { position: absolute; top: 4px; left: 4px; background: rgba(0, 0, 0, .8); color: #ffd36b; font: 800 12px var(--mono); padding: 1px 6px; border-radius: 6px; }
.dg-where { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(0, 0, 0, .85)); color: #fff; font-size: 10px; font-weight: 700; padding: 10px 4px 3px; text-align: center; }
.duel-log { display: grid; gap: 2px; font-size: 13.5px; max-height: 64vh; overflow: auto; }
.duel-log div { padding: 6px 4px; border-bottom: 1px solid var(--line, #eee); }
.duel-log .dl-turn { font-weight: 800; padding-top: 12px; }
.duel-log .dl-phase { color: var(--ink-3, #888); font-size: 12px; }
.duel-log .dl-lp { color: var(--down, #c42b1c); font-weight: 600; }

/* lobby panel */
.duel-cta { padding: 14px 16px; }
.duel-chip { background: linear-gradient(90deg, #f2c55c, #ffdf8e); color: #2a1a00; font-weight: 800; }
.duel-record { margin: 12px 2px 0; }
.duel-open { margin-top: 10px; }

@media (min-width: 700px) {
  .duel { --cw: clamp(48px, min(calc((100vw - 40px) / 7.6), calc((100dvh - 380px) / 7.6)), 84px); }
  .duel-hand .hc { --w: 92px; }
  .duel-status { max-width: 560px; margin-left: auto; margin-right: auto; width: calc(100% - 16px); }
}
@media (prefers-reduced-motion: reduce) {
  .dz.can, .hc.can, .dz.pickable, .dots i { animation: none; }
  .dz.arrive .dz-card, .dz.fx-land .dz-card { animation: none; }
}

/* sheets over the board share its night palette */
body.at-duel .sheet { background: #12162e; color: #eef1fb; --ink: #eef1fb; --ink-2: #a9b1c9; --ink-3: #7d86a3; --line: rgba(160, 190, 255, .16); --card: #1a1f3d; --paper: #0b0e22; --paper-2: #1a1f3d; border-top: 1px solid rgba(242, 197, 92, .35); }
body.at-duel .sheet .btn.ghost { background: rgba(255, 255, 255, .06); color: #eef1fb; border-color: rgba(160, 190, 255, .2); }
body.at-duel .sheet .input { background: #0b0e22; color: #eef1fb; border-color: rgba(160, 190, 255, .25); }
body.at-duel .sheet .grab { background: rgba(255, 255, 255, .25); }
body.at-duel .chip-btn.on { background: #f2c55c; color: #2a1a00; }
body.at-duel .sheet .btn:not(.red):not(.ghost) { background: #232a52; color: #eef1fb; border: 1px solid rgba(160, 190, 255, .22); }
.dsh-acts .btn { min-height: 46px; justify-content: center; padding: 10px 14px; }
