/* JARLINGS DUEL (#/duel): the card game. Cards are little steel specimen plates edged in their element colour
   (--c, and --c2 for a hybrid's second element); numbers are in the machine font. */
.duel .kick { font-family: var(--pixel); font-size: 16px; text-transform: uppercase; color: var(--accent-text); margin-bottom: 6px; }
.duel .small { font-size: 0.86rem; }
.duel .warn { color: var(--hazard); }
.duel .sh { margin-top: 30px; margin-bottom: 14px; }

/* how to play + the element wheel */
.duel-how { display: grid; grid-template-columns: 1fr 240px; gap: 24px; align-items: center; margin-top: 22px; padding: 18px 22px;
  background: var(--rivets), var(--plate); border: 1px solid #000; border-radius: 6px; box-shadow: var(--shadow); }
.duel-how .sh { margin-top: 0; border: 0; padding-bottom: 4px; }
.duel-how ol { margin: 6px 0 10px; padding-left: 1.2em; display: grid; gap: 5px; }
.duel-how li::marker { color: var(--brass); font-weight: 700; }
.wheel { width: 100%; max-width: 240px; justify-self: center; }
.wheel text { font-family: var(--font); }

/* rivals */
.opps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.opp { display: flex; gap: 14px; align-items: center; text-align: left; padding: 14px; color: var(--ink); cursor: pointer; font: inherit;
  background: var(--rivets), var(--plate); border: 1px solid #000; border-radius: 6px; box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s; }
.opp img { width: 72px; height: 72px; flex: none; border-radius: 3px; box-shadow: 0 0 0 2px #000, 0 0 0 3px #3a4542; }
.opp > span { display: grid; gap: 4px; }
.opp b { font-size: 1.15rem; }
.opp .muted { font-size: 0.86rem; line-height: 1.35; }
.opp .rec { font-family: var(--pixel); font-size: 16px; color: var(--hazard); text-transform: uppercase; }
.opp:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.opp:disabled { opacity: .5; cursor: not-allowed; }

/* the deck */
.deck-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 10px; }
.deck-head .sh { margin-bottom: 0; flex: 1; }
.deck-head .row { display: flex; gap: 8px; margin-bottom: 10px; }
.deck-row { display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px; margin: 14px 0 8px; }
.coll { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }

/* a card */
.dcard { position: relative; display: grid; grid-template-rows: auto auto auto 1fr; gap: 4px; padding: 7px 7px 16px; min-width: 0; color: var(--ink);
  background: linear-gradient(180deg, #232b29, #161b1a); border-radius: 6px; cursor: pointer; user-select: none;
  box-shadow: 0 0 0 2px #000, inset 0 0 0 2px var(--c), inset 0 0 0 3px #000, 0 6px 14px rgba(0,0,0,.45); transition: transform .1s, box-shadow .1s, opacity .1s; }
.dcard.hybrid { box-shadow: 0 0 0 2px #000, inset 3px 0 0 0 var(--c), inset -3px 0 0 0 var(--c2), inset 0 2px 0 0 var(--c), inset 0 -2px 0 0 var(--c2), 0 6px 14px rgba(0,0,0,.45); }
.dcard.legend { background: linear-gradient(180deg, #3a2d12, #1d1609); box-shadow: 0 0 0 2px #000, inset 0 0 0 2px var(--brass-hi), inset 0 0 0 3px #000, 0 0 18px rgba(242,193,100,.35); }
.dcard.shiny .art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.28) 45%, transparent 60%); background-size: 250% 100%; animation: shine 3.2s linear infinite; pointer-events: none; }
@keyframes shine { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.dcard .art { position: relative; aspect-ratio: 1; border-radius: 3px; overflow: hidden; background: var(--sunk); box-shadow: 0 0 0 1px #000; }
.dcard .art img { width: 100%; height: 100%; display: block; }
.dcard .cost, .dcard .pow { position: absolute; top: -7px; z-index: 2; display: grid; place-items: center; width: 28px; height: 28px;
  font-family: var(--pixel); font-size: 16px; line-height: 1; box-shadow: 0 0 0 2px #000, 0 2px 0 #000; }
.dcard .cost { left: -7px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #9fd6ff, #2a74d0 70%); color: #04172e; }
.dcard .pow { right: -7px; border-radius: 4px; background: linear-gradient(180deg, #ffd56a, #e08a1e); color: #2a1300; }
.dcard .nm { font-weight: 700; font-size: 0.92rem; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dcard .els { display: flex; gap: 4px; align-items: center; min-height: 18px; }
.eld { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-style: normal; font-size: 11px; color: var(--c); background: #0b0f0e; box-shadow: inset 0 0 0 1.5px var(--c); }
.dcard .bonus { margin-left: auto; font-family: var(--pixel); font-size: 12px; color: var(--accent-text); }
.dcard .tx { margin: 0; font-size: 0.74rem; line-height: 1.3; color: #c3ccc7; }
.dcard .ctag { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); padding: 1px 6px; white-space: nowrap; font-family: var(--pixel); font-size: 12px; text-transform: uppercase; color: var(--brass-ink); background: linear-gradient(180deg, var(--brass-hi), var(--brass)); border-radius: 2px; box-shadow: 0 0 0 1px #000; }
.dcard:hover { transform: translateY(-2px); }
.dcard:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.dcard.picked { opacity: .38; }
.dcard.taken { opacity: .7; }
.dcard.mini { padding: 5px 5px 6px; gap: 3px; grid-template-rows: auto auto auto; }
.dcard.mini .nm { font-size: 0.72rem; }
.dcard.mini .cost, .dcard.mini .pow { width: 22px; height: 22px; font-size: 12px; top: -6px; }
.dcard.mini .cost { left: -6px; } .dcard.mini .pow { right: -6px; }
.dcard.mini .ctag { display: none; }
.dcard.mini .els { min-height: 14px; } .dcard.mini .eld { width: 14px; height: 14px; font-size: 9px; }
.dcard.empty { cursor: default; aspect-ratio: .72; background: repeating-linear-gradient(-45deg, #141918 0 6px, #101413 6px 12px); box-shadow: inset 0 0 0 2px #2a3330; }
.dcard.empty:hover { transform: none; }
.el { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 10px; font-size: 0.8rem; color: var(--c); box-shadow: inset 0 0 0 1.5px var(--c); }

/* ---------------- the match */
.duel.playing .wrap { max-width: 1100px; }
.foe-bar, .me-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 2px; }
.foe-bar { justify-content: space-between; border-bottom: 2px solid var(--line); }
.me-bar { border-top: 2px solid var(--line); margin-top: 8px; }
.me-bar .note { flex: 1; min-width: 120px; }
.me-bar .turn { font-family: var(--pixel); font-size: 16px; text-transform: uppercase; color: var(--ink-2); }
.me-bar .turn b { color: var(--ink); font-weight: 400; }
.energy { display: inline-flex; align-items: baseline; gap: 1px; padding: 6px 12px; border-radius: 20px; background: radial-gradient(circle at 35% 30%, #9fd6ff, #2a74d0 70%); color: #04172e; box-shadow: 0 0 0 2px #000, 0 0 14px rgba(80,160,255,.45); }
.energy b { font-family: var(--pixel); font-size: 24px; font-weight: 400; } .energy i { font-family: var(--pixel); font-size: 12px; font-style: normal; }

.dboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 10px; }
.lane { display: grid; grid-template-rows: 1fr auto 1fr; gap: 8px; padding: 8px; border-radius: 6px; background: #0b0f0e; box-shadow: inset 0 0 0 1px #000, inset 0 0 0 2px #1d2523; min-height: 300px; transition: box-shadow .12s; }
.lane.can { cursor: pointer; box-shadow: inset 0 0 0 1px #000, inset 0 0 0 3px var(--accent), 0 0 16px rgba(79,227,154,.25); }
.lane .side { display: grid; grid-template-columns: repeat(2, minmax(0, 92px)); justify-content: center; gap: 6px; align-content: start; min-height: 120px; }
.lane .side.foe { align-content: end; }
.arena { position: relative; display: grid; gap: 2px; padding: 8px 10px; min-height: 76px; border-radius: 4px; background-size: cover; background-position: center; image-rendering: pixelated; box-shadow: 0 0 0 2px #000; overflow: hidden; }
.arena::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(5,8,7,.88), rgba(5,8,7,.5) 70%, rgba(5,8,7,.2)); }
.arena > * { position: relative; }
.arena .an { font-family: var(--pixel); font-size: 16px; text-transform: uppercase; color: #fff; }
.arena .at { font-size: 0.74rem; color: #d7e0db; max-width: 70%; line-height: 1.25; }
.arena .score { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: grid; justify-items: center; gap: 0; padding: 3px 8px; border-radius: 4px; background: rgba(0,0,0,.72); box-shadow: 0 0 0 1px #000; }
.arena .score b { font-family: var(--pixel); font-size: 16px; font-weight: 400; color: #ff9b8a; line-height: 1.15; }
.arena .score b.you { color: var(--accent-text); }
.arena .score b:not(.lead) { color: #8a9792; }
.arena .score b.lead:not(.you) { color: #ff8a73; text-shadow: 0 0 8px rgba(255,120,90,.6); }
.arena .score b.lead.you { text-shadow: 0 0 8px rgba(79,227,154,.7); }
.arena .score i { font-style: normal; font-size: 10px; color: #6c7873; }

.bcard { position: relative; display: block; aspect-ratio: 1; padding: 0; border: 0; border-radius: 4px; cursor: pointer; background: #121716;
  box-shadow: 0 0 0 2px #000, inset 0 0 0 2px var(--c); overflow: visible; }
.bcard img { width: 100%; height: 100%; display: block; border-radius: 4px; padding: 3px; }
.bcard.legend { box-shadow: 0 0 0 2px #000, inset 0 0 0 2px var(--brass-hi), 0 0 12px rgba(242,193,100,.45); }
.bcard .bp { position: absolute; right: -5px; bottom: -5px; min-width: 24px; height: 22px; padding: 0 4px; display: grid; place-items: center; border-radius: 3px;
  font-family: var(--pixel); font-size: 16px; line-height: 1; background: linear-gradient(180deg, #ffd56a, #e08a1e); color: #2a1300; box-shadow: 0 0 0 2px #000; }
.bcard .bp.up { background: linear-gradient(180deg, #8dffbf, #2fbf6e); color: #032312; }
.bcard .bp.down { background: linear-gradient(180deg, #ff9d8c, #d4452c); color: #2a0600; }
.bcard .arm { position: absolute; left: -5px; bottom: -5px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; font-size: 11px; background: #39433f; color: #dfe7e3; box-shadow: 0 0 0 2px #000; }
.bcard.foe { box-shadow: 0 0 0 2px #000, inset 0 0 0 2px var(--c), 0 0 0 3px rgba(255,106,82,.35); }
.bcard.back { cursor: default; background: repeating-linear-gradient(45deg, #2b1d1a 0 5px, #1d1412 5px 10px); box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #5a3a33; }
.bcard.back.mine { background: repeating-linear-gradient(45deg, #1a2b22 0 5px, #121d17 5px 10px); box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #2f5a43; }
.bcard.staged { opacity: .7; outline: 2px dashed var(--accent); outline-offset: 2px; }
.bcard.fresh { animation: flipin .42s cubic-bezier(.2,.9,.3,1.3); }
@keyframes flipin { from { transform: rotateY(90deg) scale(.7); filter: brightness(2.2); } to { transform: none; filter: none; } }
.floater { position: absolute; left: 50%; top: 10%; transform: translateX(-50%); font-family: var(--pixel); font-size: 24px; pointer-events: none; text-shadow: 0 2px 0 #000, 0 0 8px currentColor; animation: floatup 1s ease-out forwards; z-index: 5; }
.floater.up { color: #7dffb0; } .floater.down { color: #ff7a63; } .floater.blk { color: #dfe7e3; }
@keyframes floatup { from { opacity: 0; transform: translate(-50%, 6px) scale(.8); } 15% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -34px) scale(1.15); } }

.hand-row { display: flex; gap: 12px; overflow-x: auto; padding: 14px 4px 18px; scroll-snap-type: x proximity; }
.hand-row .dcard { flex: 0 0 150px; scroll-snap-align: start; }
.dcard.hand.sel { transform: translateY(-8px); box-shadow: 0 0 0 2px #000, inset 0 0 0 2px var(--c), 0 0 0 4px var(--accent), 0 10px 22px rgba(0,0,0,.5); }
.dcard.hand.used { opacity: .35; }
.dcard.hand.dear .cost { filter: grayscale(1) brightness(.7); }

.detail { display: flex; gap: 16px; align-items: start; padding: 14px; margin-bottom: 20px; border-radius: 6px; background: var(--rivets), var(--plate); box-shadow: var(--shadow); }
.detail .dcard { flex: 0 0 170px; cursor: default; } .detail .dcard:hover { transform: none; }
.detail p { margin: 0 0 6px; }

.duel-over { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(4,6,5,.72); animation: fadein .25s; }
@keyframes fadein { from { opacity: 0; } }
.ov-card { width: min(460px, 100%); padding: 26px 24px; text-align: center; border-radius: 8px; background: var(--rivets), var(--plate); box-shadow: 0 0 0 2px #000, var(--shadow); }
.ov-card h2 { font-size: 2.2rem; margin: 4px 0 8px; }
.duel-over.won .ov-card { box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--accent), 0 0 40px rgba(79,227,154,.35); }
.duel-over.lost .ov-card { box-shadow: 0 0 0 2px #000, 0 0 0 4px #ff6a52; }
.ov-card .row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }

/* ---------------- phones */
@media (max-width: 860px) {
  .duel-how { grid-template-columns: 1fr; }
  .opps { grid-template-columns: 1fr; }
  .deck-row { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 640px) {
  .coll { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
  .dcard .tx { font-size: 0.7rem; }
  .dboard { gap: 6px; }
  .lane { padding: 5px; gap: 5px; min-height: 0; }
  .lane .side { grid-template-columns: repeat(2, 1fr); gap: 7px; min-height: 96px; }
  .arena { min-height: 64px; padding: 5px 6px; }
  .arena .an { font-size: 12px; }
  .arena .at { font-size: .6rem; max-width: 100%; }
  .arena .score { position: static; transform: none; grid-auto-flow: column; gap: 6px; justify-self: start; margin-top: 2px; }
  .bcard .bp { font-size: 12px; min-width: 18px; height: 18px; right: -4px; bottom: -4px; }
  .bcard .arm { width: 14px; height: 14px; font-size: 9px; left: -4px; bottom: -4px; }
  .hand-row .dcard { flex-basis: 128px; }
  .detail { flex-direction: column; } .detail .dcard { flex-basis: auto; width: 150px; }
  .me-bar .note { order: 5; flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { .bcard.fresh, .floater, .dcard.shiny .art::after { animation: none; } .floater { opacity: 0; } }
