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

    :root {
      --bg: #070814;
      --bg-input: rgba(28, 33, 64, 0.8);
      --accent: #8d7cff;
      --accent-hover: #b3a8ff;
      --accent2: #ea72ff;
      --danger: #f43f5e;
      --text: #f4f7ff;
      --text-muted: #8c94bc;
      --border: rgba(255, 255, 255, 0.1);
      --success: #10d9a0;
      --warn: #f59e0b;
      --radius: 20px;
      --radius-sm: 14px;
      --panel-shadow: 0 20px 60px rgba(0, 0, 0, 0.42);
      --panel-shadow-soft: 0 12px 30px rgba(8, 12, 24, 0.3);
      --layer-bg: 0;
      --layer-surface: 10;
      --layer-content: 20;
      --layer-overlay: 130;
      --layer-floating: 120;
      --layer-scrim: 140;
      --surface-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
      --surface-bg-strong: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.035));
      --surface-fill: rgba(18, 21, 43, 0.72);
      --surface-fill-strong: rgba(17, 20, 39, 0.78);
      --surface-border: rgba(255, 255, 255, 0.08);
      --surface-shadow: 0 18px 34px rgba(6, 9, 18, 0.22);
      --surface-shadow-strong: 0 32px 80px rgba(5, 8, 18, 0.54);
      --surface-radius: 24px;
      --surface-radius-lg: 32px;
      --safe-top: env(safe-area-inset-top, 0px);
      --safe-right: env(safe-area-inset-right, 0px);
      --safe-bottom: env(safe-area-inset-bottom, 0px);
      --safe-left: env(safe-area-inset-left, 0px);
      --bottom-nav-height: 100px;
      --bottom-nav-safe-bottom: 0px;
      --bottom-nav-offset: calc(14px + var(--bottom-nav-safe-bottom));
      --bottom-safe-fill-height: calc(14px + var(--bottom-nav-safe-bottom));
      --page-padding-x: 16px;
      --page-padding-top: calc(16px + var(--safe-top));
      --page-padding-bottom: 20px;
      --select-gap: 10px;
      --app-viewport-height: 100dvh;
      --keyboard-focus-scroll-bottom: 160px;
    }

    input[type="number"] {
      -moz-appearance: textfield;
    }

    input[type="number"]::-webkit-outer-spin-button,
    input[type="number"]::-webkit-inner-spin-button {
      -webkit-appearance: none;
      margin: 0;
    }

    html, body {
      height: 100%;
      min-height: var(--app-viewport-height);
      background:
        radial-gradient(ellipse at 14% 8%, rgba(141, 124, 255, 0.22) 0%, transparent 34%),
        radial-gradient(ellipse at 84% 14%, rgba(234, 114, 255, 0.18) 0%, transparent 32%),
        radial-gradient(ellipse at 50% 104%, rgba(82, 215, 255, 0.12) 0%, transparent 38%),
        linear-gradient(180deg, #0a0c1d 0%, #070814 100%);
      color: var(--text);
      font-family: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
      font-size: 15px;
      line-height: 1.5;
      overflow: hidden;
      scroll-padding-bottom: 24px;
      color-scheme: dark;
    }

    html {
      height: 100%;
      min-height: 100dvh;
      background-color: #070814;
    }

    .is-standalone-pwa,
    .is-standalone-pwa body {
      height: 100vh;
      min-height: 100vh;
    }

    body {
      position: relative;
      overflow: hidden;
    }

    body::before,
    body::after {
      content: '';
      position: fixed;
      pointer-events: none;
      z-index: var(--layer-bg);
      filter: blur(24px);
      opacity: 0.9;
    }

    body::before {
      width: 360px;
      height: 360px;
      left: -110px;
      top: 120px;
      background: radial-gradient(circle, rgba(82, 215, 255, 0.16) 0%, rgba(82, 215, 255, 0.03) 55%, transparent 72%);
    }

    body::after {
      width: 420px;
      height: 420px;
      right: -120px;
      bottom: 30px;
      background: radial-gradient(circle, rgba(234, 114, 255, 0.14) 0%, rgba(234, 114, 255, 0.03) 55%, transparent 72%);
    }

    .app {
      width: min(480px, 100%);
      max-width: 480px;
      margin: 0 auto;
      padding:
        var(--page-padding-top)
        var(--page-padding-x)
        0
        var(--page-padding-x);
      min-height: var(--app-viewport-height);
      height: var(--app-viewport-height);
      display: flex;
      flex-direction: column;
      position: relative;
      z-index: var(--layer-content);
      min-width: 0;
      overflow: hidden;
    }

    .is-standalone-pwa .app,
    .is-standalone-pwa .auth-gate {
      height: 100vh;
      min-height: 100vh;
    }

    @supports (height: 100lvh) {
      .is-standalone-pwa,
      .is-standalone-pwa body,
      .is-standalone-pwa .app,
      .is-standalone-pwa .auth-gate {
        height: 100lvh;
        min-height: 100lvh;
      }
    }

    .auth-gate {
      min-height: var(--app-viewport-height);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 24px 18px;
      background:
        radial-gradient(ellipse at 30% 0%, rgba(124, 109, 240, 0.30) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 30%, rgba(217, 70, 239, 0.20) 0%, transparent 50%),
        radial-gradient(ellipse at 10% 80%, rgba(6, 194, 216, 0.10) 0%, transparent 45%),
        linear-gradient(180deg, #0d0f20 0%, #0a0c1c 100%);
      position: relative;
      z-index: var(--layer-content);
      min-width: 0;
      overflow-x: hidden;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    .auth-card {
      width: 100%;
      max-width: 392px;
      background:
        radial-gradient(circle at 18% 12%, rgba(82, 215, 255, 0.14), transparent 24%),
        radial-gradient(circle at 92% 10%, rgba(234, 114, 255, 0.12), transparent 22%),
        linear-gradient(145deg, rgba(23, 26, 49, 0.8), rgba(12, 15, 32, 0.92));
      backdrop-filter: blur(28px);
      -webkit-backdrop-filter: blur(24px);
      border: 1px solid rgba(255, 255, 255, 0.09);
      border-radius: 28px;
      padding: 30px 24px;
      box-shadow:
        0 36px 90px rgba(0, 0, 0, 0.56),
        0 0 0 1px rgba(141, 124, 255, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
      position: relative;
      overflow: visible;
      isolation: isolate;
      z-index: var(--layer-surface);
    }

    .auth-card[data-auth-mode="local"] {
      border-color: rgba(96, 165, 250, 0.18);
    }

    .auth-card[data-auth-state="error"] {
      border-color: rgba(244, 63, 94, 0.22);
    }

    .auth-card::before {
      content: '';
      position: absolute;
      top: -60px;
      right: -40px;
      width: 180px;
      height: 180px;
      background: radial-gradient(circle, rgba(124, 109, 240, 0.25) 0%, transparent 70%);
      pointer-events: none;
    }

    .auth-card::after {
      content: '';
      position: absolute;
      bottom: -40px;
      left: -30px;
      width: 140px;
      height: 140px;
      background: radial-gradient(circle, rgba(217, 70, 239, 0.18) 0%, transparent 70%);
      pointer-events: none;
    }

    .auth-title {
      font-size: 26px;
      line-height: 1.2;
      letter-spacing: -0.04em;
      font-weight: 800;
      margin-bottom: 10px;
      background: linear-gradient(135deg, #ffffff 0%, #b4b8ff 36%, #ff9af0 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }

    .auth-kicker {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      width: fit-content;
      padding: 6px 10px;
      border-radius: 999px;
      margin-bottom: 14px;
      border: 1px solid rgba(255, 255, 255, 0.08);
      background: rgba(255, 255, 255, 0.05);
      color: #d5dcff;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.11em;
      text-transform: uppercase;
    }

    .auth-kicker::before {
      content: '';
      width: 7px;
      height: 7px;
      border-radius: 999px;
      background: var(--success);
      box-shadow: 0 0 0 4px rgba(16, 217, 160, 0.12);
    }

    .auth-card[data-auth-mode="local"] .auth-kicker::before {
      background: #60a5fa;
      box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.12);
    }

    .auth-banner {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      margin: 14px 0 16px;
      padding: 14px 14px 14px 13px;
      border-radius: 20px;
      border: 1px solid rgba(255, 255, 255, 0.08);
      background: rgba(255, 255, 255, 0.04);
      color: #d5ddff;
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
    }

    .auth-banner.hidden {
      display: none;
    }

    .auth-banner-icon {
      flex: 0 0 auto;
      width: 30px;
      height: 30px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 10px;
      background: rgba(141, 124, 255, 0.14);
      color: #dbe2ff;
      font-size: 16px;
      font-weight: 800;
    }

    .auth-banner.is-local .auth-banner-icon {
      background: rgba(96, 165, 250, 0.16);
      color: #d6e8ff;
    }

    .auth-banner.is-error .auth-banner-icon {
      background: rgba(244, 63, 94, 0.14);
      color: #ffd9e0;
    }

    .auth-banner-title {
      font-size: 14px;
      font-weight: 700;
      line-height: 1.35;
      color: #f4f7ff;
      margin-bottom: 3px;
    }

    .auth-banner-text {
      font-size: 13px;
      line-height: 1.5;
      color: #aeb8df;
    }

    .auth-actions {
      display: grid;
      gap: 10px;
      margin-top: 6px;
    }

    .auth-primary {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 46px;
      padding: 0 16px;
      border-radius: 16px;
      text-decoration: none;
      cursor: pointer;
      border: 1px solid rgba(255, 255, 255, 0.10);
      background: linear-gradient(135deg, rgba(141, 124, 255, 0.98), rgba(234, 114, 255, 0.90));
      color: #ffffff;
      font-size: 14px;
      font-weight: 800;
      letter-spacing: -0.01em;
      box-shadow: 0 16px 28px rgba(111, 92, 255, 0.25);
      transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    }

    .auth-primary:hover {
      transform: translateY(-1px);
      box-shadow: 0 20px 32px rgba(111, 92, 255, 0.32);
      filter: brightness(1.04);
    }

    .auth-primary:active {
      transform: translateY(0);
    }

    .auth-primary-hint {
      font-size: 12px;
      line-height: 1.5;
      color: var(--text-muted);
    }

    .auth-widget-shell {
      margin-top: 14px;
      padding: 14px;
      border-radius: 18px;
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid rgba(255, 255, 255, 0.06);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    }

    .auth-widget-shell.hidden {
      display: none;
    }

    .auth-text {
      font-size: 14px;
      line-height: 1.6;
      color: #a9b4d6;
      margin-bottom: 0;
    }

    .auth-note {
      font-size: 12px;
      line-height: 1.5;
      color: var(--text-muted);
      margin: 10px 0 0;
      min-height: 18px;
    }

    .auth-status {
      font-size: 13px;
      line-height: 1.5;
      color: #b8fff2;
      margin: 0 0 8px;
      min-height: 22px;
    }

    .auth-status:empty {
      display: none;
      min-height: 0;
      margin-bottom: 0;
    }

    .auth-widget {
      min-height: 48px;
      margin: 0;
      display: flex;
      justify-content: center;
    }

    .auth-widget > * {
      width: 100%;
      max-width: 100%;
    }

    .auth-error {
      font-size: 13px;
      line-height: 1.5;
      color: var(--danger);
      margin-top: 10px;
      min-height: 18px;
      display: none;
    }

    .auth-card[data-auth-state="error"] .auth-error {
      display: block;
    }

    .auth-retry {
      display: none;
      margin-top: 10px;
      font-size: 13px;
      line-height: 1.2;
      color: var(--accent-hover);
      background: transparent;
      border: none;
      padding: 0;
      cursor: pointer;
      text-align: left;
      -webkit-tap-highlight-color: transparent;
    }

    .auth-retry.visible {
      display: inline-block;
    }

    .hidden { display: none !important; }

