:root {
  --bg: #0f1115;
  --bg-soft: #151922;
  --card: #1a1f2b;
  --card-hover: #202634;
  --border: #262d3d;
  --text: #e8ecf4;
  --muted: #8b94a7;
  --accent: #4d8dff;
  --accent-soft: rgba(77, 141, 255, 0.12);
  --online: #34c759;
  --online-soft: rgba(52, 199, 89, 0.14);
  --ingame: #38bdf8;
  --ingame-soft: rgba(125, 211, 252, 0.16);
  --offline: #6b7280;
  --offline-soft: rgba(107, 114, 128, 0.16);
  --radius: 14px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #1b2130 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a {
  color: inherit;
}

code {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 0.85rem;
}
.tiny {
  font-size: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 1.3rem;
  box-shadow: 0 4px 14px rgba(77, 141, 255, 0.35);
}

.brand h1 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: 0.2px;
}
.brand p {
  margin: 2px 0 0;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}

.btn {
  appearance: none;
  white-space: nowrap;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.06s ease, background 0.15s ease,
    border-color 0.15s ease, opacity 0.15s ease;
}
.btn:hover {
  background: #6aa0ff;
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn.ghost:hover {
  background: var(--card-hover);
}

.btn.danger {
  background: #a21caf;
}
.btn.danger:hover {
  background: #c026d3;
}

.btn.small {
  padding: 6px 11px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 20px 60px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 8px);
  max-width: min(88vw, 420px);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.86rem;
  line-height: 1.35;
  text-align: center;
  color: #e9eef6;
  background: rgba(20, 24, 33, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 10px 28px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 60;
}
.toast.hidden {
  visibility: hidden;
  opacity: 0;
}
.toast.toast-in {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast[data-tone="error"] {
  color: #ecd9ff;
  border-color: rgba(180, 148, 255, 0.38);
  background: rgba(28, 18, 50, 0.78);
}

.auto-timer {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.card {
  background: linear-gradient(180deg, var(--card) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover {
  border-color: #33405a;
  transform: translateY(-1px);
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.card-title {
  margin: 0;
  font-size: 1.05rem;
  word-break: break-word;
}

.status {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.status-online {
  background: var(--online-soft);
  color: var(--online);
}
.status-ingame {
  background: var(--ingame-soft);
  color: var(--ingame);
}
.status-offline {
  background: var(--offline-soft);
  color: var(--offline);
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
}
.stats div {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}
.stats dt {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 2px;
}
.stats dd {
  margin: 0;
  font-weight: 700;
  font-size: 0.95rem;
  word-break: break-word;
}

.error {
  margin: 0;
  color: #dcc6ff;
  background: rgba(109, 40, 217, 0.18);
  border: 1px solid rgba(109, 40, 217, 0.4);
  padding: 7px 10px;
  border-radius: 8px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.panel h2 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

input[type="password"],
input[type="text"],
textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}
input:focus,
textarea:focus {
  border-color: var(--accent);
}
textarea {
  resize: vertical;
  min-height: 110px;
  margin-top: 10px;
}

.row input[type="password"] {
  flex: 1 1 220px;
  width: auto;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  flex-wrap: wrap;
}
.admin-row-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.admin-row-main strong {
  word-break: break-word;
}
.admin-row-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1;
  border-radius: 12px;
}

.cred {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cred-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.cred-line:active,
.cred-line:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  border-color: #33405a;
  outline: none;
}
.cred-line .k {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.72rem;
}
.cred-line .v {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.35;
  word-break: break-all;
}
.cred-line .v-empty {
  color: var(--muted);
  font-style: italic;
}

.rank-line {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
}
.rank-line .rank-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
  flex: none;
}
.rank-line .rank-dot {
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 6px;
  background: var(--rank-color, #8f9bb0);
  transform: rotate(45deg);
  box-shadow: 0 0 14px color-mix(in srgb, var(--rank-color, #8f9bb0) 55%, transparent);
}
.rank-line .rank-name {
  font-weight: 700;
  font-size: 1.12rem;
  color: var(--rank-color, #e9eef6);
  letter-spacing: 0.01em;
}
.rank-line .pts {
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}
.rank-line.rank-unranked .rank-dot {
  background: #3a4252;
  box-shadow: none;
}
.rank-line.rank-unranked .rank-name {
  color: var(--muted);
  font-weight: 600;
}

.card-error {
  font-size: 0.78rem;
  margin: 0;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 2px;
}

.btn.armed {
  background: #701a75;
  border-color: #a21caf;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field > span {
  font-size: 0.78rem;
  color: var(--muted);
}

.dialog {
  width: min(92vw, 420px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}
.dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}
.dialog-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
}
.dialog-body h2 {
  margin: 0;
  font-size: 1.05rem;
}
.dialog-body .field {
  margin: 0;
}
.dialog-body .field input {
  width: 100%;
}
.dialog-body .tiny {
  margin: 0;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

@media (max-width: 600px) {
  .container {
    padding: 6px 14px 48px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .brand h1 {
    font-size: 1rem;
  }
  .btn {
    padding: 9px 13px;
  }
  .btn.icon-btn {
    width: 40px;
    padding: 0;
  }
  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }
}
body {
  background:
    radial-gradient(900px 520px at 8% -10%, rgba(106, 169, 255, 0.26), transparent 62%),
    radial-gradient(720px 560px at 92% -4%, rgba(77, 141, 255, 0.22), transparent 64%),
    radial-gradient(820px 720px at 50% 118%, rgba(192, 123, 255, 0.16), transparent 62%),
    #0a0c11;
  background-attachment: fixed;
}

.card {
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.095), rgba(255, 255, 255, 0.028));
  border: 1px solid rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04),
    0 14px 34px rgba(0, 0, 0, 0.45);
}
.card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.cred-line {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.13);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  backdrop-filter: blur(12px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn:not(.ghost) {
  background-image: linear-gradient(160deg, #4f8bff, #2b5bd7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 8px 20px rgba(37, 99, 235, 0.35);
}

.dialog {
  background: linear-gradient(160deg, rgba(30, 35, 48, 0.86), rgba(17, 20, 28, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 30px 70px rgba(0, 0, 0, 0.6);
}

.field input,
.field select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.toolbar .auto-timer {
  margin-left: auto;
  flex: 0 0 auto;
}
@media (max-width: 420px) {
  .toolbar .auto-timer {
    margin-left: 0;
    flex-basis: 100%;
    text-align: right;
  }
}
html,
body {
  overflow-x: hidden;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn.active,
.btn[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.pick {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin: 0 10px 0 0;
  flex: 0 0 auto;
  cursor: pointer;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.42);
  background-color: rgba(255, 255, 255, 0.07);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 15px 15px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}
.pick:hover {
  border-color: rgba(255, 255, 255, 0.68);
  background-color: rgba(255, 255, 255, 0.12);
}
.pick:checked {
  border-color: #4f8bff;
  background-color: #4f8bff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  box-shadow: 0 0 0 3px rgba(79, 139, 255, 0.22);
}
.pick:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 139, 255, 0.35);
}
.pick:active {
  transform: scale(0.9);
}
.card.managing {
  cursor: pointer;
}
.card.picked {
  border-color: rgba(96, 165, 250, 0.75);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 0 0 1px rgba(96, 165, 250, 0.5),
    0 18px 40px rgba(0, 0, 0, 0.4);
}

.card-note {
  margin: 10px 0 0;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.5;
  color: #dfe4ee;
  border-left: 3px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0 10px 10px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bulk-bar {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(34, 39, 53, 0.92), rgba(18, 21, 30, 0.94));
  border: 1px solid rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 18px 40px rgba(0, 0, 0, 0.55);
  font-size: 13px;
  white-space: nowrap;
}
.bulk-actions {
  display: flex;
  gap: 8px;
}
.bulk-count {
  color: var(--text-dim, #9aa4b2);
}

.maps {
  margin-top: 26px;
}
.maps-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 10px;
  color: #e8ecf4;
}
.maps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.map-card {
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 14px 34px rgba(0, 0, 0, 0.35);
}
.map-shot {
  position: relative;
  height: 132px;
  background-color: rgba(255, 255, 255, 0.05);
  background-position: center;
  background-size: cover;
}
.map-shot::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 12, 18, 0.05), rgba(10, 12, 18, 0.75));
}
.map-shot.small {
  height: 74px;
}
.map-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  background: rgba(12, 14, 20, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.map-info {
  padding: 10px 12px 13px;
}
.map-name {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #f4f6fb;
}
.map-name.small {
  font-size: 15px;
}
.map-timer {
  margin: 4px 0 0;
  font-size: 13px;
  color: #9aa4b2;
}
.map-timer b {
  color: #fff;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.dialog {
  transform-origin: 92% 6%;
  animation: dialog-pop 0.34s cubic-bezier(0.16, 1.12, 0.32, 1) both;
}
.dialog::backdrop {
  animation: backdrop-in 0.24s ease-out both;
}
@keyframes dialog-pop {
  from {
    opacity: 0;
    transform: translate(10px, -18px) scale(0.72);
  }
  to {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
}
@keyframes backdrop-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .dialog,
  .dialog::backdrop {
    animation: none;
  }
}

.field textarea {
  width: 100%;
  min-height: 56px;
  resize: vertical;
  padding: 10px 12px;
  border-radius: 12px;
  font: inherit;
  color: var(--text, #f2f4f8);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.field input.readonly {
  opacity: 0.6;
  cursor: not-allowed;
}
.req {
  color: #5c98ff;
  font-weight: 700;
  margin-left: 2px;
}
.dialog-lead {
  margin: 0 0 14px;
}

@media (max-width: 520px) {
  .bulk-bar {
    left: 8px;
    right: 8px;
    transform: none;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
  }
  .bulk-actions {
    justify-content: space-between;
  }
  .bulk-actions .btn {
    flex: 1;
  }
}

.card-head {
  justify-content: flex-start;
  gap: 8px;
}
.card-head .status {
  margin-left: auto;
}
.card-head .card-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.dialog {
  max-height: min(88vh, 760px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

:root {
  --ease-ios: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.22, 1.2, 0.36, 1);
}

.btn,
.drag-handle,
.pick,
.cred-line {
  transition:
    transform 0.2s var(--ease-spring),
    background 0.2s var(--ease-ios),
    color 0.2s var(--ease-ios),
    border-color 0.2s var(--ease-ios),
    box-shadow 0.24s var(--ease-ios);
}
.btn:active {
  transform: scale(0.955);
}

.card {
  transition:
    transform 0.28s var(--ease-ios),
    box-shadow 0.28s var(--ease-ios),
    background 0.24s var(--ease-ios),
    border-color 0.24s var(--ease-ios);
}
@media (hover: hover) {
  .card:not(.dragging):hover {
    transform: translateY(-2px);
  }
}
.card:not(.dragging):active {
  transform: scale(0.994);
}

.grid.first-paint .card {
  animation: card-rise 0.5s var(--ease-ios) both;
}
.grid.first-paint .card:nth-child(2) {
  animation-delay: 0.04s;
}
.grid.first-paint .card:nth-child(3) {
  animation-delay: 0.08s;
}
.grid.first-paint .card:nth-child(4) {
  animation-delay: 0.12s;
}
@keyframes card-rise {
  from {
    opacity: 0;
    transform: translate3d(0, 12px, 0) scale(0.985);
  }
}

.grid.is-managing .card {
  background: linear-gradient(160deg, rgba(38, 43, 58, 0.72), rgba(21, 25, 34, 0.82));
}
.card.picked {
  border-color: rgba(122, 167, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(122, 167, 255, 0.35), 0 18px 40px rgba(0, 0, 0, 0.45);
}

.card-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
.drag-handle {
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
  cursor: grab;
  width: 34px;
  height: 30px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  color: #9aa4b2;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
}
.drag-handle:active {
  cursor: grabbing;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.card.drag-spacer {
  opacity: 0;
  pointer-events: none;
}

.drag-ghost {
  position: fixed;
  animation: none !important;
  transition: none;
  margin: 0;
  z-index: 999;
  pointer-events: none;
  will-change: transform;
  transform-origin: center center;
  opacity: 0.98;
  background: linear-gradient(160deg, rgba(48, 55, 74, 0.96), rgba(24, 28, 38, 0.97));
  box-shadow:
    0 32px 70px rgba(0, 0, 0, 0.62),
    0 0 0 1px rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  cursor: grabbing;
}
body.is-dragging {
  -webkit-user-select: none;
  user-select: none;
  cursor: grabbing;
}

body.has-bg {
  background: #0b0d12;
}
body.has-bg::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: var(--custom-bg);
  background-size: cover;
  background-position: center;
  filter: saturate(1.05);
}
body.has-bg.bg-anim::before {
  animation: bg-in 0.6s var(--ease-ios) both;
}
body.has-bg::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(15, 17, 21, 0.28), rgba(15, 17, 21, 0.72) 62%),
    linear-gradient(to bottom, rgba(15, 17, 21, 0.42), rgba(15, 17, 21, 0.78));
}
@keyframes bg-in {
  from {
    opacity: 0;
    transform: scale(1.04);
  }
}

html.bg-boot body {
  background: #0b0d12;
}
html.bg-boot body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: var(--custom-bg);
  background-size: cover;
  background-position: center;
  filter: saturate(1.05);
}
html.bg-boot body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(15, 17, 21, 0.28), rgba(15, 17, 21, 0.72) 62%),
    linear-gradient(to bottom, rgba(15, 17, 21, 0.42), rgba(15, 17, 21, 0.78));
}

.bulk-bar {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  white-space: normal;
  animation: bulk-in 0.34s var(--ease-spring) both;
}
@keyframes bulk-in {
  from {
    opacity: 0;
    transform: translate(-50%, 18px) scale(0.97);
  }
}
.bulk-extra {
  display: flex;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.bulk-extra .btn {
  flex: 1;
}
.bulk-main {
  display: flex;
  align-items: center;
  gap: 12px;
}
.bulk-tip {
  margin: 0;
  text-align: center;
}
@media (max-width: 520px) {
  .bulk-bar {
    animation-name: bulk-in-mobile;
  }
  .bulk-main {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
}
@keyframes bulk-in-mobile {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
}

.toast {
  transition:
    opacity 0.3s var(--ease-ios),
    transform 0.3s var(--ease-ios);
}
.toast.toast-in {
  animation: toast-pop 0.42s var(--ease-spring) both;
}
@keyframes toast-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, 14px) scale(0.94);
  }
  60% {
    opacity: 1;
    transform: translate(-50%, -2px) scale(1.01);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .grid.first-paint .card,
  .bulk-bar,
  .toast.toast-in,
  body.has-bg::before {
    animation: none !important;
  }
  .btn:active,
  .card:active {
    transform: none;
  }
}

.card-error .error-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #ffd7d2;
  opacity: 0.86;
}

.drag-handle {
  touch-action: none;
  cursor: grab;
  padding: 6px 10px;
  min-width: 40px;
  min-height: 36px;
}
.drag-handle:active {
  cursor: grabbing;
}
.card-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-tools .btn.small {
  min-width: 36px;
  min-height: 36px;
  padding: 6px 8px;
}
body.is-dragging {
  user-select: none;
  cursor: grabbing;
}

.container.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  max-width: 1240px;
}
.main-col {
  min-width: 0;
}
.layout .maps {
  margin-top: 0;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.layout .maps-grid {
  grid-template-columns: 1fr;
  gap: 10px;
}
.layout .map-shot {
  height: 118px;
}
.layout .maps-title {
  margin-bottom: 8px;
}

@media (max-width: 980px) {
  .container.layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .layout .maps {
    position: static;
    max-height: none;
    overflow: visible;
    order: -1;
  }
  .layout .maps-grid {
    grid-template-columns: 1fr 1fr;
  }
  .layout .map-shot {
    height: 92px;
  }
}

@media (max-width: 560px) {
  .layout .maps-grid {
    grid-template-columns: 1fr;
  }
  .layout .map-shot {
    height: 96px;
  }
}

@media (max-width: 560px) {
  .layout .maps-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .layout .maps-title {
    font-size: 13px;
    margin-bottom: 6px;
  }
  .layout .map-shot,
  .layout .map-shot.small {
    height: 66px;
  }
  .layout .map-badge {
    font-size: 10px;
    padding: 2px 7px;
    top: 6px;
    left: 6px;
  }
  .layout .map-info {
    padding: 8px 9px 9px;
  }
  .layout .map-name,
  .layout .map-name.small {
    font-size: 0.92rem;
  }
  .layout .map-timer {
    font-size: 0.72rem;
    margin-top: 2px;
  }
}

.container.layout {
  padding-top: 2px;
}

.cred-line {
  cursor: pointer;
}
.cred-line:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.18);
}
.cred-line:active,
.cred-line:focus-visible {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.26);
  outline: none;
}
.cred-line:active .v {
  opacity: 0.75;
}

body.is-dragging .card {
  transition: none !important;
}

.layout .map-name {
  font-size: 1.15rem;
}
@media (max-width: 560px) {
  .layout .map-name,
  .layout .map-name.small {
    font-size: 1.0rem;
  }
}

.container.layout {
  display: block;
  max-width: 1100px;
}
.main-col {
  min-width: 0;
}

.maps-mini {
  margin-left: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}
.maps-mini:empty {
  display: none;
}
#maps-toggle.active {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
}

