/* =========================
   PART HEADER (НЕ ЧІПАЄМО ЛОГІКУ)
   ========================= */

.part-header {
  position: relative;
  width: 100%;
  height: 38vh;
  overflow: hidden;
  border-radius: 0 0 14px 14px;
}

.part-header img.bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: none;
}

body.theme-dark .part-header img.bg {
  filter: brightness(60%);
}


.part-header .overlay {
  position: absolute;
  bottom: 8%;
  left: 5%;
  color: white;
}

.part-header h1 {
  margin: 0;
  font-size: 2.8rem;
  font-weight: 700;
}

.part-header p.sub {
  margin-top: 6px;
  font-size: 1.2rem;
  color: #e0e0e0;
}

.part-header p.desc {
  margin-top: 10px;
  font-size: 1rem;
  max-width: 600px;
  color: #d8d8d8;
}

/* back */
.header-back {
  position: absolute;
  top: 16px;
  left: 16px;
}

/* =========================
   CONTENT UNDER HEADER (НЕ ЧІПАЄМО)
   ========================= */

.universe-content {
  max-width: 1200px;
  margin: 24px auto 32px;
  padding: 0 16px;
}

.universe-content h2 {
  margin: 0 0 12px;
  font-size: 1.4rem;
}

.parts-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

/* =========================
   USER HEADER THEME TOKENS
   (підлаштовуємо під theme-dark / theme-light)
   ========================= */

body.theme-dark {
  --uh-text: var(--text, #fff);
  --uh-pill-bg: rgba(0, 0, 0, .22);
  --uh-pill-border: rgba(255, 255, 255, .14);

  --uh-dd-bg: rgba(15, 15, 15, .92);
  --uh-dd-border: rgba(255, 255, 255, .10);
  --uh-dd-item-hover: rgba(255, 255, 255, .10);
}

body.theme-light {
  --uh-text: var(--text, #111);
  --uh-pill-bg: rgba(255, 255, 255, .78);
  --uh-pill-border: rgba(0, 0, 0, .14);

  --uh-dd-bg: rgba(255, 255, 255, .92);
  --uh-dd-border: rgba(0, 0, 0, .12);
  --uh-dd-item-hover: rgba(0, 0, 0, .06);
}

/* якщо тема не проставилась - запасні */
:root {
  --uh-text: #fff;
  --uh-pill-bg: rgba(0, 0, 0, .22);
  --uh-pill-border: rgba(255, 255, 255, .14);

  --uh-dd-bg: rgba(15, 15, 15, .92);
  --uh-dd-border: rgba(255, 255, 255, .10);
  --uh-dd-item-hover: rgba(255, 255, 255, .10);
}

/* =========================
   HEADER ADMIN (ТВОЯ РОБОЧА СХЕМА, БЕЗ ДУБЛІКАТІВ)
   ========================= */

.header-admin {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 60;

  background: transparent;
  padding: 0;
  border-radius: 0;
}

/* рядок хедера */
.header-admin .user-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.header-admin .user-header {
  display: inline-flex;
  align-items: center;
  gap: 10px;

  padding: 6px 10px;
  border-radius: 14px;

  /* вигляд як panel / part */
  background: var(--uh-pill-bg);
  border: 1px solid var(--uh-pill-border);

}

/* роль */
.header-admin .user-header-role {
  font-weight: 800;
  font-size: 0.92rem;
  white-space: nowrap;
  color: var(--uh-text);
}

/* ряд кнопок */
.header-admin .uh-admin-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* прибираємо | */
.header-admin .sep {
  display: none;
}

/* ===== кнопки (вигляд як на part-кнопках) ===== */
.header-admin a.uh-btn,
.header-admin a.uh-btn:visited {
  text-decoration: none !important;
  color: var(--uh-text) !important;
}

/* pills: (працює і для <a>, і для кнопки меню) */
.header-admin .btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 8px 12px;
  border-radius: 14px;

  background: var(--uh-pill-bg);
  border: 1px solid var(--uh-pill-border);

  color: var(--uh-text) !important;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1;

  cursor: pointer;
  user-select: none;
  white-space: nowrap;

  transition: background-color .2s ease, border-color .2s ease, transform .08s ease;
}

.header-admin .btn-pill:active {
  transform: translateY(1px);
}

/* ===== правий меню-блок (relative + absolute dropdown) ===== */
.header-admin .user-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* toggle */
.header-admin .user-menu-toggle {
  border: none;
  font: inherit;
  background: transparent;
}

/* dropdown - абсолютний під кнопкою */
.header-admin .user-menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);

  min-width: 220px;
  padding: 6px 0;
  border-radius: 14px;

  background: var(--uh-dd-bg);
  border: 1px solid var(--uh-dd-border);
  color: var(--uh-text);

  box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  z-index: 9999;
  overflow: hidden;
}

