:root {
  --bg-dark: #071018;
  --bg-panel: #0f1a25;
  --bg-panel-soft: #1b2a38;
  --accent-red: #ce2f2a;
  --accent-red-strong: #9f1f1c;
  --accent-gold: #d6bd85;
  --accent-blue: #1f6fb3;
  --text-main: #eef4fb;
  --text-muted: #b2c0d2;
  --success: #58c391;
  --discord: #4f62ff;
  --shadow: 0 22px 44px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Source Sans 3", sans-serif;
  color: var(--text-main);
  background: radial-gradient(circle at 18% 20%, #15314a 0%, var(--bg-dark) 44%, #050a0f 100%);
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 84% 14%, rgba(206, 47, 42, 0.3) 0%, transparent 44%),
    radial-gradient(circle at 12% 84%, rgba(31, 111, 179, 0.18) 0%, transparent 40%),
    radial-gradient(circle at 50% 54%, rgba(214, 189, 133, 0.08) 0%, transparent 58%),
    linear-gradient(110deg, rgba(255, 255, 255, 0.03) 0%, transparent 30%, transparent 70%, rgba(255, 255, 255, 0.03) 100%);
  z-index: -1;
}

.app {
  width: min(1200px, 92vw);
  margin: 2rem auto 3rem;
  display: grid;
  gap: 1.4rem;
  transition: filter 0.45s ease, opacity 0.45s ease;
}

.app.is-locked {
  filter: blur(4px);
  opacity: 0.28;
  user-select: none;
  pointer-events: none;
}

.topbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(140deg, rgba(13, 24, 35, 0.97), rgba(8, 14, 22, 0.97));
  border: 1px solid rgba(214, 189, 133, 0.28);
  border-radius: 18px;
  padding: 1rem 1.2rem;
  box-shadow: var(--shadow);
  animation: revealDown 0.8s ease both;
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  border-radius: 18px 0 0 18px;
  background: linear-gradient(180deg, var(--accent-red), var(--accent-red-strong));
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.crest {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  overflow: hidden;
  background: linear-gradient(160deg, #152434, #0b131d);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.crest img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}

.unit {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--accent-gold);
  font-weight: 700;
}

.brand h2 {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}

.userbox {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.logout-btn,
.discord-btn,
.discord-link {
  border: none;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.logout-btn {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.06));
  color: var(--text-main);
  padding: 0.55rem 0.85rem;
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 1rem;
}

.hero-copy,
.status-card,
.grid article,
.cta {
  background: linear-gradient(155deg, rgba(16, 27, 39, 0.95), rgba(11, 18, 27, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 1.2rem;
  box-shadow: var(--shadow);
}

.hero-copy {
  animation: revealUp 0.9s ease 0.1s both;
}

.label {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-gold);
  font-weight: 700;
}

.hero h1 {
  margin: 0.45rem 0 0.6rem;
  font-family: "Barlow Condensed", sans-serif;
  font-size: clamp(2rem, 4.4vw, 3.25rem);
  line-height: 1.05;
  text-transform: uppercase;
}

.hero p {
  margin: 0;
  color: var(--text-muted);
}

.hero-image {
  width: 100%;
  margin-top: 1rem;
  border-radius: 16px;
  display: block;
  min-height: 240px;
  max-height: 340px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--shadow);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.badges span {
  background: rgba(206, 47, 42, 0.2);
  border: 1px solid rgba(206, 47, 42, 0.6);
  color: #ffe5e2;
  border-radius: 999px;
  padding: 0.34rem 0.74rem;
  font-size: 0.84rem;
  font-weight: 600;
}

.status-card {
  animation: revealUp 0.9s ease 0.2s both;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-left: 4px solid rgba(206, 47, 42, 0.8);
}

.status-card h3,
.grid h3,
.cta h3 {
  margin: 0 0 0.55rem;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.45rem;
  letter-spacing: 0.03em;
}

.status-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
  color: var(--text-muted);
}

.status-card strong {
  color: var(--text-main);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.grid article {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.grid article:nth-child(1) {
  animation: revealUp 0.8s ease 0.3s both;
}

.grid article:nth-child(2) {
  animation: revealUp 0.8s ease 0.42s both;
}

.grid article:nth-child(3) {
  animation: revealUp 0.8s ease 0.54s both;
}

.grid p,
.cta p {
  margin: 0;
  color: var(--text-muted);
}

.cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid rgba(206, 47, 42, 0.42);
  background: linear-gradient(160deg, rgba(18, 28, 40, 0.95), rgba(14, 22, 31, 0.95));
  animation: revealUp 0.85s ease 0.65s both;
}

.copyright-hint {
  margin: 0;
  text-align: center;
  color: rgba(169, 180, 194, 0.8);
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0 0.3rem;
}

.discord-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #225d97, #174775);
  color: #fff;
  padding: 0.7rem 1rem;
  min-width: 180px;
}

.training-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  font-family: inherit;
  width: fit-content;
  background: linear-gradient(135deg, #d9bd86, #ac8a4a);
  color: #181308;
  padding: 0.62rem 0.9rem;
  border-radius: 10px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.2s ease, filter 0.2s ease;
}

.team-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  font-family: inherit;
  width: 100%;
  background: linear-gradient(135deg, rgba(206, 47, 42, 0.96), rgba(137, 27, 23, 0.96));
  color: #fff;
  padding: 0.72rem 0.95rem;
  border-radius: 10px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.2s ease, filter 0.2s ease;
}