.maps-panel {
  position: fixed;
  z-index: 70;
  left: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: min(380px, calc(100vw - 40px));
  max-height: min(72vh, 620px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px;
  border-radius: 20px;
  background: rgba(22, 26, 36, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  backdrop-filter: blur(26px) saturate(180%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 24px 64px rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(14px) scale(0.96);
  transform-origin: bottom left;
  transition:
    transform 0.36s var(--ease-ios),
    opacity 0.22s var(--ease-ios),
    visibility 0.36s;
}
.maps-panel.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
.maps-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.maps-panel .maps-title {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.maps-close {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  border-radius: 9px;
  padding: 3px 10px;
  font-size: 0.76rem;
  line-height: 1.4;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.maps-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}
.maps-panel .maps-grid {
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.maps-panel .map-shot,
.maps-panel .map-shot.small {
  height: 84px;
}
.maps-panel .map-info {
  padding: 8px 9px 9px;
}
.maps-panel .map-name {
  font-size: 0.98rem;
}
.maps-panel .map-name.small {
  font-size: 0.9rem;
}
.maps-panel .map-badge {
  font-size: 10px;
  padding: 2px 7px;
  top: 6px;
  left: 6px;
}
.maps-panel .map-timer {
  font-size: 0.74rem;
  margin-top: 2px;
}

@media (max-width: 560px) {
  .maps-panel {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    max-height: 62vh;
    transform-origin: bottom center;
  }
  .maps-panel .map-shot,
  .maps-panel .map-shot.small {
    height: 72px;
  }
}

#settings-dialog {
  width: min(94vw, 460px);
  max-height: min(88vh, 760px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

#settings-dialog .dialog-body {
  gap: 16px;
}

.set-block {
  padding: 14px;
  border-radius: 16px;
  background: rgba(12, 15, 21, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.set-title {
  margin: 0 0 10px;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #cfd6e4;
}

.set-modes {
  display: grid;
  gap: 8px;
}

.set-opt {
  display: flex;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition:
    border-color 0.18s var(--ease-ios),
    background 0.18s var(--ease-ios);
}

.set-opt:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.set-opt input {
  margin: 3px 0 0;
  accent-color: #5c98ff;
  flex: none;
}

.set-opt:has(input:checked) {
  border-color: rgba(122, 167, 255, 0.55);
  background: rgba(77, 141, 255, 0.12);
}

.set-opt b {
  display: block;
  font-size: 0.86rem;
  margin-bottom: 3px;
}

.set-opt .set-desc {
  display: block;
  font-size: 0.74rem;
  line-height: 1.55;
  color: var(--muted);
}

.set-grid {
  display: grid;
  gap: 8px;
}

.set-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.field-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--text);
  background: rgba(12, 15, 21, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  outline: none;
  transition:
    border-color 0.2s var(--ease-ios),
    box-shadow 0.25s var(--ease-ios);
}

.field-input:focus {
  border-color: rgba(122, 167, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(77, 141, 255, 0.16);
}

#unlock-dialog {
  width: min(92vw, 400px);
}

#unlock-dialog .dialog-actions {
  margin-top: 6px;
}

.cred-line.cred-locked {
  cursor: pointer;
}

.cred-line.cred-locked .v.v-empty {
  color: #b6dcff;
  font-style: italic;
  letter-spacing: 0;
}

.pw-field {
  position: relative;
  display: block;
  width: 100%;
}

.pw-field > input {
  width: 100%;
  padding-right: 46px;
}

.pw-eye {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    color 0.16s var(--ease-ios, ease),
    background 0.16s var(--ease-ios, ease),
    transform 0.16s var(--ease-spring, ease);
}

.pw-eye:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.pw-eye.is-on {
  color: #dcc6ff;
  background: rgba(77, 141, 255, 0.16);
}

.pw-eye:active {
  transform: translateY(-50%) scale(0.92);
}

.pw-eye svg {
  display: block;
  pointer-events: none;
}

.pw-field > input[type="text"] {
  -webkit-user-select: text;
  user-select: text;
}

.ct-dialog {
  width: min(92vw, 430px);
  max-height: min(90vh, 720px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.ct-dialog .ct-body {
  gap: 14px;
}
.ct-head h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}
.ct-head p {
  margin: 0;
  line-height: 1.6;
}
.ct-qr-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ct-qr {
  margin: 0;
  padding: 10px;
  border-radius: 14px;
  background: #fff;
  text-align: center;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}
.ct-qr img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}
.ct-qr figcaption {
  margin-top: 6px;
  font-size: 0.74rem;
  color: #4a5060;
  letter-spacing: 0.02em;
}
.ct-rows {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ct-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
}
.ct-k {
  flex: none;
  width: 34px;
  font-size: 0.76rem;
  color: var(--muted);
}
.ct-v {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text);
}
.ct-copy {
  flex: none;
  padding: 5px 10px;
  font-size: 0.74rem;
  font-family: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s var(--ease-ios, ease), border-color 0.18s var(--ease-ios, ease);
}
.ct-copy:hover {
  background: rgba(255, 255, 255, 0.12);
}
.ct-copy.ct-copied {
  color: #fff;
  background: rgba(52, 199, 89, 0.26);
  border-color: rgba(52, 199, 89, 0.5);
}
.ct-note {
  margin: 0;
  line-height: 1.65;
}
.link-contact {
  color: #8ab4ff;
  text-decoration: none;
  border-bottom: 1px dashed rgba(138, 180, 255, 0.55);
  cursor: pointer;
}
.link-contact:hover {
  color: #b3cdff;
  border-bottom-color: rgba(179, 205, 255, 0.85);
}

:root {
  --fx-in: 380ms;
  --fx-out: 260ms;
  --fx-spring: cubic-bezier(0.2, 1.16, 0.3, 1);
  --fx-ios: cubic-bezier(0.32, 0.72, 0, 1);
}

.dialog {
  transform-origin: 50% 50%;
  animation: dialog-pop var(--fx-in) var(--fx-spring) both;
  will-change: transform, opacity;
}
#acc-dialog {
  transform-origin: 92% 6%;
}
.dialog::backdrop {
  animation: backdrop-in 300ms var(--fx-ios) both;
}
@keyframes dialog-pop {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.9);
  }
  62% {
    opacity: 1;
    transform: translateY(-2px) scale(1.006);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes backdrop-in {
  0% {
    opacity: 0;
    -webkit-backdrop-filter: blur(0px);
    backdrop-filter: blur(0px);
  }
  100% {
    opacity: 1;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }
}
.dialog.fx-out {
  animation: dialog-out var(--fx-out) var(--fx-ios) both;
  pointer-events: none;
}
.dialog.fx-out::backdrop {
  animation: backdrop-out var(--fx-out) var(--fx-ios) both;
}
@keyframes dialog-out {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(8px) scale(0.968);
  }
}
@keyframes backdrop-out {
  0% {
    opacity: 1;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }
  100% {
    opacity: 0;
    -webkit-backdrop-filter: blur(0px);
    backdrop-filter: blur(0px);
  }
}

.toast.toast-out {
  animation: toast-out var(--fx-out) var(--fx-ios) both;
}
@keyframes toast-out {
  0% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 9px) scale(0.94);
  }
}

