:root {
  color-scheme: light dark;
  --bg: #F3F7FF;
  --surface: #FFFFFF;
  --surface-hover: #EAF1FF;
  --border: #C7D9FA;
  --border-hover: #93B4F5;
  --text: #0F172A;
  --muted: #475569;
  --accent: #1D4ED8;
  --accent-hover: #1E40AF;
  --accent-text: #FFFFFF;
  --accent-ink: #1D4ED8;
  --bg-glow: rgba(37, 99, 235, 0.22);
  --shadow-logo: 0 10px 26px rgba(29, 78, 216, 0.16);
  --shadow-card: 0 12px 26px rgba(29, 78, 216, 0.12);
  --shadow-cta: 0 6px 20px rgba(29, 78, 216, 0.28);

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090F1D;
    --surface: #111A2E;
    --surface-hover: #192540;
    --border: #223459;
    --border-hover: #355087;
    --text: #EFF6FF;
    --muted: #9BB0D4;
    --accent: #2563EB;
    --accent-hover: #3B82F6;
    --accent-text: #FFFFFF;
    --accent-ink: #60A5FA;
    --bg-glow: rgba(59, 130, 246, 0.30);
    --shadow-logo: 0 12px 28px rgba(0, 0, 0, 0.48);
    --shadow-card: 0 12px 28px rgba(0, 0, 0, 0.42);
    --shadow-cta: 0 6px 22px rgba(37, 99, 235, 0.38);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  background-color: var(--bg);
  background-image: radial-gradient(760px 420px at 50% 0%, var(--bg-glow), transparent 74%);
  background-repeat: no-repeat;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: var(--accent-ink);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 3px;
  border-radius: 6px;
}

.page {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 24px 28px;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background-color: var(--surface);
}

.lang-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
  padding: 7px 11px;
  border-radius: 7px;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.lang-btn:hover {
  color: var(--text);
}

.lang-btn[aria-pressed="true"] {
  background-color: var(--accent);
  color: var(--accent-text);
}

.site-header {
  text-align: center;
  margin-bottom: 32px;
}

.brand-logo {
  display: block;
  width: min(240px, 72vw);
  height: auto;
  margin: 0 auto 6px;
  filter: drop-shadow(0 8px 20px rgba(37, 99, 235, 0.14));
  user-select: none;
  -webkit-user-drag: none;
}

.domain {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
}

.welcome {
  margin: 0 auto;
  max-width: 440px;
  font-size: 16px;
  color: var(--muted);
}

main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.app-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 30px 22px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.app-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-ink);
  box-shadow: var(--shadow-card);
  text-decoration: none;
}

.app-logo {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  display: block;
  object-fit: cover;
  margin-bottom: 18px;
  box-shadow: var(--shadow-logo);
  user-select: none;
  -webkit-user-drag: none;
}

.app-card h2 {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
}

.app-desc {
  margin: 0 0 14px;
  font-size: 14.5px;
  color: var(--muted);
}

.app-url {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
  transition: color 150ms ease;
}

.app-card:hover .app-url {
  color: var(--accent-ink);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 156px;
  height: 44px;
  padding: 0 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background-color: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.btn:hover {
  background-color: var(--surface-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
  text-decoration: none;
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background-color: var(--accent);
  border-color: transparent;
  color: var(--accent-text);
  box-shadow: var(--shadow-cta);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  border-color: transparent;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.error-main {
  align-items: center;
}

.error-logo-link {
  display: inline-flex;
  margin-bottom: 24px;
  border-radius: 18px;
  box-shadow: var(--shadow-logo);
  transition: transform 150ms ease;
}

.error-logo-link:hover {
  transform: translateY(-1px);
}

.error-logo-link img {
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  user-select: none;
  -webkit-user-drag: none;
}

.error-card {
  width: 100%;
  max-width: 460px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
}

.error-code {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: clamp(52px, 11vw, 72px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--accent-ink);
}

.error-card h1 {
  margin: 0 0 10px;
  font-size: clamp(22px, 4vw, 26px);
  font-weight: 600;
  line-height: 1.25;
}

.error-desc {
  margin: 0 0 24px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
}

.error-actions {
  display: flex;
  justify-content: center;
}

.redirect-note {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.redirect-note strong {
  color: var(--text);
  font-weight: 600;
}

.site-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
  transition: color 150ms ease;
}

.site-footer a:hover {
  color: var(--text);
  text-decoration: none;
}

.site-footer a:focus-visible {
  border-radius: 4px;
}

.footer-contact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.footer-contact svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

@media (max-width: 520px) {
  .page {
    padding: 16px 16px 24px;
  }

  .site-header {
    margin-bottom: 24px;
  }

  .apps-grid {
    grid-template-columns: 1fr;
  }

  .app-card {
    padding: 24px 18px;
  }

  .error-card {
    padding: 26px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lang-btn,
  .app-card,
  .app-url,
  .btn,
  .error-logo-link,
  .site-footer a {
    transition: none;
  }

  .app-card:hover,
  .btn:hover,
  .btn:active,
  .error-logo-link:hover {
    transform: none;
  }
}
