:root {
  color-scheme: dark;
  --bg: #101014;
  --panel: #191922;
  --panel-2: #22222d;
  --text: #f7f3eb;
  --muted: #b8b0a6;
  --line: #34323d;
  --red: #e3263c;
  --gold: #f3c24f;
  --cyan: #46d3c7;
  --green: #6fd27d;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(227, 38, 60, .2), transparent 34%),
    linear-gradient(315deg, rgba(70, 211, 199, .12), transparent 38%),
    var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.file-btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 6px;
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover,
.file-btn:hover {
  border-color: var(--cyan);
}

a {
  color: inherit;
}

.button-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
  font-weight: 750;
}

.button-link:hover {
  border-color: var(--red);
}

.primary {
  background: var(--red);
  border-color: var(--red);
  color: white;
  font-weight: 800;
}

.topbar {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(16, 16, 20, .84);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 30;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.7rem, 3vw, 2.8rem);
  line-height: 1;
}

h2 {
  font-size: 1.2rem;
}

h3 {
  font-size: 1.05rem;
}

.kicker {
  color: var(--gold);
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 900;
}

.top-actions,
.summary-strip,
.tabs,
.filters,
.catalog-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-button {
  display: block;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--text);
  text-decoration: none;
}

.brand-button:hover {
  border-color: transparent;
}

.brand-button h1 {
  font-size: clamp(1.25rem, 2vw, 1.8rem);
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  padding: 0 11px;
  text-decoration: none;
  border-radius: 6px;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  border-color: transparent;
  background: var(--panel-2);
}

.nav-link span {
  display: inline-grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--red);
  color: white;
  font-size: .72rem;
}

.login-button {
  border-color: var(--red);
  color: white;
}

.auth-signout {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

.auth-signout:hover {
  color: white;
  background: var(--panel-2);
  border-color: #45454f;
}

.site-page {
  display: none;
}

.site-page.active {
  display: block;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 30px clamp(16px, 4vw, 44px) 4px;
}

.page-heading h2 {
  margin-top: 4px;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
}

.page-intro {
  max-width: 520px;
  color: var(--muted);
}

.data-actions {
  display: flex;
  gap: 10px;
}

.home-hero {
  min-height: min(660px, calc(100vh - 86px));
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  align-items: center;
  gap: clamp(36px, 8vw, 120px);
  padding: clamp(52px, 8vw, 104px) clamp(20px, 7vw, 96px);
  background: #15151c;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.hero-copy {
  max-width: 820px;
}

.hero-copy h2 {
  max-width: 800px;
  margin-top: 12px;
  font-size: clamp(2.8rem, 6vw, 5.8rem);
  line-height: .96;
}

.hero-lead {
  max-width: 690px;
  margin-top: 24px;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.22rem);
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 30px;
  flex-wrap: wrap;
}

.hero-actions button {
  min-height: 48px;
  padding: 0 20px;
}

.hero-statboard {
  position: relative;
  border-left: 3px solid var(--red);
  background: #20202a;
  box-shadow: 22px 22px 0 #761b29;
}

.hero-statboard > div {
  display: grid;
  gap: 2px;
  padding: 26px 28px;
  border-bottom: 1px solid var(--line);
}

.hero-statboard > div:last-child {
  border-bottom: 0;
}

.hero-statboard strong {
  color: var(--text);
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
}

.hero-statboard span {
  color: var(--muted);
}

.hero-counter strong {
  color: var(--gold);
}

.home-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.home-features article {
  min-height: 270px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 34px clamp(22px, 4vw, 52px);
  background: var(--bg);
}

.feature-number {
  color: var(--red);
  font-weight: 950;
}

.home-features h3 {
  margin-top: 22px;
  font-size: 1.4rem;
}

