/* YURI WARS — game board styles (Practice vs Bot and online duels) */
:root {
  --cw: 78px;                 /* field card width */
  --hw: 88px;                 /* hand card width */
  --gold: #f5c542;
  --jade: #2fb38a;
  --panel-w: 290px;
}
body { overflow-x: hidden; }
.game {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-w);
  gap: 14px;
  padding: 12px 14px 20px;
  max-width: 1400px; margin: 0 auto;
}
.board {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(236,72,153,0.07), transparent 55%),
    radial-gradient(ellipse at 50% 100%, rgba(124,58,237,0.09), transparent 55%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
  min-width: 0;
}

/* ── player strips ─────────────────────────── */
.who { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .85rem; color: var(--muted); }
.who b { color: var(--text); font-size: .95rem; }
.who .tag { font-size: .7rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--border); color: var(--muted); }
.who .tag.turn { background: rgba(124,58,237,.18); border-color: var(--purple); color: var(--purple2); }
.opp-hand { display: flex; gap: 3px; flex-wrap: wrap; justify-content: flex-end; }
.mini-back { width: 20px; height: 28px; border-radius: 3px; background: linear-gradient(135deg,#3b1a6e,#7a2363); border: 1px solid #8a5cd6; }

.side {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px; align-items: center;
}
.zone-col { display: flex; gap: 8px; align-items: center; }
.field { display: flex; gap: 8px; justify-content: center; flex-wrap: nowrap; min-width: 0; }
.zone-label { font-size: .62rem; color: var(--muted); text-align: center; text-transform: uppercase; letter-spacing: .06em; margin-top: 3px; }
.stack { display: flex; flex-direction: column; align-items: center; }
.piles { display: flex; gap: 8px; }
.pile {
  width: 54px; aspect-ratio: 5/7; border-radius: 6px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-weight: 800; font-size: 1.05rem;
  border: 1px solid var(--border); background: var(--surface2); cursor: default; user-select: none;
}
.pile.deck { background: linear-gradient(135deg,#3b1a6e,#7a2363); border-color: #8a5cd6; }
.pile.discard { cursor: pointer; }
.pile.discard:hover { border-color: var(--purple2); }
.pile small { font-size: .58rem; font-weight: 600; color: rgba(255,255,255,.7); text-transform: uppercase; letter-spacing: .05em; }
.passives { display: flex; gap: 5px; }
.fd { width: 44px; aspect-ratio: 5/7; border-radius: 5px; position: relative; }
.fd.empty { border: 1px dashed var(--border); }
.fd.back { background: linear-gradient(135deg,#3b1a6e,#7a2363); border: 1px solid #8a5cd6; display: flex; align-items: center; justify-content: center; font-size: .55rem; font-weight: 800; color: rgba(255,255,255,.75); }
.fd img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; filter: brightness(.55) saturate(.7); }
.fd .set-tag { position: absolute; inset: auto 0 3px 0; text-align: center; font-size: .55rem; font-weight: 800; color: #fff; letter-spacing: .05em; text-shadow: 0 1px 2px #000; }

/* ── cards ─────────────────────────────────── */
.slot { width: var(--cw); aspect-ratio: 5/7; border-radius: 7px; border: 1.5px dashed rgba(124,58,237,.35); flex: 0 0 auto; position: relative; }
.card {
  width: var(--cw); aspect-ratio: 5/7; border-radius: 7px; position: relative; flex: 0 0 auto;
  background: #12121f; box-shadow: 0 4px 10px rgba(0,0,0,.45); cursor: pointer;
  transition: transform .15s, box-shadow .15s, filter .2s;
}
.card img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; pointer-events: none; }
.card .txt { position: absolute; inset: 0; padding: 5px; font-size: .58rem; line-height: 1.2; overflow: hidden; border-radius: inherit; border: 2px solid #ec4899; background: #1d1430; }
.card .txt b { display: block; font-size: .64rem; margin-bottom: 3px; }
.card:hover { transform: translateY(-3px); }
.card.can-act { box-shadow: 0 0 0 2px var(--purple2), 0 0 16px rgba(157,92,245,.65); }
.card.is-target { box-shadow: 0 0 0 3px var(--danger), 0 0 18px rgba(239,68,68,.75); animation: pulse 1s infinite; }
.card.selected { box-shadow: 0 0 0 3px var(--gold), 0 0 18px rgba(245,197,66,.7); transform: translateY(-4px); }
.card.done { filter: grayscale(.55) brightness(.72); }
.card.acting { box-shadow: 0 0 0 3px var(--gold), 0 0 22px rgba(245,197,66,.8); transform: translateY(-5px) scale(1.04); }
.card.hit { animation: shake .45s; }
@keyframes pulse { 50% { box-shadow: 0 0 0 3px var(--danger), 0 0 6px rgba(239,68,68,.4); } }
@keyframes shake { 20% { transform: translateX(-4px) rotate(-2deg); } 40% { transform: translateX(4px) rotate(2deg); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

.badge-hp, .badge-lp {
  position: absolute; bottom: -7px; min-width: 24px; height: 22px; padding: 0 6px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; gap: 2px;
  font-weight: 800; font-size: .78rem; border: 2px solid var(--surface); z-index: 2; pointer-events: none;
}
.badge-hp { left: -6px; background: #e0405a; color: #fff; }
.badge-hp.low { background: #b91c1c; }
.badge-lp { right: -6px; background: #241a3d; color: #fff; padding-left: 2px; }
.badge-lp img { width: 17px; height: 17px; }
.plus-lp {
  position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--surface); background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff; font-weight: 900; font-size: 1rem; line-height: 1; cursor: pointer; z-index: 3;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.plus-lp:hover { transform: scale(1.12); }
.queen-hearts { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); display: flex; gap: 1px; z-index: 2; pointer-events: none; }
.queen-hearts span { font-size: .85rem; filter: drop-shadow(0 1px 1px #000); }
.queen-hearts span.off { filter: grayscale(1) brightness(.5); }

.float {
  position: fixed; z-index: 200; pointer-events: none; font-weight: 900; font-size: 1.4rem;
  color: #ff6b81; text-shadow: 0 2px 6px #000; animation: floatUp 1.1s forwards;
}
.float.good { color: #b794ff; }
@keyframes floatUp { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, -44px); } }

/* ── center strip ──────────────────────────── */
.center {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; border-radius: var(--radius-sm);
  background: rgba(13,13,26,.55); border: 1px solid var(--border);
}
.phase { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.phase .title { font-weight: 800; font-size: .95rem; }
.phase .hint { font-size: .8rem; color: var(--muted); }
.pool { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: .9rem; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--border); }
.pool img { width: 26px; height: 26px; }
.pool.has { border-color: var(--purple2); box-shadow: 0 0 12px rgba(157,92,245,.35); }
.controls { display: flex; gap: 8px; flex-wrap: wrap; }
.thinking { display: inline-flex; gap: 4px; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--pink2); animation: blink 1s infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: .2; } }

.hand-wrap { border-top: 1px solid var(--border); padding-top: 10px; }
.hand { display: flex; gap: 8px; overflow-x: auto; padding: 6px 2px 10px; min-height: calc(var(--hw) * 1.4 + 16px); }
.hand .card { width: var(--hw); }
.hand-empty { color: var(--muted); font-size: .85rem; align-self: center; padding-left: 4px; }

/* ── side panel ────────────────────────────── */
.panel-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.zoom { padding: 12px; }
.zoom-img { width: 100%; aspect-ratio: 5/7; border-radius: 10px; background: var(--surface2) center/cover; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .85rem; text-align: center; overflow: hidden; }
.zoom-img img { width: 100%; height: 100%; object-fit: cover; }
.zoom h3 { margin-top: 10px; font-size: 1rem; }
.zoom .state { color: var(--pink2); font-size: .82rem; font-weight: 700; margin-top: 2px; }
.zoom p { font-size: .82rem; color: var(--muted); margin-top: 6px; }
.log { padding: 10px 12px; max-height: 320px; overflow-y: auto; font-size: .8rem; display: flex; flex-direction: column; gap: 3px; }
.log .turn { margin-top: 6px; font-weight: 800; color: var(--purple2); font-size: .78rem; }
.log .end { font-weight: 800; color: var(--pink2); }
.log .me { color: var(--text); }
.log .bot { color: #c7b9ff; }
.rules { padding: 10px 12px; font-size: .8rem; }
.rules summary { cursor: pointer; font-weight: 700; }
.rules ul { margin: 8px 0 0 16px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }

/* ── popover + modals ──────────────────────── */
.pop {
  position: fixed; z-index: 150; min-width: 200px; max-width: 280px;
  background: var(--surface); border: 1px solid var(--purple); border-radius: var(--radius-sm);
  box-shadow: 0 12px 32px rgba(0,0,0,.55); padding: 6px; display: flex; flex-direction: column; gap: 4px;
}
.pop .pop-title { font-size: .78rem; color: var(--muted); padding: 4px 8px 2px; font-weight: 700; }
.pop button {
  text-align: left; background: var(--surface2); color: var(--text); border: 1px solid var(--border);
  border-radius: 5px; padding: 8px 10px; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.pop button:hover:not(:disabled) { border-color: var(--purple2); }
.pop button:disabled { opacity: .45; cursor: not-allowed; }
.pop button small { display: block; color: var(--muted); font-weight: 500; font-size: .74rem; margin-top: 2px; }
.pop .why { font-size: .78rem; color: var(--warning); padding: 4px 8px; }

.modal-bg { position: fixed; inset: 0; background: rgba(5,5,15,.72); z-index: 180; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: min(460px, 100%); max-height: 92vh; overflow-y: auto; text-align: center; }
.modal h2 { margin-bottom: 6px; }
.modal p { color: var(--muted); font-size: .92rem; }
.modal .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.rps { font-size: 2rem; width: 86px; height: 86px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.rps small { font-size: .7rem; font-weight: 700; }
.react-cards { display: flex; gap: 12px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.react-cards .opt { display: flex; flex-direction: column; gap: 8px; align-items: center; }

.discard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; margin-top: 12px; }
.dcard { padding: 0; border: 2px solid transparent; border-radius: 8px; background: none; cursor: pointer; transition: border-color .15s, transform .15s; }
.dcard:hover, .dcard:focus-visible { border-color: var(--purple2); transform: translateY(-2px); outline: none; }
.discard-grid img, .discard-grid .txtcard { display: block; width: 100%; aspect-ratio: 5/7; border-radius: 6px; object-fit: cover; }
.modal .hint { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.card-kind { color: var(--purple2); font-size: .8rem; font-weight: 700; margin-top: 2px; }
.card-text { margin-top: 6px; line-height: 1.45; }
.discard-grid .txtcard { background: var(--surface2); font-size: .6rem; padding: 4px; text-align: left; }
.big-card { width: min(340px, 86vw); border-radius: 12px; }
.loading { text-align: center; padding: 80px 20px; color: var(--muted); }


/* ── deck choice ───────────────────────────── */
.setup { max-width: 980px; margin: 0 auto; padding: 24px 16px 40px; }
.setup h1 { font-size: 2rem; margin-bottom: 4px; }
.setup-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-top: 18px; }
.setup h3 { margin-bottom: 10px; }
.setup h4 { margin: 16px 0 8px; font-size: .9rem; color: var(--muted); }
.deck-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.deck-opt { display: flex; gap: 10px; align-items: center; text-align: left; padding: 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface2); color: var(--text); cursor: pointer; }
.deck-opt:hover:not(:disabled) { border-color: var(--purple2); }
.deck-opt.on { border-color: var(--pink); box-shadow: 0 0 0 1px var(--pink), 0 0 14px rgba(236,72,153,.3); }
.deck-opt:disabled { opacity: .5; cursor: not-allowed; }
.fav-star { margin-left: auto; color: #facc15; font-size: 1.2rem; padding: 0 4px; }
.fav-note { font-size: .82rem; margin: -2px 0 10px; }
.deck-art { width: 36px; aspect-ratio: 5/7; border-radius: 4px; background: var(--surface); overflow: hidden; flex: 0 0 auto; }
.deck-art img { width: 100%; height: 100%; object-fit: cover; }
.deck-txt b { display: block; font-size: .88rem; }
.deck-txt small { color: var(--muted); font-size: .74rem; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.small { font-size: .8rem; }
.deckname { font-size: .72rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; margin-left: 4px; }

/* ── tools, status, choices ─────────────────── */
.tools { position: absolute; left: 50%; transform: translateX(-50%); top: calc(100% + 9px); display: flex; gap: 2px; z-index: 3; }
.tool-chip { width: 18px; height: 25px; border-radius: 3px; overflow: hidden; border: 1px solid var(--warning); background: #3a2a10; color: #fff; font-size: .55rem; font-weight: 800; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.tool-chip img { width: 100%; height: 100%; object-fit: cover; }
.tool-chip.is-target { box-shadow: 0 0 0 2px var(--danger), 0 0 10px rgba(239,68,68,.8); }
.status { position: absolute; top: -9px; left: -6px; display: flex; gap: 1px; font-size: .78rem; z-index: 3; filter: drop-shadow(0 1px 1px #000); pointer-events: none; }
.slot { margin-bottom: 22px; }
.fd.is-target { box-shadow: 0 0 0 2px var(--danger), 0 0 12px rgba(239,68,68,.75); cursor: pointer; }
.surrender { background: transparent; color: #f87171; border: 1px solid rgba(248,113,113,.5); }
.surrender:hover { background: rgba(239,68,68,.12); }
.float.heal { color: #4ade80; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin-top: 14px; max-height: 58vh; overflow-y: auto; padding: 2px; }
.pick-item { display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 6px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); cursor: pointer; font-size: .78rem; font-weight: 600; }
.pick-item:hover:not(:disabled) { border-color: var(--purple2); }
.pick-item img, .pick-item .txtcard { width: 100%; aspect-ratio: 5/7; object-fit: cover; border-radius: 6px; }
.pick-item small { color: var(--muted); font-weight: 500; font-size: .7rem; }
.txtcard { background: var(--surface2); border: 1px solid var(--border); font-size: .65rem; padding: 6px; display: flex; align-items: center; justify-content: center; text-align: center; border-radius: 6px; }
.react-img { width: 120px; border-radius: 8px; aspect-ratio: 5/7; object-fit: cover; }
.modal { width: min(560px, 100%); }
@media (max-width: 760px) { .setup-grid { grid-template-columns: 1fr; } }


/* ── motion ─────────────────────────────────── */
.card > img, .card > .txt { animation: cardIn .38s cubic-bezier(.2,.8,.3,1.2) both; }   /* on the picture, so hit/target effects on the card don't replay it */
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.86); } to { opacity: 1; transform: none; } }
.card.dying { animation: dying .48s ease-in forwards; pointer-events: none; }
@keyframes dying { 0% { opacity: 1; transform: scale(1); filter: brightness(1.6) saturate(.4); } 100% { opacity: 0; transform: scale(.7) rotate(-6deg); filter: grayscale(1) brightness(.6); } }
.badge-hp, .badge-lp, .pool, .pile { transition: background-color .3s, transform .2s; }
.card .badge-hp.low { animation: none; }
.speedbox { padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .8rem; color: var(--muted); font-weight: 700; }
.seg { display: flex; background: var(--surface2); border: 1px solid var(--border); border-radius: 999px; padding: 2px; }
.seg button { background: transparent; border: none; color: var(--muted); font-weight: 700; font-size: .74rem; padding: 4px 10px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.speedbox > span { white-space: nowrap; }
.seg button.on { background: linear-gradient(135deg, var(--purple), var(--pink)); color: #fff; }
.reveal { position: fixed; left: 50%; top: 46%; z-index: 170; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 10px;
  transform: translate(-50%, -50%); animation: revealAnim var(--dur, 1.5s) ease forwards; }
.reveal img, .reveal .reveal-txt { width: 210px; aspect-ratio: 5/7; object-fit: cover; border-radius: 14px; box-shadow: 0 0 0 2px rgba(236,72,153,.6), 0 24px 60px rgba(0,0,0,.7), 0 0 50px rgba(124,58,237,.45); }
.reveal span { background: rgba(13,13,26,.92); border: 1px solid var(--purple); padding: 6px 14px; border-radius: 999px; font-weight: 800; font-size: .9rem; white-space: nowrap; }
@keyframes revealAnim { 0% { opacity: 0; transform: translate(-50%, -46%) scale(.82); } 14% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 82% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -54%) scale(.96); } }
.turn-banner { position: fixed; left: 50%; top: 38%; z-index: 165; pointer-events: none; transform: translate(-50%, -50%);
  font-size: clamp(1.6rem, 5vw, 2.6rem); font-weight: 900; letter-spacing: .02em; padding: 10px 34px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(124,58,237,.92), rgba(236,72,153,.92)); color: #fff; box-shadow: 0 16px 50px rgba(124,58,237,.45);
  animation: bannerAnim var(--dur, 1.3s) ease forwards; }
@keyframes bannerAnim { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.7); } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); } 30% { transform: translate(-50%, -50%) scale(1); } 78% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .card > img, .card > .txt, .card.dying, .reveal, .turn-banner { animation-duration: .01s !important; } }
@media (max-width: 640px) { .reveal img, .reveal .reveal-txt { width: 150px; } }

/* ── smaller screens ───────────────────────── */
@media (max-width: 1180px) {
  :root { --cw: 70px; --hw: 80px; --panel-w: 250px; }
}
@media (max-width: 1020px) {
  .game { grid-template-columns: 1fr; }
  .panel-col { display: grid; grid-template-columns: 1fr 1fr; }
  .zoom { display: none; }
  .side { grid-template-columns: auto auto; grid-template-areas: "left right" "field field"; justify-content: space-between; }
  .side .zone-col.left { grid-area: left; }
  .side .zone-col.right { grid-area: right; }
  .side .field { grid-area: field; }
  .side.opp { grid-template-areas: "left right" "field field"; }
  .side.me { grid-template-areas: "field field" "left right"; }
}
@media (max-width: 640px) {
  :root { --cw: calc((100vw - 72px) / 6); --hw: 74px; }
  .game { padding: 8px 6px 16px; gap: 10px; }
  .board { padding: 8px 6px; }
  .field { gap: 5px; }
  .panel-col { grid-template-columns: 1fr; }
  .pile { width: 42px; font-size: .9rem; }
  .fd { width: 34px; }
  .zone-col { gap: 5px; }
  .zone-col .card { width: 58px; }
  .badge-hp, .badge-lp { height: 18px; min-width: 20px; font-size: .68rem; bottom: -6px; }
  .badge-lp img { width: 14px; height: 14px; }
  .center .btn { padding: 8px 12px; font-size: .85rem; }
  .slot { margin-bottom: 8px; }
  .tools { top: auto; bottom: 14px; left: auto; right: -5px; transform: none; flex-direction: column-reverse; gap: 1px; }
  .tool-chip { width: 13px; height: 18px; }
}