.training-link:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.team-link:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.discord-link:hover,
.discord-btn:hover,
.logout-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.07);
}

.auth-gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: linear-gradient(160deg, rgba(6, 9, 13, 0.88), rgba(9, 14, 21, 0.92));
  z-index: 20;
}

.inline-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 9, 14, 0.8);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 40;
}

.inline-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.inline-modal-card {
  width: min(1100px, 96vw);
  height: min(86vh, 860px);
  background: linear-gradient(160deg, rgba(20, 29, 38, 0.98), rgba(13, 20, 27, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  position: relative;
}

.inline-modal-card.is-loading .inline-modal-loader {
  opacity: 1;
}

.inline-modal-card.is-loading .inline-modal-frame {
  opacity: 0;
}

.inline-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.inline-modal-header h3 {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.25rem;
  letter-spacing: 0.03em;
}

.inline-modal-close {
  border: none;
  border-radius: 10px;
  padding: 0.5rem 0.8rem;
  background: linear-gradient(135deg, rgba(214, 71, 54, 0.95), rgba(145, 35, 28, 0.95));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.inline-modal-loader {
  position: absolute;
  inset: 56px 0 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  color: var(--text-muted);
  background: rgba(11, 17, 23, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  font-weight: 600;
}

.inline-modal-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(200, 168, 106, 0.25);
  border-top-color: var(--accent-gold);
  animation: spin 0.8s linear infinite;
}

.inline-modal-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #0b1117;
  transition: opacity 0.2s ease;
}

.auth-gate.hidden {
  opacity: 0;
  pointer-events: none;
}

.auth-card {
  width: min(520px, 94vw);
  border-radius: 20px;
  padding: 1.4rem;
  background: linear-gradient(165deg, rgba(14, 23, 33, 0.98), rgba(10, 16, 24, 0.98));
  border: 1px solid rgba(214, 189, 133, 0.34);
  box-shadow: var(--shadow);
  animation: revealDown 0.55s ease both;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0.3rem 0 0.55rem;
}

.auth-crest {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  padding: 3px;
  background: linear-gradient(160deg, #152434, #0b131d);
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex: 0 0 auto;
}

.auth-crest img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}

.auth-card h1 {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  font-size: clamp(1.65rem, 4vw, 2.2rem);
  line-height: 1.05;
}

.auth-card p {
  margin: 0;
  color: var(--text-muted);
}

.discord-btn {
  margin-top: 1rem;
  width: 100%;
  background: linear-gradient(135deg, #225d97, #174775);
  color: #fff;
  padding: 0.9rem 1rem;
  font-size: 1rem;
}

.hint {
  margin-top: 0.75rem !important;
  font-size: 0.9rem;
}

.hint.ok {
  color: var(--success);
}

.hint.error {
  color: #ff7f7f;
}

@keyframes revealUp {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes revealDown {
  from {
    transform: translateY(-12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 980px) {
  .hero,
  .grid,
  .cta {
    grid-template-columns: 1fr;
  }

  .cta {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .userbox {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 580px) {
  .brand h2 {
    font-size: 1.25rem;
  }

  .hero-copy,
  .status-card,
  .grid article,
  .cta,
  .auth-card {
    padding: 1rem;
  }
}