.home-features p {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.home-features button {
  margin-top: auto;
}

.ranking-tabs,
.community-tools,
.ranking-list,
.community-grid {
  margin-left: clamp(16px, 4vw, 44px);
  margin-right: clamp(16px, 4vw, 44px);
}

.ranking-tabs {
  display: flex;
  gap: 6px;
  margin-top: 28px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.ranking-tab {
  flex: 0 0 auto;
  background: transparent;
}

.ranking-tab.active {
  border-color: var(--red);
  background: var(--red);
}

.ranking-list {
  display: grid;
  gap: 10px;
  max-width: 980px;
  margin-top: 22px;
  margin-bottom: 50px;
}

.ranking-row {
  display: grid;
  grid-template-columns: 58px minmax(160px, 1fr) minmax(150px, .55fr) 110px;
  align-items: center;
  gap: 16px;
  min-height: 76px;
  padding: 12px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
}

.ranking-position {
  color: var(--gold);
  font-size: 1.35rem;
  font-weight: 950;
}

.ranking-row p,
.ranking-row small {
  color: var(--muted);
}

.ranking-value {
  text-align: right;
  font-size: 1.15rem;
  font-weight: 900;
}

.ranking-placeholder {
  padding: 34px;
  color: var(--muted);
  border: 1px dashed var(--line);
}

.community-total {
  padding: 10px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.community-total strong {
  color: var(--gold);
  font-size: 1.35rem;
}

.community-tools {
  margin-top: 28px;
}

.community-tools input {
  max-width: 420px;
}

.community-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 20px;
  margin-bottom: 50px;
}

.community-card {
  display: grid;
  gap: 18px;
  min-height: 210px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  border-radius: 6px;
}

.community-card-head,
.community-card-stats {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.community-card p,
.community-card small {
  color: var(--muted);
}

.community-card-stats span {
  display: grid;
  gap: 2px;
}

.community-card-stats strong {
  font-size: 1.25rem;
}

.community-card button {
  align-self: end;
}

.login-dialog {
  width: min(440px, calc(100% - 32px));
  padding: 0;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-dialog::backdrop {
  background: rgba(0, 0, 0, .72);
}

.login-dialog form {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.dialog-note {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.5;
}

.standalone-page {
  min-height: calc(100vh - 86px);
  padding-bottom: 50px;
}

.profile-body,
.section-body {
  background: #0c0c0f;
}

.profile-main,
.standalone-page {
  border-top: 1px solid #24242a;
}

.profile-main .app-shell {
  padding-top: 24px;
}

.profile-heading {
  padding-top: 32px;
}

.profile-heading h2,
.standalone-page .page-heading h2 {
  color: #f7f4ef;
  font-size: clamp(2rem, 3vw, 3rem);
  font-weight: 950;
}

.profile-body .panel,
.profile-body .unit-editor,
.section-body .community-card,
.section-body .ranking-row,
.section-body .auth-panel {
  background: #15151b;
  border-color: #2c2c34;
}

.profile-body input,
.profile-body select,
.profile-body textarea,
.section-body input {
  background: #0e0e12;
}

.profile-body .primary,
.section-body .primary {
  background: #ff4656;
  border-color: #ff4656;
}

.splash-body {
  background: #0c0c0f;
}

.public-topbar {
  min-height: 68px;
  height: 68px;
  padding: 0 clamp(20px, 2.2vw, 34px);
  background: #0c0c0f;
  backdrop-filter: none;
}

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

.brand-emblem {
  width: 30px;
  height: 35px;
  display: grid;
  place-items: center;
  color: #0c0c0f;
  background: #ff4656;
  clip-path: polygon(0 0, 100% 0, 82% 65%, 50% 100%, 18% 65%);
  font-size: .74rem;
  font-weight: 1000;
  padding-bottom: 8px;
}

.brand-name {
  color: #f7f4ef;
  font-size: 1.08rem;
  font-weight: 900;
}

.brand-name span {
  color: #ff4656;
}

.public-topbar .main-nav {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.public-topbar .nav-link {
  color: #8e8b90;
}

.public-topbar .nav-link:hover,
.public-topbar .nav-link.active {
  color: #f7f4ef;
  background: transparent;
}

.public-topbar .top-actions {
  flex-wrap: nowrap;
}

.language-toggle {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 11px;
  color: #66656b;
  background: #111115;
  border-color: #303038;
  font-size: .76rem;
  font-weight: 900;
}

.language-toggle:hover {
  border-color: #ff4656;
}

.language-toggle [data-language] {
  color: #66656b;
  transition: color .18s ease;
}

.language-toggle [data-language].active {
  color: #ff4656;
}

.splash-main {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-rows: 1fr auto;
}

.splash-hero {
  position: relative;
  min-height: calc(100vh - 68px - 104px);
  display: flex;
  align-items: center;
  padding: 72px clamp(28px, 3.3vw, 52px);
  overflow: hidden;
  background: #0c0c0f;
  border-bottom: 1px solid var(--line);
}

.splash-copy {
  position: relative;
  z-index: 2;
  max-width: 760px;
}

.splash-label {
  width: max-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 13px;
  color: #ff4656;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.splash-label span {
  width: 7px;
  height: 7px;
  background: #ff4656;
  border-radius: 50%;
}

.splash-copy h2 {
  margin-top: 30px;
  font-size: clamp(3.7rem, 5.2vw, 5.35rem);
  line-height: .91;
  font-weight: 950;
}

.splash-copy h2 strong {
  color: #ff4656;
}

.splash-copy > p {
  max-width: 625px;
  margin-top: 26px;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.65;
}

.hero-cta {
  min-height: 54px;
  padding: 0 22px;
}

.hero-cta span {
  margin-left: 14px;
  font-size: 1.25rem;
}

.splash-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 36px;
}

.splash-tags span {
  padding: 8px 13px;
  color: #d7d2cb;
  background: #1b1b20;
  border: 1px solid #303038;
  border-radius: 999px;
  font-size: .78rem;
}

.splash-tags span::before {
  content: "◆";
  margin-right: 7px;
  color: #ff4656;
  font-size: .65rem;
}

.splash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #101014;
}

.splash-stats > div {
  display: grid;
  gap: 4px;
  min-height: 104px;
  align-content: center;
  padding: 20px clamp(18px, 4vw, 44px);
  border-right: 1px solid var(--line);
}

.splash-stats > div:last-child {
  border-right: 0;
}

.splash-stats strong {
  color: #ff4656;
  font-size: clamp(1.55rem, 3vw, 2.25rem);
}

.splash-stats div:nth-child(2) strong {
  color: #29d98f;
}

.splash-stats div:nth-child(3) strong {
  color: #57a9ff;
}

.splash-stats div:nth-child(4) strong {
  color: var(--gold);
}

.splash-stats span {
  color: var(--muted);
  font-size: .82rem;
}

.auth-page {
  min-height: calc(100vh - 86px);
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.auth-panel {
  width: min(460px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-panel h2 {
  font-size: 1.8rem;
}

.auth-panel > p:not(.kicker) {
  color: var(--muted);
  line-height: 1.5;
}

.auth-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: #0e0e12;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.auth-mode {
  border-color: transparent;
  background: transparent;
}

.auth-mode.active {
  color: white;
  background: #ff4656;
}

.auth-form,
.signed-in-panel {
  display: grid;
  gap: 16px;
}

.remember-field {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: var(--muted);
  font-size: .9rem;
  cursor: pointer;
}

.remember-field input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--red);
}

.signup-spam-notice {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 800;
  line-height: 1.45;
}

[hidden] {
  display: none !important;
}

body[data-auth-pending] .profile-main {
  visibility: hidden;
}

.auth-status {
  min-height: 22px;
  color: var(--muted);
  font-size: .88rem;
}

.auth-status.success,
.cloud-status.success {
  color: #58d89b;
}

.auth-status.error,
.cloud-status.error {
  color: #ff6a77;
}

.cloud-status {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  color: var(--muted);
  background: #111115;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 800;
}

.public-profile-page {
  min-height: calc(100vh - 68px);
  padding: 38px clamp(16px, 4vw, 44px) 60px;
}

.public-profile-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.public-profile-header h1 {
  margin-top: 5px;
}

.public-profile-header p:not(.kicker) {
  margin-top: 9px;
  color: var(--muted);
}

.unit-grid.public-unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 300px);
  align-items: start;
  justify-content: start;
  gap: 16px;
  margin-top: 24px;
  padding: 0;
  overflow: visible;
}

.public-unit-row {
  position: relative;
  width: 300px;
  height: 96px;
  display: grid;
  grid-template-columns: 280px 0;
  align-items: center;
  gap: 0;
  padding: 10px 10px 10px 14px;
  background: #15151b;
  border: 1px solid #2c2c34;
  border-radius: 6px;
  overflow: hidden;
  isolation: isolate;
  transition: width .28s ease, height .28s ease, grid-template-columns .28s ease, box-shadow .28s ease, border-color .28s ease;
}

.public-unit-row::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--unit-accent);
  z-index: 3;
}

