:root {
  --emerald-soft: #d7ddf6;
  --emerald-lighter: #e9ecf8;
  --gold: #d6a84f;
}

@media (prefers-color-scheme: dark) {
  :root {
    --emerald-soft: #2d3548;
    --emerald-lighter: #30354a;
    --gold: #e8c76f;
  }
}

html[data-theme="light"] {
  --emerald-soft: #d7ddf6;
  --emerald-lighter: #e9ecf8;
  --gold: #d6a84f;
}

html[data-theme="dark"] {
  --emerald-soft: #2d3548;
  --emerald-lighter: #30354a;
  --gold: #e8c76f;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  font-family: 'Ravi FaNum', 'Vazirmatn', Tahoma, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  max-width: 100%;
  display: block;
}

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

.scene {
  position: relative;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(400px, 520px);
  grid-template-areas: "hero card";
  align-items: center;
  justify-content: center;
  gap: clamp(50px, 8vw, 120px);
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 6vw calc(24px + env(safe-area-inset-bottom, 0px));
  background: radial-gradient(circle at 20% 10%, var(--emerald-soft) 0%, var(--bg) 48%, var(--emerald-lighter) 100%);
}

@media (prefers-color-scheme: dark) {
  .scene {
    background: linear-gradient(135deg, #2a2e3e 0%, #35394d 50%, #2d323f 100%);
  }
}

html[data-theme="light"] .scene {
  background: radial-gradient(circle at 20% 10%, var(--emerald-soft) 0%, var(--bg) 48%, var(--emerald-lighter) 100%);
}

html[data-theme="dark"] .scene {
  background: linear-gradient(135deg, #2a2e3e 0%, #35394d 50%, #2d323f 100%);
}

.bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.1;
  z-index: 0;
}

.scene-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(241, 243, 248, .08) 0%, rgba(241, 243, 248, .12) 55%, rgba(241, 243, 248, .42) 100%);
}

html[data-theme="dark"] .scene-overlay {
  background: linear-gradient(to bottom, rgba(36, 40, 58, .04) 0%, rgba(36, 40, 58, .1) 55%, rgba(36, 40, 58, .4) 100%);
}

.candles-canvas {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 30vh;
  min-height: 170px;
  max-height: 290px;
  z-index: 1;
  opacity: .42;
  pointer-events: none;
}

.auth-page-card {
  position: relative;
  z-index: 3;
  grid-area: card;
  width: min(100%, 500px);
  padding: 28px 34px 24px;
  background: rgba(248, 249, 252, .92);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(39, 48, 68, .10);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  direction: rtl;
}

html[data-theme="dark"] .auth-page-card {
  background: rgba(45, 50, 71, .94);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .24);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .auth-page-card {
    background: rgba(45, 50, 71, .94);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .24);
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--gold);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand b,
.brand span:last-child {
  display: block;
}

.brand b {
  font-size: 16px;
  color: var(--ink);
}

.brand span:last-child {
  color: var(--ink-soft);
  font-size: 13px;
  margin-top: 2px;
}

.auth-page-card h1 {
  color: var(--ink);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 8px;
}

.auth-page-card .sub {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 18px;
}

.field {
  margin-bottom: 13px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
}

.hint {
  font-size: 12px;
  font-weight: 400;
  opacity: .85;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .58);
  color: var(--ink);
  font-family: 'Ravi FaNum', 'Vazirmatn', Tahoma, 'Segoe UI', sans-serif;
  font-size: 15px;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.field input:hover {
  border-color: var(--emerald);
}

.field input:focus {
  outline: none;
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px var(--emerald-soft);
}

html[data-theme="dark"] .field input {
  background: rgba(255, 255, 255, .05);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .field input {
    background: rgba(255, 255, 255, .05);
  }
}

.msg {
  display: none;
  margin-bottom: 14px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.6;
}

.msg.error {
  display: block;
  background: rgba(184, 85, 80, .15);
  border: 1px solid rgba(184, 85, 80, .3);
  color: #b85550;
}

