/* NeuroWatch — bandeiras a flutuar (mesmo contrato visual OwMae / flagcdn). */
@keyframes nw-flag-flutter {
  0%, 100% { transform: rotate(-6deg) skewX(-3deg) scale(1); }
  25% { transform: rotate(5deg) skewX(4deg) scale(1.04); }
  50% { transform: rotate(-3deg) skewX(-2deg) scale(1); }
  75% { transform: rotate(7deg) skewX(3deg) scale(1.04); }
}

.lang-flags {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
  flex-wrap: wrap;
}
.lang-flags button {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.28rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  cursor: pointer;
  font: inherit;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.lang-flags button:hover {
  background: rgba(20, 184, 166, 0.22);
  border-color: rgba(153, 246, 228, 0.45);
}
.lang-flags button.active {
  background: #fff;
  color: #0b3a4d;
  border-color: #fff;
  box-shadow: 0 8px 20px rgba(11, 58, 77, 0.18);
}
.lang-flags button:focus-visible {
  outline: 2px solid #99f6e4;
  outline-offset: 2px;
}
.lang-flags button .fi {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.2rem;
  transform-origin: 12% 88%;
  animation: nw-flag-flutter 2.4s ease-in-out infinite;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}
.lang-flags button:nth-child(2) .fi { animation-delay: 0.15s; }
.lang-flags button:nth-child(3) .fi { animation-delay: 0.3s; }
.lang-flags button:nth-child(4) .fi { animation-delay: 0.45s; }
.lang-flags button:nth-child(5) .fi { animation-delay: 0.6s; }
.lang-flags button:nth-child(6) .fi { animation-delay: 0.75s; }
.lang-flags button.active .fi,
.lang-flags button:hover .fi {
  animation-duration: 1.15s;
}
.lang-flags button .fi__img {
  display: block;
  height: 100%;
  width: auto;
  max-width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 2px;
  pointer-events: none;
}
.lang-flags button .fi__emoji {
  display: none;
  font-size: 1.05rem;
  line-height: 1;
}
.lang-flags button .fi--fallback .fi__img { display: none; }
.lang-flags button .fi--fallback .fi__emoji { display: block; }
.lang-flags button .lang-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  min-width: 0;
}
.lang-flags button .lbl {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.lang-flags button:has(.fi:not(.fi--fallback)) .code { display: none; }
.lang-flags button .code {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.lang-flags--flags .lang-stack,
.lang-flags--flags .code,
.lang-flags--flags .lbl { display: none; }
.lang-flags--flags button { padding: 0.22rem 0.34rem; }

/* Hub de estudos: coluna elegante com mastro */
.lang-flags--stack {
  position: relative;
  flex-direction: column;
  max-width: 16.5rem;
  gap: 0.45rem;
  padding-left: 1.05rem;
}
.lang-flags--stack::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 99px;
  background: linear-gradient(180deg, #99f6e4 0%, #0f766e 42%, #0b3a4d 100%);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.08);
}
.lang-flags--stack button {
  width: 100%;
  border-radius: 14px;
  padding: 0.4rem 0.75rem;
  background: #fff;
  color: #0b1c2c;
  border: 1px solid #d5e4ea;
  box-shadow: 0 8px 22px rgba(11, 58, 77, 0.06);
}
.lang-flags--stack button .fi {
  width: 2.35rem;
  height: 1.5rem;
}
.lang-flags--stack button .lbl { font-size: 0.82rem; }
.lang-flags--stack .code { display: none !important; }
.lang-flags--stack button .fi__img {
  height: 100%;
  width: auto;
  max-height: 1.5rem;
}
.lang-flags--stack button.active {
  border-color: #0f766e;
  box-shadow: 0 10px 28px rgba(15, 118, 110, 0.18);
}

.lang-flags--paper button {
  background: linear-gradient(180deg, #ffffff, #eef9ff);
  color: #0a2540;
  border: 1px solid rgba(46, 184, 255, 0.28);
  box-shadow: 0 1px 0 #fff inset, 0 4px 12px rgba(46, 184, 255, 0.16);
}
.lang-flags--paper button:hover,
.lang-flags--paper button.active {
  background: linear-gradient(180deg, #ffffff, #d9f6ff);
  color: #0d4f8c;
  border-color: rgba(18, 184, 201, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  .lang-flags button .fi { animation: none; }
}