.public-unit-row:hover,
.public-unit-row:focus-visible {
  width: min(860px, calc(100vw - 32px));
  height: 126px;
  grid-template-columns: 280px minmax(500px, 1fr);
  border-color: rgba(255, 255, 255, .24);
  box-shadow: 0 20px 46px rgba(0, 0, 0, .48);
  z-index: 20;
  outline: none;
}

.public-unit-summary {
  min-width: 0;
  display: grid;
  grid-template-columns: 72px minmax(0, 170px);
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.public-unit-summary img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  object-position: center;
  background: #22222a;
  border-radius: 4px;
}

.public-unit-summary h3 {
  font-size: 1rem;
  line-height: 1.2;
}

.public-unit-summary p,
.public-unit-row small,
.public-unit-empty {
  display: block;
  color: var(--muted);
}

.public-unit-summary p {
  margin-top: 5px;
  font-size: .84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.public-unit-details {
  min-width: 280px;
  display: grid;
  gap: 9px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity .18s ease .08s, transform .2s ease .08s;
}

.public-unit-row:hover .public-unit-details,
.public-unit-row:focus-visible .public-unit-details {
  opacity: 1;
  transform: translateX(0);
}

.public-unit-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(58px, 1fr));
  gap: 10px;
}

.public-unit-progress span,
.public-unit-revelation span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.public-unit-progress strong,
.public-unit-revelation strong {
  overflow: hidden;
  font-size: .78rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.public-unit-row small {
  font-size: .65rem;
  text-transform: capitalize;
}

.public-unit-revelation {
  display: flex;
  gap: 12px;
  min-width: 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.public-unit-revelation span {
  flex: 1 1 0;
  max-width: 112px;
}

.public-unit-revelation strong {
  display: -webkit-box;
  white-space: normal;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.public-unit-empty {
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: .74rem;
}

.public-unit-row.is-a6::before {
  width: 5px;
  background: linear-gradient(180deg, #7cecff, #7788ff, #ed82ff, #ffffff, #63ffd7, #7cecff);
  background-size: 100% 260%;
  box-shadow: 0 0 14px rgba(124, 236, 255, .8);
  animation: public-a6-accent 2.4s linear infinite;
}

.public-unit-row.is-a6 {
  border-color: rgba(174, 226, 255, .38);
}

@keyframes public-a6-accent {
  to {
    background-position: 0 260%;
    filter: hue-rotate(360deg);
  }
}

@media (max-width: 680px) {
  .public-profile-header {
    align-items: stretch;
    flex-direction: column;
  }

  .public-unit-row {
    width: 100%;
    height: auto;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .unit-grid.public-unit-grid {
    grid-template-columns: 1fr;
  }

  .public-unit-row:hover,
  .public-unit-row:focus-visible {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .public-unit-details {
    min-width: 0;
    padding: 12px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
    opacity: 1;
    transform: none;
  }

  .public-unit-progress {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .public-unit-row,
  .public-unit-details,
  .public-unit-row.is-a6::before {
    transition: none;
    animation: none;
  }
}

.file-btn {
  display: inline-grid;
  place-items: center;
}

.file-btn input {
  display: none;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 20px;
  padding: 20px clamp(16px, 4vw, 44px) 44px;
}

.sidebar,
.workspace,
.stack {
  display: grid;
  gap: 16px;
}

.sidebar {
  align-self: start;
  align-content: start;
  grid-auto-rows: max-content;
}

.sidebar .panel {
  align-self: start;
  height: auto;
}

.panel,
.unit-editor {
  background: rgba(25, 25, 34, .92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
}

.profile-list-panel {
  align-self: start;
}

.section-title,
.workspace-head,
.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title span {
  min-width: 32px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--cyan);
  padding: 2px 8px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  background: #111117;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  min-height: 40px;
  padding: 9px 10px;
}

textarea {
  resize: vertical;
  line-height: 1.4;
}

.unit-editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.unit-editor-actions > button {
  min-height: 42px;
}

.delete-unit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #e5e3df;
  background: #27272e;
  border-color: #42424b;
}

.delete-unit-button:hover {
  color: white;
  background: #34343c;
  border-color: #5a5a64;
}

.delete-unit-button svg {
  width: 17px;
  height: 17px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  outline: 2px solid rgba(70, 211, 199, .16);
}

input[readonly] {
  color: var(--cyan);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.workspace {
  min-width: 0;
}

.workspace-head {
  min-height: 80px;
  padding: 0 2px;
}

.summary-strip span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: var(--muted);
  background: rgba(34, 34, 45, .82);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}

.summary-strip strong {
  color: var(--text);
  font-size: 1.05rem;
}

.tabs {
  border-bottom: 1px solid var(--line);
}

.tab {
  border: 0;
  background: transparent;
  border-radius: 0;
  color: var(--muted);
  padding: 0 12px 12px;
}

.tab.active {
  color: var(--text);
  border-bottom: 3px solid var(--red);
}

.tab-view {
  display: none;
}

.tab-view.active {
  display: grid;
  gap: 18px;
}

.unit-editor {
  padding: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 14px 0;
}

legend {
  color: var(--gold);
  font-weight: 900;
  padding: 0 8px;
}

.revelation-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.filters input,
.catalog-tools input {
  max-width: 340px;
}

.catalog-tools {
  justify-content: space-between;
}

.sort-control {
  grid-template-columns: auto minmax(150px, 190px);
  align-items: center;
  gap: 10px;
}

.sort-control select {
  min-width: 170px;
}

.catalog-tools p {
  max-width: 620px;
  color: var(--muted);
  font-size: .88rem;
}

.profile-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.profile-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 54px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #121219;
}

.profile-item.active {
  border-color: var(--red);
}

.profile-item button {
  min-height: 32px;
  padding: 0 10px;
}

.profile-meta,
.unit-meta {
  color: var(--muted);
  font-size: .82rem;
}

.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 264px);
  gap: 24px;
  justify-content: start;
  align-items: start;
  overflow: visible;
  padding: 10px 4px 24px;
}

.unit-card {
  position: relative;
  width: 264px;
  min-height: 400px;
  height: 400px;
  overflow: visible;
  background: var(--accent);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  isolation: isolate;
  transform-origin: center center;
  transition: transform .26s ease, box-shadow .26s ease, border-color .26s ease;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .22);
}

.unit-card:hover,
.unit-card:focus-within {
  transform: scale(1.1);
  z-index: 15;
  border-color: rgba(255, 255, 255, .26);
  box-shadow: 0 28px 60px rgba(0, 0, 0, .42);
}

.unit-art {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  isolation: isolate;
  background: var(--accent);
  overflow: hidden;
  border-radius: inherit;
}

.unit-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .02) 0%, rgba(0, 0, 0, .08) 45%, rgba(0, 0, 0, .26) 100%);
  z-index: 1;
}

