/* Pack Rush Web — dark, art-backed theme in the app's direction. */
:root {
  --bg: #120d20;
  --bg2: #1c1433;
  --panel: #221a3d;
  --panel2: #2a2150;
  --line: #3d3266;
  --gold: #f2b33d;
  --gold2: #ffd97a;
  --cream: #f5edd8;
  --dim: #a99fd0;
  --red: #ef5350;
  --green: #66bb6a;
  --blue: #42a5f5;
  --purple: #ab47bc;
  --orange: #ffa726;
  --grey: #b0b0b0;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(120% 90% at 50% 0%, var(--bg2) 0%, var(--bg) 60%);
  color: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--gold2); }

/* ---------- header / tabs ---------- */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; position: sticky; top: 0; z-index: 30;
  background: rgba(18, 13, 32, .92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-art { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; border: 1px solid var(--line); }
.brand-name { font-weight: 900; letter-spacing: 2px; font-size: 19px; color: var(--gold2); line-height: 1; }
.brand-sub { font-size: 11px; color: var(--dim); letter-spacing: 1px; }
.top-stats { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.stat-name { font-weight: 700; }
.stat-coins { color: var(--gold2); font-weight: 700; }
.stat-conn { font-size: 11px; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--line); color: var(--dim); }
.stat-conn.on { color: var(--green); border-color: var(--green); }
#tabs { display: flex; gap: 6px; padding: 8px 12px 0; max-width: 880px; margin: 0 auto; }
.tab {
  flex: 1; padding: 10px; border-radius: 10px 10px 0 0; border: 1px solid var(--line);
  border-bottom: none; background: #191231; color: var(--dim); font-size: 15px; font-weight: 700;
}
.tab.active { background: var(--panel); color: var(--gold2); }
main { max-width: 880px; margin: 0 auto; padding: 0 12px 20px; }
.view { display: none; }
.view.active { display: block; }

.card {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; margin-top: 12px;
}
.panel-title { font-weight: 800; font-size: 16px; color: var(--gold2); letter-spacing: .4px; margin-bottom: 8px; }
.hint { color: var(--dim); font-size: 13px; line-height: 1.45; }
.hint.center { text-align: center; }
.warn { background: #3a1626; border: 1px solid #7a2547; color: #ffb3c2; padding: 8px 10px; border-radius: 10px; font-size: 13px; margin: 8px 0; }
.hidden { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  background: var(--panel2); color: var(--cream); border: 1px solid var(--line);
  border-radius: 11px; padding: 10px 14px; font-size: 14px; font-weight: 700; cursor: pointer;
}
.btn:disabled { opacity: .45; cursor: default; }
.btn.gold { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #2a1d05; border-color: #a8741a; }
.btn.big { width: 100%; padding: 14px; font-size: 17px; margin-top: 8px; }
.btn.small { padding: 7px 10px; font-size: 13px; }
.btn.ghost { background: transparent; }
.btn.danger { background: #4a1620; border-color: #8e2434; color: #ffc9cf; }
.btn:active { transform: translateY(1px); }

/* ---------- lobby ---------- */
.profile-body { font-size: 15px; line-height: 1.6; }
.profile-body b { color: var(--gold2); }
.tier-body { margin-top: 6px; font-size: 13px; color: var(--dim); }
.tier-bar { height: 8px; background: #17102b; border-radius: 6px; overflow: hidden; margin-top: 4px; border: 1px solid var(--line); }
.tier-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold2)); }
.quests-body { font-size: 14px; }
.quest { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.quest:last-child { border-bottom: none; }
.quest .q-prog { color: var(--dim); white-space: nowrap; }
.quest.done .q-label { color: var(--green); }
.referral-body { font-size: 14px; line-height: 1.55; }
.referral-code { font-size: 22px; font-weight: 900; letter-spacing: 3px; color: var(--gold2); }
.redeem-row { display: flex; gap: 8px; margin-top: 8px; }
.redeem-row input, #name-input {
  flex: 1; background: #17102b; border: 1px solid var(--line); color: var(--cream);
  border-radius: 10px; padding: 10px; font-size: 15px; min-width: 0;
}
.redeem-msg { font-size: 13px; color: var(--dim); margin-top: 6px; min-height: 16px; }
.queue-status { margin-top: 8px; font-size: 14px; color: var(--gold2); min-height: 18px; }

/* ---------- cross-promo ---------- */
.more-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .more-grid { grid-template-columns: 1fr 1fr; } }
.more-card {
  display: block; text-decoration: none; color: var(--cream);
  background: #17102b; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.more-card:active { transform: translateY(1px); }
.more-name { font-weight: 900; font-size: 17px; color: var(--gold2); letter-spacing: .4px; }
.more-tag { color: var(--dim); font-size: 13px; line-height: 1.45; margin: 3px 0 8px; }
.more-cta { font-size: 13px; font-weight: 800; color: var(--gold); }

/* ---------- packs ---------- */
.packs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.pack-card { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); }
.pack-card img { width: 100%; height: 110px; object-fit: cover; display: block; }
.pack-info { padding: 10px; }
.pack-name { font-weight: 800; font-size: 15px; }
.pack-tag { color: var(--dim); font-size: 12px; margin: 2px 0 8px; }
.pack-card .btn { width: 100%; }
.rip-area { margin-top: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.rip-cards { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

/* ---------- game cards ---------- */
.gcard {
  width: 104px; border-radius: 10px; overflow: hidden; position: relative; flex: 0 0 auto;
  border: 2px solid var(--grey); background: #17102b; font-size: 11px;
}
.gcard img.art { width: 100%; height: 74px; object-fit: cover; display: block; }
.gcard .gc-name { padding: 4px 6px 1px; font-weight: 700; font-size: 11px; line-height: 1.15; min-height: 26px; }
.gcard .gc-line { padding: 0 6px 5px; color: var(--dim); display: flex; justify-content: space-between; }
.gcard .gc-stats { font-weight: 800; color: var(--cream); }
.gcard.r0 { border-color: var(--grey); } .gcard.r1 { border-color: var(--green); }
.gcard.r2 { border-color: var(--blue); } .gcard.r3 { border-color: var(--purple); }
.gcard.r4 { border-color: var(--orange); box-shadow: 0 0 10px rgba(255,167,38,.45); }
.gcard.sel { outline: 3px solid var(--gold); outline-offset: 1px; }
.gcard.tappable { cursor: pointer; }
.gcard.targetable { outline: 3px solid var(--green); outline-offset: 1px; cursor: pointer; animation: pulse 1.1s infinite; }
.gcard.tapped { opacity: .55; transform: rotate(4deg); }
.gcard.hurt .gc-stats { color: var(--red); }
.gcard .gc-hp { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.72); color: #fff; font-weight: 800; padding: 1px 6px; border-radius: 8px; font-size: 11px; }
.gcard .gc-cost { position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,.72); color: var(--gold2); font-weight: 800; padding: 1px 6px; border-radius: 8px; font-size: 11px; }
.gcard.land { width: 84px; }
.gcard.land img.art { height: 52px; }
@keyframes pulse { 0%,100% { outline-offset: 1px; } 50% { outline-offset: 3px; } }

/* ---------- deck ---------- */
.deck-count { color: var(--dim); font-size: 13px; font-weight: 600; }
.deck-actions { display: flex; gap: 8px; margin-bottom: 8px; }
.deck-list, .collection-list { font-size: 14px; }
.deck-row, .coll-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.deck-row:last-child, .coll-row:last-child { border-bottom: none; }
.deck-row .nm, .coll-row .nm { flex: 1; }
.deck-row .ct, .coll-row .ct { color: var(--dim); font-size: 12px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--cream); font-size: 16px; font-weight: 800; }
.stepper .n { min-width: 18px; text-align: center; font-weight: 800; }
.land-steppers { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 14px; }
.land-steppers .ls-row { display: flex; align-items: center; justify-content: space-between; }

/* ---------- battle ---------- */
#view-battle { padding-top: 10px; }
.battle-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hp-chip { background: #17102b; border: 1px solid var(--line); border-radius: 20px; padding: 5px 12px; font-weight: 800; font-size: 14px; }
.hp-chip.me { border-color: var(--gold); color: var(--gold2); }
.hp-chip.low { color: var(--red); border-color: var(--red); }
.turn-chip { font-size: 12px; color: var(--dim); }
.zone-label { font-size: 11px; letter-spacing: 1px; color: var(--dim); margin: 10px 0 4px; text-transform: uppercase; }
.field-row, .hand-row, .lands-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; min-height: 40px; }
.empty-note { color: var(--dim); font-size: 12px; padding: 8px 2px; }
.cardback {
  width: 62px; height: 86px; border-radius: 8px; flex: 0 0 auto;
  background: repeating-linear-gradient(45deg, #2a2150, #2a2150 6px, #241b42 6px, #241b42 12px);
  border: 2px solid var(--line); display: flex; align-items: center; justify-content: center;
  color: var(--gold); font-weight: 900; font-size: 11px; text-align: center;
}
.land-chip {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 64px; font-size: 10px; color: var(--dim);
}
.land-chip img { width: 64px; height: 42px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); }
.land-chip.tapped img { opacity: .4; transform: rotate(6deg); }
.battle-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.battle-actions .btn { flex: 1 1 30%; }
.banner {
  border-radius: 12px; padding: 12px; margin: 10px 0; font-size: 15px; line-height: 1.45;
  background: #2c2144; border: 1px solid var(--gold);
}
.banner.respond { background: #33254d; border-color: var(--purple); }
.banner.block { background: #3a2b16; border-color: var(--orange); }
.banner .count { float: right; font-weight: 900; color: var(--gold2); }
.battle-log {
  background: #100b1e; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; font-size: 12.5px; color: var(--dim); height: 128px; overflow-y: auto;
  display: flex; flex-direction: column-reverse;
}
.result-banner { text-align: center; padding: 18px 10px; }
.result-banner .big { font-size: 26px; font-weight: 900; color: var(--gold2); }
.timerbar { height: 6px; background: #17102b; border-radius: 4px; overflow: hidden; margin: 6px 0; }
.timerbar .fill { height: 100%; background: var(--blue); transition: width 1s linear; }
.timerbar.hot .fill { background: var(--red); }

/* ---------- modal / footer ---------- */
.modal { position: fixed; inset: 0; background: rgba(8,5,16,.8); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 18px; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; }
footer { max-width: 880px; margin: 0 auto; padding: 14px; color: var(--dim); font-size: 12px; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line); }
@media (min-width: 700px) {
  .gcard { width: 122px; }
  .gcard img.art { height: 88px; }
  .packs-grid { grid-template-columns: repeat(4, 1fr); }
}
