* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
:root {
  --bg: #121829;
  --panel: #1d2540;
  --line: #34406a;
  --gold: #f5c542;
  --gold-dark: #b8860b;
  --me: #3b82f6;
  --enemy: #ef4444;
  --text: #eef2ff;
  --muted: #9aa6c8;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(
      ellipse at 50% -10%,
      #2b3a6b 0%,
      var(--bg) 60%) fixed,
    var(--bg);
  font-family:
    -apple-system,
    "Apple SD Gothic Neo",
    "Noto Sans KR",
    "Malgun Gothic",
    sans-serif;
}
button {
  font: inherit;
  font-weight: 800;
  padding: 12px 16px;
  border: 2px solid #1b1b2f;
  border-radius: 12px;
  cursor: pointer;
  color: #3a2600;
  background:
    linear-gradient(
      #ffe08a,
      var(--gold) 55%,
      #e0a823);
  box-shadow: 0 4px 0 #8a5a00, inset 0 2px 0 rgba(255, 255, 255, 0.6);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.08s, box-shadow 0.08s;
}
button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #8a5a00, inset 0 2px 0 rgba(255, 255, 255, 0.6);
}
button.secondary {
  color: var(--text);
  background: linear-gradient(#4a5a8c, #2f3b63);
  box-shadow: 0 4px 0 #161c33, inset 0 2px 0 rgba(255, 255, 255, 0.15);
  text-shadow: none;
}
input {
  font: inherit;
  padding: 11px 13px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: #0d1222;
  color: #fff;
  min-width: 0;
  outline: none;
}
input:focus {
  border-color: #6b7fc0;
}
select {
  width: 100%;
  font: inherit;
  padding: 11px 13px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: #0d1222;
  color: #fff;
  outline: none;
}
.hidden {
  display: none !important;
}
.msg {
  color: #ff9a9a;
  min-height: 1.4em;
  text-align: center;
  margin: 4px 0;
  font-weight: 600;
}
.msg.ok {
  color: #86efac;
}
.center {
  text-align: center;
}
.small {
  font-size: 12px;
  margin: 0;
}
.auth-box {
  width: 100%;
  max-width: 360px;
  margin: auto 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
}
.auth-logo .logo-mark {
  font-size: 40px;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5));
}
.auth-logo h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 900;
  color: var(--gold);
  -webkit-text-stroke: 1.5px #1b1b2f;
  text-shadow: 0 3px 0 #1b1b2f;
}
#authForms {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#authForms.hidden {
  display: none;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.auth-form.hidden {
  display: none;
}
details.fold summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 2px;
}
details.fold input {
  width: 100%;
  margin-top: 6px;
}
details.fold[open] {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pending-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 20px 16px;
}
.pending-box h2 {
  margin: 0;
}
.pending-box p {
  margin: 0;
  font-size: 13px;
}
.pending-icon {
  font-size: 44px;
  animation: pendingSpin 2.4s ease-in-out infinite;
}
@keyframes pendingSpin {
  0%, 70% {
    transform: rotate(0);
  }
  85% {
    transform: rotate(180deg);
  }
  100% {
    transform: rotate(180deg);
  }
}
.head-btns {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.logo-mini {
  flex-shrink: 0;
}
.logo-mini h1 {
  white-space: nowrap;
}
.head-btns .chip-btn {
  max-width: none;
}
#btnNick {
  min-width: 0;
  max-width: 140px;
}
#btnAdmin {
  flex-shrink: 0;
  overflow: visible;
}
@media (max-width: 400px) {
  .logo-mini h1 {
    font-size: 20px;
  }
  .logo-mini .logo-mark {
    font-size: 22px;
  }
  .admin-word {
    display: none;
  }
}
.badge {
  display: inline-block;
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}
.field label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}
.modal .panel {
  text-align: left;
}
.modal .panel h2 {
  text-align: center;
}
.admin-panel {
  max-width: 460px !important;
  max-height: calc(88vh - var(--safe-top) - var(--safe-bottom));
  padding: 18px 16px;
}
.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.admin-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 80px;
  padding-right: 2px;
}
.admin-group {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  margin: 6px 2px 0;
}
.admin-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 4px;
}
.acc-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #141b31;
  border: 2px solid var(--line);
}
.acc-row.pending {
  border-color: var(--gold);
}
.acc-row.rejected {
  opacity: 0.75;
}
.acc-main {
  flex: 1;
  min-width: 0;
}
.acc-name {
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acc-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acc-row button {
  padding: 6px 9px;
  font-size: 12px;
  border-radius: 10px;
  box-shadow: 0 3px 0 #8a5a00;
}
.acc-row button.secondary {
  box-shadow: 0 3px 0 #161c33;
}
.acc-row button.danger {
  color: #fff;
  background: linear-gradient(#f87171, #dc2626);
  box-shadow: 0 3px 0 #7f1d1d;
  text-shadow: none;
}
.acc-tag {
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
  white-space: nowrap;
}
.temp-pw {
  display: block;
  margin-top: 4px;
  font-family:
    ui-monospace,
    Menlo,
    monospace;
  font-size: 20px;
  letter-spacing: 1px;
  color: var(--gold);
  user-select: all;
}
body::before {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: var(--safe-top);
  z-index: 25;
  pointer-events: none;
  background:
    linear-gradient(
      rgba(11, 15, 29, 0.95),
      rgba(11, 15, 29, 0.95) 70%,
      rgba(11, 15, 29, 0));
}
.screen {
  display: none;
  height: 100%;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  overflow-y: auto;
  padding: calc(14px + var(--safe-top)) calc(14px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(14px + var(--safe-left));
}
.screen.active {
  display: flex;
}
.muted {
  color: var(--muted);
}
.lobby-head {
  width: 100%;
  max-width: 440px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.logo-mini {
  display: flex;
  align-items: center;
  gap: 6px;
}
.logo-mini .logo-mark {
  font-size: 26px;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5));
}
.logo-mini h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: var(--gold);
  -webkit-text-stroke: 1px #3a2600;
  text-shadow: 0 3px 0 #3a2600;
}
.chip-btn {
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-shadow: none;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 999px;
  box-shadow: none;
  max-width: 55%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip-btn:active {
  transform: none;
  box-shadow: none;
}
.tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  width: 100%;
  max-width: 440px;
}
.tab {
  padding: 10px;
  font-size: 15px;
  color: var(--muted);
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: none;
  text-shadow: none;
}
.tab.active {
  color: #3a2600;
  background:
    linear-gradient(
      #ffe08a,
      var(--gold) 55%,
      #e0a823);
  border-color: #1b1b2f;
}
.tab:active {
  transform: none;
  box-shadow: none;
}
.tab-panel {
  display: none;
  width: 100%;
  max-width: 440px;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.tab-panel.active {
  display: flex;
}
.link-btn {
  padding: 2px 6px;
  font-size: 13px;
  font-weight: 700;
  color: #93c5fd;
  background: none;
  border: 0;
  box-shadow: none;
  text-shadow: none;
}
.link-btn:active {
  transform: none;
  box-shadow: none;
}
.deck-current {
  width: 100%;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 10px;
}
.deck-current-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.deck-current-head .label {
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
}
.deck-current-head .link-btn {
  margin-left: auto;
}
.slot-pick,
.slot-tabs {
  display: flex;
  gap: 4px;
}
.slot-tabs {
  width: 100%;
}
.slot-btn {
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  background: #10162b;
  border: 2px solid var(--line);
  border-radius: 9px;
  box-shadow: none;
  text-shadow: none;
}
.slot-tabs .slot-btn {
  flex: 1;
  padding: 9px 6px;
  font-size: 13px;
}
.slot-btn.active {
  color: #3a2600;
  background: var(--gold);
  border-color: #1b1b2f;
}
.slot-btn.incomplete:not(.active) {
  opacity: 0.7;
}
.slot-btn:active {
  transform: none;
  box-shadow: none;
}
.deck-preview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px 8px;
}
.deck-preview .empty-slot {
  aspect-ratio: 0.8;
  border: 2px dashed var(--line);
  border-radius: 10px;
}
.deck-preview-info {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.room-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.room-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 12px;
}
.room-row .room-name {
  flex: 1;
  min-width: 0;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-row .room-state {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.room-row.playing .room-name,
.room-row.playing .room-state {
  opacity: 0.6;
}
.room-row button {
  padding: 7px 14px;
  font-size: 14px;
}
.room-empty {
  width: 100%;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 14px;
  border: 2px dashed var(--line);
  border-radius: 12px;
}
.check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
}
.grow {
  flex: 1;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 18, 0.75);
  overflow-y: auto;
  padding: calc(16px + var(--safe-top)) calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(16px + var(--safe-left));
}
.modal .panel {
  width: 100%;
  max-width: 360px;
  margin: auto;
}
.modal h2 {
  margin: 0;
}
.modal p {
  margin: 0;
  font-size: 13px;
}
.row {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 440px;
}
.row input {
  flex: 1;
}
.section-title {
  width: 100%;
  max-width: 440px;
  font-weight: 800;
  font-size: 16px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.section-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.pool {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 12px 10px;
  width: 100%;
  max-width: 440px;
  padding-top: 6px;
}
.info {
  width: 100%;
  max-width: 440px;
  min-height: 108px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.info-hint {
  color: var(--muted);
  width: 100%;
  text-align: center;
}
.big-art {
  width: 96px;
  height: 96px;
  flex: none;
  border-radius: 12px;
  background:
    radial-gradient(
      circle at 50% 35%,
      #4d5f96,
      #222b4a);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}
.big-art canvas {
  width: 96px;
  height: 96px;
  display: block;
}
.big-art .card-emoji {
  font-size: 54px;
  margin: auto;
}
.info-body {
  flex: 1;
  min-width: 0;
}
.info-title {
  font-weight: 900;
  font-size: 16px;
  margin-bottom: 3px;
}
.info-title .tag {
  font-size: 11px;
  font-weight: 700;
  color: #f0d9ff;
  background: #6d2a8f;
  border-radius: 8px;
  padding: 2px 7px;
  vertical-align: middle;
}
.info-desc {
  color: #cfd6ee;
  margin-bottom: 6px;
}
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
}
.stats span {
  background: #10162b;
  border-radius: 7px;
  padding: 2px 7px;
  color: #dfe5f7;
  font-size: 12px;
}
.stats b {
  color: var(--muted);
  font-weight: 600;
}
.info-skills {
  margin-top: 6px;
  font-size: 12px;
  color: #f9d2ee;
  line-height: 1.45;
}
.buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 440px;
  margin-top: 4px;
}
.waiting-box {
  margin: auto;
  text-align: center;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 26px 30px;
}
.code {
  font-size: 58px;
  font-weight: 900;
  letter-spacing: 12px;
  color: var(--gold);
  -webkit-text-stroke: 1.5px #3a2600;
  margin: 10px 0 18px;
}
.card {
  position: relative;
  border-radius: 13px;
  padding: 5px 5px 6px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  background: linear-gradient(#45588f, #2a3459);
  border: 2px solid #1b1b2f;
  box-shadow:
    0 4px 0 #0c1020,
    inset 0 0 0 2px #6d82c4,
    inset 0 2px 0 3px rgba(255, 255, 255, 0.1);
  transition:
    transform 0.12s,
    box-shadow 0.12s,
    filter 0.2s;
}
.card.kind-spell {
  background: linear-gradient(#9b4a26, #5a2614);
  box-shadow:
    0 4px 0 #0c1020,
    inset 0 0 0 2px #e08a52,
    inset 0 2px 0 3px rgba(255, 255, 255, 0.1);
}
.card.kind-building {
  background: linear-gradient(#7a6038, #45351d);
  box-shadow:
    0 4px 0 #0c1020,
    inset 0 0 0 2px #c4a46a,
    inset 0 2px 0 3px rgba(255, 255, 255, 0.1);
}
.card-art {
  aspect-ratio: 1;
  border-radius: 9px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background:
    radial-gradient(
      circle at 50% 30%,
      rgba(255, 255, 255, 0.28),
      rgba(255, 255, 255, 0.04) 60%,
      rgba(0, 0, 0, 0.25));
  box-shadow: inset 0 -6px 10px rgba(0, 0, 0, 0.25);
}
.card-art canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.card-emoji {
  font-size: 34px;
  margin: auto;
}
.card-name {
  font-size: 11.5px;
  font-weight: 800;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 0 #000;
}
.card-name.long {
  position: relative;
  overflow: visible;
  text-overflow: clip;
}
.card-name.long::before {
  content: " ";
}
.card-name.long > span {
  position: absolute;
  left: -3px;
  right: -3px;
  bottom: 0;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
  font-size: 9.5px;
  line-height: 1.1;
  text-shadow: 0 1px 0 #000, 0 0 3px rgba(0, 0, 0, 0.9);
}
.card.small .card-name.long > span {
  left: -2px;
  right: -2px;
  font-size: 8.5px;
}
.cost {
  position: absolute;
  top: -9px;
  left: -9px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #1b1b2f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  color: #fff;
  text-shadow: 0 1px 0 #3a0a4a;
  background:
    radial-gradient(
      circle at 35% 30%,
      #f6c2ff,
      #c04ae6 50%,
      #6d1a8f);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}
.count {
  position: absolute;
  top: 7px;
  right: 7px;
  font-size: 11px;
  font-weight: 900;
  background: rgba(10, 12, 24, 0.7);
  border-radius: 7px;
  padding: 0 5px;
}
.cost.multi {
  width: auto;
  min-width: 26px;
  padding: 0 6px;
  border-radius: 13px;
  font-size: 12px;
}
.card .form-pick {
  display: none;
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  gap: 4px;
  z-index: 3;
}
.card.selected .form-pick {
  display: flex;
}
.card .form-pick button {
  padding: 3px 7px;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 900;
  border-radius: 10px;
  white-space: nowrap;
  color: #fff;
  background: linear-gradient(#4a5a8c, #2f3b63);
  border: 2px solid #1b1b2f;
  box-shadow: 0 2px 0 #161c33;
  text-shadow: none;
}
.card .form-pick button.on {
  color: #1b1b2f;
  background: linear-gradient(#ffe58a, var(--gold));
  box-shadow: 0 2px 0 #8a5a00;
}
.card.inDeck {
  box-shadow:
    0 4px 0 #0c1020,
    inset 0 0 0 2px var(--gold),
    0 0 0 2px var(--gold),
    0 0 12px rgba(245, 197, 66, 0.45);
}
.pool .card:not(.inDeck) {
  filter: saturate(0.5) brightness(0.75);
}
.card.selected {
  transform: translateY(-12px) scale(1.05);
  box-shadow:
    0 0 0 3px #fff,
    0 0 18px rgba(255, 255, 255, 0.65),
    0 10px 16px rgba(0, 0, 0, 0.5);
  z-index: 2;
}
.card.poor {
  filter: grayscale(0.85) brightness(0.6);
}
.card.pending {
  opacity: 0.4;
  filter: grayscale(0.6);
  pointer-events: none;
}
.card.locked {
  filter: none;
  cursor: not-allowed;
}
.card.locked .card-art,
.card.locked .card-name,
.card.locked .cost {
  filter: grayscale(1) brightness(0.5);
}
.card .lock {
  position: absolute;
  left: 5px;
  right: 5px;
  top: 5px;
  aspect-ratio: 1;
  border-radius: 9px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: rgba(8, 10, 24, 0.35);
  box-shadow: inset 0 0 0 2px rgba(255, 214, 102, 0.9);
  animation: lockPop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.lock-icon {
  font-size: 22px;
  line-height: 1;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.7));
}
.lock-sec {
  font-size: 12px;
  line-height: 15px;
  font-weight: 900;
  color: #fff;
  padding: 0 6px;
  border-radius: 8px;
  background: #b91c1c;
  border: 1.5px solid #1b1b2f;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 0 #3a0a0a;
}
@keyframes lockPop {
  from {
    transform: scale(0.5);
    opacity: 0;
  }
}
.card.small {
  cursor: default;
  border-radius: 10px;
  padding: 3px;
}
.card.small .card-name {
  font-size: 10px;
  margin-top: 2px;
}
.card.small .cost {
  width: 20px;
  height: 20px;
  font-size: 11px;
  top: -7px;
  left: -7px;
}
#game {
  padding: 0;
  gap: 0;
  justify-content: flex-start;
  overflow: hidden;
}
#hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 640px;
  padding: max(6px, var(--safe-top)) 10px 6px;
  background: linear-gradient(rgba(8, 10, 20, 0.85), rgba(8, 10, 20, 0.55));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.hud-player {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-weight: 800;
  font-size: 13px;
}
.hud-player.me {
  justify-content: flex-end;
}
.pname {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-player.enemy .pname {
  color: #fca5a5;
}
.hud-player.me .pname {
  color: #93c5fd;
}
.team-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
  border: 2px solid #1b1b2f;
}
.enemy .team-dot {
  background: var(--enemy);
}
.me .team-dot {
  background: var(--me);
}
.crowns {
  display: inline-flex;
  gap: 2px;
  flex: none;
}
.crown {
  display: inline-block;
  width: 18px;
  height: 14px;
  opacity: 0.28;
  filter: grayscale(1) brightness(1.4);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 18'%3E%3Cpath d='M2 15 L1 4 L7 8.5 L12 1.5 L17 8.5 L23 4 L22 15 Z' fill='%23f5c542' stroke='%231b1b2f' stroke-width='1.6' stroke-linejoin='round'/%3E%3Crect x='2' y='13.5' width='20' height='3.5' rx='1.2' fill='%23d99a1e' stroke='%231b1b2f' stroke-width='1.3'/%3E%3Ccircle cx='12' cy='9.5' r='1.6' fill='%23ef4444'/%3E%3C/svg%3E") no-repeat center / contain;
}
.crown.on {
  opacity: 1;
  filter: drop-shadow(0 0 4px rgba(245, 197, 66, 0.7));
}
.hud-center {
  position: relative;
}
.clock {
  min-width: 66px;
  text-align: center;
  font-weight: 900;
  font-size: 18px;
  padding: 2px 12px;
  border-radius: 12px;
  background: #0b0f1d;
  border: 2px solid #3a4677;
  font-variant-numeric: tabular-nums;
  line-height: 21px;
}
.clock.ot {
  border-color: #ff9a1f;
  color: #ffcf8a;
}
.clock.low {
  color: #ff8a8a;
  animation: pulse 0.5s ease-in-out infinite alternate;
}
.ot-badge {
  position: absolute;
  left: 50%;
  top: calc(100% - 2px);
  transform: translateX(-50%);
  z-index: 2;
  font-size: 10px;
  line-height: 12px;
  font-weight: 900;
  color: #fff;
  background: #c2410c;
  border-radius: 6px;
  padding: 0 6px;
  white-space: nowrap;
  pointer-events: none;
}
@keyframes pulse {
  to {
    transform: scale(1.08);
  }
}
#arenaWrap {
  position: relative;
  line-height: 0;
  margin-top: 2px;
}
#arenaGl {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  pointer-events: none;
  border-radius: 6px;
}
#arena {
  position: relative;
  display: block;
  touch-action: none;
  border-radius: 6px;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.6), 0 6px 22px rgba(0, 0, 0, 0.55);
}
.toast {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%) scale(0.9);
  opacity: 0;
  pointer-events: none;
  background: rgba(12, 14, 26, 0.88);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  line-height: 1.4;
  padding: 8px 14px;
  border-radius: 10px;
  transition: opacity 0.15s, transform 0.15s;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.toast.low {
  top: 72%;
}
#bottom {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 12px 8px max(8px, var(--safe-bottom));
  background: linear-gradient(rgba(8, 10, 20, 0.4), rgba(8, 10, 20, 0.9));
  border-radius: 14px 14px 0 0;
}
#bottom::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 100vh;
  background: rgba(8, 10, 20, 0.9);
  pointer-events: none;
}
.trap-badge {
  position: absolute;
  right: 10px;
  top: -18px;
  z-index: 1;
  pointer-events: none;
  padding: 1px 9px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 15px;
  font-weight: 800;
  white-space: nowrap;
  color: #fff7d6;
  background: rgba(30, 22, 4, 0.9);
  border: 1.5px solid var(--gold);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  animation: trapGlow 0.9s ease-in-out infinite alternate;
}
.trap-badge b {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
@keyframes trapGlow {
  to {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), 0 0 10px rgba(245, 197, 66, 0.65);
  }
}
#game.spectating .trap-badge {
  display: none;
}
#spectateBar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 800;
}
#spectateBar button {
  padding: 8px 16px;
  font-size: 14px;
}
#game.spectating #spectateBar {
  display: flex;
}
#game.spectating #hand,
#game.spectating #manaRow {
  display: none;
}
.watchers {
  position: absolute;
  left: 8px;
  top: 6px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 800;
  color: #fff;
  background: rgba(8, 10, 20, 0.55);
  pointer-events: none;
}
#hand {
  display: grid;
  grid-template-columns: 0.72fr repeat(4, 1fr);
  gap: 7px;
  align-items: end;
  min-height: 92px;
}
#hand .card {
  touch-action: none;
}
.next-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  opacity: 0.85;
}
.next-box .card {
  width: 100%;
}
.next-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
}
#manaRow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.mana-gem {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50% 50% 50% 8%;
  transform: rotate(-45deg);
  border: 2px solid #1b1b2f;
  background:
    radial-gradient(
      circle at 35% 30%,
      #f6c2ff,
      #c04ae6 50%,
      #6d1a8f);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}
.mana-gem span {
  transform: rotate(45deg);
  font-weight: 900;
  font-size: 16px;
  color: #fff;
  text-shadow: 0 1px 0 #3a0a4a;
}
#manaBar {
  position: relative;
  flex: 1;
  height: 22px;
  background: #0b0f1d;
  border: 2px solid #1b1b2f;
  border-radius: 11px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
}
#manaFill {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background:
    linear-gradient(
      #f0a6ff,
      #c04ae6 45%,
      #7d22a6);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.1s linear;
}
.mana-ticks {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0 calc(10% - 2px),
      rgba(10, 12, 24, 0.75) calc(10% - 2px) 10%);
}
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 18, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
  z-index: 10;
}
.panel {
  min-width: 260px;
  background: linear-gradient(#26305a, #1a2142);
  border: 2px solid #4a5a99;
  border-radius: 20px;
  padding: 24px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  animation: pop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes pop {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
}
.result-title {
  font-size: 44px;
  font-weight: 900;
  -webkit-text-stroke: 2px #1b1b2f;
  text-shadow: 0 4px 0 #1b1b2f;
  overflow-wrap: anywhere;
}
.panel.win .result-title {
  color: var(--gold);
}
.panel.lose .result-title {
  color: #9fb0d9;
}
.panel.tie .result-title {
  color: #fff;
}
.result-crowns {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 6px;
}
.rc {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 6px 10px;
  font-weight: 800;
}
.rc.me span {
  color: #93c5fd;
}
.rc.enemy span {
  color: #fca5a5;
}
.rc .crown {
  width: 26px;
  height: 20px;
}
button.nudge {
  animation: nudge 0.8s ease-in-out infinite alternate;
}
@keyframes nudge {
  to {
    transform: scale(1.06);
    box-shadow: 0 4px 0 #8a5a00, 0 0 18px rgba(245, 197, 66, 0.8);
  }
}
#rotateHint {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--bg);
  color: var(--text);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
}
#rotateHint .icon {
  font-size: 44px;
}
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  #game.active #rotateHint {
    display: flex;
  }
}
.rank-list,
.match-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.rank-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 12px;
  background: var(--panel);
  border: 2px solid var(--line);
}
.rank-row.me {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold) inset;
}
.rank-no {
  font-weight: 900;
  text-align: center;
  font-size: 15px;
}
.rank-who {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.rank-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank-rating {
  font-weight: 900;
  font-size: 17px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.name-btn {
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  box-shadow: none;
  text-shadow: none;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: underline;
  text-decoration-color: rgba(147, 197, 253, 0.5);
  text-underline-offset: 3px;
}
.name-btn:active {
  transform: none;
  box-shadow: none;
}
.match-row {
  padding: 7px 10px;
  border-radius: 12px;
  background: var(--panel);
  border: 2px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.match-head {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.match-tag {
  padding: 0 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 700;
}
.match-tag.warn {
  background: rgba(248, 113, 113, 0.2);
  color: #fecaca;
}
.match-side {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}
.match-side .who {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}
.match-side.win .name-btn {
  color: var(--gold);
}
.match-side .crowns-n {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.delta {
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.delta.up {
  color: #86efac;
}
.delta.down {
  color: #fca5a5;
}
.deck-mini {
  font-size: 14px;
  letter-spacing: 1px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}
.rank-note {
  width: 100%;
  max-width: 440px;
  font-size: 12px;
  line-height: 1.5;
}
.rank-empty {
  width: 100%;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 14px;
  border: 2px dashed var(--line);
  border-radius: 12px;
}
.profile-panel {
  max-width: 400px;
}
.profile-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.profile-grid > div {
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 12px;
  color: var(--muted);
}
.profile-grid b {
  display: block;
  font-size: 17px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.profile-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.profile-cards span {
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 13px;
}
.profile-sub {
  font-weight: 800;
  font-size: 14px;
}
.profile-matches {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 45vh;
  overflow-y: auto;
}
.pm-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  padding: 4px 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}
.pm-res {
  font-weight: 900;
  text-align: center;
}
.pm-res.w {
  color: #86efac;
}
.pm-res.l {
  color: #fca5a5;
}
.pm-res.d {
  color: var(--muted);
}
.pm-vs {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.foldable {
  cursor: pointer;
}
.fold-hint {
  font-size: 11px;
  color: #93c5fd;
  font-weight: 700;
}
.pm-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 2px;
}
.pm-item .fold-hint {
  padding-left: 6px;
}
.match-detail {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
}
.open > .match-detail {
  display: flex;
}
.deck-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
}
.deck-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.deck-chips span {
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.07);
  white-space: nowrap;
}
.patch-bar {
  width: 100%;
  max-width: 440px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-shadow: none;
  text-align: left;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 12px;
  box-shadow: none;
}
.patch-bar:active {
  transform: none;
  box-shadow: none;
}
.patch-label {
  color: var(--gold);
  flex-shrink: 0;
}
.patch-latest {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.patch-bar .badge,
.patch-more {
  flex-shrink: 0;
}
.patch-more {
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}
.install-tip {
  width: 100%;
  max-width: 440px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 4px 7px 12px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  background: #16213f;
  border: 2px dashed #3d5ba3;
  border-radius: 12px;
}
.install-text {
  flex: 1;
  min-width: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.install-go.wait {
  visibility: hidden;
}
.install-go {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 10px;
  box-shadow: 0 3px 0 #8a5a00, inset 0 2px 0 rgba(255, 255, 255, 0.6);
}
.install-close {
  flex-shrink: 0;
  padding: 4px 8px;
  font-size: 15px;
  color: var(--muted);
}
.modal .patch-panel {
  max-width: 440px;
  max-height: calc(88vh - var(--safe-top) - var(--safe-bottom));
  padding: 18px 14px;
}
.patch-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  min-height: 0;
  overscroll-behavior: contain;
}
.patch-note {
  flex-shrink: 0;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  padding: 8px 10px;
}
.patch-note summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
}
.patch-note summary::-webkit-details-marker {
  display: none;
}
.patch-note summary::before {
  content: "▸";
  color: var(--muted);
  font-size: 12px;
  width: 10px;
  flex-shrink: 0;
}
.patch-note[open] summary::before {
  content: "▾";
}
.patch-date {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.patch-title {
  min-width: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.patch-note .badge {
  flex-shrink: 0;
}
.patch-note ul {
  margin: 6px 0 2px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.patch-note li {
  font-size: 13px;
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
