/* ===== Base ===== */
:root {
  --accent: #5715db;
  --accent-strong: #5715db;
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --text: #111111;
  --text-muted: #555555;
  --surface: #ffffff;
  --surface-soft: #f4f6fb;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
  --footer-icon-filter: none;
}

:root[data-theme="dark"] {
  --accent: #5715db;
  --accent-strong: #5715db;
  --bg: #0f0f0f;
  --bg-soft: #141414;
  --text: #ededed;
  --text-muted: #b0b0b0;
  --surface: #1a1a1a;
  --surface-soft: #232323;
  --line: #323232;
  --line-strong: #3f3f3f;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.4);
  --footer-icon-filter: invert(1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-top: 70px;
}

/* Shared centered loading spinner */
.center-loading {
  width: 100%;
  min-height: 140px;
  padding: 20px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.center-loading--compact {
  min-height: 72px;
  padding: 8px 0;
}

.center-loading-spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 8px solid #c5cad3;
  border-top-color: #ffffff;
  animation: center-loading-spin 0.9s linear infinite;
  box-shadow: none;
}

.center-loading-spinner--sm {
  width: 40px;
  height: 40px;
  border-width: 6px;
}

@keyframes center-loading-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.inline-loading-note {
  width: 100%;
  min-height: 140px;
  padding: 20px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
}

.inline-loading-note--compact {
  min-height: 72px;
  padding: 8px 0;
  font-size: 13px;
}

/* Global top loading bar for backend requests */
.global-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 14000;
  transition: opacity 0.16s ease, visibility 0.16s ease;
}

.global-loading-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.global-loading-overlay__track {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: rgba(79, 70, 229, 0.12);
}

.global-loading-overlay__bar {
  position: absolute;
  top: 0;
  left: 0;
  width: clamp(120px, 28vw, 260px);
  height: 100%;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  box-shadow: 0 0 18px rgba(79, 70, 229, 0.32);
  animation: global-loading-slide 1.05s ease-in-out infinite;
}

@keyframes global-loading-slide {
  0% {
    transform: translate3d(-100%, 0, 0) scaleX(0.72);
  }
  55% {
    transform: translate3d(52vw, 0, 0) scaleX(1);
  }
  100% {
    transform: translate3d(100vw, 0, 0) scaleX(0.82);
  }
}

@keyframes page-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes detail-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: no-preference) {
  main {
    animation: page-enter 0.45s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  }

  .d-card.is-mounted {
    animation: detail-enter 0.52s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  }

  :root.theme-animating body,
  :root.theme-animating .navbar,
  :root.theme-animating .theme-btn,
  :root.theme-animating .settings-trigger-btn,
  :root.theme-animating .profile-trigger-btn,
  :root.theme-animating .menu-btn,
  :root.theme-animating .lang-switch,
  :root.theme-animating .profile-card,
  :root.theme-animating .profile-input,
  :root.theme-animating .profile-name-input,
  :root.theme-animating .profile-block,
  :root.theme-animating .profile-exam-item,
  :root.theme-animating .lang-item,
  :root.theme-animating .custom-select-trigger,
  :root.theme-animating .custom-options,
  :root.theme-animating .custom-option,
  :root.theme-animating .site-footer,
  :root.theme-animating .hero-section,
  :root.theme-animating .stats-section,
  :root.theme-animating .feature-box,
  :root.theme-animating .mockup-card,
  :root.theme-animating .u-card,
  :root.theme-animating .uni-card,
  :root.theme-animating .u-panel,
  :root.theme-animating .u-input,
  :root.theme-animating .u-select,
  :root.theme-animating .u-reset,
  :root.theme-animating .page-btn,
  :root.theme-animating .view-toggles,
  :root.theme-animating .rank-card,
  :root.theme-animating .rank-badge,
  :root.theme-animating .d-card,
  :root.theme-animating .d-box,
  :root.theme-animating .track-card,
  :root.theme-animating .roi-box,
  :root.theme-animating .chance-panel,
  :root.theme-animating .finance-card,
  :root.theme-animating .total-price-card,
  :root.theme-animating .scholarship-card,
  :root.theme-animating .program-card {
    transition:
      background-color 0.2s ease,
      color 0.2s ease,
      border-color 0.2s ease;
  }
}

a {
  text-decoration: none;
  color: inherit;
}

:where(a[href], button, input, select, textarea, [role="button"], .custom-select-trigger):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

html, body {
  /* overflow-x: removed to allow sticky position */
  width: 100%;        /* Keeps the layout within the viewport width */
  position: relative; /* Stabilizes positioning */
}

/* ===== Navbar ===== */
/* ===== Navbar (same on all pages) ===== */
.navbar{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  height: 70px;
  width: 100%;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0 40px;
  box-sizing: border-box;

  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  z-index: 1000;
}

.navbar-left,
.navbar-center,
.navbar-right{
  display: flex;
  align-items: center;
}

.navbar-logo-link {
  display: flex;
  align-items: center;
}

.lang-control {
  display: flex;
  align-items: center;
  margin-right: 8px;
}

.navbar-center{
  gap: 30px;
  padding: 0 30px;
  justify-content: left;
  flex: 1;
}

.navbar-center a{
  font-weight: 600;
  color: var(--text-muted);
}

.navbar-center a:hover{
  color: var(--accent);
}

.navbar-center a.is-active{
  color: var(--accent);
}

:root[data-theme="dark"] .navbar-center a.is-active{
  color: var(--accent);
}

.logo{
  height: 42px;
  width: auto;
  object-fit: contain;
}

.profile-trigger-btn,
.settings-trigger-btn{
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  cursor: pointer;
}

.profile-trigger-btn:hover,
.settings-trigger-btn:hover{
  border-color: var(--accent);
  color: var(--accent);
}

.theme-btn {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  margin-right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  cursor: pointer;
}

.theme-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.lang-switch-wrap {
  display: block;
  width: auto;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0;
}

.lang-switch {
  height: 38px;
  width: 72px;
  min-width: 72px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  padding: 0 10px;
  margin-right: 0;
}

.lang-switch:hover {
  border-color: var(--accent);
}

.navbar-right .lang-control .custom-select-wrapper {
  width: 80px;
  margin-right: 0;
}

.navbar-right .lang-control .custom-select-trigger {
  width: 80px;
  min-height: 38px;
  padding: 0 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  justify-content: center;
  align-items: center;
  gap: 6px;
  background: var(--surface-soft);
  line-height: 1;
}

.settings-trigger-btn {
  margin-right: 8px;
}

.navbar-right .lang-control .custom-select-trigger::after {
  width: 8px;
  height: 5px;
  position: static;
  display: inline-block;
  flex: 0 0 auto;
  transform: none;
}

.navbar-right .lang-control .custom-select-wrapper.open .custom-select-trigger::after {
  transform: rotate(180deg);
}

.navbar-right .lang-control .custom-select-trigger--language span {
  display: inline;
}

.navbar-right .lang-control .custom-select-trigger--language .custom-select-trigger-content {
  align-items: center;
  flex: 0 1 auto;
  gap: 5px;
  max-width: none;
}

.navbar-right .lang-control .custom-select-trigger--language .custom-select-trigger-content span {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: max-content;
  line-height: 1;
  overflow: visible;
  text-overflow: clip;
}

.navbar-right .lang-control .custom-options {
  left: 50%;
  right: auto;
  min-width: 170px;
  width: max-content;
  transform: translateX(-50%) translateY(-10px);
}

.navbar-right .lang-control .custom-select-wrapper.open .custom-options {
  transform: translateX(-50%) translateY(0);
}

.navbar-right .lang-control .custom-option {
  white-space: nowrap;
}

.menu-btn {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  line-height: 1;
}

.menu-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Auto-compact navbar layout when one-row navigation does not fit */
.navbar.is-compact {
  height: auto;
  padding: 10px 20px;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.navbar.is-compact .navbar-left {
  order: 1;
  width: 100%;
  flex: 0 0 100%;
  justify-content: center;
}

.navbar.is-compact .navbar-left > a {
  justify-content: center;
}

.navbar.is-compact .navbar-right {
  order: 2;
  width: 100%;
  flex: 0 0 100%;
  justify-content: center;
  margin-left: 0;
  gap: 8px;
}

.navbar.is-compact .navbar-center {
  order: 3;
  width: 100%;
  flex: 0 0 100%;
  margin: 5px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
  justify-content: center;
  gap: 15px;
}

/* ===== Profile Modal ===== */
.profile-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 12px; /* Adds breathing room on small screens */
}

