.sidebar,
.content {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.25);
  border-radius: 12px;
}

.ip-badge,
.metric-card,
.score-board,
.rank-list,
.challenge {
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  border-radius: 10px;
}

.ip-badge {
  background: #ffffff;
}

.content .metric-card,
.content .score-board,
.content .rank-list,
.content .challenge,
.content .alert-form,
.content .podium-block {
  background: rgba(255, 255, 255, 0.50);
}

.app-panel {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
  min-height: calc(100vh - 56px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.side-brand {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.side-logo {
  display: block;
  width: min(298px, 100%);
  max-height: 119px;
  object-fit: contain;
  margin: 0 auto 16px;
}

.side-brand span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.86rem;
}

.menu {
  display: grid;
  gap: 10px;
  margin: 24px 0;
}

.menu-item {
  width: 100%;
  text-align: left;
  padding: 0 14px;
}

.menu-item[data-view="access"],
.menu-item[data-view="score"],
.menu-item[data-view="challenges"],
.topbar h2 {
  font-weight: 800;
  text-transform: uppercase;
}

.logout {
  margin-top: 0;
  color: var(--blue);
  min-height: 29px;
  font-size: 0.78rem;
  padding: 0 10px;
  flex: 1;
}

.content {
  padding: clamp(10px, 2.5vw, 22px) clamp(18px, 4vw, 34px) clamp(18px, 4vw, 34px);
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.topbar h2 {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
}

.view-heading {
  display: grid;
  gap: 4px;
}

.ranking-user-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.ip-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-width: 110px;
  padding: 6px 10px;
  font-size: 0.8rem;
}

.metric-card span,
.score-board span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.ip-badge span {
  display: inline;
  color: #000000;
  font-size: 0.72rem;
  font-weight: 800;
}

.metric-card strong,
.score-board strong {
  display: block;
  margin-top: 4px;
  color: var(--cyan);
  overflow-wrap: anywhere;
}

.ip-badge strong {
  display: inline;
  margin-top: 0;
  color: var(--blue);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

#accessView.active {
  grid-template-columns: 1fr;
}

.siem-card {
  display: grid;
  place-items: center;
  min-height: min(72vh, 680px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(rgba(0, 15, 28, 0.42), rgba(0, 15, 28, 0.52)),
    var(--wallpaper-image),
    linear-gradient(135deg, rgba(0, 87, 153, 0.78), rgba(0, 174, 255, 0.18));
  background-position: center;
  background-size: cover;
  overflow: hidden;
}

.siem-button {
  min-width: 528px;
  min-height: 102px;
  padding: 0 56px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(0, 174, 255, 0.90) 0%, rgba(0, 87, 153, 0.90) 52%, rgba(0, 61, 109, 0.90) 100%);
  color: #ffffff;
  font-size: 2.1rem;
  font-weight: 900;
  text-transform: uppercase;
  box-shadow:
    0 12px 0 #002a4a,
    0 22px 34px rgba(0, 0, 0, 0.45),
    inset 0 2px 0 rgba(255, 255, 255, 0.45);
  transform: translateY(-6px);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.training-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(4, 25, 43, 0.78);
}

.training-card span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
}

.training-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.training-button {
  width: fit-content;
  min-width: 220px;
  min-height: 43px;
  display: inline-grid;
  place-items: center;
  padding: 0 26px;
  text-decoration: none;
  border-color: rgba(0, 87, 153, 0.35);
  box-shadow:
    0 5px 0 rgba(0, 42, 74, 0.95),
    0 10px 18px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  transform: translateY(-3px);
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.training-button:hover {
  transform: translateY(-5px);
  box-shadow:
    0 7px 0 rgba(0, 42, 74, 0.95),
    0 14px 24px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.training-button:active {
  transform: translateY(1px);
  box-shadow:
    0 1px 0 rgba(0, 42, 74, 0.95),
    0 6px 12px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.siem-button:hover {
  transform: translateY(-9px);
  box-shadow:
    0 15px 0 #002a4a,
    0 28px 42px rgba(0, 0, 0, 0.50),
    inset 0 2px 0 rgba(255, 255, 255, 0.50);
}

.siem-button:active {
  transform: translateY(2px);
  box-shadow:
    0 4px 0 #002a4a,
    0 10px 20px rgba(0, 0, 0, 0.42),
    inset 0 2px 0 rgba(255, 255, 255, 0.35);
}

.metric-card,
.score-board {
  min-height: 170px;
  padding: 22px;
}

.metric-card.wide,
.score-board,
.rank-list {
  grid-column: 1 / -1;
}

.metric-card strong,
.score-board strong {
  font-size: clamp(1.7rem, 4vw, 3rem);
}

.metric-card p,
.score-board p,
.challenge p {
  color: var(--muted);
  line-height: 1.6;
}

.content .rank-list {
  display: grid;
  gap: 8px;
  background: transparent;
  backdrop-filter: none;
  border: 0;
  padding: 8px 0;
}

#scoreView.active {
  grid-template-columns: minmax(0, 1fr) 209px;
  align-items: start;
}

.ranking-main {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.ranking-main .podium,
.ranking-main .rank-list,
.ranking-main .rank-pager {
  grid-column: auto;
}

.ranking-rules {
  margin-top: 36px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--blue);
  box-shadow:
    0 5px 0 rgba(0, 42, 74, 0.88),
    0 10px 18px rgba(0, 0, 0, 0.18);
}

.ranking-rules h3 {
  margin-bottom: 10px;
  font-size: 1rem;
}

.ranking-rules p,
.ranking-rules li {
  line-height: 1.5;
  font-size: 0.78rem;
}

.ranking-rules ul {
  display: grid;
  gap: 7px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.ranking-rules strong {
  font-weight: 800;
}

.ranking-alert {
  margin-top: 14px;
  padding: 10px;
  border: 1px solid rgba(212, 169, 0, 0.45);
  border-radius: 8px;
  background: rgba(255, 230, 128, 0.65);
  font-weight: 700;
}

.rank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 70%;
  justify-self: center;
  padding: 3px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow:
    0 5px 0 rgba(0, 42, 74, 0.88),
    0 10px 18px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.70);
}

.challenge {
  display: flex;
  gap: 8px;
  min-height: 32px;
  padding: 4px 10px;
  background: #ffffff !important;
  color: var(--blue);
}

#challengesView.active {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.challenge > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 1px solid #8a9199;
  background: #8a9199;
  color: #ffffff;
  font-weight: 800;
  border-radius: 5px;
  font-size: 0.72rem;
}

.challenge.done {
  border-color: rgba(70, 246, 177, 0.5);
}

.challenge.current > span {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.challenge.done > span {
  border-color: #047857;
  background: #047857;
  color: #ffffff;
}

.challenge strong,
.challenge p {
  color: var(--blue);
}

.challenge strong {
  font-size: 0.82rem;
}

.challenge p {
  margin: 1px 0 0;
  font-size: 0.72rem;
  line-height: 1.2;
}

/* ── topbar right ───────────────────────────────────────────────────── */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.settings-btn.sidebar-settings {
  width: 44px;
  min-height: 29px;
  text-align: center;
  padding: 0;
  border: 1px solid var(--line);
  color: var(--blue);
  border-radius: 8px;
  font-size: 0.9rem;
  margin-top: 0;
  flex: 0 0 44px;
}

.sidebar-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

/* ── sidebar avatar ─────────────────────────────────────────────────── */
.side-user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.side-avatar {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: var(--blue);
  color: #ffffff;
  font-weight: 800;
  font-size: 2rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

#currentNickname {
  color: var(--cyan);
  font-size: 0.76rem;
}

/* ── modal ──────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.60);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  width: min(100% - 32px, 380px);
  padding: 24px;
  background: rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.40);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h2 {
  font-size: 1.26rem;
}

.modal-close {
  width: 32px;
  height: 32px;
  min-height: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: 6px;
  font-size: 0.9rem;
  display: grid;
  place-items: center;
}

#profileForm {
  display: grid;
  gap: 9px;
  margin-top: 6px;
}

#profileForm input {
  min-height: 40px;
}

#profileForm .primary-action {
  min-height: 25px;
}

.avatar-preview {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background: var(--blue);
  color: #ffffff;
  font-weight: 800;
  font-size: 3rem;
  display: grid;
  place-items: center;
  margin: 0 auto 10px;
  cursor: pointer;
}

.avatar-colors {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.avatar-color-btn {
  width: 28px;
  height: 28px;
  min-height: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}

.avatar-color-btn.active {
  border-color: #ffffff;
  outline: 2px solid var(--cyan);
  outline-offset: 1px;
}

/* ── podium ─────────────────────────────────────────────────────────── */
.podium {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  padding: 36px 24px 0;
}

.podium-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
}

.podium-avatar {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 2.2rem;
  color: #ffffff;
}

.podium-avatar.empty {
  background: rgba(255, 255, 255, 0.08);
  border: 1px dashed var(--line);
}

.podium-name {
  font-size: 1.64rem;
  color: var(--muted);
  text-align: center;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-block {
  width: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 15px 12px;
  border-radius: 8px 8px 0 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.50);
}

.podium-block.empty { opacity: 0.3; }

.place-1 .podium-block {
  height: 180px;
  border-color: #ffd700;
  background: linear-gradient(180deg, #ffe680, #d4a900);
  color: #1b1400;
}

.place-2 .podium-block {
  height: 135px;
  border-color: #c0c0c0;
  background: linear-gradient(180deg, #f2f2f2, #a9a9a9);
  color: #111111;
}

.place-3 .podium-block {
  height: 105px;
  border-color: #b87333;
  background: linear-gradient(180deg, #d99a5b, #8f4f20);
  color: #ffffff;
}

.podium-medal { font-size: 2.1rem; }

.podium-pts {
  font-size: 1.23rem;
  color: inherit;
}

/* ── rank list (4th+) ───────────────────────────────────────────────── */
.rank-row {
  align-items: center;
}

.rank-position {
  width: 28px;
  text-align: center;
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
}

.rank-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.78rem;
  color: #ffffff;
  flex-shrink: 0;
}

.rank-avatar .avatar-img {
  width: 28px !important;
  height: 28px !important;
}

.rank-name {
  flex: 1;
  color: var(--blue);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-pts {
  color: #d4a900;
  flex-shrink: 0;
  font-size: 0.8rem;
}

.rank-empty {
  padding: 18px 20px;
  color: var(--muted);
}

/* ── challenge points ───────────────────────────────────────────────── */
.challenge-pts {
  margin-left: auto;
  flex-shrink: 0;
  align-self: center;
  color: #d4a900;
  font-weight: 800;
  font-size: 0.76rem;
}


/* ── avatar gallery (settings modal) ───────────────────────────────── */
.avatar-gallery {
  display: grid;
  grid-template-columns: repeat(4, 60px);
  grid-auto-rows: 60px;
  justify-content: center;
  gap: 8px;
  width: 284px;
  max-width: 100%;
  max-height: 196px;
  overflow-y: auto;
  padding: 4px;
  margin: 0 auto 8px;
}

.avatar-gallery-item {
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  border: 2px solid transparent;
  background: none;
  min-height: 0;
}

.avatar-gallery-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.avatar-gallery-item:hover .avatar-gallery-img {
  transform: scale(1.75);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  z-index: 2;
}

.avatar-gallery-item.active {
  border-color: var(--cyan);
  background: rgba(0, 174, 255, 0.10);
}

.avatar-gallery-img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.avatar-gallery-name {
  display: none;
  font-size: 0.68rem;
  color: var(--muted);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.avatar-clear {
  width: fit-content;
  min-width: 106px;
  min-height: 21px;
  font-size: 0.66rem;
  font-weight: 800;
  margin: 0 auto 10px;
  padding: 0 11px;
  display: grid;
  place-items: center;
}

/* ── lightbox ───────────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  cursor: pointer;
}

.lightbox-img {
  width: min(620px, 88vw);
  height: min(620px, 88vw);
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--cyan);
  box-shadow: 0 0 40px rgba(0, 174, 255, 0.30);
}

.lightbox-name {
  position: absolute;
  bottom: calc(50% - min(200px, 44vw));
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  margin-top: 16px;
}

/* ── rank pager ─────────────────────────────────────────────────────── */
.rank-pager {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 0;
}

.rank-pager button {
  min-height: 34px;
  padding: 0 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.10);
  color: var(--text);
  border-radius: 6px;
  font-size: 0.85rem;
}

.rank-pager button:disabled {
  opacity: 0.35;
  cursor: default;
}

.rank-pager span {
  color: var(--muted);
  font-size: 0.82rem;
}

/* ── round avatar images (rank list + podium) ───────────────────────── */
.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
/* ── MFA prompt modal ────────────────────────────────────────────────── */
.mfa-prompt-panel {
  text-align: center;
}

.mfa-prompt-icon {
  font-size: 2.8rem;
  margin-bottom: 10px;
}

.mfa-prompt-title {
  margin: 0 0 10px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}

.mfa-prompt-desc {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0 0 20px;
}

.mfa-prompt-cta {
  width: 100%;
  min-height: 42px;
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.mfa-prompt-skip {
  display: block;
  width: 100%;
  min-height: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 4px 0;
  box-shadow: none;
  transform: none;
  cursor: pointer;
}

.mfa-prompt-skip:hover {
  color: var(--text);
}

/* ── MFA section (settings modal) ───────────────────────────────────── */
.modal-panel {
  max-height: 90vh;
  overflow-y: auto;
}

.mfa-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
}

.mfa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.mfa-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--line);
  text-transform: uppercase;
}

.mfa-badge.active {
  color: var(--ok);
  border-color: rgba(70, 246, 177, 0.4);
  background: rgba(70, 246, 177, 0.08);
}

.mfa-badge.inactive {
  color: var(--muted);
}

.mfa-hint {
  color: var(--muted);
  font-size: 0.84rem;
  margin: 4px 0 8px;
}

.mfa-qr {
  display: block;
  width: 180px;
  height: 180px;
  margin: 0 auto 8px;
  border-radius: 8px;
}

.mfa-secret-line {
  color: var(--muted);
  font-size: 0.78rem;
  margin: 0 0 8px;
  text-align: center;
  overflow-wrap: anywhere;
}

.mfa-secret-line code {
  color: var(--cyan);
  user-select: all;
}

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

.mfa-input {
  min-height: 36px !important;
}

.mfa-btn {
  min-height: 26px !important;
  font-size: 0.82rem;
}

.mfa-danger {
  color: var(--danger) !important;
}

.mfa-controls {
  display: flex;
  gap: 8px;
}

@media (max-width: 900px) {
  .app-panel {
    grid-template-columns: 1fr;
    min-height: calc(100vh - 28px);
  }

  .sidebar {
    min-height: auto;
  }

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

  .logout {
    margin-top: 0;
  }

  #scoreView.active {
    grid-template-columns: 1fr;
  }

  .ranking-rules {
    margin-top: 0;
  }

  #challengesView.active {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .view.active {
    grid-template-columns: 1fr;
  }

  #challengesView.active {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .ip-badge {
    min-width: 0;
  }
}
