@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/space-grotesk-400.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../assets/fonts/space-grotesk-600.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../assets/fonts/space-grotesk-700.woff2") format("woff2");
}

:root {
  --space-black: #05070f;
  --panel: rgba(18, 26, 48, 0.72);
  --panel-solid: #121a30;
  --green: #5be08a;
  --teal: #1de9b6;
  --cyan: #00e5ff;
  --blue: #2979ff;
  --violet: #9b4dff;
  --magenta: #ff2dae;
  --gold: #ffc107;
  --red: #ff5a6e;
  --text: #eaf2ff;
  --text-dim: #8fa3c8;
  --border: rgba(143, 163, 200, 0.18);
  --radius: 18px;
  --radius-sm: 12px;
  --maxw: 1080px;
  --font: "Space Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
  --lang-pill-font: 0.74rem;
  --lang-pill-pad-y: 0.34rem;
  --lang-frame: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.app {
  font-family: var(--font);
  color: var(--text);
  background: var(--space-black);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.cosmos {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1200px 800px at 15% -10%, rgba(91, 224, 138, 0.16), transparent 60%),
    radial-gradient(1000px 700px at 90% 0%, rgba(0, 229, 255, 0.16), transparent 55%),
    linear-gradient(180deg, #05070f 0%, #0b1020 50%, #05070f 100%);
}

a {
  color: inherit;
  text-decoration: none;
}
img {
  max-width: 100%;
  display: block;
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  background: rgba(5, 7, 15, 0.72);
  border-bottom: 1px solid var(--border);
}
.appbar__inner {
  width: min(100% - 2rem, var(--maxw));
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.7rem 0;
  min-height: 60px;
}
.appbar__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
}
.appbar__brand img {
  height: 26px;
  width: auto;
}
.appnav {
  display: flex;
  gap: 0.2rem;
  flex: 1 1 auto;
  flex-wrap: wrap;
  min-height: 2rem;
  align-items: center;
}
.appnav__link {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.86rem;
}
.appnav__link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.appnav__link.active {
  color: #061018;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
}
.appbar__right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
}
.identity {
  color: var(--text-dim);
  font-size: 0.82rem;
  font-weight: 600;
  max-width: 14ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lang {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(10, 7, 32, 0.55);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  min-height: calc(var(--lang-pill-font) + var(--lang-pill-pad-y) * 2 + var(--lang-frame));
}
.lang__pill {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-dim);
  font-family: inherit;
  font-weight: 600;
  font-size: var(--lang-pill-font);
  letter-spacing: 0.03em;
  padding: var(--lang-pill-pad-y) 0.55rem;
  border-radius: 999px;
  line-height: 1;
}
.lang__pill:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.lang__pill.active {
  color: #061018;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
}

.appmain {
  width: min(100% - 2rem, var(--maxw));
  margin-inline: auto;
  padding: 2rem 0 3rem;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.appfooter {
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.82rem;
  text-align: center;
  padding: 1.2rem 1rem;
}
.appfooter a:hover {
  color: var(--cyan);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
}
.panel--auth {
  max-width: 420px;
  margin-inline: auto;
  width: 100%;
}
.panel__title {
  font-size: 1.1rem;
  color: var(--cyan);
  margin-bottom: 1rem;
  letter-spacing: 0.02em;
}

.hero-card {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
}
.hero-card__portrait {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(0, 229, 255, 0.4);
  flex: 0 0 auto;
}
.hero-card__body {
  min-width: 0;
}
.hero-card__eyebrow {
  color: var(--text-dim);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.hero-card__name {
  font-size: 1.8rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.hero-card__rank {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-top: 0.3rem;
}
.hero-card__ladder {
  color: var(--teal);
  font-weight: 600;
  font-size: 0.9rem;
}
.tag {
  color: var(--text-dim);
  font-weight: 600;
}

.badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--violet), var(--magenta));
  color: #fff;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
}

