:root {
    --crimson: #6B1020;
    --crimson-dark: #4A0B16;
    --crimson-mid: #8C1A2E;
    --gold: #C9A84C;
    --gold-light: #E5C97E;
    --glass-bg: rgba(255,255,255,0.07);
    --glass-border: rgba(255,255,255,0.14);
    --input-bg: rgba(255,255,255,0.10);
    --input-border: rgba(255,255,255,0.2);
    --text-white: #FFFFFF;
    --text-muted: rgba(255,255,255,0.55);

    /* Fluid spacing/type tokens — scale smoothly between viewports */
    --space-page: clamp(16px, 4vw, 56px);
    --card-pad: clamp(20px, 4vw, 40px);
    --h1-size: clamp(28px, 5vw, 52px);
    --h2-size: clamp(20px, 3vw, 26px);
}

* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color: transparent; }

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

body {
    font-family: 'Arial', 'Arial', sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: stretch;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

/* === BACKGROUND === */
.bg-layer {
    position: fixed;
    inset: 0;
    background-image: url('data:image/jpeg;base64,');
    background-size: cover;
    background-position: center;
    filter: brightness(0.22) saturate(0.7);
    z-index: 0;
}

.bg-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(
      135deg,
      rgba(74,11,22,0.92) 0%,
      rgba(50,8,16,0.85) 40%,
      rgba(20,5,10,0.75) 100%
    );
    z-index: 1;
}

/* Floating bokeh orbs — sized relatively so they never overpower small screens */
.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(min(80px, 8vw));
    opacity: 0.18;
    z-index: 1;
    animation: float 8s ease-in-out infinite;
    pointer-events: none;
}
.orb-1 { width:min(500px, 60vw); height:min(500px, 60vw); background:var(--crimson); top:-120px; left:-100px; animation-delay:0s; }
.orb-2 { width:min(350px, 45vw); height:min(350px, 45vw); background:#9B2335; bottom:-80px; right:min(200px, 10vw); animation-delay:3s; }
.orb-3 { width:min(250px, 35vw); height:min(250px, 35vw); background:var(--gold); top:40%; left:38%; animation-delay:1.5s; opacity:0.1; }

@keyframes float {
    0%,100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-24px) scale(1.04); }
}

@media (prefers-reduced-motion: reduce) {
  .orb, .left-panel, .right-panel, .form-section, .btn-submit, .pill-btn { animation: none !important; transition: none !important; }
}

/* === LAYOUT === */
.page-wrap {
    position: relative;
    z-index: 2;
    display: flex;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}

/* === LEFT PANEL === */
.left-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: var(--space-page);
    animation: slideLeft 0.7s cubic-bezier(.22,1,.36,1) both;
    min-width: 0; /* prevent flex overflow */
}

@keyframes slideLeft {
    from { opacity:0; transform:translateX(-32px); }
    to { opacity:1; transform:translateX(0); }
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand img {
    width: clamp(120px, 18vw, 250px) !important;
    height: clamp(120px, 18vw, 250px) !important;
    max-width: 100%;
}

.brand-icon {
    width: 52px; height: 52px;
    background: var(--crimson);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    box-shadow: 0 8px 32px rgba(107,16,32,0.5);
    flex-shrink: 0;
}

.brand-name {
    font-family: 'Arial', serif;
    font-size: clamp(20px, 3vw, 26px);
    font-weight: 900;
    color: white;
    letter-spacing: 1px;
}
.brand-name span { color: var(--gold-light); }

.left-middle {
    max-width: 440px;
    width: 100%;
}

.left-middle h1 {
    font-family: 'Arial', serif;
    font-size: var(--h1-size);
    font-weight: 900;
    color: white;
    line-height: 1.08;
    margin-bottom: clamp(12px, 2vw, 20px);
    word-wrap: break-word;
}

.left-middle h1 em {
    color: var(--gold-light);
    font-style: italic;
}

.left-middle p {
    font-size: clamp(13px, 1.6vw, 16px);
    color: rgba(255,255,255,0.6);
    line-height: 1.7;
    margin-bottom: clamp(20px, 3vw, 36px);
    max-width: 380px;
}

.left-btns {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.pill-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.8);
    padding: 10px 20px;
    border-radius: 100px;
    font-size: clamp(12px, 1.4vw, 13px);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s;
    font-family: 'Arial', sans-serif;
    backdrop-filter: blur(8px);
    white-space: nowrap;
}

.pill-btn:hover {
    background: rgba(255,255,255,0.16);
    color: white;
    transform: translateY(-2px);
}

