:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #18191c;
  --ink-soft: #5f6870;
  --accent: #005aaa;
  --accent-strong: #004888;
  --error: #a62f2f;
  --border: #d8dee6;
}

* {
  box-sizing: border-box;
}

[x-cloak] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  background-repeat: no-repeat;
  background-size: 100% 100vh;
  color: var(--ink);
}

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 18px 16px 40px;
}

.initial-loader {
  min-height: 30vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink-soft);
}

.spinner {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 3px solid #cfd8e3;
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  padding: 14px 16px;
}

.header-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
}

h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.15;
}

nav {
  display: flex;
  gap: 8px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-link {
  text-decoration: none;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.9rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 10px 26px rgba(17, 54, 44, 0.08);
}

.panel + .panel {
  margin-top: 14px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

button {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}

button.secondary {
  background: #f2f5f8;
  color: var(--ink);
  border: 1px solid var(--border);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status {
  margin-top: 10px;
  color: var(--ink-soft);
}

.error {
  margin-top: 10px;
  color: var(--error);
  font-weight: 600;
}

pre {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f8fafc;
  overflow-x: auto;
  max-height: 300px;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 4px 0 0;
}

.footer-legal {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.footer-legal-link {
  color: var(--accent-strong);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.footer-legal-separator {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.footer-legal-link:hover,
.footer-legal-link:focus-visible {
  text-decoration: underline;
}

.footer-language-picker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  border: 1px solid rgba(216, 222, 230, 0.8);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
}

.footer-language-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.footer-language-switch {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: 999px;
  background: rgba(238, 243, 248, 0.85);
}

button.language-option {
  min-width: 72px;
  padding: 5px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 500;
}

button.language-option.is-active {
  background: rgba(0, 90, 170, 0.12);
  color: var(--accent-strong);
  box-shadow: none;
}

@media (max-width: 640px) {
  .app {
    padding: 16px 12px 28px;
  }

  .initial-loader {
    min-height: 22vh;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .app-footer {
    justify-content: stretch;
  }

  .footer-legal {
    width: 100%;
    justify-content: center;
  }

  .footer-language-picker {
    width: 100%;
    justify-content: space-between;
  }

  .footer-language-switch {
    flex: 1;
  }

  button.language-option {
    flex: 1;
    min-width: 0;
  }
}