.bulk-bar.bulk-out {
  animation: bulk-out var(--fx-out) var(--fx-ios) both;
  pointer-events: none;
}
@keyframes bulk-out {
  0% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 14px) scale(0.96);
  }
}
@media (max-width: 520px) {
  @keyframes bulk-out {
    0% {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
    100% {
      opacity: 0;
      transform: translateY(14px) scale(0.96);
    }
  }
}

.maps-panel {
  transition:
    transform 420ms var(--fx-spring),
    opacity 260ms var(--fx-ios),
    visibility 420ms;
}
.maps-panel.open {
  transform: translateY(0) scale(1);
}
@media (max-width: 560px) {
  .maps-panel {
    transform-origin: bottom center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dialog,
  .dialog::backdrop,
  .dialog.fx-out,
  .dialog.fx-out::backdrop,
  .toast.toast-in,
  .toast.toast-out,
  .bulk-bar,
  .bulk-bar.bulk-out {
    animation: none !important;
  }
  .maps-panel,
  .maps-panel.open {
    transition: opacity 1ms linear;
  }
}

@keyframes err-in {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.985);
  }
}
@keyframes err-out {
  to {
    opacity: 0;
    transform: translateY(-4px) scale(0.985);
  }
}
.login-error.err-in,
.form-error.err-in,
#login-error.err-in,
#reg-error.err-in,
#kg-error.err-in,
#gate-error.err-in {
  animation: err-in 300ms var(--fx-spring, cubic-bezier(0.2, 1.16, 0.3, 1)) both;
}
.login-error.err-out,
.form-error.err-out,
#login-error.err-out,
#reg-error.err-out,
#kg-error.err-out,
#gate-error.err-out {
  animation: err-out 220ms var(--fx-ios, cubic-bezier(0.32, 0.72, 0, 1)) both;
  pointer-events: none;
}
.fx-hiding {
  animation: fx-fade-out 260ms var(--fx-ios, cubic-bezier(0.32, 0.72, 0, 1)) both;
  pointer-events: none;
}
@keyframes fx-fade-out {
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
}
@media (prefers-reduced-motion: reduce) {
  .login-error.err-in,
  .login-error.err-out,
  .form-error.err-in,
  .form-error.err-out,
  .fx-hiding {
    animation: none !important;
  }
}
