/* Layout inspirado no Magic Online: paleta azul-escura, painéis à esquerda, campos espelhados no centro. */
:root {
  --bg: #0b0f16; --mat: #131b27; --mat2: #0f1620; --panel: #18212f; --panel2: #1f2a3b; --line: #2b3a52;
  --text: #e8edf5; --muted: #8fa0ba; --gold: #e8b64c; --accent: #3d8bfd; --ok: #3fbf74; --danger: #e05252;
  --target: #ffd23f; --play: #49e08f; --attack: #ff5a3c; --block: #4aa8ff;
  --cw: clamp(54px, 5.4vw, 98px); --ch: calc(var(--cw) * 1.395);
  --hw: clamp(66px, 6.8vw, 124px); --hh: calc(var(--hw) * 1.395);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
button { background: linear-gradient(#2a3850, #1e293b); color: var(--text); border: 1px solid #3a4c6a; border-radius: 4px; padding: 7px 12px; cursor: pointer; font: inherit; }
button:hover:not(:disabled) { border-color: var(--accent); filter: brightness(1.12); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: linear-gradient(#4b93ff, #2c6fd6); border-color: #5aa0ff; color: #fff; font-weight: 600; }
button.danger { color: #ffb4b4; border-color: #6b3434; }
input { background: #0a1018; color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; font: inherit; width: 100%; }
kbd { font-size: 10px; opacity: .55; margin-left: 4px; font-family: inherit; }
.hidden { display: none !important; }
.hint { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }

#topbar { height: 36px; display: flex; align-items: center; gap: 16px; padding: 0 14px; background: linear-gradient(#18233a, #0e1522); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; letter-spacing: .6px; color: var(--gold); }
.conn { font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.conn.on { background: #173a29; color: #9ff0c2; }
.conn.off { background: #3d1b1b; color: #f0a39f; }
#whoami { margin-left: auto; color: var(--muted); }
.screen { height: calc(100% - 36px); overflow: auto; }

/* login / lobby */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 16px; }
.panel.narrow { max-width: 360px; margin: 10vh auto; display: flex; flex-direction: column; gap: 10px; }
h1, h2 { margin: 0 0 10px; }
h2 { font-size: 15px; color: var(--gold); }
.lobby { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px; max-width: 1200px; margin: 0 auto; }
@media (max-width: 800px) { .lobby { grid-template-columns: 1fr; } }
.list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 60vh; overflow: auto; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 8px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list li:hover { background: var(--panel2); }
.list li.sel { background: #22355a; }
.list .folder { color: var(--muted); font-size: 12px; }

.form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
select { background: #0a1018; color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 7px 8px; font: inherit; }
.seg { display: flex; }
.seg button { flex: 1; border-radius: 0; }
.seg button:first-child { border-radius: 4px 0 0 4px; }
.seg button:last-child { border-radius: 0 4px 4px 0; }
.seg button.on { background: linear-gradient(#4b93ff, #2c6fd6); color: #fff; border-color: #5aa0ff; }
.ai-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.paste { width: min(640px, 85vw); height: 320px; background: #0a1018; color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 8px; font: 13px/1.4 ui-monospace, Consolas, monospace; }
.row input { flex: 1; width: auto; }

/* ---------------- mesa ---------------- */
.table { display: grid; grid-template-columns: 210px 1fr 300px; height: 100%; }
.left, .right { display: flex; flex-direction: column; gap: 8px; padding: 8px; background: var(--mat2); min-height: 0; }
.left { border-right: 1px solid var(--line); }
.right { border-left: 1px solid var(--line); }
.center { position: relative; display: grid; grid-template-rows: 1fr auto 1fr auto; min-width: 0; min-height: 0;
  background: radial-gradient(ellipse at 50% 50%, #1b2840 0%, var(--mat) 60%, #0d131d 100%); }

/* painel do jogador */
.ppanel { background: linear-gradient(#1d283b, #151d2b); border: 1px solid var(--line); border-radius: 6px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.ppanel.active { border-color: #4c6fa8; box-shadow: 0 0 0 1px #4c6fa8 inset; }
.ppanel.priority { box-shadow: 0 0 0 2px var(--gold) inset; }
.ppanel.target { cursor: pointer; box-shadow: 0 0 0 2px var(--target) inset, 0 0 14px var(--target); }
.ppanel .who { display: flex; align-items: center; gap: 8px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #3d5a8a, #23314d); display: grid; place-items: center; font-weight: 700; text-transform: uppercase; flex: none; }
.pname { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptimer { font-size: 11px; color: var(--muted); }
.life { font-size: 34px; font-weight: 800; line-height: 1; text-align: center; padding: 4px 0; text-shadow: 0 2px 6px #000; }
.life.low { color: #ff7a6b; }
.zones { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.zone { font-size: 12px; color: var(--muted); background: #0f1622; border: 1px solid #243249; border-radius: 4px; padding: 3px 6px; display: flex; justify-content: space-between; }
.zone b { color: var(--text); }
.zone.link { cursor: pointer; }
.zone.link:hover { border-color: var(--accent); }
.pcounters { font-size: 12px; color: #ffb36b; }
.mana { display: flex; gap: 4px; flex-wrap: wrap; }
.mana span { min-width: 26px; text-align: center; border-radius: 10px; padding: 1px 6px; font-weight: 700; font-size: 12px; color: #111; }
.mana span.click { cursor: pointer; outline: 2px solid var(--target); }
.m-W { background: #f3edc7; } .m-U { background: #8fc3ef; } .m-B { background: #b3a9aa; } .m-R { background: #ef9a7f; } .m-G { background: #8fd3a2; } .m-C { background: #cfcfcf; }

/* escada de fases */
.phases { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 0; overflow: hidden; }
.phase { font-size: 11px; color: #61718b; padding: 2px 8px; border-left: 3px solid transparent; border-radius: 2px; white-space: nowrap; }
.phase.cur { color: #fff; font-weight: 700; background: #22324d; border-left-color: var(--gold); }
.phase.cur.opp { border-left-color: var(--danger); }

/* campos de batalha */
.bf { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; padding: 8px 10px; min-height: 0; overflow: auto; }
.bf.opp { flex-direction: column-reverse; }
.bf-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; align-items: center; min-height: calc(var(--ch) * .35); }
.bf.opp .bf-row.front { align-items: flex-end; }
.bf.me .bf-row.front { align-items: flex-start; }
.bf-row.back { justify-content: center; }
.bf-row.back .sep { flex: 0 0 calc(var(--cw) * .5); }

/* faixa central */
.midline { display: flex; align-items: center; gap: 12px; padding: 6px 10px; background: linear-gradient(90deg, rgba(10,16,26,.9), rgba(24,34,52,.95), rgba(10,16,26,.9)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.turninfo { font-size: 12px; color: var(--muted); white-space: nowrap; }
.turninfo b { color: var(--text); }
.prompt { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-height: 40px; }
.prompt .pmsg { flex: 1; text-align: right; font-weight: 600; }
.prompt .psub { color: var(--muted); font-size: 12px; font-weight: 400; }
.prompt.active .pmsg { color: var(--gold); }
.prompt button { min-width: 92px; padding: 8px 16px; font-size: 14px; }
.prompt.over .pmsg { color: var(--gold); font-size: 16px; }

/* mao */
.hand { display: flex; justify-content: center; align-items: flex-end; padding: 6px 10px 8px; min-height: calc(var(--hh) * .6); background: linear-gradient(transparent, rgba(0,0,0,.45)); }
.hand .card { width: var(--hw); height: var(--hh); margin-left: var(--overlap, 6px); }
.hand .card:first-child { margin-left: 0; }
.hand .card:hover { transform: translateY(-14px); z-index: 5; }

/* pilha flutuante */
.stack-wrap { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); z-index: 8; background: rgba(12,18,28,.92); border: 1px solid var(--gold); border-radius: 6px; padding: 6px; max-height: 80%; overflow: auto; box-shadow: 0 6px 24px #000; }
.zone-title { font-size: 11px; color: var(--gold); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.stack { display: flex; flex-direction: column; gap: 4px; }
.stack .card { margin-top: calc(var(--ch) * -0.55); }
.stack .card:first-child { margin-top: 0; }
.stack .card:hover { z-index: 3; }

/* cartas */
.card { --rot: 0deg; --ty: 0px; position: relative; width: var(--cw); height: var(--ch); border-radius: calc(var(--cw) * .055); background: #222 center/cover; border: 2px solid #050505;
  flex: none; overflow: hidden; transform: translateY(var(--ty)) rotate(var(--rot)); transition: transform .12s, box-shadow .12s; box-shadow: 0 2px 5px rgba(0,0,0,.6); user-select: none; }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.card.tapped { --rot: 90deg; margin: 0 calc((var(--ch) - var(--cw)) / 2); }
.card .ctext { display: none; position: absolute; inset: 0; padding: 4px; font-size: 9px; line-height: 1.2; background: linear-gradient(#3b3f48, #23262d); }
.card.textcard .ctext { display: block; }
.card .cname { font-weight: 700; font-size: 10px; margin-bottom: 2px; }
.card .ctype { color: #bbb; margin-bottom: 2px; }
.card .badge { position: absolute; right: 2px; bottom: 2px; background: linear-gradient(#f2f2f2, #cfcfcf); color: #111; font-weight: 800; font-size: 11px; padding: 0 4px; border-radius: 3px; border: 1px solid #555; }
.card .dmg { position: absolute; right: 2px; bottom: 20px; background: var(--danger); color: #fff; font-weight: 800; font-size: 10px; padding: 0 4px; border-radius: 3px; }
.card .ctr { position: absolute; left: 2px; top: 2px; background: rgba(30,70,140,.92); color: #fff; font-size: 9px; padding: 0 4px; border-radius: 3px; max-width: 95%; overflow: hidden; white-space: nowrap; }
.card .cnt { position: absolute; left: 2px; bottom: 2px; background: rgba(0,0,0,.8); color: #fff; font-size: 11px; font-weight: 700; padding: 0 5px; border-radius: 8px; }
.card.playable { border-color: var(--play); box-shadow: 0 0 9px var(--play); cursor: pointer; }
.card.target, .card.choosable { border-color: var(--target); box-shadow: 0 0 12px var(--target); cursor: pointer; }
.card.selected { border-color: #fff; box-shadow: 0 0 12px #fff; }
.card.attacking { border-color: var(--attack); box-shadow: 0 0 10px var(--attack); }
.bf.me .card.attacking { --ty: -14px; }
.bf.opp .card.attacking { --ty: 14px; }
.card.blocking { border-color: var(--block); box-shadow: 0 0 10px var(--block); }
.card.sick::after { content: ""; position: absolute; inset: 0; background: rgba(40,60,90,.25); }

/* grupos: pilhas de terrenos iguais e anexos (auras/equipamentos) */
.grp { display: flex; align-items: flex-end; }
.grp.lands .card + .card { margin-left: calc(var(--cw) * -0.78); }
.grp.lands .card.tapped + .card.tapped { margin-left: calc(var(--ch) * -0.82); }
.grp.attach { flex-direction: column; align-items: center; }
.grp.attach .card.att { margin-bottom: calc(var(--ch) * -0.82); }

/* direita */
.preview { display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 160px; }
.preview img { width: 100%; max-width: 260px; border-radius: 12px; box-shadow: 0 4px 16px #000; }
.preview .ptext { font-size: 12px; width: 100%; max-height: 140px; overflow: auto; }
.preview .ptext div { margin-bottom: 3px; }
.passbar { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.passbar button { padding: 5px 6px; font-size: 12px; }
.log-wrap { flex: 1; display: flex; flex-direction: column; min-height: 100px; }
.log { flex: 1; overflow: auto; font-size: 12px; background: #070b11; border: 1px solid var(--line); border-radius: 4px; padding: 6px; }
.log > div { margin-bottom: 2px; }
.log .u { color: var(--accent); font-weight: 600; }
.log .ti { color: #5d6c84; }
#chat-form { margin-top: 6px; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 20; }
.modal-box { background: var(--panel); border: 1px solid var(--gold); border-radius: 6px; padding: 16px; max-width: min(960px, 95vw); max-height: 90vh; overflow: auto; box-shadow: 0 10px 40px #000; }
.modal-title { font-weight: 700; margin-bottom: 10px; color: var(--gold); }
.modal-body { display: flex; flex-wrap: wrap; gap: 8px; }
.modal-body .card { --cw: 110px; --ch: 153px; }
.modal-body .opt { display: block; width: 100%; text-align: left; }
.modal-body .pile { flex: 1; min-width: 220px; }
.modal-body .pile .cards { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.modal-body label { display: flex; gap: 8px; align-items: center; width: 100%; }
.modal-body label input { width: 90px; }

#toasts { position: fixed; right: 312px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 30; }
.toast { background: #1c2638; border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 8px 12px; border-radius: 4px; max-width: 380px; box-shadow: 0 4px 12px #000; }
.toast.error { border-left-color: var(--danger); }

/* telas menores */
@media (max-width: 1100px) {
  .table { grid-template-columns: 170px 1fr 230px; }
  .life { font-size: 26px; }
}
@media (max-width: 820px) {
  .table { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .left { flex-direction: row; overflow-x: auto; }
  .left .ppanel { min-width: 180px; }
  .phases { display: none; }
  .right { max-height: 40vh; }
  #toasts { right: 12px; }
}

/* ---------------- animacoes (estilo MTGO) ----------------
   Os keyframes sempre incluem translateY(var(--ty)) e rotate(var(--rot)) para nao brigar com
   "virada" e "atacando". fill-mode "backwards": ao terminar, o estilo normal (e o :hover) volta a valer. */
.anim-in-bf-me   { animation: inBfMe .42s cubic-bezier(.2,.8,.25,1) backwards; }
.anim-in-bf-opp  { animation: inBfOpp .42s cubic-bezier(.2,.8,.25,1) backwards; }
.anim-in-stack   { animation: inStack .36s cubic-bezier(.2,.8,.25,1) backwards; }
.anim-in-hand    { animation: inHand .32s ease-out backwards; }
.anim-tap        { animation: tap .26s ease-in-out backwards; }
.anim-untap      { animation: untap .26s ease-in-out backwards; }
.anim-attack     { animation: charge .42s ease-out backwards; }

@keyframes inBfMe {
  0%   { opacity: 0; transform: translateY(calc(var(--ty) + 90px)) rotate(var(--rot)) scale(1.3); filter: brightness(1.8); }
  70%  { opacity: 1; filter: brightness(1.15); }
  100% { opacity: 1; transform: translateY(var(--ty)) rotate(var(--rot)) scale(1); filter: none; }
}
@keyframes inBfOpp {
  0%   { opacity: 0; transform: translateY(calc(var(--ty) - 90px)) rotate(var(--rot)) scale(1.3); filter: brightness(1.8); }
  70%  { opacity: 1; filter: brightness(1.15); }
  100% { opacity: 1; transform: translateY(var(--ty)) rotate(var(--rot)) scale(1); filter: none; }
}
@keyframes inStack {
  0%   { opacity: 0; transform: translateX(-60px) scale(.75); box-shadow: 0 0 0 var(--gold); }
  60%  { opacity: 1; box-shadow: 0 0 22px var(--gold); }
  100% { opacity: 1; transform: none; }
}
@keyframes inHand {
  0%   { opacity: 0; transform: translateY(70px) scale(.9); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes tap {
  0%   { transform: translateY(var(--ty)) rotate(0deg); }
  100% { transform: translateY(var(--ty)) rotate(90deg); }
}
@keyframes untap {
  0%   { transform: translateY(var(--ty)) rotate(90deg); }
  100% { transform: translateY(var(--ty)) rotate(0deg); }
}
@keyframes charge {
  0%   { transform: translateY(0) rotate(var(--rot)); }
  55%  { transform: translateY(calc(var(--ty) * 2.2)) rotate(var(--rot)) scale(1.06); }
  100% { transform: translateY(var(--ty)) rotate(var(--rot)) scale(1); }
}

/* carta saindo do campo/pilha (clone fixo na tela) */
.card.ghost { position: fixed; margin: 0; z-index: 60; pointer-events: none; animation: leave .6s ease-in forwards; }
@keyframes leave {
  0%   { opacity: 1; }
  100% { opacity: 0; transform: translateY(calc(var(--ty) + 36px)) rotate(var(--rot)) scale(.72); filter: grayscale(1) brightness(.45); }
}

/* vida */
.life { position: relative; }
.life-down { animation: lifeDown .9s ease-out backwards; }
.life-up   { animation: lifeUp .9s ease-out backwards; }
@keyframes lifeDown { 0% { color: #ff4a3a; transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes lifeUp   { 0% { color: #57e08f; transform: scale(1.35); } 100% { transform: scale(1); } }
.ldelta { position: absolute; right: 8px; top: -4px; font-size: 18px; font-weight: 800; animation: floatUp .9s ease-out forwards; pointer-events: none; }
.ldelta.neg { color: #ff5a4a; } .ldelta.pos { color: #57e08f; }
@keyframes floatUp { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-26px); } }

/* mana entrando na reserva */
.mana span.pop { animation: pop .38s ease-out backwards; }
@keyframes pop { 0% { transform: scale(1.7); box-shadow: 0 0 12px #fff; } 100% { transform: scale(1); } }

/* destaque pulsante para alvos (como o brilho do MTGO) */
.card.target::before, .card.choosable::before { content: ""; position: absolute; inset: -2px; border-radius: inherit; box-shadow: inset 0 0 0 2px var(--target); animation: pulse 1.1s ease-in-out infinite; pointer-events: none; z-index: 2; }
@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .card, .card *, .life, .ldelta, .mana span { animation: none !important; transition: none !important; }
  .card.ghost { display: none; }
}

/* ---------------- lobby: decks salvos e modos ---------------- */
.tabs { display: flex; gap: 4px; margin: 10px 0 4px; border-bottom: 1px solid var(--line); }
.tabs button { border-radius: 4px 4px 0 0; border-bottom: none; background: transparent; color: var(--muted); }
.tabs button.on { background: var(--panel2); color: var(--text); border-color: var(--line); }
.list-wrap { max-height: 55vh; overflow: auto; }
.fmt-group { margin: 8px 0; }
.fmt-title { font-size: 12px; color: var(--gold); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
.save-row select { width: 170px; }
.list li .acts { display: flex; gap: 4px; }
.list li .acts button { padding: 4px 8px; font-size: 12px; }
label.check { flex-direction: row !important; align-items: center; gap: 6px !important; }
label.check input { width: auto; }

/* ---------------- telas de draft e montagem ---------------- */
.two-col { display: grid; grid-template-columns: 1fr 290px; height: 100%; }
.col-main { overflow: auto; padding: 10px 14px; background: radial-gradient(ellipse at 50% 0%, #1b2840 0%, var(--mat) 70%); }
.col-side { padding: 10px; background: var(--mat2); border-left: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0; }
.bar-title { font-weight: 700; color: var(--gold); flex: 1; }
.stats { color: var(--muted); font-size: 12px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; padding: 3px 10px; border-radius: 12px; background: #0a1018; border: 1px solid var(--line); }
.timer.low { color: #ff7a6b; border-color: #7a2d2d; }
.booster { display: flex; flex-wrap: wrap; gap: 10px; padding: 8px 0 14px; }
.booster .card { --cw: clamp(90px, 9vw, 150px); --ch: calc(var(--cw) * 1.395); cursor: pointer; }
.booster .card:hover { transform: translateY(-6px); box-shadow: 0 0 14px var(--accent); }
.booster.waiting { opacity: .45; pointer-events: none; }
.cols { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0 12px; min-height: 60px; overflow-x: auto; }
.col { display: flex; flex-direction: column; align-items: center; min-width: calc(var(--cw) + 4px); }
.col .col-title { font-size: 11px; color: var(--muted); margin-bottom: 4px; white-space: nowrap; }
.col .card { --cw: clamp(70px, 6.4vw, 110px); --ch: calc(var(--cw) * 1.395); cursor: pointer; }
.col .card + .card { margin-top: calc(var(--ch) * -0.80); }
.col .card:hover { z-index: 3; transform: translateY(-4px); }
.zone-label-h { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 6px; }
.lands-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
.land-ctl { display: flex; align-items: center; gap: 6px; background: #0f1622; border: 1px solid #243249; border-radius: 6px; padding: 4px 8px; }
.land-ctl b { min-width: 22px; text-align: center; }
.land-ctl button { padding: 2px 9px; }
.filters { display: flex; gap: 4px; }
.filters button { padding: 3px 9px; font-size: 12px; }
.filters button.on { outline: 2px solid var(--accent); }
.tour { text-align: center; }
.tour .hint { font-size: 15px; margin: 14px 0 20px; }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } .col-side { display: none; } }

/* habilidade na pilha: arte da carta de origem escurecida + caixa de texto (estilo MTGO) */
.card.ability img { filter: brightness(.6) saturate(.85); }
.card.ability .abil { position: absolute; left: 3%; right: 3%; bottom: 4%; max-height: 82%; overflow: hidden;
  background: rgba(244, 236, 214, .95); color: #1a1408; border: 1px solid #7a6640; border-radius: 3px;
  padding: 4px 5px; font-size: calc(var(--cw) * .1); line-height: 1.2; box-shadow: 0 1px 4px rgba(0,0,0,.6); }
.card.ability .abil .an { font-weight: 700; margin-bottom: 2px; border-bottom: 1px solid rgba(122,102,64,.5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.ability .abil .at { margin-bottom: 1px; }
.card.ability.textcard .ctext { display: none; }
.card.ability.textcard { background: linear-gradient(#5a4a2e, #2b2316); }
.stack .card { --cw: clamp(92px, 8vw, 136px); --ch: calc(var(--cw) * 1.395); }

/* numeros dos atalhos de teclado */
kbd.knum { display: inline-block; min-width: 16px; margin: 0 6px 0 0; padding: 0 4px; border-radius: 3px; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.25); font-size: 11px; opacity: .9; text-align: center; }
.knum-card { position: absolute; top: 3px; right: 3px; z-index: 4; min-width: 18px; text-align: center; font-size: 12px; font-weight: 800; color: #111; background: var(--target); border-radius: 9px; padding: 0 5px; box-shadow: 0 1px 3px #000; }

/* paradas por fase (stops) na escada de fases */
.phase { display: flex; align-items: center; gap: 6px; }
.phase .pn { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.phase.head { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .5px; border-left-color: transparent; background: none; }
.stops-h { width: 16px; text-align: center; font-size: 9px; }
.stop { width: 16px; height: 12px; flex: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.stop::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 1px solid #4a5d7c; background: transparent; }
.stop.on::before { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 5px var(--gold); }
.stop:hover::before { border-color: var(--accent); }
.stop.none { cursor: default; }
.stop.none::before { border: none; }
button.link { background: none; border: none; color: var(--muted); padding: 2px 6px; font-size: 12px; text-decoration: underline; }

/* combate: vagas alinhadas, numeros e setas */
.combat-row { gap: 16px; align-items: center; }
.cslot { --n: 1; min-width: calc(var(--n) * (var(--ch) + 10px)); display: flex; justify-content: center; align-items: center; gap: 8px;
  padding: 4px; border-radius: 8px; min-height: calc(var(--ch) * .5);
  background: color-mix(in srgb, var(--gc) 9%, transparent); border: 1px dashed color-mix(in srgb, var(--gc) 55%, transparent); }
.card .cnum { position: absolute; top: 3px; left: 50%; transform: translateX(-50%); z-index: 4; min-width: 20px; text-align: center;
  font-weight: 800; font-size: 12px; color: #111; background: var(--gc, #ff5a3c); border-radius: 10px; padding: 0 6px; box-shadow: 0 1px 4px #000; }
.card.tapped .cnum { transform: translateX(-50%) rotate(-90deg); }
.card[style*="--gc"].attacking, .card[style*="--gc"].blocking { border-color: var(--gc); box-shadow: 0 0 10px var(--gc); }
.arrows { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 7; overflow: visible; }

/* ---------------- menu do topo ---------------- */
.mainnav { display: flex; gap: 2px; margin-left: 10px; height: 100%; }
.mainnav button { background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); padding: 0 14px; height: 100%; font-weight: 600; letter-spacing: .3px; }
.mainnav button:hover { color: var(--text); filter: none; }
.mainnav button.on { color: var(--text); border-bottom-color: var(--gold); }
.row.tight { gap: 4px; margin: 4px 0; }
.row.tight select { flex: 1; min-width: 0; }
.grow { flex: 1; }
button.tiny { padding: 1px 7px; font-size: 12px; }
.seg.small button { padding: 4px 10px; font-size: 12px; }

/* ---------------- gerenciador de decks ---------------- */
.dm { display: grid; grid-template-columns: 230px 1fr 340px; height: 100%; }
.dm-list { padding: 10px; background: var(--mat2); border-right: 1px solid var(--line); overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.dm-list > select { width: 100%; }
.dm-decks { flex: 1; overflow: auto; }
.dm-decks .fmt-title { margin-top: 10px; }
.dm-item { display: flex; justify-content: space-between; gap: 6px; padding: 6px 8px; border-radius: 4px; cursor: pointer; border: 1px solid transparent; }
.dm-item:hover { background: var(--panel2); }
.dm-item.on { background: #22355a; border-color: #3a5a92; }
.dm-iname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-icount { color: var(--muted); font-size: 12px; }
.dm-editor { overflow: auto; padding: 10px 14px; background: radial-gradient(ellipse at 50% 0%, #1b2840 0%, var(--mat) 70%); }
.dm-empty { max-width: 460px; margin: 12vh auto; text-align: center; }
.dm-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dm-head #dm-name { flex: 0 1 280px; font-weight: 700; font-size: 15px; }
.dm-head #dm-format { width: 190px; }
.dirty { color: var(--gold); font-size: 12px; }
.dm-valid { margin: 8px 0; padding: 6px 10px; border-radius: 4px; font-size: 13px; }
.dm-valid:empty { display: none; }
.dm-valid.ok { background: #143525; border: 1px solid #2f7a52; color: #9ff0c2; }
.dm-valid.bad { background: #3a1a1a; border: 1px solid #7a2d2d; color: #ffc4bd; }
.dm-valid.warn { background: #3a3014; border: 1px solid #7a652d; color: #ffe2a0; }
.dm-valid ul { margin: 4px 0 0 18px; padding: 0; }
.dm-valid .vtitle { font-weight: 700; }
.dm-stats { display: flex; gap: 22px; align-items: flex-end; margin: 8px 0; padding: 8px 10px; background: rgba(0,0,0,.25); border-radius: 6px; flex-wrap: wrap; }
.dm-nums .big { font-size: 18px; font-weight: 800; }
.dm-curve { display: flex; gap: 5px; align-items: flex-end; height: 64px; }
.dm-cbar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; width: 22px; height: 100%; }
.dm-cbar .bar { width: 100%; background: linear-gradient(#4b93ff, #2c6fd6); border-radius: 2px 2px 0 0; min-height: 1px; }
.dm-cbar .n { font-size: 10px; color: var(--muted); }
.dm-cbar .l { font-size: 10px; color: var(--muted); margin-top: 2px; }
.dm-viewbar { display: flex; gap: 12px; align-items: center; margin: 6px 0; }
.card .qty { position: absolute; right: 3px; top: 3px; z-index: 4; background: rgba(0,0,0,.85); color: #fff; font-weight: 800; font-size: 12px; padding: 0 6px; border-radius: 9px; border: 1px solid var(--gold); }
.dm-listview { display: flex; flex-direction: column; gap: 1px; margin-bottom: 10px; }
.dm-group { font-size: 12px; color: var(--gold); text-transform: uppercase; letter-spacing: .5px; margin: 8px 0 2px; }
.dm-row { display: grid; grid-template-columns: auto 24px auto minmax(140px, 1fr) 70px minmax(120px, 1fr) auto; gap: 6px; align-items: center; padding: 3px 6px; border-radius: 3px; }
.dm-row:hover { background: var(--panel2); }
.dm-rqty { text-align: center; }
.dm-rname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-rcost { color: #ffd98a; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.dm-rtype { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-search { padding: 10px; background: var(--mat2); border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.dm-search .row.tight select { font-size: 12px; padding: 5px; }
.cbtn { padding: 2px 4px; background: none; border-color: transparent; opacity: .5; }
.cbtn span { display: inline-block; min-width: 22px; text-align: center; border-radius: 10px; padding: 1px 4px; font-weight: 700; font-size: 12px; color: #111; }
.cbtn.on { opacity: 1; border-color: var(--accent); }
.dm-results { flex: 1; min-height: 120px; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; align-content: start; }
.dm-results .card { --cw: 100%; width: 100%; height: auto; aspect-ratio: 488 / 680; cursor: pointer; }
.dm-results .card:hover { box-shadow: 0 0 10px var(--accent); }
.dm-preview { min-height: 0; max-height: 42%; overflow: auto; }
.dm-preview img { max-width: 200px; }
.samples-list { max-height: 50vh; width: min(560px, 80vw); }
#screen-decks .cols .card { --cw: clamp(78px, 6.6vw, 112px); --ch: calc(var(--cw) * 1.395); }
@media (max-width: 1100px) { .dm { grid-template-columns: 190px 1fr 280px; } }
@media (max-width: 820px) { .dm { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; } .dm-list { max-height: 30vh; } .dm-search { max-height: 45vh; } }

/* ===== fases em retangulos, mensagem do jogo e botoes da direita (v2) ===== */
.turninfo { display: flex; flex-direction: column; align-items: stretch; gap: 1px; padding: 6px 8px; border-radius: 5px; background: #142036; border: 1px solid var(--line); text-align: center; white-space: normal; }
.turninfo .tnum { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.turninfo .twho { font-size: 14px; font-weight: 700; color: var(--text); }
.turninfo.mine { border-color: rgba(232,182,76,.55); }
.turninfo.mine .twho { color: var(--gold); }
.turninfo.theirs { border-color: rgba(224,82,82,.5); }
.turninfo.theirs .twho { color: #ff9a9a; }

.phases { gap: 3px; justify-content: flex-start; padding: 2px 0; }
.phase { flex: 1 1 0; min-height: 18px; max-height: 32px; padding: 0; border: none; background: none; font-size: 12px; gap: 4px; }
.phase .pn { height: 100%; display: flex; align-items: center; padding: 0 9px; border-radius: 4px; background: #152036; border: 1px solid #24324a; color: #7d8ca6; font-weight: 600; letter-spacing: .2px; transition: background .2s, color .2s, box-shadow .2s; }
.phase.cur { background: none; border: none; }
.phase.cur .pn { color: #1b1305; background: linear-gradient(#f3c866, #d39d2f); border-color: #ffd886; box-shadow: 0 0 10px rgba(232,182,76,.45); font-weight: 800; }
.phase.cur.opp .pn { color: #fff; background: linear-gradient(#e46a6a, #b13a3a); border-color: #ff9a9a; box-shadow: 0 0 10px rgba(224,82,82,.45); }
.phase.head { flex: 0 0 auto; min-height: 0; font-size: 10px; }
.phase.head .pn { background: none; border: none; padding: 0 4px; color: var(--muted); height: auto; font-weight: 600; }
.stops-h { width: 18px; }
.stop { width: 18px; height: 100%; max-height: 22px; }
.stop::before { width: 12px; height: 12px; border-radius: 3px; border: 1px solid #40536f; background: #101826; }
.stop.on::before { background: var(--gold); border-color: #ffd886; box-shadow: 0 0 6px rgba(232,182,76,.7); }

/* mensagem do jogo: a esquerda da faixa central, grande e destacada */
.midline { padding: 6px 10px; }
.prompt { justify-content: flex-start; gap: 10px; min-height: 52px; }
.prompt .picon { flex: none; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 800; background: #1d2a40; border: 1px solid var(--line); color: var(--muted); }
.prompt .pmsg { text-align: left; font-size: 17px; font-weight: 700; line-height: 1.25; padding: 4px 12px; border-left: 3px solid transparent; }
.prompt .psub { font-size: 13px; margin-top: 2px; }
.prompt.active .pmsg { color: var(--gold); border-left-color: var(--gold); background: linear-gradient(90deg, rgba(232,182,76,.12), transparent 70%); border-radius: 0 4px 4px 0; }
.prompt.active .picon { color: #1b1305; background: var(--gold); border-color: #ffd886; box-shadow: 0 0 10px rgba(232,182,76,.5); }
.prompt.k-target .picon { background: var(--target); }
.prompt.k-mana .picon { background: #7fd3ff; border-color: #b6e6ff; box-shadow: 0 0 10px rgba(127,211,255,.5); }
.prompt.over .pmsg { font-size: 20px; }
.prompt button { min-width: 100px; padding: 9px 18px; font-size: 15px; border-radius: 6px; }
.prompt.flash .pmsg, .prompt.flash .picon { animation: promptFlash 1s ease-out; }
@keyframes promptFlash { 0% { filter: brightness(1.9); transform: translateX(-6px); } 40% { filter: brightness(1.3); transform: none; } 100% { filter: none; } }

/* botoes de passe: maiores, com icones */
.passbar { gap: 6px; }
.passbar button { display: flex; align-items: center; gap: 7px; min-height: 40px; padding: 6px 9px; font-size: 13px; font-weight: 600; text-align: left; border-radius: 6px; background: linear-gradient(#2c3c58, #1c2639); border-color: #3b5072; box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 1px 2px rgba(0,0,0,.4); transition: transform .08s, border-color .15s, filter .15s; }
.passbar button:hover:not(:disabled) { border-color: var(--accent); }
.passbar button:active:not(:disabled) { transform: translateY(1px); }
.passbar .ico { flex: none; width: 18px; height: 18px; fill: #9cc2ff; }
.passbar .pl { flex: 1; line-height: 1.15; }
.passbar kbd { flex: none; margin: 0; padding: 1px 5px; border-radius: 3px; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.18); opacity: .8; font-size: 10px; }
.passbar button.stopall .ico { fill: var(--gold); }
.passbar button.danger { background: linear-gradient(#4a2328, #2e171b); border-color: #7a3a40; color: #ffc0c0; }
.passbar button.danger .ico { fill: #ff8a8a; }
.passbar button.danger:hover:not(:disabled) { border-color: var(--danger); }
@media (max-width: 1100px) { .passbar button { font-size: 12px; min-height: 36px; } .passbar kbd { display: none; } }
/* ajustes: bloco de fases centralizado na vertical e cabecalho "Voce / Op." sem sobrepor */
.phases { justify-content: center; }
.phase.head { gap: 4px; margin-bottom: 1px; }
.phase.head .stops-h { width: 22px; font-size: 8px; letter-spacing: 0; text-transform: none; white-space: nowrap; overflow: visible; text-align: center; }
.stop { width: 22px; }
/* pilha: coluna propria a direita do campo (so aparece quando ha algo na pilha), sem sobrepor nada */
.center { grid-template-columns: minmax(0, 1fr) auto; }
.center > #opp-bf { grid-column: 1; grid-row: 1; }
.center > .midline { grid-column: 1; grid-row: 2; }
.center > #me-bf { grid-column: 1; grid-row: 3; }
.center > #hand { grid-column: 1 / -1; grid-row: 4; }
.center > #stack-wrap { grid-column: 2; grid-row: 1 / 4; position: static; transform: none; align-self: center; max-height: calc(100% - 16px); margin: 8px 8px 8px 0; overflow-y: auto; overflow-x: hidden; animation: stackIn .2s ease-out; }
@keyframes stackIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
/* pilha do lado esquerdo do campo, em coluna propria (sem sobrepor a mensagem) */
.center { grid-template-columns: auto minmax(0, 1fr); }
.center > #opp-bf { grid-column: 2; }
.center > .midline { grid-column: 2; }
.center > #me-bf { grid-column: 2; }
.center > #stack-wrap { grid-column: 1; margin: 8px 0 8px 8px; }
@keyframes stackIn { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
/* troca de mensagem do jogo: icone "salta", texto entra deslizando com fade, botoes surgem em seguida */
.prompt.flash .pmsg, .prompt.flash .picon { animation: none; }
.prompt.swap .picon { animation: pIconIn .45s cubic-bezier(.3,1.6,.5,1) backwards; }
.prompt.swap .pmsg { animation: pMsgIn .42s cubic-bezier(.2,.8,.25,1) backwards; }
.prompt.swap .pmsg .psub { animation: pMsgIn .42s cubic-bezier(.2,.8,.25,1) .08s backwards; }
.prompt.swap button { animation: pBtnIn .35s ease-out .12s backwards; }
.prompt.swap.active .pmsg::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 20%, rgba(255,230,160,.35) 45%, transparent 70%); background-size: 250% 100%; animation: pShine .7s ease-out backwards; animation-delay: inherit; }
.prompt .pmsg { position: relative; overflow: hidden; }
@keyframes pIconIn { 0% { transform: scale(.3) rotate(-30deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes pMsgIn { 0% { opacity: 0; transform: translateY(10px); filter: blur(3px); } 100% { opacity: 1; transform: none; filter: none; } }
@keyframes pBtnIn { 0% { opacity: 0; transform: translateY(6px) scale(.96); } 100% { opacity: 1; transform: none; } }
@keyframes pShine { 0% { background-position: 120% 0; } 100% { background-position: -60% 0; } }
/* ordem da pilha */
.stack-hint { font-size: 9px; color: var(--muted); text-transform: none; letter-spacing: 0; margin-left: 6px; }
.snum { position: absolute; top: 4px; left: 4px; z-index: 6; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #e8edf5; background: rgba(12,18,28,.88); border: 1px solid #5a6e90; box-shadow: 0 1px 4px #000; }
.snum.top { color: #1b1305; background: var(--gold); border-color: #ffd886; box-shadow: 0 0 8px rgba(232,182,76,.7); }
/* botao de tela cheia */
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 26px; padding: 0; border-radius: 5px; background: transparent; border: 1px solid transparent; }
.iconbtn:hover:not(:disabled) { background: #1d2a40; border-color: var(--line); }
.iconbtn .ico { width: 18px; height: 18px; fill: var(--muted); }
.iconbtn:hover .ico { fill: var(--gold); }
.iconbtn .ico-exit { display: none; }
.iconbtn.on .ico-enter { display: none; }
.iconbtn.on .ico-exit { display: block; }
#btn-fullscreen { margin-left: 4px; }
/* modo janela: some a barra do topo e o jogo ocupa a janela inteira do navegador */
body.focus #topbar { display: none; }
body.focus .screen { height: 100%; }
.unfocus { display: none; position: fixed; top: 4px; right: 4px; z-index: 30; width: 30px; height: 26px; padding: 0; border-radius: 5px;
  align-items: center; justify-content: center; background: rgba(15,22,32,.55); border: 1px solid rgba(255,255,255,.12); opacity: .35; transition: opacity .15s; }
.unfocus svg { width: 18px; height: 18px; fill: var(--muted); }
.unfocus:hover { opacity: 1; }
.unfocus:hover svg { fill: var(--gold); }
body.focus .unfocus { display: inline-flex; }
/* reserva de mana sempre visivel */
.mana.pool { align-items: center; gap: 3px; padding: 4px 5px; border-radius: 5px; background: rgba(0,0,0,.25); border: 1px solid #24324a; }
.mana.pool.has { border-color: rgba(232,182,76,.6); box-shadow: 0 0 8px rgba(232,182,76,.25); }
.mana .mlabel { min-width: 0; padding: 0 3px 0 0; font-size: 10px; font-weight: 600; color: var(--muted); background: none; text-transform: uppercase; letter-spacing: .5px; border-radius: 0; }
.mana.pool span:not(.mlabel) { min-width: 22px; padding: 1px 4px; }
.mana span.zero { opacity: .22; filter: grayscale(.6); }
/* desvirar mais visivel: um pouco mais lento e com brilho rapido */
.anim-untap { animation: untap .36s cubic-bezier(.3,1.3,.5,1) backwards; }
@keyframes untap {
  0%   { transform: translateY(var(--ty)) rotate(90deg); filter: brightness(1.5); }
  100% { transform: translateY(var(--ty)) rotate(0deg); filter: none; }
}
/* evita "sujeira" de pintura no Chrome (copias fantasma de cartas viradas ao redesenhar/rolar):
   cada campo vira uma camada propria e tudo que for desenhado fora dele e recortado e repintado junto */
.bf { contain: paint; transform: translateZ(0); backface-visibility: hidden; }
.bf .card { backface-visibility: hidden; }
.bf { padding-top: 16px; padding-bottom: 16px; } /* espaco para o avanco do atacante nao ser recortado */

/* relogio de xadrez no painel do jogador */
.pclock { display: inline-flex; align-items: baseline; gap: 5px; margin-top: 2px; padding: 1px 8px; border-radius: 4px; background: #0b111b; border: 1px solid #2b3a52;
  font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 800; color: #9fb0c9; }
.pclock .ck-ico { font-size: 11px; opacity: .7; }
.pclock .ck-buf { font-size: 11px; font-weight: 700; color: #57e08f; }
.pclock.run { color: #fff; border-color: var(--gold); box-shadow: 0 0 8px rgba(232,182,76,.35); }
.pclock.low { color: #ffb36b; }
.pclock.run.low { border-color: #ff9a3c; }
.pclock.crit { color: #ff6b6b; }
.pclock.run.crit { border-color: var(--danger); animation: clockCrit 1s ease-in-out infinite; }
@keyframes clockCrit { 50% { box-shadow: 0 0 12px rgba(224,82,82,.8); } }
.match-opts { margin-top: 4px; }

/* menu do botao direito na partida */
.game-menu { position: fixed; z-index: 80; min-width: 250px; padding: 5px; border-radius: 8px; background: rgba(16,23,35,.98); border: 1px solid #3b5072;
  box-shadow: 0 10px 30px rgba(0,0,0,.6); display: flex; flex-direction: column; gap: 2px; animation: gmIn .12s ease-out; }
@keyframes gmIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.gm-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; background: none; border: 1px solid transparent; border-radius: 5px; text-align: left; font-size: 13px; }
.gm-item:hover:not(:disabled) { background: #22324d; border-color: #3b5072; filter: none; }
.gm-item .gm-ico { width: 18px; text-align: center; font-size: 15px; color: #9cc2ff; }
.gm-item .gm-text { flex: 1; }
.gm-item kbd { margin: 0; padding: 1px 5px; border-radius: 3px; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.18); }
.gm-item.warn .gm-ico { color: var(--gold); }
.gm-item.danger { color: #ffb4b4; }
.gm-item.danger .gm-ico { color: #ff8a8a; }
.gm-item.danger:hover:not(:disabled) { background: #3a1d22; border-color: #7a3a40; }
.gm-sep { height: 1px; margin: 3px 4px; background: var(--line); }

/* dado de 20 lados no inicio da partida */
.dice { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; background: rgba(5,8,14,.55); backdrop-filter: blur(2px); cursor: pointer; }
.dice-panel { padding: 22px 34px; border-radius: 12px; background: linear-gradient(#1a2540, #0f1626); border: 1px solid #3b5072; box-shadow: 0 16px 50px rgba(0,0,0,.7); text-align: center; animation: gmIn .18s ease-out; }
.dice-title { font-size: 15px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 16px; }
.dice-row { display: flex; gap: 46px; justify-content: center; }
.die-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.die-name { font-weight: 700; }
.d20 { width: 92px; height: 92px; display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 900; color: #fff;
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%); background: linear-gradient(145deg, #4b6fb0, #22355e); text-shadow: 0 2px 4px #000; transition: transform .25s, background .25s; }
.d20.rolling { animation: dieSpin .3s linear infinite; }
.d20.won { background: linear-gradient(145deg, #f3c866, #b8841f); color: #1b1305; text-shadow: none; transform: scale(1.12); }
.d20.lost { background: linear-gradient(145deg, #4a5368, #262c3a); color: #aab4c6; }
@keyframes dieSpin { 0% { transform: rotate(0) scale(1); } 50% { transform: rotate(180deg) scale(.92); } 100% { transform: rotate(360deg) scale(1); } }
.dice-result { margin-top: 16px; font-size: 16px; font-weight: 700; color: var(--gold); min-height: 22px; }

/* ===== tela de login com contas ===== */
.panel.auth { max-width: 400px; margin-top: 7vh; padding: 26px 28px; }
.auth-brand { font-size: 26px; font-weight: 800; letter-spacing: 1px; color: var(--gold); text-align: center; margin-bottom: 16px; }
.auth-tabs { display: flex; margin-bottom: 14px; }
.auth-tabs button { flex: 1; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.auth-form button.primary { margin-top: 4px; padding: 10px; font-size: 15px; }
.auth-form button.link { align-self: center; }
.auth-sep { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: var(--muted); font-size: 12px; }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-oauth { display: flex; flex-direction: column; gap: 8px; }
.oauth-btn { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px; border-radius: 5px; font-weight: 600; text-decoration: none; border: 1px solid transparent; }
.oauth-btn svg { width: 18px; height: 18px; }
.oauth-btn.google { background: #fff; color: #1f1f1f; border-color: #dadce0; }
.oauth-btn.google:hover { background: #f2f2f2; }
.oauth-btn.discord { background: #5865f2; color: #fff; }
.oauth-btn.discord:hover { background: #4752c4; }
.panel.auth > .hint.small { margin-top: 18px; text-align: center; }

/* setas de combate (minimalistas) */
.arrows .arrow-line { fill: none; stroke-width: 2.2; stroke-linecap: round; }
.arrows .arrow-glow { fill: none; stroke-width: 7; stroke-linecap: round; opacity: .12; }
.arrows .arrow-head { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.arrows .arrow-dot { opacity: .9; }
.arrows .arrow.direct .arrow-line { stroke-dasharray: 2 7; animation: arrowFlow .9s linear infinite; }
@keyframes arrowFlow { to { stroke-dashoffset: -9; } }
@media (prefers-reduced-motion: reduce) { .arrows .arrow.direct .arrow-line { animation: none; } }

/* escolha de cartas no modal (vidência etc.) */
.modal-hint { width: 100%; margin-bottom: 6px; font-size: 13px; }
.modal-body .card.chosen { transform: translateY(-6px); box-shadow: 0 0 0 2px #fff, 0 0 14px var(--gold); }

/* simbolos de mana no texto */
img.ms { height: 1.05em; width: auto; vertical-align: -0.17em; margin: 0 1px; filter: drop-shadow(0 1px 0 rgba(0,0,0,.45)); }
.prompt .pmsg img.ms { height: 1.15em; }
.modal-title img.ms { height: 1.1em; }
.dm-rcost img.ms { height: 14px; margin: 0; }

/* aviso de inatividade */
.idle-warn { position: fixed; top: 46px; left: 50%; transform: translateX(-50%); z-index: 75; padding: 10px 18px; border-radius: 8px;
  background: linear-gradient(#5a1f24, #3a1418); border: 1px solid #c0464f; color: #ffe1e1; font-size: 14px; box-shadow: 0 8px 26px rgba(0,0,0,.6);
  animation: idlePulse 1.2s ease-in-out infinite; }
.idle-warn b { color: #fff; margin-right: 4px; }
@keyframes idlePulse { 50% { box-shadow: 0 8px 26px rgba(0,0,0,.6), 0 0 18px rgba(224,82,82,.65); } }

/* ordenar cartas no topo/fundo do grimorio */
.order-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; width: 100%; padding: 4px 0 2px; }
.order-slot { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px; border-radius: 8px; border: 1px solid transparent; cursor: grab; transition: background .15s, border-color .15s; }
.order-slot.sel { border-color: var(--gold); background: rgba(232,182,76,.08); }
.order-slot.over { border-color: var(--accent); background: rgba(61,139,253,.12); }
.order-slot .card { --cw: 118px; --ch: 165px; }
.order-pos { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.order-slot:first-child .order-pos { color: var(--gold); }
.order-ctl { display: flex; gap: 6px; }
.order-ctl button { min-width: 34px; padding: 3px 8px; }

/* tamanho das cartas escolhido pelo jogador (--cs = multiplicador; 1 = padrao) */
#screen-game { --cw: calc(clamp(54px, 5.4vw, 98px) * var(--cs, 1)); --ch: calc(var(--cw) * 1.395);
  --hw: calc(clamp(66px, 6.8vw, 124px) * var(--cs, 1)); --hh: calc(var(--hw) * 1.395); }
#screen-game .stack .card { --cw: calc(clamp(92px, 8vw, 136px) * var(--cs, 1)); --ch: calc(var(--cw) * 1.395); }
#screen-decks .cols .card { --cw: calc(clamp(78px, 6.6vw, 112px) * var(--cs, 1)); --ch: calc(var(--cw) * 1.395); }
#screen-decks .dm-results { grid-template-columns: repeat(auto-fill, minmax(calc(92px * var(--cs, 1)), 1fr)); }
#screen-build .col .card { --cw: calc(clamp(70px, 6.4vw, 110px) * var(--cs, 1)); --ch: calc(var(--cw) * 1.395); }
#screen-build .col { min-width: calc(clamp(70px, 6.4vw, 110px) * var(--cs, 1) + 4px); }
.size-seg { align-items: center; }
.size-seg .size-label { font-size: 11px; color: var(--muted); margin-right: 6px; }
.size-seg button { min-width: 30px; }
.size-seg button:nth-of-type(1) { border-radius: 4px 0 0 4px; }
.gm-sizes { display: flex; align-items: center; gap: 4px; padding: 6px 10px; font-size: 13px; }
.gm-sizes .gm-text { flex: 1; }
.gm-sizes button { min-width: 30px; padding: 3px 6px; font-size: 12px; }
.gm-sizes button.on { background: linear-gradient(#4b93ff, #2c6fd6); color: #fff; border-color: #5aa0ff; }
