/* ===========================================================
   Cloud-OBS · Language selector
   Professional dark theme
   =========================================================== */

:root {
  --bg-base: #07090d;
  --bg-deep: #05070a;
  --surface: rgba(20, 24, 32, 0.55);
  --surface-strong: rgba(28, 33, 44, 0.72);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.62);
  --text-dim: rgba(255, 255, 255, 0.38);
  --accent: #4fb3ff;
  --accent-2: #7c5cff;
  --accent-glow: rgba(79, 179, 255, 0.35);
  --ok: #22c55e;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-xl: 0 30px 80px rgba(0, 0, 0, 0.55), 0 8px 24px rgba(0, 0, 0, 0.4);
  --transition: 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--text);
  background: var(--bg-base);
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---------------------------------------------------------
   Background
   --------------------------------------------------------- */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, #0f1624 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 50% 100%, #0a1420 0%, transparent 70%),
    var(--bg-deep);
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, #000 40%, transparent 100%);
}

.bg-gradient {
  position: absolute;
  inset: -20%;
  background:
    conic-gradient(from 180deg at 50% 50%,
      rgba(79, 179, 255, 0.08) 0deg,
      rgba(124, 92, 255, 0.06) 120deg,
      rgba(34, 197, 94, 0.04) 240deg,
      rgba(79, 179, 255, 0.08) 360deg);
  filter: blur(80px);
  opacity: 0.6;
  animation: rotate 40s linear infinite;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.5;
}
.bg-orb--1 {
  top: -10%;
  left: -10%;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, #1e4876 0%, transparent 70%);
  animation: float 18s ease-in-out infinite;
}
.bg-orb--2 {
  bottom: -10%;
  right: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #3d2a7a 0%, transparent 70%);
  animation: float 22s ease-in-out infinite reverse;
}
.bg-orb--3 {
  top: 40%;
  left: 60%;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, #0d4a3d 0%, transparent 70%);
  animation: float 26s ease-in-out infinite;
  opacity: 0.3;
}

.bg-noise {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.4'/></svg>");
  opacity: 0.035;
  mix-blend-mode: overlay;
  pointer-events: none;
}

@keyframes rotate {
  to { transform: rotate(360deg); }
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -30px) scale(1.08); }
}

/* ---------------------------------------------------------
   Top bar
   --------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 40px;
  z-index: 2;
}

.brand {
  display: flex;
  align-items: center;
}
.brand__logo {
  height: 44px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.topbar__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.05); }
}

/* ---------------------------------------------------------
   Main stage / card
   --------------------------------------------------------- */
.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  z-index: 1;
}

.card {
  width: 100%;
  max-width: 900px;
  padding: 56px 48px 44px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg,
      rgba(28, 33, 44, 0.55) 0%,
      rgba(16, 19, 26, 0.72) 100%);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: var(--shadow-xl);
  position: relative;
  overflow: hidden;
  animation: cardIn 700ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg,
      rgba(255, 255, 255, 0.22) 0%,
      rgba(255, 255, 255, 0) 30%,
      rgba(255, 255, 255, 0) 70%,
      rgba(255, 255, 255, 0.08) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

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

.card__eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 20px;
}
.eyebrow-line {
  flex: 0 0 44px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
}
.eyebrow-text {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.title {
  text-align: center;
  font-size: clamp(32px, 4.5vw, 44px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #c8d0dc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  text-align: center;
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 44px;
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* ---------------------------------------------------------
   Language grid
   --------------------------------------------------------- */
.lang-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 36px;
}

.lang-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  padding: 22px 22px 20px;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: transform var(--transition), border-color var(--transition),
              background var(--transition), box-shadow var(--transition);
  overflow: hidden;
  cursor: pointer;
  animation: cardItemIn 600ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.lang-card:nth-child(1) { animation-delay: 100ms; }
.lang-card:nth-child(2) { animation-delay: 200ms; }
.lang-card:nth-child(3) { animation-delay: 300ms; }

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

.lang-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 0%),
      rgba(79, 179, 255, 0.12) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.lang-card:hover {
  transform: translateY(-4px);
  border-color: rgba(79, 179, 255, 0.35);
  background: linear-gradient(180deg,
      rgba(36, 44, 60, 0.82) 0%,
      rgba(24, 28, 38, 0.82) 100%);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(79, 179, 255, 0.12),
    0 0 40px -10px var(--accent-glow);
}
.lang-card:hover::before { opacity: 1; }

.lang-card:active {
  transform: translateY(-1px);
}

.lang-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.lang-card__flag-wrap {
  width: 64px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  position: relative;
  transition: transform var(--transition);
}
.lang-card:hover .lang-card__flag-wrap {
  transform: scale(1.06);
}
.lang-card__flag {
  width: 100%;
  height: 100%;
  display: block;
}

.lang-card__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lang-card__name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.lang-card__region {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.lang-card__arrow {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all var(--transition);
}
.lang-card__arrow svg { width: 14px; height: 14px; }
.lang-card:hover .lang-card__arrow {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: translateX(3px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

/* ---------------------------------------------------------
   Footer note
   --------------------------------------------------------- */
.footer-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.bottombar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  z-index: 2;
}
.dot-sep { opacity: 0.5; }

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */
@media (max-width: 820px) {
  .lang-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .card {
    padding: 40px 24px 28px;
  }
  .title { font-size: 30px; }
  .subtitle { margin-bottom: 32px; }
  .topbar {
    padding: 18px 20px;
  }
  .brand__logo { height: 36px; }
  .topbar__meta { display: none; }
}

@media (max-width: 420px) {
  .lang-card {
    padding: 18px;
  }
  .lang-card__arrow {
    top: 18px;
    right: 18px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