.profile-modal.is-open {
  display: flex;
}

.profile-modal.is-open .profile-backdrop {
  animation: motion-backdrop-in var(--motion-medium) var(--motion-ease-standard) both;
}

.settings-modal.is-open .settings-backdrop {
  animation: motion-backdrop-in var(--motion-medium) var(--motion-ease-standard) both;
}

.profile-modal.is-open .profile-card,
.settings-modal.is-open .settings-card,
.profile-confirm-modal.is-open .profile-confirm-card {
  animation: motion-modal-in var(--motion-medium) var(--motion-ease-enter) both;
}

.profile-modal.is-closing .profile-backdrop {
  animation: motion-backdrop-out var(--motion-fast) var(--motion-ease-exit) forwards;
}

.profile-confirm-modal.is-closing .profile-confirm-backdrop {
  animation: motion-backdrop-out var(--motion-fast) var(--motion-ease-exit) forwards;
}

.profile-modal.is-closing .profile-card,
.settings-modal.is-closing .settings-card,
.profile-confirm-modal.is-closing .profile-confirm-card {
  animation: motion-modal-out var(--motion-fast) var(--motion-ease-exit) forwards;
}

.profile-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45); /* Backdrop dimming via a separate layer */
}

/* Modal shell */
.profile-card{
  position: relative;
  width: min(760px, 96vw);      /* Slightly wider on large screens */
  max-height: 92vh;             /* Prevents overflow beyond the viewport */
  background: var(--surface-solid);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  z-index: 1;

  display: flex;                /* Keeps header fixed while body scrolls */
  flex-direction: column;
  overflow: hidden;             /* Lets inner scrolling behave cleanly */
}