.left-footer {
    display: flex;
    gap: clamp(14px, 2.5vw, 24px);
    flex-wrap: wrap;
}

.stat-mini { text-align: center; }
.stat-mini .n {
    font-family: 'Arial', serif;
    font-size: clamp(18px, 2.2vw, 24px);
    font-weight: 700;
    color: var(--gold-light);
}
.stat-mini .l {
    font-size: clamp(9px, 1.1vw, 11px);
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

/* Decorative book stack illustration */
.deco-books {
    position: absolute;
    left: 56px;
    bottom: 180px;
    width: 220px;
    opacity: 0.12;
    pointer-events: none;
    z-index: 0;
}

/* === RIGHT PANEL — FORM CARD === */
.right-panel {
    width: 480px;
    max-width: 100%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 3vw, 40px) clamp(16px, 3vw, 32px);
    animation: slideRight 0.7s cubic-bezier(.22,1,.36,1) 0.15s both;
    min-width: 0;
}

@keyframes slideRight {
    from { opacity:0; transform:translateX(32px); }
    to { opacity:1; transform:translateX(0); }
}

.form-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(28px) saturate(1.4);
    -webkit-backdrop-filter: blur(28px) saturate(1.4);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: clamp(16px, 2vw, 24px);
    padding: var(--card-pad);
    box-shadow:
      0 32px 80px rgba(0,0,0,0.45),
      inset 0 1px 0 rgba(255,255,255,0.1);
    position: relative;
    overflow: hidden;
    margin: 0 auto;
}

.form-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
}

/* Tab switcher */
.tab-row {
    display: flex;
    background: rgba(0,0,0,0.25);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: clamp(20px, 3vw, 32px);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.45);
    font-size: clamp(12px, 1.5vw, 14px);
    font-weight: 600;
    padding: 10px 4px;
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.25s;
    font-family: 'Arial', sans-serif;
    min-height: 40px;
}

.tab-btn.active {
    background: var(--crimson);
    color: white;
    box-shadow: 0 4px 16px rgba(107,16,32,0.5);
}

/* Form sections */
.form-section { display: none; }
.form-section.visible { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
    from { opacity:0; transform:translateY(8px); }
    to { opacity:1; transform:translateY(0); }
}

.form-section h2 {
    font-family: 'Arial', serif;
    font-size: var(--h2-size);
    font-weight: 700;
    color: white;
    margin-bottom: 6px;
}

.form-section .sub {
    font-size: 13px;
    color: rgba(255,255,255,0.45);
    margin-bottom: clamp(20px, 3vw, 28px);
}

/* Inputs */
.field { margin-bottom: 16px; }

.field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrap input,
.input-wrap select {
    width: 100%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 13px 44px 13px 16px;
    color: white;
    font-size: 16px; /* >=16px prevents iOS auto-zoom on focus */
    font-family: 'Arial', sans-serif;
    outline: none;
    transition: all 0.2s;
    appearance: none;
    min-height: 48px; /* comfortable touch target */
}

.input-wrap input::placeholder { color: rgba(255,255,255,0.3); }

.input-wrap input:focus,
.input-wrap select:focus {
    border-color: rgba(201,168,76,0.6);
    background: rgba(255,255,255,0.12);
    box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}

.input-wrap select option { background: #2A0A12; color: white; }

.input-icon {
    position: absolute;
    right: 14px;
    color: rgba(255,255,255,0.35);
    font-size: 16px;
    pointer-events: none;
}

.toggle-pw {
    cursor: pointer;
    pointer-events: all;
    user-select: none;
    padding: 4px;
}

/* Row for two fields */
.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Extras row */
.extras-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 22px;
}

.check-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.check-wrap input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--gold);
    cursor: pointer;
    flex-shrink: 0;
}

.check-wrap span {
    font-size: 13px;
    color: rgba(255,255,255,0.55);
}

.forgot-link {
    font-size: 13px;
    color: var(--gold-light);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}
.forgot-link:hover { color: white; }

/* Submit btn */
.btn-submit {
    width: 100%;
    background: var(--crimson);
    border: none;
    color: white;
    padding: 15px;
    border-radius: 13px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Arial', sans-serif;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
    transition: all 0.25s;
    box-shadow: 0 8px 24px rgba(107,16,32,0.5);
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-submit::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}

.btn-submit:hover {
    background: #7D1525;
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(107,16,32,0.6);
}

.btn-submit:hover::after { opacity:1; }
.btn-submit:active { transform: translateY(0); }

.btn-submit.loading {
  pointer-events: none;
  opacity: 0.85;
}
.btn-submit.loading .spinner { display: inline-block; }
.btn-submit.loading .btn-text::after { content: attr(data-loading); }
.btn-submit .btn-text::after { content: ''; }

