/*
 * Единая тёмная стеклянная тема приложения.
 * Все визуальные настройки централизованы здесь.
 */
:root {
  color-scheme: dark;
  --font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-size: 15px;
  --line-height: 1.55;
  --page-width: 820px;
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --radius: 14px;
  --radius-small: 10px;

  --color-page: #080e19;
  --color-surface: rgba(17, 27, 44, .76);
  --color-surface-raised: rgba(25, 39, 61, .78);
  --color-surface-input: rgba(7, 15, 28, .62);
  --color-text: #e8f0fb;
  --color-muted: #91a2ba;
  --color-border: rgba(151, 180, 218, .17);
  --color-border-strong: rgba(151, 190, 225, .3);
  --color-control-border: rgba(145, 174, 210, .25);
  --color-primary: #168da5;
  --color-primary-hover: #20a9bd;
  --color-primary-text: #f4fdff;
  --color-error-bg: rgba(150, 45, 59, .18);
  --color-error-text: #ffb8c0;
  --color-success-bg: rgba(27, 137, 111, .16);
  --shadow-panel: 0 24px 80px rgba(0, 0, 0, .38);
  --shadow-control: 0 8px 24px rgba(0, 0, 0, .18);
  --focus-ring: 0 0 0 3px rgba(42, 184, 203, .2);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--color-page); }

body {
  min-height: 100vh;
  margin: 0;
  padding: clamp(20px, 5vh, 56px) var(--space-2);
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 12% 8%, rgba(19, 112, 145, .22), transparent 38%),
    radial-gradient(ellipse at 88% 82%, rgba(44, 75, 151, .2), transparent 42%),
    linear-gradient(145deg, #080e19 0%, #0b1423 48%, #0b1020 100%);
  color: var(--color-text);
  font: var(--font-size)/var(--line-height) var(--font-family);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .16;
  background-image:
    linear-gradient(rgba(155, 190, 220, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(155, 190, 220, .045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

.page-shell {
  width: min(100%, var(--page-width));
  margin: 0 auto;
  padding: clamp(22px, 4vw, 36px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  box-shadow: var(--shadow-panel);
  -webkit-backdrop-filter: blur(22px) saturate(135%);
  backdrop-filter: blur(22px) saturate(135%);
}

.auth-panel { width: min(100%, 420px); margin: 8vh auto; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

h1, h2 { margin-top: 0; line-height: 1.25; letter-spacing: -.025em; }
h1 { margin-bottom: 0; font-size: clamp(1.35rem, 3vw, 1.65rem); font-weight: 680; }
h2 { margin-bottom: var(--space-2); font-size: 1.18rem; font-weight: 650; }
p { margin: 0 0 var(--space-2); }
strong { color: #f2f8ff; font-weight: 650; }
code {
  padding: 2px 6px;
  color: #a9e6ee;
  background: rgba(7, 15, 28, .65);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  overflow-wrap: anywhere;
}
.muted, .help-text { color: var(--color-muted); }
.content-section { margin-top: var(--space-3); }
.form-stack { display: flex; flex-direction: column; gap: var(--space-1); }

label {
  margin-top: var(--space-1);
  color: #cbd8e9;
  font-size: .92rem;
  font-weight: 620;
}

input, select, button { font: inherit; }

input, select {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  color: var(--color-text);
  background: var(--color-surface-input);
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-small);
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .18);
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

input::placeholder { color: #71839c; opacity: 1; }
input:hover, select:hover { border-color: var(--color-border-strong); }
input:focus, select:focus {
  border-color: rgba(49, 190, 207, .72);
  background: rgba(8, 19, 34, .86);
  box-shadow: var(--focus-ring);
}
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--color-text);
  box-shadow: 0 0 0 1000px #101d30 inset, var(--focus-ring);
  transition: background-color 9999s ease-out;
}

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  margin-top: var(--space-2);
  padding: 9px 17px;
  color: var(--color-primary-text);
  background: linear-gradient(135deg, #147f98, #147f9c 55%, #176f91);
  border: 1px solid rgba(104, 221, 229, .2);
  border-radius: var(--radius-small);
  box-shadow: 0 7px 20px rgba(0, 119, 147, .2), inset 0 1px 0 rgba(255, 255, 255, .12);
  font: inherit;
  font-weight: 620;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform .16s ease, filter .16s ease, box-shadow .16s ease, border-color .16s ease;
}

button:hover, .button:hover {
  filter: brightness(1.12);
  border-color: rgba(117, 230, 235, .42);
  box-shadow: 0 9px 26px rgba(0, 145, 166, .28), inset 0 1px 0 rgba(255, 255, 255, .16);
}
button:active, .button:active { transform: translateY(1px); }
button:focus-visible, .button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring), 0 7px 20px rgba(0, 119, 147, .2);
}
button:disabled {
  opacity: .48;
  filter: saturate(.55);
  cursor: not-allowed;
  box-shadow: none;
}

.button-secondary {
  color: #c9d8e9;
  background: rgba(120, 151, 188, .08);
  border-color: var(--color-control-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
}
.button-secondary:hover {
  color: #effaff;
  background: rgba(42, 155, 177, .13);
  border-color: rgba(78, 195, 207, .42);
  box-shadow: 0 7px 20px rgba(0, 0, 0, .16);
}

.header-action, .form-actions, .result-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.header-action form { margin: 0; }
.header-action button, .header-action .button { margin: 0; }
.form-actions button, .result-actions button { margin-top: var(--space-2); }
.result-actions { margin-top: var(--space-1); }

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

a:not(.button) { color: #62c9d7; text-decoration-color: rgba(98, 201, 215, .35); }
a:not(.button):hover { color: #9ce8ed; }

.alert {
  padding: 12px 15px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: rgba(120, 151, 188, .08);
}
.alert-error {
  color: var(--color-error-text);
  background: var(--color-error-bg);
  border-color: rgba(239, 112, 130, .24);
}
.help-text { font-size: .9rem; }

::selection { color: #f4fdff; background: rgba(27, 153, 177, .42); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 560px) {
  body { padding: 12px 0; }
  .page-shell {
    width: 100%;
    padding: var(--space-2);
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }
  .page-header { align-items: flex-start; }
  .header-action { justify-content: flex-end; gap: 8px; }
  .header-action .button, .header-action button { padding-inline: 11px; }
  .form-actions, .result-actions { align-items: stretch; }
  .form-actions button, .result-actions button { flex: 1 1 100%; }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .page-shell { background: #111b2c; }
}
