/* ==========================================================================
   Apocalypse Mod by DW — Sci-Fi Design System & Portal Stylesheet
   Production & Test Stand Asset (CSP style-src 'self' compliant)
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Surfaces & Backgrounds */
  --bg-deep: #07121f;
  --bg-base: #0b1a2d;
  --surface-base: #102337;
  --surface-elevated: #203C53;
  --surface-floating: #2A4860;
  --surface-panel: rgba(16, 35, 55, 0.82);
  --surface-panel-border: rgba(118, 156, 184, 0.38);

  /* Borders & Dividers */
  --border-subtle: rgba(118, 156, 184, 0.22);
  --border-main: #769CB8;
  --border-bright: #9ec5e2;
  --border-glow: rgba(97, 221, 245, 0.45);

  /* Typography Colors */
  --text-primary: #EEF5FC;
  --text-secondary: #B5CDDF;
  --text-muted: #7E9EB8;
  --text-dim: #54748c;

  /* Accent Colors */
  --cyan-accent: #61DDF5;
  --cyan-glow: rgba(97, 221, 245, 0.5);
  --amber-accent: #F3B64C;
  --amber-glow: rgba(243, 182, 76, 0.5);
  --amber-btn-bg-1: rgba(175, 102, 22, 0.94);
  --amber-btn-bg-2: rgba(115, 58, 10, 0.96);

  /* Semantic Feedback */
  --color-success: #4AE3A8;
  --color-warning: #F3B64C;
  --color-error: #F06A6A;
  --color-info: #61DDF5;

  /* Fonts */
  --font-display: 'Exo 2', 'Rajdhani', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Consolas', 'Courier New', monospace;

  /* Radii & Chamfers */
  --radius-sm: 4px;
  --radius-md: 6px;
  --chamfer-size: 8px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg-deep);
  background-image: 
    radial-gradient(circle at 50% 0%, #152d47 0%, transparent 65%),
    linear-gradient(180deg, var(--bg-deep) 0%, #050c14 100%);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

/* Accessible focus visible */
:focus-visible, a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--cyan-accent) !important;
  outline-offset: 3px !important;
}

[hidden] {
  display: none !important;
}

/* ==========================================================================
   Header (BrandHeader)
   ========================================================================== */
.header {
  position: relative;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 7%;
  background: rgba(11, 26, 45, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 100;
}

.header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  right: 15%;
  width: 48px;
  height: 1px;
  background: var(--cyan-accent);
  box-shadow: 0 0 10px var(--cyan-accent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--text-primary);
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--cyan-accent);
  border-radius: var(--radius-sm);
  background: rgba(97, 221, 245, 0.1);
  box-shadow: 0 0 10px rgba(97, 221, 245, 0.25);
  font-size: 20px;
  font-weight: 800;
  color: var(--cyan-accent);
}

.brand small {
  display: block;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

.header nav {
  display: flex;
  align-items: center;
  gap: 32px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.header nav a:hover {
  color: var(--text-primary);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
  min-height: 620px;
  position: relative;
  display: flex;
  align-items: center;
  background: #0b1a2d url('hero.png') center right / cover no-repeat;
  overflow: hidden;
}

.hero-shade {
  position: absolute;
  inset: 0;
  background: 
    linear-gradient(90deg, rgba(7, 18, 31, 0.96) 0%, rgba(7, 18, 31, 0.82) 42%, rgba(7, 18, 31, 0.15) 85%, rgba(7, 18, 31, 0.45) 100%),
    linear-gradient(0deg, rgba(7, 18, 31, 0.95) 0%, transparent 35%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 5;
  width: min(650px, 86%);
  margin-left: 7%;
  padding: 60px 0 80px;
}

.overline {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan-accent);
  margin-bottom: 16px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(38px, 5.2vw, 68px);
  line-height: 1.06;
  letter-spacing: -0.01em;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 20px;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}

.lead {
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 480px;
  margin-bottom: 32px;
}

.hero-caption {
  position: absolute;
  bottom: 24px;
  left: 7%;
  right: 7%;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--text-muted);
  font-size: 12px;
  z-index: 5;
  border-top: 1px solid rgba(118, 156, 184, 0.15);
  padding-top: 12px;
}

/* ==========================================================================
   ChamferButton (Янтарная главная кнопка)
   ========================================================================== */
.primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 13px 30px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff6e5;
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 1;
  transition: transform var(--transition-fast);
}

.primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #f7ce7a 0%, #e8a236 45%, #f3b64c 100%);
  clip-path: polygon(
    var(--chamfer-size) 0%,
    calc(100% - var(--chamfer-size)) 0%,
    100% var(--chamfer-size),
    100% calc(100% - var(--chamfer-size)),
    calc(100% - var(--chamfer-size)) 100%,
    var(--chamfer-size) 100%,
    0% calc(100% - var(--chamfer-size)),
    0% var(--chamfer-size)
  );
  filter: drop-shadow(0 0 12px var(--amber-glow));
  z-index: -2;
  transition: filter var(--transition-normal), background var(--transition-normal);
}

.primary::after {
  content: '';
  position: absolute;
  inset: 1.5px;
  background: linear-gradient(180deg, var(--amber-btn-bg-1) 0%, var(--amber-btn-bg-2) 100%);
  clip-path: polygon(
    calc(var(--chamfer-size) - 0.5px) 0%,
    calc(100% - calc(var(--chamfer-size) - 0.5px)) 0%,
    100% calc(var(--chamfer-size) - 0.5px),
    100% calc(100% - calc(var(--chamfer-size) - 0.5px)),
    calc(100% - calc(var(--chamfer-size) - 0.5px)) 100%,
    calc(var(--chamfer-size) - 0.5px) 100%,
    0% calc(100% - calc(var(--chamfer-size) - 0.5px)),
    0% calc(var(--chamfer-size) - 0.5px)
  );
  z-index: -1;
  transition: background var(--transition-normal);
}

.primary:hover {
  transform: translateY(-1px);
}

.primary:hover::before {
  background: linear-gradient(135deg, #ffe299 0%, #f7b445 45%, #ffd173 100%);
  filter: drop-shadow(0 0 18px rgba(243, 182, 76, 0.8));
}

.primary:hover::after {
  background: linear-gradient(180deg, rgba(195, 118, 28, 0.94) 0%, rgba(135, 70, 14, 0.96) 100%);
}

.primary:active {
  transform: translateY(1px) scale(0.99);
}

.primary:disabled {
  cursor: not-allowed;
  transform: none;
  color: var(--text-muted);
}

.primary:disabled::before {
  background: rgba(118, 156, 184, 0.3);
  filter: none;
}

.primary:disabled::after {
  background: rgba(20, 38, 54, 0.85);
}

/* ==========================================================================
   Join Section & Portal Panel (Личный кабинет пилота)
   ========================================================================== */
.join {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 8%;
  padding: 90px 7%;
  background: #0e2237;
  background-image: 
    radial-gradient(circle at 80% 20%, rgba(97, 221, 245, 0.07) 0%, transparent 60%),
    linear-gradient(180deg, #07121f 0%, #0e2237 100%);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.section-copy h2 {
  font-family: var(--font-display);
  font-size: clamp(32px, 3.8vw, 50px);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 12px 0 20px;
}

.section-copy > p:last-child {
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 440px;
  font-size: 15px;
}

.join-panel {
  padding: 32px 36px;
  background: var(--surface-panel);
  backdrop-filter: blur(14px);
  border: 1px solid var(--surface-panel-border);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
}

.panel-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan-accent);
}

.join-panel h3 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 12px 0 8px;
}

.join-panel p {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 14px;
  margin-bottom: 16px;
}

