:root {
  color-scheme: dark;
  --canvas: #0d1119;
  --panel: #151b26;
  --plate: #1a2231;
  --line: #283447;
  --text: #edf2fb;
  --muted: #9daac0;
  --blue: #a4c5ff;
  --blue-strong: #91b9fc;
  --red: #ff9a9f;
  --radius: 16px;
  font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 290px; min-height: 100dvh; background: var(--canvas); color: var(--text); }
input, button, summary { font: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
button, input, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid #a6c8ff; outline-offset: 3px; }
button, input { color: inherit; }
button svg, summary svg { width: 18px; height: 18px; flex: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 3.4vw, 2.8rem); line-height: 1.08; letter-spacing: -.055em; font-weight: 720; }
h2 { font-size: 1.05rem; line-height: 1.25; letter-spacing: -.01em; }
h3 { font-size: 1rem; }
.muted, small { color: var(--muted); }
small { display: block; font-size: .82rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.loading { display: grid; min-height: 100dvh; place-items: center; color: var(--muted); }

.login-layout {
  min-height: 100dvh; display: grid; place-items: center; padding: 28px;
  background:
    radial-gradient(ellipse at 50% 27%, #263a5f 0%, #161f31 34%, transparent 65%),
    repeating-linear-gradient(124deg, #26304416 0 1px, transparent 1px 77px),
    #0b1019;
}
.login-card {
  width: min(100%, 430px); padding: 39px 38px 34px; border: 1px solid #37465f;
  border-radius: 24px; background: linear-gradient(160deg, #1a2333, #111823 86%);
  box-shadow: 0 24px 80px #040914ad, inset 0 1px 0 #ffffff0f;
}
.login-brand { display: grid; justify-items: center; gap: 11px; padding-bottom: 30px; }
/* The source is 1199 × 1312. This viewport crops to its lion mark above the wordmark. */
.brand-mark {
  position: relative; display: block; flex: none; overflow: hidden; aspect-ratio: 711 / 906;
}
.brand-mark img {
  position: absolute; top: -8.72%; left: 50%; transform: translateX(-50%);
  width: 168.64%; height: auto; filter: brightness(2.4) saturate(.8);
}
.login-brand .brand-mark { width: clamp(7.25rem, 12vw, 8rem); filter: drop-shadow(0 6px 16px #6c9cfa68); }
.login-brand h1 { font-size: 2.3rem; }
#setup h2 { font-size: 1.32rem; margin-bottom: 7px; }
#setup .muted { margin-bottom: 19px; }
.field { display: grid; gap: 7px; color: #dce5f6; font-size: .9rem; font-weight: 600; }
form > .field + .field, .form-stack > .field + .field { margin-top: 15px; }
input:not([type=checkbox]) {
  width: 100%; min-width: 0; border: 1px solid #354258; background: #101721; border-radius: 9px;
  padding: 11px 12px; color: var(--text); font-weight: 400;
}
input::placeholder { color: #8290a9; }
input:focus { border-color: #7a9cd8; outline-offset: 1px; }
.password-field { display: flex; position: relative; }
.password-field input { padding-right: 47px; }
.password-field .button { position: absolute; right: 4px; top: 4px; bottom: 4px; background: transparent; }
.tick { display: flex; align-items: center; gap: 9px; font-size: .91rem; color: #d7e1ef; }
.tick input { width: 16px; height: 16px; margin: 0; accent-color: var(--blue-strong); }
.login-card .tick { margin-top: 18px; }
.form-error { color: var(--red); font-size: .9rem; margin: 13px 0; }
.form-error:empty { margin: 0; }
.login-card button[type=submit] { margin-top: 18px; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  padding: 8px 13px; border: 1px solid transparent; border-radius: 9px; min-height: 38px;
  white-space: nowrap; font-size: .91rem; font-weight: 650; color: var(--text);
  background: #222c3d; transition: background .16s, border-color .16s;
}
.button:hover { background: #2c394f; border-color: #465672; }
.button.square { min-width: 34px; width: 34px; min-height: 34px; padding: 5px; background: #1a2434; color: #c3d3ee; }
.button.square:hover { background: #2b3a51; }
.button.primary { background: var(--blue-strong); color: #0d1b32; border-color: var(--blue-strong); }
.button.primary:hover { background: #b8d2ff; }
.button.outline { background: transparent; border-color: #42526d; color: var(--blue); }
.button.outline:hover { background: #202c41; }
.button.danger { color: var(--red); }
.button.danger-fill { background: #a73545; border-color: #d45e6d; color: white; }
.button.danger-fill:hover { background: #be4354; }
.button.link-button { background: transparent; display: flex; margin: 9px auto 0; }
.button.wide { width: 100%; }

.workspace { min-height: 100dvh; background: radial-gradient(ellipse at 48% -4%, #202e46 0, transparent 56%), var(--canvas); }
.site-header { display: flex; align-items: center; gap: 34px; min-height: 72px; padding: 0 max(24px, 4vw); background: #111823dd; border-bottom: 1px solid #2a384e; }
.site-brand { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; font-weight: 750; letter-spacing: -.03em; font-size: 1.15rem; }
.site-brand .brand-mark { width: 2.125rem; }
nav { display: flex; gap: 4px; flex: 1; align-self: stretch; }
.nav-item {
  display: inline-flex; position: relative; gap: 7px; align-items: center; padding: 0 14px; border: 0; background: transparent;
  white-space: nowrap; font-size: .91rem; font-weight: 650; color: #b7c5dd;
}
.nav-item.current { color: #dbe9ff; background: #7895c011; }
.nav-item.current::after { position: absolute; content: ""; left: 12px; right: 12px; bottom: 0; height: 2px; background: var(--blue-strong); }
.nav-item:hover { background: #7895c01e; }
.profile { position: relative; margin-left: auto; z-index: 3; }
.profile summary { display: flex; align-items: center; gap: 9px; white-space: nowrap; list-style: none; padding: 3px 4px; }
.profile summary::-webkit-details-marker { display: none; }
.profile summary svg { width: 15px; color: var(--muted); }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid #5474a2; border-radius: 50%; background: #2c4264; color: #e4efff; font-weight: 700; }
.avatar.mini { width: 30px; height: 30px; font-size: .8rem; flex-shrink: 0; }
.profile-menu { position: absolute; top: calc(100% + 10px); right: 0; min-width: 180px; padding: 6px; border: 1px solid #42526b; border-radius: 10px; background: #1a2436; box-shadow: 0 14px 30px #030712a5; }
.profile-menu .button { display: flex; justify-content: flex-start; width: 100%; background: transparent; }
.profile-menu .button:hover { background: #2b3b56; }
.content { max-width: 1490px; margin: 0 auto; padding: 36px max(21px, 4vw) 50px; }
.alliance-content { max-width: 1920px; padding-inline: clamp(20px, 2.4vw, 46px); }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 26px; }
.page-heading p { margin-top: 8px; }
.heading-actions { display: flex; align-items: center; gap: 11px; }
.draft-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.tag-info { color: #c0cee3; white-space: nowrap; background: #1a2636; border: 1px solid #35455e; font-size: .84rem; padding: 6px 11px; border-radius: 99px; }
.panel { min-width: 0; background: linear-gradient(145deg, #171f2d, var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); }
.alliance-layout {
  display: grid; grid-template-columns: clamp(195px, 14.5vw, 225px) minmax(0, 1fr) clamp(205px, 15vw, 245px);
  align-items: start; gap: 16px;
}
.gangs, .activity { padding: 15px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 9px; margin-bottom: 14px; }
.section-tools { display: flex; align-items: center; gap: 5px; }
.gang-list { display: grid; gap: 5px; margin-bottom: 14px; }
.gang-row { position: relative; border: 1px solid transparent; border-radius: 10px; }
.gang-row.picked { border-color: #46628b; background: #27374e; }
.gang-row:hover { background: #222e42; }
.gang-pick { display: flex; text-align: left; align-items: center; gap: 9px; width: 100%; padding: 9px; background: transparent; border: 0; color: var(--text); border-radius: 9px; }
.gang-pick span:nth-child(2) { min-width: 0; flex: 1; }
.gang-pick strong, .gang-pick small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gang-count { color: #b2c2d9; font-size: .84rem; }
.swatch { display: inline-block; flex: 0 0 auto; width: 9px; height: 27px; border-radius: 6px; background: var(--gang-color, #6c95d4); border: 1px solid #ffffff36; }
.gang-tools { display: flex; position: absolute; right: 4px; top: 50%; transform: translateY(-50%); opacity: 0; pointer-events: none; gap: 3px; }
.gang-row:hover .gang-tools, .gang-row:focus-within .gang-tools { opacity: 1; pointer-events: auto; }
.gang-tools .square { width: 29px; min-width: 29px; min-height: 29px; }
.gang-tools svg { width: 15px; height: 15px; }
.gang-row:hover .gang-count, .gang-row:focus-within .gang-count { visibility: hidden; }
.skin-panel { padding: 18px; min-height: 320px; }
.gang-heading { display: flex; align-items: center; gap: 11px; min-width: 0; }
.gang-heading h2 { font-size: clamp(1.05rem, 1.8vw, 1.38rem); }
.gang-heading .swatch { height: 34px; }
.gang-heading p { font-size: .91rem; margin-top: 3px; }
.skin-grid {
  --skin-preview-height: 15.5rem;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr)); gap: 12px;
}
.skin {
  display: flex; position: relative; flex-direction: column; justify-content: flex-end; align-items: center;
  min-width: 0; min-height: calc(var(--skin-preview-height) + 2rem); overflow: hidden; border: 1px solid #344057; border-radius: 10px;
  background: radial-gradient(ellipse at 50% 42%, #354661 0%, #212c40 44%, #1a2334 84%);
}
.skin img { display: block; width: 100%; height: var(--skin-preview-height); object-fit: contain; padding: 9px 8px 0; filter: drop-shadow(0 5px 5px #0005); }
.skin-id { flex: 0 0 auto; width: 100%; background: #151d2bde; color: #e1e9fa; text-align: center; font-size: .88rem; font-variant-numeric: tabular-nums; font-weight: 680; padding: 4px 3px; }
.skin-status {
  position: absolute; top: 6px; left: 5px; z-index: 1; padding: 2px 4px;
  border: 1px solid #87515d; border-radius: 5px; color: var(--red); background: #38202a;
  font-size: .71rem; line-height: 1.2; font-weight: 720; cursor: help;
}
.skin-actions { position: absolute; top: 4px; right: 4px; display: flex; gap: 3px; z-index: 1; opacity: 0; pointer-events: none; }
.skin:hover .skin-actions, .skin:focus-within .skin-actions { opacity: 1; pointer-events: auto; }
.skin-actions .square { min-width: 28px; min-height: 28px; width: 28px; background: #121b2bea; }
.skin-actions svg { width: 15px; height: 15px; }
.add-tile { grid-column: -2 / -1; justify-content: center; gap: 6px; border: 1px dashed #6084bc; background: #24365051; color: #c9dcff; font-size: .84rem; font-weight: 650; }
.add-tile span { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 50%; color: #e5eeff; background: #334e78; }
.add-tile:hover { background: #354d6f91; }
.connection { display: inline-flex; align-items: center; gap: 6px; font-size: .79rem; white-space: nowrap; color: var(--muted); }
.connection i { width: 7px; height: 7px; border-radius: 50%; background: #bba178; }
.connection.live { color: #a0dbbe; }
.connection.live i { background: #75d8a9; }
.activity > .muted { font-size: .91rem; }
.draft { padding: 11px; margin-top: 10px; border: 1px solid #35445c; background: #1d2738; border-radius: 10px; }
.draft-title, .history-who, .account-name { display: flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.draft-title strong { font-size: .91rem; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 9px 0; }
.chip { display: inline-block; padding: 2px 6px; border: 1px solid #466186; background: #293d5d; color: #d4e4ff; border-radius: 5px; font-size: .77rem; font-weight: 650; }
.draft-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px; }
.draft-bottom .button { min-height: 29px; font-size: .78rem; padding: 3px 6px; }
.timer { font-size: .81rem; color: #c6d5f1; font-variant-numeric: tabular-nums; }
.history-panel, .admin-panel { max-width: 980px; padding: 18px 22px; }
.history-entry + .history-entry, .account-row + .account-row { border-top: 1px solid var(--line); }
.history-entry { padding: 12px 0; }
.history-entry ul { padding-left: 39px; color: #d4dff2; }
.account-row { display: grid; grid-template-columns: minmax(150px, 1fr) max-content max-content; align-items: center; gap: 14px; padding: 10px 0; }

dialog {
  width: min(490px, calc(100vw - 28px)); max-height: min(86dvh, 830px); margin: auto;
  padding: 19px; border: 1px solid #415473; border-radius: 16px;
  background: #192334; color: var(--text); box-shadow: 0 24px 90px #000b; overflow: auto;
}
dialog.wide-dialog { width: min(840px, calc(100vw - 28px)); }
dialog::backdrop { background: #060911bf; backdrop-filter: blur(3px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 15px; }
.modal-head h2 { font-size: 1.28rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding-top: 13px; margin-top: 14px; border-top: 1px solid #303e54; }
.confirm-text { margin-bottom: 16px; }
dialog .form-stack { margin: 12px 0; }
.color-pair { display: grid; grid-template-columns: 58px 1fr; gap: 10px; }
.color-pair input[type=color] { padding: 3px 5px; height: 46px; }
.picker-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.search { position: relative; width: min(310px, 72%); display: flex; align-items: center; }
.search svg { width: 18px; position: absolute; left: 11px; color: #a3b6d5; }
.search input { padding-left: 36px; }
.picker-grid, .review-grid {
  --skin-preview-height: 11.5rem;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 7.5rem), 1fr)); gap: 9px;
}
.picker-grid, .review-list { overflow: auto; max-height: min(48dvh, 520px); padding: 4px 5px 5px; }
.picker-grid { max-height: min(56dvh, 540px); }
.pick-tile { padding: 0; }
.pick-tile:hover { border-color: #97b5e3; }
.pick-tile.selected { border-color: #b4d2ff; background: #395c8f; outline: 1px solid #b4d2ff; }
.pick-tile.selected .skin-id { color: #0f1d35; background: #a7c7fa; }
.review-section { padding: 12px 0; }
.review-section + .review-section { border-top: 1px solid var(--line); }
.review-section ul { padding-left: 21px; color: #cbd9ed; }
#toast { position: fixed; bottom: 22px; right: 22px; z-index: 5; max-width: min(410px, calc(100vw - 44px)); padding: 11px 16px; border: 1px solid #578e78; border-radius: 10px; background: #172f2a; color: #defaee; box-shadow: 0 8px 22px #0007; }
#toast.bad { border-color: #ab6673; color: #ffdde4; background: #402332; }
@media (max-width: 1120px) {
  .alliance-layout { grid-template-columns: clamp(170px, 20vw, 195px) minmax(0, 1fr); }
  .activity { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 8px; }
  .activity .section-head { grid-column: 1 / -1; margin: 0; }
  .activity .draft { margin: 0; }
}
@media (max-width: 650px) {
  .site-header { flex-wrap: wrap; min-height: 0; padding: 10px 14px 0; gap: 8px; }
  .site-brand { order: 0; }
  .profile { order: 1; }
  nav { order: 2; flex: 0 0 100%; min-height: 44px; }
  .nav-item { padding: 0 9px; }
  .alliance-layout { grid-template-columns: 1fr; }
  .activity { grid-column: auto; }
  .gang-list { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
  .gang-pick small { display: none; }
  .skin-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 7.5rem), 1fr)); }
  .page-heading { align-items: flex-start; flex-wrap: wrap; }
  .heading-actions { align-items: flex-end; flex-direction: column; }
  .content { padding: 22px 13px 40px; }
  .account-row { grid-template-columns: minmax(98px, 1fr) max-content; gap: 7px; }
  .account-row .section-tools { grid-column: 1 / -1; justify-self: end; }
  .login-layout { padding: 17px; }
  .login-card { padding: 31px 24px; }
}
@media (hover: none) {
  .skin-actions { opacity: 1; pointer-events: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