.header-admin .user-menu-dropdown a {
  display: block;
  padding: 8px 12px;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  font-weight: 600;
  font-size: .92rem;
}

.header-admin .user-menu-dropdown a:hover {
  background: var(--uh-dd-item-hover);
}

/* показ */
.header-admin .user-menu.open .user-menu-dropdown {
  display: block;
}

/* ===== адаптив: щоб не розривало стрічку ===== */
@media (max-width: 900px) {
  .header-admin .user-header {
    max-width: 92vw;
  }

  .header-admin .btn-pill {
    padding: 7px 10px;
    font-size: .9rem;
  }
}

@media (max-width: 520px) {
  .header-admin .user-header {
    gap: 8px;
    padding: 7px 8px;
  }

  .header-admin .btn-pill {
    padding: 6px 9px;
    border-radius: 12px;
    font-size: .88rem;
  }
}


.uh-is-hidden {
  display: none !important;
}

.part-header .overlay h1,
.part-header .overlay p {
  text-shadow:
    /* outline */
    -1px -1px 0 #1d13321b,
    1px -1px 0 #1d13321b,
    -1px 1px 0 #1d13321b,
    1px 1px 0 #1d13321b,

    /* glow */
    0 0 6px rgba(0, 0, 0, .85),
    0 0 12px rgba(0, 0, 0, .55);
}


.part-header .overlay h1,
.part-header .overlay p {
  transition: text-shadow .25s ease;
}

/* ===== Language switch ===== */

.lang-switch{
  position: relative;
  display: inline-flex;
}

.js-lang-native-select{
  display:none;
}

.lang-switch-dropdown{
  position:absolute;
  top:calc(100% + 6px);
  left:0;

  min-width:160px;
  padding:6px;

  border-radius:12px;
  border:1px solid rgba(0,0,0,.12);

  background:var(--panel, #fff);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);

  box-shadow:0 12px 28px rgba(0,0,0,.15);

  display:none;
  flex-direction:column;
  gap:4px;

  z-index:200;
}

.lang-switch.open .lang-switch-dropdown{
  display:flex;
}

.lang-switch-option{
  appearance:none;
  border:0;

  background:transparent;
  color:var(--text,#111);

  text-align:left;
  padding:7px 10px;

  border-radius:8px;

  font-size:13px;
  font-weight:600;

  cursor:pointer;
}

.lang-switch-option:hover{
  background:rgba(0,0,0,.06);
}

body.theme-dark .lang-switch-option:hover{
  background:rgba(255,255,255,.08);
}

.lang-switch-option.is-active{
  background:rgba(37,99,235,.12);
}

/* =========================
   Guest auth links
   Styled closer to figureinfo.css pills / back button
   ========================= */

.guest-links {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.guest-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  padding: 8px 14px;
  border-radius: 999px;

  text-decoration: none;
  font-weight: 700;
  font-size: .92rem;
  line-height: 1;

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  transition:
    background-color .2s ease,
    border-color .2s ease,
    color .2s ease,
    transform .08s ease,
    box-shadow .2s ease;
}

/* dark theme */
body.theme-dark .guest-pill {
  background: rgba(0, 0, 0, .55);
  border: 1px solid rgba(120, 120, 120, .55);
  color: #fff;
}

body.theme-dark .guest-pill:hover {
  background: rgba(0, 0, 0, .72);
  border-color: rgba(160, 160, 160, .65);
}

/* light theme */
body.theme-light .guest-pill {
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(140, 140, 140, .40);
  color: #111;
}

body.theme-light .guest-pill:hover {
  background: rgba(255, 255, 255, .92);
  border-color: rgba(160, 160, 160, .52);
}

.guest-pill:active {
  transform: translateY(1px);
}

.guest-pill:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .18);
}

/* primary register button */
/* DARK */
body.theme-dark .guest-pill-primary {
  background: rgba(34, 197, 94, 0.92);
  border-color: rgba(34, 197, 94, 0.95);
  color: #fff;
}

body.theme-dark .guest-pill-primary:hover {
  background: rgba(22, 163, 74, 0.96);
  border-color: rgba(22, 163, 74, 0.98);
}

/* LIGHT */
body.theme-light .guest-pill-primary {
  background: rgba(34, 197, 94, 0.95);
  border-color: rgba(34, 197, 94, 0.95);
  color: #fff;
}

body.theme-light .guest-pill-primary:hover {
  background: rgba(22, 163, 74, 0.98);
  border-color: rgba(22, 163, 74, 0.98);
}

@media (max-width: 640px) {
  .guest-links {
    gap: 6px;
  }

  .guest-pill {
    padding: 7px 12px;
    font-size: .88rem;
  }
}