.msg.success {
  display: block;
  background: rgba(95, 165, 132, .15);
  border: 1px solid rgba(95, 165, 132, .3);
  color: #3f8f6b;
}

html[data-theme="dark"] .msg.error {
  color: #ff9d98;
}

html[data-theme="dark"] .msg.success {
  color: #8fd9b4;
}

.submit-btn {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--emerald);
  color: #fff;
  font: 700 15px 'Vazirmatn', sans-serif;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(102, 116, 232, .20);
  transition: background-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.submit-btn:hover {
  background: var(--emerald-deep);
  transform: translateY(-1px);
}

.submit-btn:active {
  transform: translateY(0);
}

.submit-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}

.alt-link {
  margin-top: 14px;
  color: var(--ink-soft);
  text-align: center;
}

.alt-link a,
.back-home {
  color: var(--emerald);
  font-weight: 600;
}

.back-home {
  display: block;
  margin-top: 6px;
  text-align: center;
}

.hero-art {
  position: relative;
  z-index: 3;
  grid-area: hero;
  display: flex;
  align-items: center;
  justify-content: center;
  direction: ltr;
}

.hero-art img {
  width: min(42vw, 470px);
  height: min(42vw, 470px);
  object-fit: cover;
  border-radius: 50%;
  border: 7px solid rgba(102, 116, 232, .78);
  box-shadow: 0 20px 60px rgba(39, 48, 68, .16);
}

@media (max-width: 900px) {
  .scene {
    grid-template-columns: 1fr;
    grid-template-areas:
      "card"
      "hero";
    justify-items: center;
    align-content: start;
    gap: 30px;
    padding: 84px 20px 40px;
  }

  .auth-page-card {
    width: min(100%, 520px);
  }

  .hero-art img {
    width: min(60vw, 300px);
    height: min(60vw, 300px);
    border-width: 5px;
  }

  .candles-canvas {
    height: 220px;
    min-height: 150px;
  }
}

@media (max-width: 640px) {
  .auth-page-card {
    padding: 24px 20px 22px;
    border-radius: 20px;
  }

  .auth-page-card h1 {
    font-size: 25px;
  }

  .candles-canvas {
    height: 170px;
    min-height: 120px;
    opacity: .30;
  }

  body > #themeSwitcher {
    top: 14px;
    left: 14px;
  }
}

@media (max-width: 420px) {
  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}


/* ===== Auth polish: gradient frames like the main photo ===== */
.auth-page-card{
  background:color-mix(in srgb,var(--emerald) 6%,var(--surface));border:0;border-radius:28px;
  box-shadow:0 24px 60px -28px rgba(15,23,42,.55)
}
.auth-page-card::before{
  content:"";position:absolute;inset:0;border-radius:inherit;padding:3px;pointer-events:none;
  background:linear-gradient(160deg,var(--emerald),var(--gold));
  -webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);
  -webkit-mask-composite:xor;mask-composite:exclude
}
.hero-art{flex-direction:column;gap:26px}
.hero-art img{
  border:7px solid transparent;
  background:linear-gradient(var(--surface),var(--surface)) padding-box,linear-gradient(160deg,var(--emerald),var(--gold)) border-box;
  box-shadow:0 26px 60px -24px rgba(15,23,42,.55)
}
.hero-quote{
  direction:rtl;max-width:430px;text-align:center;font-size:16px;line-height:1.95;font-weight:600;color:var(--ink);
  padding:18px 22px;border-radius:22px;background:color-mix(in srgb,var(--gold) 10%,var(--surface));
  box-shadow:0 14px 34px -24px rgba(15,23,42,.5)
}
.hero-quote b{display:block;margin-top:6px;font-size:13px;font-weight:600;color:var(--gold)}
.submit-btn{background:linear-gradient(135deg,var(--emerald),var(--emerald-deep));border-radius:14px}
.field input{background:var(--surface);border-radius:14px}
@media(max-width:900px){.hero-quote{font-size:14px;padding:14px 16px}}
