* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: -apple-system, system-ui, sans-serif;
  background: #101418; color: #e6e8ea;
  overscroll-behavior: none;
}
.screen { max-width: 640px; margin: 0 auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 100%; }
h1 { font-size: 28px; margin-top: 24px; }
.sub { color: #8b949e; margin-bottom: 12px; }
input {
  background: #1c2128; border: 1px solid #30363d; color: #e6e8ea;
  border-radius: 10px; padding: 12px 14px; font-size: 17px; width: 100%;
}
button {
  background: #238636; color: #fff; border: 0; border-radius: 10px;
  padding: 12px 16px; font-size: 16px; font-weight: 600;
}
button.big { padding: 15px; font-size: 18px; }
button.secondary { background: #30363d; }
button.warn { background: #b62324; }
button:disabled { opacity: .4; }
.row { display: flex; gap: 8px; }
.row > input { flex: 1; }
.error { color: #ff7b72; min-height: 1.2em; }

/* seats */
#seats { display: flex; flex-direction: column; gap: 6px; }
.seat { background: #1c2128; border-radius: 10px; padding: 10px 14px; display: flex; justify-content: space-between; }
.seat .tag { color: #8b949e; }

/* game screen */
#screen-game { padding-bottom: 90px; }
#topbar { display: flex; align-items: center; gap: 8px; font-size: 13px; }
#topbar .spacer { flex: 1; }
#gamecode { background: #263041; border-radius: 6px; padding: 2px 8px; font-weight: 800; letter-spacing: 1px; }
#turninfo { color: #8b949e; }
button.icon {
  background: #1c2128; border: 1px solid #30363d; border-radius: 8px;
  padding: 6px 10px; font-size: 15px; line-height: 1;
}
button.icon.on { background: #1f4428; border-color: #238636; }

/* opponent expanded board */
#oppboard { background: #161b22; border: 1px solid #30363d; border-radius: 10px; padding: 8px; }
#oppboard .head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
#oppboard .meta { color: #8b949e; font-size: 12px; }

/* overlays */
.overlay {
  position: fixed; inset: 8% 4% auto 4%; max-height: 84%; z-index: 20;
  background: #161b22; border: 1px solid #30363d; border-radius: 14px;
  padding: 12px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 12px 40px #000a;
}
.overlay-head { display: flex; justify-content: space-between; align-items: center; }
#log { overflow-y: auto; font-size: 13px; color: #b6bec6; }
#log div { padding: 2px 0; border-bottom: 1px solid #21262d; }
.menu-items { display: flex; flex-direction: column; gap: 10px; }
.menu-note { color: #8b949e; font-size: 13px; }
#opponents { display: flex; gap: 6px; }
.opp {
  flex: 1; background: #1c2128; border-radius: 10px; padding: 6px 8px;
  font-size: 12px; border: 1px solid #30363d; min-width: 0;
}
.opp.active-turn { border-color: #d29922; }
.opp.dead { opacity: .35; }
.opp.targetable { border-color: #f85149; box-shadow: 0 0 0 2px #f8514966; }
.opp .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opp .life { font-size: 18px; font-weight: 800; }
.opp .meta { color: #8b949e; }
.opp .minis { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 3px; }
.mini {
  background: #263041; border-radius: 4px; font-size: 10px; padding: 1px 4px;
  white-space: nowrap; max-width: 84px; overflow: hidden; text-overflow: ellipsis;
}
.mini.tapped { opacity: .45; transform: rotate(6deg); }
.mini.attacking { background: #5c1a1a; }
.mini.selectable-block { outline: 2px solid #f85149; }

#statusbar {
  background: #1c2128; border-radius: 10px; padding: 8px 12px; font-size: 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
#statusbar .prio { color: #d29922; font-weight: 700; }

#stack { background: #2d1e33; border: 1px solid #6e40c9; border-radius: 10px; padding: 8px 12px; font-size: 13px; }
#stack .item { padding: 2px 0; }

.zone { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0; min-height: 86px; }
.card {
  flex: 0 0 auto; width: 96px; height: 120px; background: #1c2128;
  border: 1px solid #30363d; border-radius: 10px; padding: 6px;
  display: flex; flex-direction: column; font-size: 11px; position: relative;
}
.card .cname { font-weight: 700; line-height: 1.15; padding-right: 22px; }
.card .cost { position: absolute; top: 4px; right: 6px; color: #d29922; font-weight: 700; }
.card .tline { color: #8b949e; margin-top: auto; font-size: 9px; }
.card .pt { position: absolute; bottom: 4px; right: 6px; font-weight: 800; font-size: 13px; }
.card .kw { color: #58a6ff; font-size: 9px; }
.card .dmg { color: #ff7b72; font-weight: 700; }
.card.tapped { transform: rotate(8deg); opacity: .6; }
.card.sick .cname::after { content: " 💤"; }
.card.attacking { border-color: #f85149; background: #2a1517; }
.card.commander { border-color: #d29922; }
.card.selected { outline: 3px solid #58a6ff; }
.card.land { background: #17201a; }

#mybar {
  background: #1c2128; border-radius: 10px; padding: 8px 12px;
  display: flex; justify-content: space-between; align-items: center; font-size: 14px;
}
#mybar .life { font-size: 20px; font-weight: 800; }
#mybar .mana { color: #d29922; font-weight: 700; }

#actionbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #161b22ee; backdrop-filter: blur(8px);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  border-top: 1px solid #30363d;
}
#actionbar .hint { width: 100%; text-align: center; color: #8b949e; font-size: 13px; }

.opp.expanded { border-color: #58a6ff; }

#toast {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  background: #b62324; color: #fff; border-radius: 10px; padding: 10px 16px;
  font-size: 14px; z-index: 10; max-width: 90%;
}
