@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700&display=swap');

:root {
  --ink: #13223B;
  --ink-soft: #33445F;
  --accent: #C98A2E;
  --accent-deep: #A66F1E;
  --bg: #EFF1F4;
  --surface: #FFFFFF;
  --border: #DCE0E6;
  --error: #B3261E;
  --error-bg: #FBEAE9;
  --btn: #13223B;
  --btn-hover: #33445F;
  --glint: #A9B6C8;            /* نقره‌ای (برق لاک‌پشت‌ها) */
  --glint-glow: rgba(169, 182, 200, .65);
  color-scheme: light dark; /* تم روشن/تیره از روی تنظیم سیستم‌عامل */
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #E8EDF5;
    --ink-soft: #9FACC2;
    --accent: #D9A04A;
    --accent-deep: #E2B063;
    --bg: #0E1420;
    --surface: #162033;
    --border: #27324A;
    --error: #F2A09B;
    --error-bg: #3A1F24;
    --btn: #2C56B3;
    --btn-hover: #3A67C9;
    --glint: #F1F4F9;
    --glint-glow: rgba(226, 233, 244, .55);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Vazirmatn', sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}

.wrap { position: relative; z-index: 1; width: 100%; padding: 24px; }

.card {
  position: relative;
  max-width: 380px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 34px 28px 30px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .10);
}

.lang-switch {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  display: flex;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px;
  cursor: pointer;
  font-family: inherit;
}

.lang-switch span {
  padding: 3px 9px;
  font-size: 12px;
  border-radius: 16px;
  color: var(--ink-soft);
}

.lang-switch span.active {
  background: var(--ink);
  color: #fff;
}

.brand {
  margin: 0 0 2px;
  font-size: 24px;
  font-weight: 700;
}

.slogan {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.sub {
  margin: 0 0 24px;
  color: var(--ink-soft);
  font-size: 14px;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  background: none;
  border: none;
  padding: 10px 4px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.panel { display: none; flex-direction: column; gap: 6px; }
.panel.active { display: flex; }

label { font-size: 13px; color: var(--ink-soft); margin-top: 10px; }

input {
  font-family: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  outline: none;
}

input:focus { border-color: var(--accent); }

.btn {
  margin-top: 18px;
  padding: 11px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  background: var(--btn);
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
}

.btn:hover { background: var(--btn-hover); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-link {
  margin-top: 12px;
  background: none;
  border: none;
  color: var(--accent-deep);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 4px;
}

.hint { font-size: 13px; color: var(--ink-soft); margin: 0 0 4px; }

.error {
  margin-top: 16px;
  padding: 10px 12px;
  background: var(--error-bg);
  border-radius: 10px;
  color: var(--error);
  font-size: 13px;
  border-inline-start: 3px solid var(--error);
}

/* ویژگی hidden همیشه باید عنصر را مخفی کند، حتی اگر کلاس عنصر display دیگری بدهد */
[hidden] { display: none !important; }

.btn-link:disabled { opacity: .6; cursor: default; }
.btn { touch-action: manipulation; }


/* ---------- لاک‌پشت‌های سایه‌روشن در زمینه (فقط تزئینی) ---------- */
/* هر لاک‌پشت یک ماسک با شکل SVG است تا رنگش با CSS عوض شود (در تم تیره هم خودکار سازگار می‌شود) */
.bg-turtles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-turtle {
  position: absolute;
  aspect-ratio: 260 / 150;
  --shape: url('/shared/turtle.svg');
}

.bg-turtle i {
  display: block;
  width: 100%;
  height: 100%;
  background-color: var(--ink);
  opacity: .07;
  -webkit-mask: var(--shape) center / contain no-repeat;
  mask: var(--shape) center / contain no-repeat;
}

.bt1 { left: 5%;  bottom: 7%;  width: min(240px, 44vw); }
.bt2 { right: 6%; top: 9%;     width: min(170px, 34vw); --shape: url('/shared/turtle-l.svg'); }
.bt3 { right: 16%; bottom: 20%; width: min(130px, 26vw); --shape: url('/shared/turtle-l.svg'); }
.bt4 { left: 9%;  top: 12%;    width: min(120px, 24vw); }
.bt5 { left: 42%; bottom: 3%;  width: min(90px, 18vw); }

/* برق زدن: یک درخشش نقره‌ای سریع، لطیف و لحظه‌ای (فقط یک قله، بدون هاله‌ی کلفت) */
.bg-turtle.glow { animation: turtle-halo 1.1s ease-out; }
.bg-turtle.glow i { animation: turtle-flash 1.1s ease-out; }

@keyframes turtle-flash {
  0%   { background-color: var(--ink);   opacity: .07; }
  28%  { background-color: var(--glint); opacity: .38; }
  100% { background-color: var(--ink);   opacity: .07; }
}

@keyframes turtle-halo {
  0%   { filter: drop-shadow(0 0 0 transparent); }
  28%  { filter: drop-shadow(0 0 3px var(--glint-glow)); }
  100% { filter: drop-shadow(0 0 0 transparent); }
}

@media (prefers-reduced-motion: reduce) {
  .bg-turtle.glow, .bg-turtle.glow i { animation: none; }
}

/* ---------- انیمیشن انتظار: لاک‌پشت در حال راه رفتن ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  overflow: hidden;
  background: rgba(239, 241, 244, .88);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

@media (prefers-color-scheme: dark) {
  .loader { background: rgba(14, 20, 32, .88); }
}

.loader-track { width: 100%; direction: ltr; overflow: hidden; padding: 6px 0; }

.walker {
  display: block;
  width: 130px;
  margin: 0 auto;
  animation: walk 7s linear infinite;
}

.walker .art { fill: var(--ink); }
.walker .far { opacity: .55; }

.walker .leg,
.walker .head {
  transform-box: fill-box;
}

.walker .leg {
  transform-origin: 50% 0;
  animation: step .8s ease-in-out infinite alternate;
}
.walker .legB { animation-delay: -.8s; } /* پاهای مقابل در فاز مخالف حرکت می‌کنند */

.walker .bob { animation: bob .8s ease-in-out infinite alternate; }
.walker .head { transform-origin: 0 50%; animation: nod 1.2s ease-in-out infinite alternate; }

.loader-text { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink-soft); }

@keyframes walk {
  from { transform: translateX(calc(-50vw - 140px)); }
  to { transform: translateX(calc(50vw + 140px)); }
}
@keyframes step {
  from { transform: rotate(-14deg); }
  to { transform: rotate(14deg); }
}
@keyframes bob {
  to { transform: translateY(-2px); }
}
@keyframes nod {
  to { transform: translateX(3px); }
}

@media (prefers-reduced-motion: reduce) {
  .walker, .walker .leg, .walker .bob, .walker .head { animation: none; }
}