.unit-art img {
  position: absolute;
  top: 0;
  left: 50%;
  width: auto;
  min-width: 0;
  max-width: none;
  height: 100%;
  object-fit: contain;
  object-position: center top;
  display: block;
  transform: translateX(-50%);
  transform-origin: top center;
  transition: filter .26s ease;
  z-index: 0;
}

.unit-card:hover .unit-art img,
.unit-card:focus-within .unit-art img {
  transform: translateX(-50%);
}

.catalog-card .unit-art img {
  transform: translateX(-50%);
}

.catalog-card:hover .unit-art img,
.catalog-card:focus-within .unit-art img {
  transform: translateX(-50%);
}

.unit-art .fallback {
  position: relative;
  font-size: 3.8rem;
  font-weight: 950;
  color: rgba(255, 255, 255, .92);
  text-shadow: 0 8px 22px rgba(0, 0, 0, .45);
  z-index: 2;
}

.unit-body {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 14px;
  display: grid;
  grid-template-rows: minmax(40px, auto) minmax(28px, auto) minmax(76px, 1fr) 14px auto;
  gap: 8px;
  padding: 13px 12px;
  min-height: 174px;
  background: rgba(18, 13, 17, .9);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .32);
  backdrop-filter: blur(8px);
  z-index: 2;
}

