:root {
  --bg: #120d22; --bg2: #1d1535; --bg3: #2a1f4a; --line: #3b2d66;
  --txt: #f3eefe; --muted: #a99bd0; --gold: #f5b300; --red: #ef4444; --green: #22c55e; --blue: #22a7f0;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--txt); font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
body { min-height: 100vh; background: radial-gradient(circle at 50% -20%, #3a2370 0%, var(--bg) 60%) fixed; }
#app { max-width: 560px; margin: 0 auto; padding: 14px 14px 90px; }
h1 { font-family: "Arial Black", Arial, sans-serif; font-size: 34px; line-height: 1; margin: 18px 0 4px; text-align: center; letter-spacing: -1px; }
h1 span { color: var(--gold); }
.sub { text-align: center; color: var(--muted); margin: 0 0 18px; }
h2 { margin: 0 0 10px; } h3 { margin: 16px 0 6px; color: var(--gold); font-size: 15px; }
.panel { background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin: 12px 0; }
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; }
input { width: 100%; padding: 14px; font-size: 18px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg); color: var(--txt); outline: none; }
input:focus { border-color: var(--gold); }
input.code { text-transform: uppercase; letter-spacing: 6px; text-align: center; font-weight: 900; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 12px; padding: 13px 16px; font-weight: 800; font-size: 16px; color: #1b1300; background: var(--gold); width: 100%; margin-top: 10px; transition: transform .08s; }
button:active { transform: scale(.97); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.sec { background: var(--bg3); color: var(--txt); border: 1px solid var(--line); }
button.red { background: var(--red); color: #fff; }
button.green { background: var(--green); color: #052b14; }
button.small { width: auto; padding: 8px 12px; font-size: 14px; margin: 0; }
.row { display: flex; gap: 10px; } .row > * { flex: 1; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.topbar .tag { background: var(--bg3); border: 1px solid var(--line); padding: 6px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }

.bigcode { font-family: "Arial Black", Arial; font-size: 46px; letter-spacing: 10px; text-align: center; color: var(--gold); margin: 4px 0; }
.plist { list-style: none; padding: 0; margin: 0; }
.plist li { display: flex; align-items: center; gap: 10px; padding: 10px; border-bottom: 1px solid var(--line); font-weight: 700; }
.plist li:last-child { border: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none; }
.dot.off { background: #666; }
.crown { margin-left: auto; font-size: 12px; color: var(--gold); }
.linkbox { word-break: break-all; background: var(--bg); border: 1px dashed var(--line); padding: 10px; border-radius: 10px; font-size: 14px; margin-top: 6px; }

.castgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.cc { text-align: center; font-size: 10px; font-weight: 700; line-height: 1.1; cursor: pointer; opacity: .4; }
.cc .card.sm { width: 100%; max-width: 64px; margin: 0 auto 3px; }
.cc.on { opacity: 1; }
.cc.on .card { outline: 3px solid var(--gold); outline-offset: 1px; border-radius: 8px; }

/* jogo */
.opps { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.opp { background: var(--bg2); border: 2px solid var(--line); border-radius: 14px; padding: 8px; position: relative; }
.opp.turn { border-color: var(--gold); box-shadow: 0 0 14px rgba(245,179,0,.35); }
.opp.out { opacity: .45; }
.opp.target { border-color: var(--red); }
.opp .nm { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
.opp .coins { font-size: 13px; color: var(--gold); font-weight: 800; margin: 2px 0 4px; }
.opp .cards { display: flex; gap: 4px; }
.opp .badge { position: absolute; top: -8px; right: 6px; background: var(--gold); color: #1b1300; font-size: 10px; font-weight: 900; padding: 2px 6px; border-radius: 999px; }
.card { width: 100%; max-width: 130px; height: auto; display: block; filter: drop-shadow(0 4px 8px rgba(0,0,0,.45)); }
.card.sm { width: 46px; }
.card.dead { filter: grayscale(1) brightness(.6); }
.mycards { display: flex; gap: 12px; justify-content: center; }
.mycards .slot { flex: 0 1 130px; text-align: center; }
.mycards .slot.pick { cursor: pointer; }
.mycards .slot.pick .card { outline: 3px dashed var(--red); outline-offset: 3px; border-radius: 10px; animation: pulse 1s infinite; }
.mycards .slot.sel .card { outline: 4px solid var(--green); outline-offset: 3px; border-radius: 10px; }
@keyframes pulse { 50% { transform: scale(1.04); } }

.status { text-align: center; font-weight: 800; font-size: 17px; margin: 4px 0 8px; }
.timer { height: 6px; background: var(--bg3); border-radius: 99px; overflow: hidden; margin: 6px 0 2px; }
.timer i { display: block; height: 100%; background: var(--gold); transition: width .25s linear; }
.timer.hot i { background: var(--red); }
.secs { text-align: right; font-size: 12px; color: var(--muted); }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.act { margin: 0; padding: 10px; text-align: left; background: var(--bg3); color: var(--txt); border: 2px solid var(--line); border-radius: 12px; font-size: 14px; }
.act b { display: block; font-size: 15px; }
.act small { color: var(--muted); font-weight: 600; font-size: 12px; }
.act .who { display: inline-block; margin-top: 4px; font-size: 11px; padding: 2px 7px; border-radius: 99px; color: #111; font-weight: 900; }
.act.on { border-color: var(--gold); }
.targets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.targets button { width: auto; flex: 1 1 40%; margin: 0; }

.log { max-height: 230px; overflow-y: auto; font-size: 14px; display: flex; flex-direction: column-reverse; }
.log div { padding: 5px 2px; border-bottom: 1px solid rgba(255,255,255,.05); }
.log div.priv { color: #7fd3ff; font-weight: 700; }

.winner { text-align: center; font-size: 26px; font-weight: 900; margin: 10px 0; }
.winner .big { font-size: 64px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 50; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 16px; }
.modal-box { background: var(--bg2); border: 1px solid var(--line); border-radius: 18px; padding: 18px; max-width: 560px; width: 100%; position: relative; }
.modal-box ul { padding-left: 20px; } .modal-box li { margin: 4px 0; }
.modal .x { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; padding: 0; margin: 0; background: var(--bg3); color: var(--txt); }
.rc { display: flex; gap: 10px; align-items: center; margin: 8px 0; }
.rc .card { width: 64px; flex: none; }
.rc p { margin: 0; font-size: 14px; }

/* regras */
.modal-box { padding-top: 0; max-height: calc(100vh - 32px); overflow-y: auto; }
.rhead { position: sticky; top: 0; z-index: 2; background: var(--bg2); display: flex; align-items: center; justify-content: space-between; padding: 14px 0 8px; }
.rhead h2 { margin: 0; }
.rhead .x { position: static; }
.rtabs { position: sticky; top: 60px; z-index: 2; background: var(--bg2); display: flex; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.rtabs button { margin: 0; padding: 10px 6px; font-size: 14px; background: var(--bg3); color: var(--txt); border: 1px solid var(--line); }
.rtabs button.on { background: var(--gold); color: #1b1300; border-color: var(--gold); }
.rnote { background: var(--bg); border-radius: 10px; padding: 10px; font-size: 14px; margin: 0 0 10px; }
.rcard { display: flex; gap: 12px; border: 2px solid; border-radius: 14px; padding: 10px; margin: 0 0 10px; background: var(--bg); scroll-margin-top: 120px; }
.rcard.flash { animation: flash 1.2s 2; }
@keyframes flash { 50% { box-shadow: 0 0 0 4px var(--gold); } }
.rcard-img { flex: 0 0 92px; }
.rcard-img .card { width: 92px; }
.rcard-txt { flex: 1; min-width: 0; font-size: 14px; }
.rname { font-weight: 900; font-size: 18px; }
.rline { margin-top: 7px; line-height: 1.35; }
.rline.tip { background: var(--bg3); border-radius: 8px; padding: 6px 8px; font-size: 13px; }
.pill { display: inline-block; font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 99px; background: var(--bg3); border: 1px solid var(--line); }
.pill.gold { background: var(--gold); color: #1b1300; border-color: var(--gold); }
.rbase { background: var(--bg); border-radius: 10px; padding: 10px; margin: 6px 0; font-size: 14px; }
.rtable { overflow-x: auto; }
.rtable table { border-collapse: collapse; width: 100%; min-width: 480px; font-size: 13px; }
.rtable th, .rtable td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rtable th { color: var(--gold); position: sticky; top: 0; }
.dotc { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.modal-box ol { padding-left: 20px; } .modal-box ol li { margin: 5px 0; }
.mycards .slot[data-do="rulecard"] { cursor: pointer; }
.fab { position: fixed; right: 14px; bottom: 16px; width: auto; margin: 0; z-index: 40; padding: 12px 16px; border-radius: 999px; box-shadow: 0 6px 18px rgba(0,0,0,.5); display: flex; align-items: center; gap: 6px; font-size: 18px; }
.fab span { font-size: 15px; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--red); color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 700; z-index: 60; max-width: 90vw; text-align: center; }