/* Кнопка входа Google */
.google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(22, 45, 68, 0.7);
  color: var(--text-primary);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-sm);
  min-height: 48px;
  padding: 10px 22px;
  font-size: 14.5px;
  font-weight: 600;
  transition: all var(--transition-fast);
  cursor: pointer;
  margin-top: 10px;
}

.google:hover:not(:disabled) {
  background: rgba(30, 60, 90, 0.95);
  border-color: var(--cyan-accent);
  box-shadow: 0 0 14px rgba(97, 221, 245, 0.3);
}

.google .google-g {
  font-size: 18px;
  font-weight: 800;
  color: var(--cyan-accent);
}

/* Кнопка выхода */
#logout {
  margin-top: 14px;
  min-height: 42px;
  padding: 10px 20px;
  background: rgba(25, 48, 70, 0.8);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition-fast);
}

#logout:hover {
  background: rgba(35, 65, 95, 0.95);
  border-color: var(--border-main);
}

#session-status {
  padding: 12px 0 6px;
  margin-bottom: 0;
  font-weight: 600;
  color: var(--cyan-accent);
  font-size: 13.5px;
}

#game-nickname {
  background: rgba(97, 221, 245, 0.1);
  border: 1px solid rgba(97, 221, 245, 0.3);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  margin: 12px 0;
}

/* Формы ника и пароля */
#nickname-form, #password-form {
  border-top: 1px solid var(--border-subtle);
  margin-top: 20px;
  padding-top: 18px;
}

#nickname-form label, #password-form label {
  display: block;
  margin: 12px 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

#nickname-form input, #password-form input {
  display: block;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-main);
  border-radius: var(--radius-sm);
  background: #091a2b;
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

#nickname-form input:focus, #password-form input:focus {
  outline: none;
  border-color: var(--cyan-accent);
  box-shadow: 0 0 10px rgba(97, 221, 245, 0.35);
}

#nickname-form button, #password-form button {
  margin-top: 14px;
}

#nickname-status, #password-status {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Карточки скачивания лаунчера */
#client-downloads {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.download-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.download-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 14px 18px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  background: rgba(18, 40, 62, 0.65);
  backdrop-filter: blur(8px);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.download-card:hover {
  border-color: var(--cyan-accent);
  background: rgba(26, 56, 84, 0.85);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.download-card strong {
  display: block;
  font-size: 14.5px;
  color: var(--text-primary);
}

.download-card small {
  display: block;
  margin-top: 4px;
  line-height: 1.4;
  color: var(--text-muted);
  font-size: 12px;
}

.notice {
  font-size: 11.5px !important;
  color: var(--text-muted) !important;
  line-height: 1.5;
  margin-top: 12px;
}

/* ==========================================================================
   About & Footer
   ========================================================================== */
.about {
  display: flex;
  justify-content: space-between;
  gap: 48px;
  padding: 90px 7%;
  background: #081524;
}

.about h2 {
  font-family: var(--font-display);
  font-size: clamp(30px, 3.5vw, 46px);
  font-weight: 800;
  line-height: 1.12;
  color: var(--text-primary);
}

.about > p {
  max-width: 440px;
  color: var(--text-secondary);
  font-size: 15.5px;
  line-height: 1.7;
}

footer {
  padding: 24px 7%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border-subtle);
  background: #06101c;
  flex-wrap: wrap;
}

footer a:hover {
  color: var(--cyan-accent);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 820px) {
  .header {
    height: 72px;
    padding: 0 5%;
  }
  .header nav {
    gap: 16px;
    font-size: 13px;
  }
  .hero-content {
    margin-left: 5%;
    width: 90%;
  }
  .join {
    grid-template-columns: 1fr;
    padding: 60px 5%;
    gap: 32px;
  }
  .about {
    display: block;
    padding: 60px 5%;
  }
  .about > p {
    margin-top: 20px;
  }
  footer {
    padding: 20px 5%;
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