.catalog-card .unit-body {
  grid-template-rows: minmax(40px, auto) minmax(28px, auto) 36px;
  min-height: 146px;
}

.owned-indicator {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #0c0c0f;
  background: #f7f4ef;
  border: 2px solid #ff4656;
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .32);
  font-size: 1rem;
  font-weight: 1000;
  z-index: 4;
}

.collection-card {
  cursor: pointer;
}

.collection-card:focus-visible {
  outline: 3px solid #ff4656;
  outline-offset: 4px;
}

.collection-card.is-a6 {
  border-color: rgba(225, 247, 255, .88);
  box-shadow:
    0 0 0 2px rgba(102, 224, 255, .44),
    0 0 22px rgba(82, 167, 255, .55),
    0 0 42px rgba(206, 84, 255, .32),
    0 20px 48px rgba(0, 0, 0, .34);
}

.collection-card.is-a6::before {
  content: "";
  position: absolute;
  inset: -4px;
  padding: 4px;
  border-radius: 11px;
  background: conic-gradient(
    from 0deg,
    #7cecff,
    #7788ff,
    #ed82ff,
    #ffffff,
    #63ffd7,
    #7cecff
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 5;
  animation: a6-hologram-spin 4.8s linear infinite;
}

.collection-card.is-a6 .unit-art::before {
  content: "";
  position: absolute;
  inset: -18% -14% -4%;
  background:
    radial-gradient(ellipse at 8% 78%, rgba(94, 225, 255, .86) 0 6%, transparent 18%),
    radial-gradient(ellipse at 92% 70%, rgba(220, 104, 255, .82) 0 7%, transparent 19%),
    radial-gradient(ellipse at 25% 4%, rgba(114, 153, 255, .7) 0 5%, transparent 17%),
    radial-gradient(ellipse at 76% 12%, rgba(102, 255, 222, .62) 0 5%, transparent 16%);
  background-size: 72% 78%, 74% 82%, 62% 70%, 66% 74%;
  mix-blend-mode: screen;
  filter: blur(7px) saturate(1.35);
  opacity: .82;
  pointer-events: none;
  z-index: 2;
  animation: a6-flame-drift 2.8s ease-in-out infinite alternate;
}

.collection-card.is-a6 .unit-body {
  border-color: rgba(174, 226, 255, .48);
  box-shadow:
    0 10px 26px rgba(0, 0, 0, .35),
    inset 0 0 18px rgba(99, 173, 255, .08);
}

@keyframes a6-hologram-spin {
  0% {
    filter: hue-rotate(0deg) brightness(1);
  }
  50% {
    filter: hue-rotate(180deg) brightness(1.22);
  }
  to {
    filter: hue-rotate(360deg) brightness(1);
  }
}

@keyframes a6-flame-drift {
  0% {
    transform: translate3d(-2%, 2%, 0) scale(1);
    filter: blur(7px) saturate(1.25) hue-rotate(0deg);
  }
  100% {
    transform: translate3d(2%, -2%, 0) scale(1.08);
    filter: blur(9px) saturate(1.5) hue-rotate(28deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .collection-card.is-a6::before,
  .collection-card.is-a6 .unit-art::before {
    animation: none;
  }
}

.unit-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
  min-height: 40px;
}

.unit-title > div {
  min-width: 0;
}

.unit-title h3 {
  font-size: 1rem;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-content: start;
  min-height: 28px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 999px;
  padding: 0 10px;
  font-size: .72rem;
  color: var(--text);
  background: rgba(255, 255, 255, .06);
}

.stats-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 12px;
  align-content: start;
  color: var(--muted);
  font-size: .79rem;
}

.stats-table span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  line-height: 1.15;
}