/* Spinner */
.spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Divider */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.1);
}
.divider span { font-size: 12px; color: rgba(255,255,255,0.3); }

/* Social btn */
.btn-social {
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.7);
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: 'Arial', sans-serif;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 46px;
}
.btn-social:hover {
    background: rgba(255,255,255,0.12);
    color: white;
    border-color: rgba(255,255,255,0.2);
}

/* Switch link */
.switch-txt {
    text-align: center;
    margin-top: 22px;
    font-size: 13px;
    color: rgba(255,255,255,0.4);
}
.switch-txt a {
    color: var(--gold-light);
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
}
.switch-txt a:hover { color: white; }

/* Toast */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: rgba(74,11,22,0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(201,168,76,0.3);
    color: white;
    padding: 14px 24px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    z-index: 999;
    opacity: 0;
    transition: all 0.4s cubic-bezier(.22,1,.36,1);
    max-width: calc(100vw - 32px);
    width: max-content;
    white-space: normal;
    text-align: center;
    line-height: 1.5;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Password strength bar */
.strength-bar {
    height: 3px;
    border-radius: 3px;
    background: rgba(255,255,255,0.1);
    margin-top: 8px;
    overflow: hidden;
}
.strength-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s, background 0.3s;
    width: 0%;
    background: var(--crimson-mid);
}

/* === BACK TO LIBRARY === */
.back-link {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.75);
  padding: 9px 16px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  backdrop-filter: blur(8px);
  transition: all 0.2s;
}
.back-link:hover {
  background: rgba(255,255,255,0.16);
  color: white;
  transform: translateX(-2px);
}
.back-link i { font-size: 12px; }

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* Large tablet / small laptop: panels stack side-by-side but tighten up */
@media (max-width: 1100px) {
  .left-panel { padding: var(--space-page) clamp(24px, 4vw, 40px); }
  .right-panel { width: 420px; }
}

/* Tablet: stack the two panels vertically */
@media (max-width: 900px) {
  .page-wrap { flex-direction: column; }

  .left-panel {
    padding: 90px 40px 32px;
    align-items: center;
    text-align: center;
  }
  .left-middle { max-width: 100%; }
  .left-middle p { margin-left: auto; margin-right: auto; }
  .left-btns { justify-content: center; }
  .left-footer { justify-content: center; flex-wrap: wrap; }

  .right-panel { width: 100%; padding: 24px; }
  .form-card { max-width: 480px; margin: 0 auto; }

  .deco-books { display: none; }
}

/* Small tablet / large phone landscape */
@media (max-width: 768px) {
  .left-panel { padding: 84px 28px 28px; }
  .orb-1, .orb-2, .orb-3 { filter: blur(60px); opacity: 0.12; }
}

/* Mobile */
@media (max-width: 560px) {
  body { overflow-y: auto; overflow-x: hidden; min-height: 100vh; }
  .page-wrap { min-height: 100vh; min-height: 100dvh; }

  .back-link {
    top: 16px;
    left: 16px;
    padding: 8px 14px;
    font-size: 12px;
  }

  .left-panel { padding: 76px 20px 24px; gap: 24px; }
  .brand img { width: 130px !important; height: 130px !important; }
  .left-middle h1 { margin-bottom: 14px; }
  .left-btns { gap: 8px; }
  .pill-btn { font-size: 12px; padding: 9px 14px; }
  .left-footer { gap: 16px; margin-top: 8px; }

  .right-panel { padding: 16px; }
  .form-card { padding: 24px 20px; border-radius: 18px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .tab-btn { font-size: 13px; padding: 9px 4px; }
  .extras-row { gap: 10px; }
  .toast { bottom: 16px; font-size: 13px; padding: 12px 18px; }
}

/* Very small phones */
@media (max-width: 360px) {
  .form-card { padding: 20px 14px; }
  .brand img { width: 100px !important; height: 100px !important; }
  .field-row { gap: 0; }
}

/* Landscape phones (short viewport height) — reclaim vertical space */
@media (max-height: 560px) and (orientation: landscape) {
  .page-wrap { flex-direction: row; }
  .left-panel { display: none; }
  .right-panel { width: 100%; padding: 16px; align-items: flex-start; padding-top: 24px; }
  .form-card { max-width: 420px; }
  .orb { display: none; }
}

/* Large desktop — cap growth so the card doesn't get lost */
@media (min-width: 1600px) {
  .right-panel { width: 520px; }
  .form-card { max-width: 460px; }
}