.emblem {
  display: inline-block;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
}
.emblem--0 {
  background: linear-gradient(135deg, var(--cyan), var(--blue));
}
.emblem--1 {
  background: linear-gradient(135deg, var(--green), var(--teal));
}
.emblem--2 {
  background: linear-gradient(135deg, var(--violet), var(--magenta));
}
.emblem--3 {
  background: linear-gradient(135deg, var(--gold), #ff8a3d);
}
.emblem--4 {
  background: linear-gradient(135deg, #ff5a47, var(--magenta));
}
.emblem--5 {
  background: linear-gradient(135deg, #6c8bff, var(--violet));
}
.emblem--6 {
  background: linear-gradient(135deg, var(--teal), var(--cyan));
}
.emblem--7 {
  background: linear-gradient(135deg, #ff6fa5, var(--gold));
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.8rem;
}
.tile {
  background: rgba(5, 7, 15, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.tile__value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
}
.tile__label {
  color: var(--text-dim);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tile--good .tile__value {
  color: var(--green);
}
.tile--bad .tile__value {
  color: var(--red);
}

.table-wrap {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.table th,
.table td {
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 0.6rem;
  text-align: left;
  white-space: nowrap;
}
.table th {
  color: var(--text-dim);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.table td.num,
.table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.table td.actions,
.table th.actions {
  text-align: right;
}
.table td.actions {
  display: table-cell;
}
.row--mine td {
  background: rgba(0, 229, 255, 0.08);
}

.pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.pill--won {
  color: var(--green);
  border-color: rgba(91, 224, 138, 0.45);
}
.pill--lost {
  color: var(--red);
  border-color: rgba(255, 90, 110, 0.45);
}
.pill--draw {
  color: var(--gold);
  border-color: rgba(255, 193, 7, 0.45);
}
.pill--pending {
  color: var(--text-dim);
}
.pill--role {
  color: var(--cyan);
  border-color: rgba(0, 229, 255, 0.35);
}

.clan-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.clan-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: rgba(5, 7, 15, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem;
}
.clan-card__body {
  flex: 1 1 auto;
  min-width: 0;
}
.clan-card__name {
  font-weight: 700;
  overflow-wrap: anywhere;
}
.clan-card__desc {
  color: var(--text-dim);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.form--inline {
  flex-direction: row;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.form--inline .field {
  flex: 1 1 200px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.field span {
  color: var(--text-dim);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.field input,
.field select {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: rgba(5, 7, 15, 0.65);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.7rem;
  width: 100%;
}
.field input:focus-visible,
.field select:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 1px;
}
.form__status {
  min-height: 1.5rem;
}

.btn-primary,
.btn-secondary {
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1.4rem;
  cursor: pointer;
  align-self: flex-start;
}
.btn-primary {
  color: #061018;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
}
.btn-secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
}
.btn-sm {
  font-family: inherit;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  margin-left: 0.3rem;
}
.btn-sm--danger {
  color: var(--red);
  border-color: rgba(255, 90, 110, 0.4);
}
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-sm:disabled {
  opacity: 0.5;
  cursor: progress;
}
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-sm:focus-visible,
.lang__pill:focus-visible,
.appnav__link:focus-visible,
.appbar__brand:focus-visible,
.appfooter a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.lead {
  color: var(--text-dim);
  margin-bottom: 1rem;
}
.muted {
  color: var(--text-dim);
  font-size: 0.84rem;
  margin-top: 0.6rem;
}
.empty {
  color: var(--text-dim);
  font-size: 0.9rem;
}
.loading {
  color: var(--text-dim);
  font-size: 0.9rem;
}
.alert {
  color: #ffd7dc;
  background: rgba(255, 90, 110, 0.12);
  border: 1px solid rgba(255, 90, 110, 0.4);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}
.alert__rid {
  display: block;
  color: var(--text-dim);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  margin-top: 0.2rem;
}

@media (max-width: 640px) {
  .appbar__inner {
    gap: 0.6rem;
  }
  .appnav {
    order: 3;
    flex-basis: 100%;
  }
  .hero-card {
    flex-direction: column;
    text-align: center;
  }
  .hero-card__portrait {
    width: 88px;
    height: 88px;
  }
}

@media (max-width: 380px) {
  :root {
    --lang-pill-font: 0.64rem;
    --lang-pill-pad-y: 0.28rem;
    --lang-frame: 6px;
  }
  .lang {
    gap: 0;
    padding: 2px;
  }
  .lang__pill {
    padding: var(--lang-pill-pad-y) 0.32rem;
  }
  .appbar__brand span {
    display: none;
  }
  .identity {
    max-width: 8ch;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