.stats-table strong {
  color: var(--text);
}

.unit-note {
  margin: 0;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.unit-note.is-empty {
  visibility: hidden;
}

.card-actions {
  display: flex;
  gap: 8px;
  min-height: 0;
}

.card-actions button {
  flex: 1;
  min-height: 34px;
  display: none;
}

.catalog-add-action {
  justify-content: flex-end;
  min-height: 34px;
}

.catalog-add-action .add-unit-button {
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  color: white;
  background: #ff4656;
  border-color: #ff4656;
  border-radius: 50%;
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
}

.catalog-add-action .add-unit-button:hover {
  background: #ff6674;
}

.card-actions--empty {
  visibility: hidden;
}

.empty-state {
  min-height: 240px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 8px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 24px;
}

@media (max-width: 1080px) {
  .topbar {
    flex-wrap: wrap;
  }

  .main-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .home-hero {
    grid-template-columns: 1fr;
  }

  .hero-statboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .hero-statboard > div {
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .home-features {
    grid-template-columns: 1fr;
  }

  .public-topbar {
    height: auto;
    min-height: 68px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .public-topbar .main-nav {
    position: static;
    transform: none;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .revelation-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }
}

@media (max-width: 680px) {
  .topbar,
  .page-heading,
  .workspace-head,
  .editor-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    position: static;
  }

  .brand-button h1 {
    font-size: 1.3rem;
  }

  .main-nav {
    justify-content: flex-start;
  }

  .nav-link {
    padding: 0 8px;
  }

  .top-actions,
  .summary-strip,
  .data-actions {
    width: 100%;
  }

  .top-actions > *,
  .summary-strip span,
  .data-actions > * {
    flex: 1;
  }

  .home-hero {
    min-height: auto;
    padding-top: 56px;
    padding-bottom: 64px;
  }

  .hero-copy h2 {
    font-size: 2.65rem;
  }

  .splash-hero {
    min-height: 650px;
    align-items: flex-start;
    padding-top: 64px;
  }

  .splash-copy h2 {
    font-size: clamp(3rem, 15vw, 4.4rem);
  }

  .splash-stats {
    grid-template-columns: 1fr 1fr;
  }

  .splash-stats > div:nth-child(2) {
    border-right: 0;
  }

  .splash-stats > div {
    border-bottom: 1px solid var(--line);
  }

  .hero-statboard {
    grid-template-columns: 1fr;
    box-shadow: 10px 10px 0 #761b29;
  }

  .hero-statboard > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .ranking-row {
    grid-template-columns: 42px 1fr auto;
  }

  .ranking-row small {
    display: none;
  }

  .community-card-stats {
    flex-wrap: wrap;
  }

  .form-grid,
  .revelation-grid,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .unit-grid {
    grid-template-columns: 1fr;
  }

  .unit-card {
    width: 100%;
  }
}
