/**
 * Lavren — giriş / kayıt / şifre sıfırlama mobil düzeni
 * Yalnızca max-width: 768px; masaüstüne dokunmaz.
 */
@media (max-width: 768px) {
  body.lavren-auth-page {
    --auth-pad-x: clamp(16px, 4.8vw, 24px);
    --auth-pad-top: max(12px, env(safe-area-inset-top, 0px));
    --auth-pad-bottom: max(clamp(18px, 4.5vw, 28px), env(safe-area-inset-bottom, 0px));
    --auth-header-pt: clamp(12px, 3.2vw, 14px);
    --auth-header-pb: clamp(10px, 2.8vw, 14px);
    --auth-header-px: clamp(14px, 4vw, 18px);
    --auth-form-pt: clamp(12px, 3.5vw, 16px);
    --auth-ref-panel-h: clamp(148px, 36dvh, 268px);
    --auth-branding-h: clamp(84px, 21vw, 112px);
    --auth-logo-max: clamp(96px, 36vw, 150px);
    --auth-brand-gap: clamp(8px, 2.2vw, 10px);
    --auth-tagline: clamp(13px, 3.5vw, 15px);
    --auth-title: clamp(21px, 5.4vw, 24px);
    --auth-subtitle: clamp(13px, 3.4vw, 15px);
    --auth-label: clamp(12px, 3.1vw, 13px);
    --auth-input-pad-y: clamp(7px, 2vw, 9px);
    --auth-form-gap: clamp(12px, 3.2vw, 16px);
    --auth-btn-pad: clamp(12px, 3.4vw, 14px);
    --auth-section-gap: clamp(14px, 3.8vw, 20px);
    --auth-touch-min: 44px;
  }

  html:has(body.lavren-auth-page),
  body.lavren-auth-page {
    height: auto;
    min-height: 100dvh;
    max-height: none;
    max-width: 100vw;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
  }

  body.lavren-auth-page {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    height: auto;
  }

  body.lavren-auth-page .left-panel {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 0;
    position: relative;
    top: auto;
    left: auto;
    flex-shrink: 0;
    z-index: 0;
    padding: var(--auth-header-pt) var(--auth-header-px) var(--auth-header-pb);
    padding-top: max(var(--auth-header-pt), env(safe-area-inset-top, 0px));
    justify-content: flex-start;
    background:
      linear-gradient(to bottom,
        color-mix(in srgb, var(--accent) 88%, #ffffff) 0%,
        color-mix(in srgb, var(--accent) 62%, #ffffff) 8%,
        color-mix(in srgb, #5f5b7a 42%, #ffffff) 16%,
        color-mix(in srgb, #5f5b7a 18%, #ffffff) 24%,
        color-mix(in srgb, #5f5b7a 7%, #ffffff) 32%,
        var(--chat-bg) 40%,
        var(--chat-bg) 100%),
      radial-gradient(ellipse 62% 38% at 0% 0%, color-mix(in srgb, var(--accent) 42%, transparent) 0%, transparent 75%),
      radial-gradient(ellipse 58% 36% at 100% 0%, color-mix(in srgb, #5f5b7a 38%, transparent) 0%, transparent 76%),
      var(--chat-bg);
    background-color: var(--chat-bg);
    background-size: 100% 100%;
    background-position: 0 0;
    background-repeat: no-repeat;
  }

  /* Logo üst konumu: eski ortalı panel referansı; alt spacer yok */
  body.lavren-auth-page .left-panel-spacer {
    flex: 0 0 auto;
    width: 100%;
    min-height: 0;
  }

  body.lavren-auth-page .left-panel-spacer:first-child {
    height: max(
      0px,
      calc(
        (var(--auth-ref-panel-h) - var(--auth-header-pt) - var(--auth-header-pb) - var(--auth-branding-h)) / 2
      )
    );
  }

  body.lavren-auth-page .left-panel-spacer:last-child {
    display: none;
  }

  body.lavren-auth-page .left-panel-branding {
    gap: var(--auth-brand-gap);
    max-width: min(92vw, 360px);
    flex: 0 0 auto;
  }

  body.lavren-auth-page .left-panel-logo {
    width: auto;
    max-width: var(--auth-logo-max);
    height: auto;
  }

  body.lavren-auth-page .left-panel-tagline {
    font-size: var(--auth-tagline);
    line-height: 1.3;
  }

  body.lavren-auth-page .left-panel-slogan-wrap {
    display: none;
  }

  body.lavren-auth-page .right-panel {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    flex: 1 0 auto;
    min-height: 0;
    height: auto;
    position: relative;
    top: auto;
    right: auto;
    z-index: 2;
    align-items: center;
    justify-content: flex-start;
    padding: var(--auth-form-pt) var(--auth-pad-x) var(--auth-pad-bottom);
    overflow: visible;
    background: var(--chat-bg);
  }

  body.lavren-auth-page .container {
    width: 100%;
    max-width: min(100%, 420px);
    margin-top: 0;
    margin-bottom: 0;
    flex-shrink: 0;
  }

  body.lavren-auth-page .branding {
    margin-top: 0;
    margin-bottom: var(--auth-section-gap);
  }

  body.lavren-auth-page .title {
    font-size: var(--auth-title);
    line-height: 1.2;
  }

  body.lavren-auth-page .subtitle {
    font-size: var(--auth-subtitle);
    margin-bottom: var(--auth-section-gap);
    line-height: 1.45;
  }

  body.lavren-auth-page .form-group {
    margin-bottom: var(--auth-form-gap);
  }

  body.lavren-auth-page label {
    font-size: var(--auth-label);
    margin-bottom: clamp(6px, 1.8vw, 8px);
  }

  body.lavren-auth-page .input-wrapper,
  body.lavren-auth-page .password-input-container {
    padding: clamp(5px, 1.6vw, 6px) clamp(8px, 2.2vw, 10px) clamp(5px, 1.6vw, 6px) clamp(14px, 4vw, 18px);
    min-height: var(--auth-touch-min);
    box-sizing: border-box;
  }

  body.lavren-auth-page .input {
    padding: var(--auth-input-pad-y) 0;
    font-size: 16px;
    line-height: 1.35;
    -webkit-text-size-adjust: 100%;
  }

  body.lavren-auth-page .password-hint {
    font-size: clamp(11px, 2.9vw, 12px);
    line-height: 1.4;
    margin-bottom: clamp(6px, 1.8vw, 8px);
  }

  body.lavren-auth-page .toggle-pass {
    min-width: var(--auth-touch-min);
    min-height: var(--auth-touch-min);
  }

  body.lavren-auth-page .btn {
    min-height: var(--auth-touch-min);
    padding: var(--auth-btn-pad) clamp(16px, 4vw, 20px);
    font-size: clamp(14px, 3.8vw, 15px);
  }

  body.lavren-auth-page .btn-google {
    margin-top: clamp(10px, 2.8vw, 12px);
  }

  body.lavren-auth-page .divider {
    margin: clamp(16px, 4.5vw, 22px) 0;
  }

  body.lavren-auth-page .divider span {
    font-size: clamp(12px, 3.1vw, 13px);
  }

  body.lavren-auth-page .remember {
    font-size: clamp(13px, 3.4vw, 14px);
    margin-bottom: clamp(4px, 1.2vw, 6px);
  }

  body.lavren-auth-page .remember label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: var(--auth-touch-min);
    margin-bottom: 0;
  }

  body.lavren-auth-page .auth-links {
    flex-wrap: wrap;
    gap: clamp(12px, 4vw, 20px);
    margin-top: clamp(16px, 4.5vw, 22px);
    font-size: clamp(13px, 3.6vw, 15px);
  }

  body.lavren-auth-page .auth-links a {
    min-height: var(--auth-touch-min);
    display: inline-flex;
    align-items: center;
  }

  body.lavren-auth-page .footer-note {
    margin-top: clamp(14px, 4vw, 20px);
    font-size: clamp(11px, 2.9vw, 12px);
    line-height: 1.45;
    text-align: center;
    padding-inline: var(--auth-pad-x);
  }

  body.lavren-auth-page .kayit-consent-wrap {
    margin-bottom: clamp(10px, 2.8vw, 14px);
  }

  body.lavren-auth-page .kayit-consent-label {
    align-items: flex-start;
    gap: clamp(8px, 2.2vw, 10px);
    font-size: clamp(12px, 3.2vw, 13px);
    line-height: 1.45;
  }

  body.lavren-auth-page .kayit-consent-label .kayit-checkmark {
    flex-shrink: 0;
    margin-top: 2px;
  }

  body.lavren-auth-page .error,
  body.lavren-auth-page .success {
    font-size: clamp(12px, 3.2vw, 13px);
    padding: clamp(10px, 2.8vw, 12px) clamp(12px, 3.5vw, 16px);
  }

  body.lavren-auth-page .back-to-home {
    font-size: clamp(10px, 2.8vw, 12px);
    top: max(12px, env(safe-area-inset-top, 0px));
    left: max(12px, env(safe-area-inset-left, 0px));
    gap: clamp(5px, 1.6vw, 6px);
    z-index: 100;
  }

  body.lavren-auth-page .back-to-home svg {
    width: clamp(12px, 3.2vw, 13px);
    height: clamp(12px, 3.2vw, 13px);
    align-self: center;
  }

  body.lavren-auth-page .back-to-home-text {
    white-space: normal;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.12;
    font-size: clamp(10px, 2.7vw, 11px);
    font-weight: 500;
  }

  body.lavren-auth-page .bth-line {
    display: block;
  }

  body.lavren-auth-page .bth-line-top::after {
    content: none;
  }

  body.lavren-auth-page .kayit-modal-overlay,
  body.lavren-auth-page .kayit-modal-overlay.is-open {
    padding: max(16px, env(safe-area-inset-top, 0px)) var(--auth-pad-x) max(16px, env(safe-area-inset-bottom, 0px));
  }

  body.lavren-auth-page .kayit-modal,
  body.lavren-auth-page .kayit-modal.google-consent-modal,
  body.lavren-auth-page .google-consent-modal {
    max-height: min(88dvh, calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
    width: min(100%, 480px);
  }

  /* Kısa ekranlar (iPhone SE, yatay mod) */
  @media (max-height: 680px) {
    body.lavren-auth-page {
      --auth-ref-panel-h: clamp(118px, 28dvh, 190px);
      --auth-branding-h: clamp(72px, 18vw, 96px);
      --auth-logo-max: clamp(88px, 32vw, 128px);
      --auth-form-pt: clamp(8px, 2.5vw, 12px);
      --auth-section-gap: clamp(10px, 3vw, 14px);
      --auth-form-gap: clamp(10px, 2.8vw, 14px);
    }
  }

  /* Çok dar ekran */
  @media (max-width: 360px) {
    body.lavren-auth-page {
      --auth-pad-x: 14px;
      --auth-header-px: 14px;
    }

    body.lavren-auth-page .auth-links {
      flex-direction: column;
      align-items: center;
    }
  }
}