.profile-header{
  padding: 22px 22px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.profile-title{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-username{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  max-width: 100%;
  overflow: hidden;
}

.profile-subtitle{
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.profile-name-input{
  display: none;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 16px;
  min-width: 180px;
  outline: none;
  background: var(--surface);
  color: var(--text);
}

.profile-name-input:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(128, 128, 128, 0.16);
}

.profile-username.is-editing #profileNameDisplay{
  display: none;
}

.profile-username.is-editing .profile-name-input{
  display: inline-flex;
}

.icon-btn{
  border: none;
  background: var(--surface-soft);
  color: var(--accent);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn svg{
  width: 18px;
  height: 18px;
  display: block;
}

.ui-icon {
  width: 1em;
  height: 1em;
  display: block;
  flex: 0 0 auto;
  overflow: visible;
}

[data-heroicon] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  flex: 0 0 auto;
  vertical-align: middle;
}

.ui-icon--14 {
  width: 14px;
  height: 14px;
}

.ui-icon--16 {
  width: 16px;
  height: 16px;
}

.ui-icon--18 {
  width: 18px;
  height: 18px;
}

.ui-icon--20 {
  width: 20px;
  height: 20px;
}

.ui-icon--22 {
  width: 22px;
  height: 22px;
}

.ui-icon--24 {
  width: 24px;
  height: 24px;
}

.icon-btn:hover{
  background: var(--line);
}

.profile-close{
  background: var(--surface-soft);
  color: var(--text-muted);
}

.profile-close:hover{
  background: var(--line);
}

/* Content scrolls inside the modal */
.profile-body{
  padding: 16px 22px 22px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  display: grid;
  gap: 18px;
}

.profile-field{
  display: grid;
  gap: 8px;
}

.profile-label{
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.profile-label-row{
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-info-wrap{
  position: relative;
  display: inline-flex;
  align-items: center;
}

.profile-info{
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  box-sizing: border-box;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-soft);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex: 0 0 auto;
  line-height: 0;
  padding: 0;
  cursor: pointer;
  appearance: none;
}

.profile-info > *{
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  line-height: 0;
}

.profile-info .ui-icon{
  width: 14px;
  height: 14px;
  display: block;
}

.profile-info:hover,
.profile-info:focus-visible{
  outline: none;
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(87, 21, 219, 0.08);
}

.profile-tooltip{
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  width: min(320px, 78vw);
  background: #101010;
  color: #f5f5f5;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  z-index: 40;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  overflow-wrap: anywhere;
}

.profile-tooltip strong{
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
}

.profile-tooltip span{
  display: block;
}

.profile-info-wrap:hover .profile-tooltip,
.profile-info-wrap:focus-within .profile-tooltip,
.profile-info-wrap.is-open .profile-tooltip{
  opacity: 1;
  transform: translateY(0);
}

.profile-input{
  width: 100%;
  box-sizing: border-box;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

.profile-input:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(128, 128, 128, 0.16);
}

.profile-input--select {
  cursor: pointer;
}

.profile-budget {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.profile-budget--with-unit {
  grid-template-columns: minmax(0, 1fr) auto;
}

.profile-unit{
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: 10px;
  white-space: nowrap;
}

.profile-hint{
  font-size: 12px;
  color: var(--text-muted);
}

.profile-budget-grant-hint{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #f5d58b;
  border-radius: 10px;
  background: #fff8e6;
  color: #8a5208;
  font-size: 12px;
  line-height: 1.35;
}

.profile-budget-grant-hint[hidden]{
  display: none !important;
}

.profile-budget-grant-hint__text{
  flex: 1 1 auto;
}

.profile-budget-grant-hint__actions{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.profile-budget-grant-hint__cta{
  border: 1px solid rgba(87, 21, 219, 0.28);
  background: rgba(87, 21, 219, 0.08);
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.profile-budget-grant-hint__cta:hover{
  background: rgba(87, 21, 219, 0.14);
}

.profile-budget-grant-hint__dismiss{
  width: 22px;
  height: 22px;
  border: 1px solid #e7d2a1;
  border-radius: 999px;
  background: #fff;
  color: #9a6a18;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.profile-budget-grant-hint__dismiss .ui-icon{
  width: 14px;
  height: 14px;
}

.profile-budget-grant-hint__dismiss:hover{
  background: #fff3d4;
}

.profile-exam-form{
  display: grid;
  grid-template-columns: 1.2fr 0.8fr auto;
  gap: 10px;
  align-items: end;
}

.profile-exam-form--with-special{
  grid-template-columns: minmax(180px, 1.05fr) minmax(280px, 1.45fr) auto;
  align-items: end;
}

.profile-exam-form--with-special.profile-exam-form--grades{
  grid-template-columns: minmax(150px, 0.95fr) minmax(430px, 2.4fr) auto;
}

.profile-exam-form--with-special.profile-exam-form--breakdown{
  grid-template-columns: minmax(170px, 0.95fr) minmax(420px, 2.5fr) auto;
}

.profile-exam-form--no-score{
  grid-template-columns: 1fr auto;
}

.profile-exam-special{
  min-width: 0;
}

.profile-exam-special-grid{
  display: grid;
  gap: 8px;
}

.profile-exam-special-grid--grades{
  grid-template-columns: repeat(4, minmax(96px, 1fr));
  column-gap: 10px;
  row-gap: 8px;
}

.profile-exam-special-  .guide-layout{
    display: block; /* Stack naturally to allow sidebar to stick over content */
  }

.profile-exam-special-grid--grades .profile-input{
  min-height: 45px;
  padding-top: 11px;
  padding-bottom: 11px;
}

.profile-exam-special-grid--grades .mini-label{
  min-height: 32px;
  display: flex;
  align-items: end;
}

.profile-exam-special-field{
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.profile-exam-special-field--inline{
  justify-content: end;
}

.profile-exam-special-field--inline .profile-input{
  min-width: 160px;
}

.profile-exam-special-hint{
  grid-column: 1 / -1;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
}

.profile-exam-breakdown-row{
  display: grid;
  grid-template-columns: minmax(170px, 0.95fr) minmax(180px, 1.05fr);
  gap: 10px;
  align-items: end;
}

.profile-exam-breakdown-subject,
.profile-exam-breakdown-score{
  min-width: 0;
}

.profile-exam-breakdown-chip{
  min-height: 45px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--text);
}

.profile-exam-breakdown-empty{
  min-height: 45px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px dashed var(--line);
  color: var(--text-muted);
  background: var(--bg-soft);
}

.track-exam-entry-group{
  display: grid;
  gap: 6px;
  padding: 8px 0;
}

.track-exam-entry-group + .track-exam-entry-group{
  border-top: 1px dashed var(--line);
  margin-top: 6px;
}

.track-exam-entry-group-title{
  color: var(--text);
}

.track-exam-entry-group-list{
  display: grid;
  gap: 4px;
}

.profile-exam-form .profile-add{
  align-self: end;
}

.mini-label--hidden{
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.profile-add{
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background-color var(--motion-fast) var(--motion-ease-standard),
    transform var(--motion-fast) var(--motion-ease-standard),
    box-shadow var(--motion-fast) var(--motion-ease-standard);
}

/* ===== Settings Modal ===== */
.settings-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  padding: 16px;
}

.settings-modal.is-open {
  display: flex;
}

.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.settings-card {
  position: relative;
  z-index: 1;
  width: min(680px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  padding: 20px;
  display: grid;
  gap: 18px;
}

.settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.settings-header h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.settings-header p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.settings-list {
  display: grid;
  gap: 12px;
}

.settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.settings-copy h3 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.3;
}

.settings-copy p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.settings-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.settings-switch-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.settings-switch-track {
  position: relative;
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-solid);
  transition:
    background-color var(--motion-fast) var(--motion-ease-standard),
    border-color var(--motion-fast) var(--motion-ease-standard);
}

.settings-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--text-muted);
  transition:
    transform var(--motion-fast) var(--motion-ease-standard),
    background-color var(--motion-fast) var(--motion-ease-standard);
}

.settings-switch-input:checked + .settings-switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.settings-switch-input:checked + .settings-switch-track .settings-switch-thumb {
  transform: translateX(20px);
  background: #ffffff;
}

.settings-switch-input:focus-visible + .settings-switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.settings-switch-text {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .settings-card {
    width: min(100%, 96vw);
    padding: 16px;
  }

  .settings-row {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }
}

.profile-add:hover{
  background: var(--accent-strong);
}

.profile-add--small{
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 13px;
}

.profile-add--secondary{
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--line-strong);
}

.profile-add--secondary:hover{
  background: var(--line);
}

.profile-interests-actions{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.profile-interests-warning{
  margin-top: 6px;
  color: #b45309;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 600;
}

:root[data-theme="dark"] .profile-interests-warning{
  color: #fbbf24;
}

:root[data-theme="dark"] .profile-info{
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  color: #c9c9d6;
}

:root[data-theme="dark"] .profile-info:hover,
:root[data-theme="dark"] .profile-info:focus-visible{
  background: rgba(124, 92, 255, 0.16);
  border-color: rgba(124, 92, 255, 0.36);
  color: #d8cbff;
}

:root[data-theme="dark"] .profile-tooltip{
  background: #18181c;
  color: #f5f5f5;
}

:root[data-theme="dark"] .profile-budget-grant-hint{
  border-color: #5a4a24;
  background: #2a2418;
  color: #f5c76c;
}

:root[data-theme="dark"] .profile-budget-grant-hint__cta{
  border-color: rgba(167, 139, 250, 0.35);
  background: rgba(167, 139, 250, 0.14);
  color: #d8b4fe;
}

:root[data-theme="dark"] .profile-budget-grant-hint__dismiss{
  border-color: #6b572b;
  background: #1f1b13;
  color: #f5c76c;
}

:root[data-theme="dark"] .profile-delete--danger{
  border-color: rgba(248, 113, 113, 0.28);
  background: rgba(127, 29, 29, 0.28);
  color: #fecaca;
}

:root[data-theme="dark"] .profile-delete--danger:hover{
  border-color: rgba(248, 113, 113, 0.42);
  background: rgba(153, 27, 27, 0.38);
  color: #fee2e2;
}

.profile-interests-status{
  font-size: 12px;
  font-weight: 700;
  color: #15803d;
  transform: translateY(-3px);
}

.profile-interests-status.is-dirty{
  color: #b45309;
}

.profile-actions{
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  bottom: 0;
  z-index: 4;
  background: linear-gradient(180deg, rgba(255,255,255,0), var(--surface-solid) 30%);
}

.profile-progress {
  margin: 0 22px 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
}

.profile-section-tabs {
  margin: 0 22px 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.profile-section-tab {
  position: relative;
  min-width: 0;
  min-height: 42px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  line-height: 1.1;
  font-weight: 800;
  padding: 10px 0 12px;
  cursor: pointer;
  transition:
    color var(--motion-fast) var(--motion-ease-standard),
    transform var(--motion-fast) var(--motion-ease-standard);
}

.profile-section-tab:hover {
  color: var(--text);
}

.profile-section-tab.is-active {
  background: transparent;
  color: var(--accent);
  box-shadow: none;
}

[data-profile-section].is-motion-active {
  animation: motion-fade-lift-enter var(--motion-medium) var(--motion-ease-enter) both;
}

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

.profile-interest-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.profile-interest-chips button {
  min-height: 40px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition:
    border-color var(--motion-fast) var(--motion-ease-standard),
    background-color var(--motion-fast) var(--motion-ease-standard),
    transform var(--motion-fast) var(--motion-ease-standard);
}

.profile-interest-chips button:hover {
  border-color: var(--accent);
}

.profile-save-state{
  font-size: 12px;
  font-weight: 700;
  color: #15803d;
}

.profile-save-state.is-dirty{
  color: #b45309;
}

.profile-save-state.motion-state-pulse {
  display: inline-flex;
  border-radius: 999px;
}

#saveProfileBtn[disabled]{
  cursor: not-allowed;
  opacity: 0.6;
}

.profile-reset-zone{
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.profile-reset-copy{
  display: grid;
  gap: 6px;
  max-width: 420px;
}

.profile-reset-copy strong{
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

.profile-reset-copy span{
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

.profile-delete--danger{
  border-color: #dc2626;
  background: #fee2e2;
  color: #991b1b;
}

.profile-delete--danger:hover{
  border-color: #b91c1c;
  background: #fecaca;
  color: #7f1d1d;
}

.profile-confirm-modal{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10010;
}

.profile-confirm-modal.is-open{
  display: flex;
}

.profile-confirm-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
}

.profile-confirm-card{
  position: relative;
  z-index: 1;
  width: min(560px, 92vw);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.28);
  display: grid;
  gap: 12px;
}

.profile-confirm-card h3{
  margin: 0;
  font-size: 18px;
}

.profile-confirm-card p{
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.45;
}

.profile-confirm-actions{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-confirm-actions .profile-delete,
.profile-confirm-actions .profile-add{
  min-height: 44px;
  padding: 12px 16px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#profileResetModal .profile-confirm-actions .profile-delete,
#profileResetModal .profile-confirm-actions .profile-add{
  width: 160px;
  min-width: 160px;
  flex: 0 0 160px;
}

.profile-error{
  min-height: 18px;
  font-size: 12px;
  color: #d21e1e;
}

.profile-error--username{
  margin: -4px 0 6px;
}

.profile-exam-list{
  display: grid;
  gap: 10px;
}

.profile-exam-item{
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  box-shadow: 0 6px 14px rgba(0,0,0,0.04);
  transform-origin: center;
}

.profile-exam-meta{
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-exam-name{
  font-weight: 700;
  color: var(--text);
}

.profile-exam-score{
  font-size: 12px;
  color: var(--text-muted);
}

.profile-delete{
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  transition:
    border-color var(--motion-fast) var(--motion-ease-standard),
    color var(--motion-fast) var(--motion-ease-standard),
    background-color var(--motion-fast) var(--motion-ease-standard),
    transform var(--motion-fast) var(--motion-ease-standard);
}

.profile-delete:hover{
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== Languages block ===== */
.profile-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 14px 12px;
  background: var(--surface-soft);
}

.profile-block-head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.profile-block h3{
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.mini-label{
  display:block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0 0 6px;
}

.lang-add-grid{
  display: grid;
  grid-template-columns: 1fr 0.9fr 0.9fr 1.2fr auto;
  gap: 10px;
  align-items: end;
}

.profile-lang-conditional {
  display: none;
}

.lang-add-grid .profile-exam-special{
  grid-column: 1 / -1;
}

.lang-actions{
  display:flex;
  justify-content:flex-end;
}

.lang-exam-grid{
  display:grid;
  grid-template-columns: 1fr 0.7fr;
  gap: 10px;
}

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

.lang-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 6px 14px rgba(0,0,0,0.04);
  transform-origin: center;
}

.lang-item strong{
  color: var(--text);
}

.lang-item small{
  color: var(--text-muted);
}

.lang-item button{
  cursor: pointer;
}

/* --- TOAST NOTIFICATIONS --- */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  min-width: 250px;
  max-width: 350px;
  animation: slideIn var(--motion-medium) var(--motion-ease-enter) forwards;
  pointer-events: auto;
  border-left: 4px solid var(--accent);
}

.toast.error {
  border-left-color: #ef4444;
  background: #fef2f2;
  color: #991b1b;
}

.toast.success {
  border-left-color: #10b981;
  background: #ecfdf5;
  color: #065f46;
}

.toast-message {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.toast-message span:last-child {
  min-width: 0;
}

.toast-icon {
  flex: 0 0 auto;
}

.toast-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  padding: 0;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toast-close .ui-icon{
  width: 16px;
  height: 16px;
}
.toast-close:hover { opacity: 1; }

.profile-username .icon-btn{
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.profile-username .icon-btn .ui-icon{
  width: 16px;
  height: 16px;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  to { transform: translateX(100%); opacity: 0; }
}

/* ===== Hero ===== */
.hero {
  padding: 120px 20px 80px;
  text-align: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #ffffff;
}

.hero h1 {
  font-size: 44px;
  margin-bottom: 20px;
}

.hero p {
  font-size: 20px;
  max-width: 900px;
  margin: 0 auto 30px;
}

.hero-btn {
  display: inline-block;
  background: #ffffff;
  color: var(--accent);
  padding: 14px 26px;
  border-radius: 10px;
  font-weight: 800;
}

.hero-btn:hover {
  background: #f0f0f0;
}

/* ===== Features ===== */
.features {
  max-width: 1100px;
  margin: 60px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.feature-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  text-align: center;
}

.feature-card h3 {
  color: var(--accent);
  margin-bottom: 10px;
}

/* --- Custom Select (Global dropdown styles) --- */
.custom-select-wrapper {
  position: relative;
  width: 100%;
  min-width: 0;
  user-select: none;
}

.u-select-hidden {
  display: none !important;
}

.custom-select-trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  min-height: 43px;
  padding: 12px;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 400;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition:
    border-color var(--motion-fast) var(--motion-ease-standard),
    background-color var(--motion-fast) var(--motion-ease-standard),
    color var(--motion-fast) var(--motion-ease-standard),
    box-shadow var(--motion-fast) var(--motion-ease-standard);
}

.custom-select-trigger:hover {
  border-color: var(--accent);
}

.custom-select-trigger::after {
  content: '';
  width: 10px;
  height: 6px;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.custom-select-trigger > span,
.custom-select-trigger-content span {
  display: block;
  min-width: 0;
  line-height: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-wrapper.open .custom-select-trigger::after {
  transform: rotate(180deg);
}

.custom-options {
  position: absolute;
  display: block;
  top: 100%;
  left: 0;
  right: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.1);
  background: var(--surface);
  transition:
    opacity var(--motion-fast) var(--motion-ease-standard),
    visibility var(--motion-fast) var(--motion-ease-standard),
    transform var(--motion-fast) var(--motion-ease-enter);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-10px);
  z-index: 9999;
  max-height: 200px;
  overflow-x: hidden;
  overflow-y: auto;
  margin-top: 5px;
}

.custom-select-wrapper.open .custom-options {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transform: translateY(0);
}

.custom-option {
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition:
    background-color var(--motion-fast) var(--motion-ease-standard),
    color var(--motion-fast) var(--motion-ease-standard),
    transform var(--motion-fast) var(--motion-ease-standard);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.custom-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.custom-option:hover {
  background-color: var(--surface-soft);
  color: var(--accent);
  transform: translateX(2px);
}

.custom-option.selected {
  background-color: rgba(87, 21, 219, 0.05);
  font-weight: 600;
  color: var(--accent);
}

.custom-option.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.custom-option.is-disabled:hover {
  background-color: transparent;
  color: var(--text);
}

.custom-select-trigger-content {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.custom-select-trigger-content--compact {
  gap: 6px;
}

.custom-option img, .custom-select-trigger img {
  width: 24px;
  height: 18px;
  flex: 0 0 auto;
  display: inline-block;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.flag-icon-inline {
  width: 24px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Footer block */
.site-footer {
    background-color: var(--surface-soft);
    padding: 20px 0;
    margin-top: auto;
    border-top: 1px solid var(--line);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-content p {
    margin: 0;
    font-weight: 500;
    color: var(--text);
}

.social-links{
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.social-links a{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    border: 1px solid transparent;
}

.social-links a::before {
    content: "";
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 0C3.58 0 0 3.67 0 8.2c0 3.62 2.29 6.69 5.47 7.78.4.08.55-.18.55-.4 0-.2-.01-.86-.01-1.56-2.01.38-2.53-.5-2.69-.96-.09-.24-.48-.97-.82-1.17-.28-.15-.68-.52-.01-.53.63-.01 1.08.59 1.23.84.72 1.24 1.87.89 2.33.68.07-.53.28-.89.51-1.09-1.78-.21-3.64-.91-3.64-4.04 0-.89.31-1.62.82-2.19-.08-.21-.36-1.04.08-2.16 0 0 .67-.22 2.2.84A7.42 7.42 0 0 1 8 3.96c.68 0 1.36.09 2 .28 1.53-1.06 2.2-.84 2.2-.84.44 1.12.16 1.95.08 2.16.51.57.82 1.3.82 2.19 0 3.14-1.87 3.83-3.65 4.04.29.25.54.75.54 1.52 0 1.1-.01 1.98-.01 2.25 0 .22.15.48.55.4A8.09 8.09 0 0 0 16 8.2C16 3.67 12.42 0 8 0Z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 0C3.58 0 0 3.67 0 8.2c0 3.62 2.29 6.69 5.47 7.78.4.08.55-.18.55-.4 0-.2-.01-.86-.01-1.56-2.01.38-2.53-.5-2.69-.96-.09-.24-.48-.97-.82-1.17-.28-.15-.68-.52-.01-.53.63-.01 1.08.59 1.23.84.72 1.24 1.87.89 2.33.68.07-.53.28-.89.51-1.09-1.78-.21-3.64-.91-3.64-4.04 0-.89.31-1.62.82-2.19-.08-.21-.36-1.04.08-2.16 0 0 .67-.22 2.2.84A7.42 7.42 0 0 1 8 3.96c.68 0 1.36.09 2 .28 1.53-1.06 2.2-.84 2.2-.84.44 1.12.16 1.95.08 2.16.51.57.82 1.3.82 2.19 0 3.14-1.87 3.83-3.65 4.04.29.25.54.75.54 1.52 0 1.1-.01 1.98-.01 2.25 0 .22.15.48.55.4A8.09 8.09 0 0 0 16 8.2C16 3.67 12.42 0 8 0Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.social-links a:hover {
    color: var(--text);
    background: var(--surface-soft);
    border-color: var(--line);
}

.social-links img{
    width: 18px;
    height: 18px;
    display: block;
    object-fit: contain;
}

.site-footer img {
    filter: var(--footer-icon-filter);
}

.footer-social-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* --- Mobile responsiveness (improved) --- */
@media (max-width: 768px) {

  .navbar {
    position: sticky;
    top: 0;
    height: auto;
    padding: 10px 15px;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  body {
    margin: 0;
    font-family: "Noto Sans", "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    padding-top: 0;
  }

  .navbar-left {
    order: 1;
    width: 100%;
    flex: 0 0 100%;
    justify-content: center;
  }
  .navbar-left > a { justify-content: center; }
  .logo { height: 32px; }
  
  .navbar-right {
    order: 2;
    width: 100%;
    flex: 0 0 100%;
    justify-content: center;
    margin-left: 0;
    gap: 6px;
  }
  .lang-control { margin-right: 6px; }
  .lang-switch-wrap { display: none; }
  .lang-switch { width: 68px; min-width: 68px; height: 34px; margin-right: 0; }
  .navbar-right .lang-control .custom-select-wrapper { margin-right: 0; }
  .navbar-right .lang-control .custom-select-wrapper,
  .navbar-right .lang-control .custom-select-trigger {
    width: 82px;
    min-height: 38px;
  }
  .navbar-right .lang-control .custom-select-trigger {
    padding: 0 16px 0 10px; /* Better left padding for flag */
    font-size: 11px;
    width: 82px;
  }
  .navbar-right .lang-control .custom-select-trigger::after {
    right: 6px;
  }
  .profile-trigger-btn,
  .settings-trigger-btn { width: 34px; height: 34px; }
  .theme-btn { width: 34px; height: 34px; margin-right: 6px; }
  .menu-btn { display: none; }

  .navbar-center {
    order: 3;
    width: 100%;
    margin: 5px 0 0;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    justify-content: center;
    gap: 15px;
    display: flex; /* We use absolute/opacity/max-height for the toggleable menu */
  }

  .menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Profile modal tweaks */
  .profile-card { width: min(720px, 96vw); max-height: 90vh; }
  .profile-header { padding: 18px 16px 12px; }
  .profile-body { padding: 12px 16px 16px; }

  .profile-exam-form{ grid-template-columns: 1fr; }
  .profile-exam-special-grid--grades{ grid-template-columns: 1fr; }
  .profile-exam-breakdown-row{ grid-template-columns: 1fr; }
  .profile-budget{
    grid-template-columns: minmax(0, 1fr);
    column-gap: 8px;
    row-gap: 8px;
  }
  .profile-budget--with-unit{
    grid-template-columns: minmax(0, 1fr);
  }
  .profile-budget .profile-input{
    min-width: 0;
  }
  .profile-budget--with-unit .profile-unit{
    grid-column: 1 / -1;
    width: fit-content;
    padding: 8px 10px;
  }
  .profile-budget-grant-hint{
    flex-wrap: wrap;
  }
  .profile-budget-grant-hint__actions{
    width: 100%;
    justify-content: flex-start;
  }
  .profile-actions{
    flex-direction: column;
    align-items: stretch;
  }
  .profile-reset-zone{
    flex-direction: column;
    align-items: stretch;
  }
  .profile-confirm-actions{
    flex-direction: column;
    align-items: stretch;
  }
  .profile-confirm-actions .profile-delete,
  .profile-confirm-actions .profile-add{
    width: 100%;
  }

  .profile-name-input {
    min-width: 0;
    width: 120px;
    max-width: 100%;
  }
  
  .profile-username {
    gap: 5px;
  }

  .lang-add-grid{
    grid-template-columns: 1fr;
  }
  .lang-actions{ justify-content: stretch; }
  .lang-actions .profile-add{ width: 100%; }
  .lang-exam-grid{ grid-template-columns: 1fr; }
}

@media (max-width: 599px) {
  .navbar-right {
    margin-left: 0;
    justify-content: center;
    gap: 6px;
  }

  .lang-switch {
    width: 68px;
    min-width: 68px;
    padding: 0 6px;
    font-size: 11px;
  }

  .menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    font-size: 18px;
  }

  .navbar-center {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1001;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    margin-top: 0;
    padding: 0 15px;
    background: var(--surface);
    border-top: none;
    border-bottom: 1px solid transparent;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0);
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition: max-height 0.25s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  }

  .navbar.is-menu-open .navbar-center {
    margin-top: 0;
    padding: 8px 15px 12px;
    border-top: 1px solid var(--line);
    border-bottom-color: var(--line);
    max-height: min(70vh, 420px);
    opacity: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
    pointer-events: auto;
  }

  .navbar-center a {
    width: 100%;
    padding: 10px 0;
    text-align: left;
  }
}

@media (max-width: 1024px) and (min-width: 769px) {
  .navbar {
    padding: 0 18px;
  }

  .navbar-center {
    gap: 18px;
    padding: 0 14px;
  }

  .logo {
    height: 36px;
  }

  .theme-btn {
    margin-right: 6px;
  }

  .profile-trigger-btn,
  .settings-trigger-btn { width: 34px; height: 34px; }
}

@media (max-width: 700px) {
  .footer-content {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  .social-links {
    display: inline-flex;
    justify-content: center;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .toast-container {
    left: 10px;
    right: 10px;
    bottom: 12px;
  }

  .toast {
    width: 100%;
    min-width: 0;
    max-width: none;
    padding: 10px 12px;
    font-size: 13px;
  }
}

/* ===== 2026 Product Refresh ===== */
:root {
  --font-sans: "Segoe UI", Arial, sans-serif;
  --font-display: "Segoe UI", Arial, sans-serif;
  --accent: #5715db;
  --accent-strong: #3f0ea8;
  --accent-soft: rgba(87, 21, 219, 0.12);
  --accent-faint: rgba(87, 21, 219, 0.06);
  --bg: #f3f5f9;
  --bg-soft: #edf1f6;
  --text: #111827;
  --text-muted: #667085;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --surface-soft: #f8fafc;
  --line: rgba(17, 24, 39, 0.08);
  --line-strong: rgba(17, 24, 39, 0.16);
  --shadow-sm: 0 10px 26px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 30px 70px rgba(15, 23, 42, 0.18);
  --motion-instant: 80ms;
  --motion-fast: 160ms;
  --motion-medium: 260ms;
  --motion-ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --motion-ease-enter: cubic-bezier(0.16, 1, 0.3, 1);
  --motion-ease-exit: cubic-bezier(0.4, 0, 1, 1);
  --motion-ease-emphasized: cubic-bezier(0.2, 0.8, 0.2, 1);
}

:root[data-theme="dark"] {
  --accent: #5715db;
  --accent-strong: #3f0ea8;
  --accent-soft: rgba(87, 21, 219, 0.18);
  --accent-faint: rgba(87, 21, 219, 0.1);
  --bg: #0f1012;
  --bg-soft: #141516;
  --text: #f3f4f6;
  --text-muted: #a9adb7;
  --surface: rgba(20, 21, 23, 0.9);
  --surface-solid: #17181a;
  --surface-soft: #1d1f22;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --shadow-sm: 0 12px 30px rgba(0, 0, 0, 0.34);
  --shadow-md: 0 28px 76px rgba(0, 0, 0, 0.5);
}

.motion-press-pop {
  animation: motion-press-pop var(--motion-fast) var(--motion-ease-standard) both;
}

.motion-pop {
  animation: motion-pop var(--motion-medium) var(--motion-ease-emphasized) both;
}

.motion-state-pulse {
  animation: motion-state-pulse 420ms var(--motion-ease-emphasized) both;
}

.motion-fade-lift-enter,
.motion-panel-enter {
  animation: motion-fade-lift-enter var(--motion-medium) var(--motion-ease-enter) both;
}

.motion-list-item-enter {
  animation: motion-list-item-enter 320ms var(--motion-ease-enter) both;
}

.motion-row-exit {
  animation: motion-row-exit var(--motion-fast) var(--motion-ease-exit) forwards;
  pointer-events: none !important;
}

@keyframes motion-press-pop {
  0% { transform: scale(1); }
  48% { transform: scale(0.94); }
  100% { transform: scale(1); }
}

@keyframes motion-pop {
  0% { transform: scale(0.82); opacity: 0.72; }
  64% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes motion-state-pulse {
  0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.22); }
  70% { box-shadow: 0 0 0 9px rgba(79, 70, 229, 0); }
  100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

@keyframes motion-fade-lift-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes motion-list-item-enter {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes motion-row-exit {
  to { opacity: 0; transform: translateX(12px) scale(0.98); }
}

@keyframes motion-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes motion-backdrop-out {
  to { opacity: 0; }
}

@keyframes motion-modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes motion-modal-out {
  to { opacity: 0; transform: translateY(8px) scale(0.985); }
}

@media (prefers-reduced-motion: reduce) {
  .motion-press-pop,
  .motion-pop,
  .motion-state-pulse,
  .motion-fade-lift-enter,
  .motion-panel-enter,
  .motion-list-item-enter,
  .motion-row-exit,
  .settings-modal.is-open .settings-backdrop,
  .settings-modal.is-open .settings-card,
  .profile-modal.is-open .profile-backdrop,
  .profile-modal.is-open .profile-card,
  .profile-confirm-modal.is-open .profile-confirm-card,
  .settings-modal.is-closing .settings-card,
  .profile-modal.is-closing .profile-backdrop,
  .profile-modal.is-closing .profile-card,
  .profile-confirm-modal.is-closing .profile-confirm-card,
  .fadeIn {
    animation: none !important;
  }

  .global-loading-overlay,
  .custom-options,
  .custom-select-trigger,
  .custom-option,
  .profile-section-tab,
  .profile-interest-chips button,
  .profile-add,
  .profile-delete,
  .profile-exam-item,
  .settings-switch-track,
  .settings-switch-thumb,
  .lang-item {
    transition: none !important;
  }

  .global-loading-overlay__bar,
  .center-loading-spinner,
  .skeleton-block,
  .skeleton-line,
  .is-skeleton .uni-media,
  .is-skeleton .uni-logo,
  .is-skeleton .uni-price {
    animation: none !important;
  }
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  padding-top: 72px;
  letter-spacing: 0;
}

body[data-page="about"],
body[data-page="guide"] {
  background: linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
}

:root[data-theme="dark"] body[data-page="about"],
:root[data-theme="dark"] body[data-page="guide"] {
  background: linear-gradient(180deg, #131416 0%, var(--bg) 100%);
}

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

h1,
h2,
h3,
h4,
h5,
h6,
.navbar-center a,
.login-btn,
.profile-trigger-btn,
.settings-trigger-btn,
.menu-btn,
.btn-primary,
.home-secondary-btn,
.page-btn,
.error-btn,
.u-filter-title,
.u-found,
.rank-header h1,
.rank-title,
.about-title,
.guide-hero h1,
.d-title {
  font-family: var(--font-display);
}

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 72px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}

:root[data-theme="dark"] .navbar {
  background: rgba(15, 16, 18, 0.84);
}

.navbar-center {
  gap: 24px;
  --sliding-indicator-extra-width: 0px;
}

.navbar-center a {
  position: relative;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.16s ease;
}

.navbar-center a:hover {
  color: var(--text);
}

.navbar-center a.is-active {
  color: var(--accent);
}

.navbar-center a.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
}

@media (max-width: 980px) {
  .navbar-center a.is-active::after {
    bottom: 5px;
    left: auto;
    width: 4px;
    height: 4px;
  }
}

.logo {
  height: 40px;
}

.profile-trigger-btn,
.settings-trigger-btn,
.theme-btn,
.lang-switch,
.navbar-right .lang-control .custom-select-trigger,
.menu-btn {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
  border-radius: 12px;
}

.theme-btn:hover,
.profile-trigger-btn:hover,
.settings-trigger-btn:hover,
.lang-switch:hover,
.navbar-right .lang-control .custom-select-trigger:hover,
.menu-btn:hover {
  border-color: rgba(79, 70, 229, 0.24);
  color: var(--text);
  background: var(--surface-solid);
}

.profile-trigger-btn .ui-icon,
.settings-trigger-btn .ui-icon {
  width: 18px;
  height: 18px;
}

.site-footer {
  background: transparent;
  border-top: 1px solid var(--line);
}

.footer-content {
  max-width: 1240px;
  padding: 18px 24px;
}

.footer-content p {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}

.social-links a {
  min-width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

@media (max-width: 768px) {
  /* Inherit global 72px padding-top */

  .navbar {
    padding: 10px 16px;
    height: 72px;
    flex-wrap: nowrap;
    justify-content: space-between;
  }

  .navbar-left {
    order: 1;
    width: auto;
    flex: 0 0 auto;
  }

  .navbar-right {
    order: 2;
    width: auto;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px; /* Standardize gap for all buttons */
    margin-left: 0;
  }

  .navbar-right > * {
    margin: 0 !important; /* Remove any individual margins to ensure even gaps */
  }

  .navbar-center {
    display: flex;
    position: absolute;
    top: 72px; /* Height of the fixed navbar */
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--surface-solid);
    border-bottom: 1px solid var(--line);
    padding: 10px 20px;
    z-index: 1001;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    transition:
      opacity var(--motion-medium) var(--motion-ease-standard),
      max-height var(--motion-medium) var(--motion-ease-standard);
  }

  .navbar.is-menu-open .navbar-center {
    opacity: 1;
    max-height: 500px;
    pointer-events: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  }

  .navbar-center a {
    padding: 12px 0;
    width: 100%;
    border-bottom: 1px solid var(--line-faint);
  }

  .navbar-center a:last-child {
    border-bottom: none;
  }

  .logo {
    height: 34px;
  }
}

/* Initial Page Loader */
.initial-loading > *:not(#siteInitialLoader) {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

body.route-loading main {
  opacity: 0.72;
  transform: translateY(4px);
  pointer-events: none;
  transition:
    opacity 160ms var(--motion-ease-standard),
    transform 160ms var(--motion-ease-standard);
}

.site-initial-loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.site-initial-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.site-initial-loader__spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 8px solid #c5cad3;
  border-top-color: #ffffff;
  animation: center-loading-spin 0.9s linear infinite;
  box-shadow: none;
}

/* Skeleton Loader Background */
:root {
  --skeleton-base: rgba(148, 163, 184, 0.16);
  --skeleton-highlight: rgba(255, 255, 255, 0.72);
}

:root[data-theme="dark"] {
  --skeleton-base: rgba(255, 255, 255, 0.08);
  --skeleton-highlight: rgba(255, 255, 255, 0.14);
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 120% 0;
  }
  100% {
    background-position: -120% 0;
  }
}

.skeleton-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  display: flex;
  flex-direction: column;
  padding: 80px 5% 20px;
  gap: 30px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.5;
}
.skeleton-bg--row {
  display: flex;
  flex-direction: row;
  gap: 30px;
}
.skeleton-bg--grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  width: 100%;
}
.skeleton-block {
  background-color: var(--skeleton-base);
  background-image: linear-gradient(
    100deg,
    transparent 0%,
    transparent 34%,
    var(--skeleton-highlight) 46%,
    transparent 58%,
    transparent 100%
  );
  background-size: 220% 100%;
  border-radius: 12px;
  animation: skeleton-shimmer 1.35s ease-in-out infinite;
}

.skeleton-line {
  background-color: var(--skeleton-base);
  background-image: linear-gradient(
    100deg,
    transparent 0%,
    transparent 34%,
    var(--skeleton-highlight) 46%,
    transparent 58%,
    transparent 100%
  );
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.35s ease-in-out infinite;
}

/* Common Skeleton Shapes */
.skel-header-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 64px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0;
}
.skel-sidebar-col {
  width: 280px;
  display: none;
}
@media (min-width: 900px) {
  .skel-sidebar-col { display: flex; flex-direction: column; gap: 20px; }
}
.skel-content-col {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.skel-title { height: 40px; width: 60%; border-radius: 6px; }
.skel-text { height: 20px; width: 100%; border-radius: 4px; }
.skel-text-short { height: 20px; width: 70%; border-radius: 4px; }
.skel-card { height: 200px; width: 100%; border-radius: 12px; }
.skel-hero { height: 350px; width: 100%; border-radius: 24px; }
/* Error / No Connection Screen */
.error-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 20px;
  width: 100%;
}

.error-screen--full {
  min-height: calc(100vh - 200px);
}

.fadeIn {
  animation: fadeInAnim 0.6s cubic-bezier(0.2, 0, 0.2, 1) both;
}

@keyframes fadeInAnim {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.error-icon-wrap {
  width: 90px;
  height: 90px;
  background: var(--surface-soft);
  color: var(--accent);
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.05),
    inset 0 0 0 1px var(--line);
}

.error-icon-wrap .ui-icon {
  width: 44px;
  height: 44px;
}

.error-title {
  font-size: 32px;
  font-weight: 800;
  margin: 0 0 12px;
  color: var(--text);
  letter-spacing: 0;
}

.error-desc {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 440px;
  line-height: 1.6;
  margin: 0 0 36px;
}

.error-btn {
  background: var(--accent);
  color: #ffffff;
  border: none;
  padding: 14px 32px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  box-shadow: none;
  transition:
    background-color var(--motion-fast) var(--motion-ease-standard),
    box-shadow var(--motion-fast) var(--motion-ease-standard),
    transform var(--motion-fast) var(--motion-ease-standard);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.error-btn:hover {
  background: var(--accent-strong);
  box-shadow: none;
}

.error-btn:active {
  transform: translateY(0) scale(0.97);
}

.error-btn .ui-icon {
  transition: transform 0.5s cubic-bezier(0.2, 0, 0.2, 1);
}

.error-btn:hover .ui-icon {
  transform: rotate(180deg);
}

:root[data-theme="dark"] .profile-actions {
  background: linear-gradient(180deg, rgba(23,24,26,0), var(--surface-solid) 30%);
}

/* ===== Narrow viewport hardening ===== */
@media (max-width: 380px) {
  .navbar {
    padding-left: 10px;
    padding-right: 10px;
    gap: 8px;
  }

  .logo {
    height: 30px;
    max-width: 106px;
    object-fit: contain;
  }

  .navbar-right {
    gap: 5px;
  }

  .menu-btn,
  .theme-btn,
  .settings-trigger-btn,
  .profile-trigger-btn {
    width: 34px;
    min-width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .navbar-right .lang-control .custom-select-wrapper,
  .navbar-right .lang-control .custom-select-trigger {
    width: 58px;
    min-width: 58px;
  }

  .navbar-right .lang-control .custom-select-trigger {
    gap: 0;
    padding: 0 6px;
    font-size: 11px;
  }

  .navbar-right .lang-control .custom-select-trigger--language .custom-select-trigger-content {
    gap: 4px;
  }

  .navbar-right .lang-control .custom-select-trigger--language img {
    width: 20px;
    height: 15px;
  }

  .navbar-right .lang-control .custom-select-trigger::after {
    display: none;
  }

  .navbar-right .lang-control .custom-options {
    right: 0;
    left: auto;
    min-width: min(176px, calc(100vw - 20px));
    transform: translateY(-10px);
  }

  .navbar-right .lang-control .custom-select-wrapper.open .custom-options {
    transform: translateY(0);
  }

  .profile-card {
    width: min(100vw - 16px, 760px);
    max-height: calc(100dvh - 16px);
    border-radius: 14px;
  }

  .profile-header {
    padding: 14px 12px 10px;
    gap: 10px;
  }

  .profile-title {
    min-width: 0;
  }

  .profile-username {
    font-size: 18px;
  }

  .profile-progress,
  .profile-section-tabs {
    margin-left: 12px;
    margin-right: 12px;
  }

  .profile-section-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-body {
    padding: 10px 12px 14px;
  }

  .profile-actions {
    gap: 8px;
  }
}

@media (max-width: 340px) {
  .navbar {
    height: auto;
    min-height: 98px;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    row-gap: 8px;
    column-gap: 0;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .navbar-left {
    width: 100%;
    flex: 0 0 100%;
    justify-content: center;
  }

  .navbar-logo-link {
    justify-content: center;
  }

  .logo {
    height: 31px;
    max-width: 132px;
  }

  .navbar-right {
    width: 100%;
    flex: 0 0 100%;
    justify-content: center;
    gap: 7px;
  }

  .menu-btn,
  .theme-btn,
  .settings-trigger-btn,
  .profile-trigger-btn {
    width: 36px;
    min-width: 36px;
    height: 36px;
  }

  .navbar-right .lang-control .custom-select-wrapper,
  .navbar-right .lang-control .custom-select-trigger {
    width: 68px;
    min-width: 68px;
  }

  .navbar-right .lang-control .custom-select-trigger {
    padding: 0 8px;
    font-size: 12px;
  }

  .navbar-right .lang-control .custom-select-trigger--language img {
    width: 22px;
    height: 16px;
  }

  .navbar-center {
    top: 100%;
  }
}

/* ===== 2026 Device UX Hardening ===== */
:root {
  --nav-height: 72px;
  --mobile-safe-gutter: clamp(12px, 4vw, 20px);
}

html {
  scroll-padding-top: calc(var(--nav-height) + 18px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  padding-top: var(--nav-height);
}

main,
section,
article,
aside,
header,
footer,
nav {
  min-width: 0;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

@media (max-width: 980px) {
  .navbar {
    height: var(--nav-height);
    min-height: var(--nav-height);
    padding: 0 var(--mobile-safe-gutter);
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .navbar-left {
    order: 1;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    justify-content: flex-start;
  }

  .navbar-logo-link {
    min-width: 0;
  }

  .logo {
    height: 34px;
    max-width: min(36vw, 148px);
    object-fit: contain;
  }

  .navbar-right {
    order: 2;
    width: auto;
    flex: 0 0 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-left: 0;
  }

  .navbar-right > * {
    margin: 0 !important;
  }

  .menu-btn,
  .theme-btn,
  .settings-trigger-btn,
  .profile-trigger-btn,
  .navbar-right .lang-control .custom-select-trigger {
    min-width: 40px;
    min-height: 40px;
  }

  .menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    order: 1;
  }

  .lang-control {
    order: 2;
    margin-right: 0;
  }

  .theme-btn {
    order: 3;
    width: 40px;
    height: 40px;
  }

  .settings-trigger-btn {
    order: 4;
    width: 40px;
    height: 40px;
  }

  .profile-trigger-btn {
    order: 5;
    width: 40px;
    height: 40px;
  }

  .navbar-right .lang-control .custom-select-wrapper,
  .navbar-right .lang-control .custom-select-trigger {
    width: 82px;
  }

  .navbar-right .lang-control .custom-select-trigger {
    padding: 0 18px 0 9px;
    border-radius: 12px;
    font-size: 12px;
  }

  .navbar-right .lang-control .custom-options {
    right: 0;
    left: auto;
    min-width: min(188px, calc(100vw - 24px));
    transform: translateY(-10px);
  }

  .navbar-right .lang-control .custom-select-wrapper.open .custom-options {
    transform: translateY(0);
  }

  .navbar-center {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    z-index: 999;
    order: 3;
    width: 100%;
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin: 0;
    padding: 0 var(--mobile-safe-gutter);
    border-top: 1px solid transparent;
    border-bottom: 1px solid transparent;
    background: var(--surface-solid);
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    transition:
      opacity var(--motion-medium) var(--motion-ease-standard),
      max-height var(--motion-medium) var(--motion-ease-standard),
      padding-top var(--motion-fast) var(--motion-ease-standard),
      padding-bottom var(--motion-fast) var(--motion-ease-standard),
      box-shadow var(--motion-fast) var(--motion-ease-standard),
      border-color var(--motion-fast) var(--motion-ease-standard);
  }

  .navbar.is-menu-open .navbar-center {
    opacity: 1;
    max-height: calc(100dvh - var(--nav-height));
    padding-top: 10px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    border-top-color: var(--line);
    border-bottom-color: var(--line);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    pointer-events: auto;
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.12);
  }

  .navbar-center a {
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    border: 0;
    border-radius: 14px;
    display: flex;
    align-items: center;
    color: var(--text);
  }

  .navbar-center a:hover,
  .navbar-center a.is-active {
    background: var(--surface-soft);
    color: var(--accent);
  }

  .navbar-center a.is-active::after {
    left: 0;
    right: auto;
    top: 11px;
    bottom: 11px;
    width: 3px;
    height: auto;
    border-radius: 999px;
  }
}

@media (max-width: 420px) {
  .navbar {
    gap: 6px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .navbar-left {
    flex: 0 0 auto;
    width: min(30vw, 96px);
  }

  .logo {
    height: 30px;
    max-width: min(30vw, 96px);
  }

  .navbar-right {
    gap: 4px;
  }

  .menu-btn,
  .theme-btn,
  .settings-trigger-btn,
  .profile-trigger-btn,
  .navbar-right .lang-control .custom-select-trigger {
    min-width: 32px;
    min-height: 32px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .navbar-right .lang-control .custom-select-wrapper,
  .navbar-right .lang-control .custom-select-trigger {
    width: 54px;
    min-width: 54px;
  }

  .navbar-right .lang-control .custom-select-trigger {
    gap: 0;
    padding: 0 5px;
    font-size: 11px;
  }

  .navbar-right .lang-control .custom-select-trigger--language .custom-select-trigger-content {
    gap: 3px;
  }

  .navbar-right .lang-control .custom-select-trigger--language img {
    width: 18px;
    height: 14px;
  }

  .navbar-right .lang-control .custom-select-trigger::after {
    display: none;
  }

  .navbar-right .lang-control .custom-options {
    right: 0;
    left: auto;
    min-width: min(176px, calc(100vw - 20px));
    transform: translateY(-10px);
  }

  .navbar-right .lang-control .custom-select-wrapper.open .custom-options {
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .profile-modal {
    align-items: flex-end;
    padding: 0;
  }

  .profile-card {
    width: 100%;
    max-height: calc(100dvh - max(10px, env(safe-area-inset-top)));
    border-radius: 22px 22px 0 0;
  }

  .profile-header {
    padding: 16px var(--mobile-safe-gutter) 12px;
  }

  .profile-progress {
    margin: 0 var(--mobile-safe-gutter) 10px;
  }

  .profile-section-tabs {
    margin: 0 var(--mobile-safe-gutter) 10px;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .profile-section-tabs::-webkit-scrollbar {
    display: none;
  }

  .profile-section-tab {
    flex: 0 0 auto;
    min-width: max-content;
    min-height: 42px;
    padding: 0 12px;
    scroll-snap-align: start;
  }

  .profile-body {
    padding: 12px var(--mobile-safe-gutter) calc(16px + env(safe-area-inset-bottom));
  }

  .profile-input,
  .profile-add,
  .profile-delete,
  .profile-confirm-actions .profile-delete,
  .profile-confirm-actions .profile-add {
    min-height: 44px;
  }

  .profile-actions {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .profile-tooltip {
    left: auto;
    right: 0;
    width: min(320px, calc(100vw - 24px));
  }
}

@media (max-width: 380px) {
  .navbar {
    padding-left: 10px;
    padding-right: 10px;
    gap: 7px;
  }

  .logo {
    height: 30px;
    max-width: 112px;
  }

  .navbar-right {
    gap: 5px;
  }

  .menu-btn,
  .theme-btn,
  .settings-trigger-btn,
  .profile-trigger-btn {
    flex-basis: 36px;
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
  }

  .navbar-right .lang-control .custom-select-wrapper,
  .navbar-right .lang-control .custom-select-trigger {
    width: 64px;
    min-width: 64px;
  }

  .navbar-right .lang-control .custom-select-trigger {
    padding: 0 8px;
  }
}

@media (max-width: 340px) {
  :root {
    --nav-height: 104px;
  }

  .navbar {
    height: var(--nav-height);
    min-height: var(--nav-height);
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    row-gap: 8px;
    column-gap: 0;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .navbar-left {
    flex: 0 0 100%;
    width: 100%;
    justify-content: center;
  }

  .logo {
    height: 30px;
    max-width: 132px;
  }

  .navbar-right {
    flex: 0 0 100%;
    width: 100%;
    justify-content: center;
    gap: 7px;
  }

  .navbar-center {
    top: var(--nav-height);
  }
}

/* Keep the compact language arrow anchored while the flag/label changes. */
.navbar-right .lang-control .custom-select-trigger--language {
  position: relative;
  justify-content: flex-start;
  padding-right: 24px;
}

.navbar-right .lang-control .custom-select-trigger--language::after {
  position: absolute;
  right: 10px;
  top: 50%;
  display: block;
  transform: translateY(-50%);
}

.navbar-right .lang-control .custom-select-wrapper.open .custom-select-trigger--language::after {
  transform: translateY(-50%) rotate(180deg);
}

.navbar-right .lang-control .custom-select-trigger--language .custom-select-trigger-content {
  width: 100%;
  justify-content: flex-start;
}

.navbar-right .lang-control .custom-select-trigger--language {
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
}

.navbar-right .lang-control .custom-select-trigger--language::after {
  position: static;
  display: inline-block;
  transform: none;
}

.navbar-right .lang-control .custom-select-wrapper.open .custom-select-trigger--language::after {
  transform: rotate(180deg);
}

.navbar-right .lang-control .custom-select-trigger--language .custom-select-trigger-content {
  width: auto;
  justify-content: center;
  gap: 7px;
}

@media (max-width: 380px) {
  .navbar-right .lang-control .custom-select-trigger--language {
    padding: 0 8px;
  }

  .navbar-right .lang-control .custom-select-trigger--language::after {
    position: static;
  }
}

@media (max-width: 980px) {
  .navbar-left {
    flex: 0 1 auto;
  }

  .navbar-logo-link {
    max-width: min(32vw, 132px);
  }
}

@media (max-width: 420px) {
  .navbar {
    gap: 6px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .navbar-left {
    flex: 0 0 auto;
    width: min(30vw, 96px);
  }

  .logo {
    height: 30px;
    max-width: min(30vw, 96px);
  }

  .navbar-right {
    gap: 4px;
  }

  .menu-btn,
  .theme-btn,
  .settings-trigger-btn,
  .profile-trigger-btn,
  .navbar-right .lang-control .custom-select-trigger {
    flex-basis: 32px;
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    border-radius: 10px;
  }

  .navbar-right .lang-control .custom-select-wrapper,
  .navbar-right .lang-control .custom-select-trigger {
    width: 54px;
    min-width: 54px;
  }

  .navbar-right .lang-control .custom-select-trigger--language {
    padding: 0 5px;
  }

  .navbar-right .lang-control .custom-select-trigger--language::after {
    display: none;
  }

  .navbar-right .lang-control .custom-select-trigger--language .custom-select-trigger-content {
    gap: 3px;
  }

  .navbar-right .lang-control .custom-select-trigger--language img {
    width: 18px;
    height: 14px;
  }
}

@media (max-width: 340px) {
  .navbar-left {
    flex: 0 0 100%;
    width: 100%;
  }
}

/* Final mobile navbar sizing: keep five controls readable without crowding. */
@media (max-width: 560px) {
  .navbar {
    gap: 10px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .navbar-left {
    flex: 0 0 clamp(88px, 28vw, 112px);
    width: clamp(88px, 28vw, 112px);
    min-width: 0;
  }

  .navbar-logo-link {
    width: 100%;
    max-width: 100%;
  }

  .logo {
    width: 100%;
    height: 31px;
    max-width: 100%;
  }

  .navbar-right {
    gap: 6px;
    margin-left: auto;
  }

  .menu-btn,
  .theme-btn,
  .settings-trigger-btn,
  .profile-trigger-btn {
    flex: 0 0 36px;
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    border-radius: 11px;
  }

  .navbar-right .lang-control .custom-select-wrapper,
  .navbar-right .lang-control .custom-select-trigger {
    width: 64px;
    min-width: 64px;
    height: 36px;
    min-height: 36px;
  }

  .navbar-right .lang-control .custom-select-trigger--language {
    padding: 0 8px;
  }

  .navbar-right .lang-control .custom-select-trigger--language::after {
    display: none;
  }

  .navbar-right .lang-control .custom-select-trigger--language .custom-select-trigger-content {
    gap: 4px;
  }

  .navbar-right .lang-control .custom-select-trigger--language img {
    width: 20px;
    height: 15px;
  }
}

@media (max-width: 420px) {
  .navbar {
    gap: 8px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .navbar-logo-link {
    width: 100%;
    max-width: 100%;
  }

  .navbar-left {
    flex-basis: clamp(76px, 26vw, 92px);
    width: clamp(76px, 26vw, 92px);
  }

  .navbar-right {
    gap: 5px;
    margin-left: auto;
  }

  .menu-btn,
  .theme-btn,
  .settings-trigger-btn,
  .profile-trigger-btn {
    flex-basis: 34px;
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
  }

  .navbar-right .lang-control .custom-select-wrapper,
  .navbar-right .lang-control .custom-select-trigger {
    width: 58px;
    min-width: 58px;
    height: 34px;
    min-height: 34px;
  }

  .navbar-right .lang-control .custom-select-trigger--language {
    padding: 0 6px;
  }

  .navbar-right .lang-control .custom-select-trigger--language img {
    width: 18px;
    height: 14px;
  }
}

@media (max-width: 340px) {
  .navbar {
    gap: 0;
  }

  .navbar-left {
    flex: 0 0 100%;
    width: 100%;
    justify-content: center;
  }

  .navbar-logo-link {
    width: auto;
    max-width: 132px;
  }

  .logo {
    width: auto;
  }

  .navbar-right {
    flex: 0 0 100%;
    width: 100%;
    justify-content: center;
    gap: 7px;
    margin-left: 0;
  }
}

/* Sliding Indicator */
.has-sliding-indicator {
  position: relative;
}
.sliding-indicator {
  position: absolute;
  bottom: 0px;
  left: 0;
  height: 2px;
  width: 1px;
  background: var(--accent);
  transition:
    transform 220ms var(--motion-ease-emphasized),
    width 220ms var(--motion-ease-emphasized),
    opacity 120ms var(--motion-ease-standard);
  pointer-events: none;
  transform-origin: left bottom;
  z-index: 10;
  border-radius: 2px 2px 0 0;
}

.navbar-center .sliding-indicator {
  bottom: -6px;
}

body .has-sliding-indicator .is-active::after,
body .has-sliding-indicator .active::after {
  display: none !important;
}

@media (max-width: 980px) {
  .navbar-center.has-sliding-indicator {
    position: fixed;
  }
}
