:root, html.dark {
  --bg-grad-1: #050505;
  --bg-grad-2: #0a0a0a;
  --bg-grad-3: #111111;
  --text: #ecf0f1;
  --muted: #888888;
  --border: #333333;
  --input-bg: #111111;
  --panel-bg: #050505;
  --panel-hover: #1a1a1a;
  --grid-line: rgba(212, 175, 55, 0.04);
  --orb: rgba(212, 175, 55, 0.12);
  --primary: #d4af37;
  --primary-foreground: #000000;
  --purple: #6C3FF5;
  --black: #2D2D2D;
  --orange: #FF9B6B;
  --yellow: #E8D754;
  --eye-bg: #ffffff;
  --pupil: #2D2D2D;
  --footer-link: rgba(255,255,255,0.45);
  --error-color: #ff6b6b;
  --error-bg: rgba(255, 107, 107, 0.1);
  --error-border: rgba(255, 107, 107, 0.3);
  --info-color: #f1c40f;
  --info-bg: rgba(241, 196, 15, 0.1);
  --info-border: rgba(241, 196, 15, 0.3);
  --focus-ring: rgba(212, 175, 55, 0.4);
}

.page {
  box-sizing: border-box;
  color: var(--text);
  background: var(--panel-bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.page * { box-sizing: border-box; }

@media (max-width: 1023px) {
  .page { grid-template-columns: 1fr; }
  .stage { display: none !important; }
}

/* ============ LEFT (stage) ============ */
.stage {
  position: relative;
  background: linear-gradient(135deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 50%, var(--bg-grad-3) 100%);
  overflow: hidden;
  min-height: 100vh;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* subtle grid + soft orbs */
.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
  z-index: 0;
}
.stage::after {
  content: "";
  position: absolute;
  top: 18%;
  right: 12%;
  width: 320px; height: 320px;
  background: var(--orb);
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}
.stage > * { position: relative; z-index: 1; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 18px;
  z-index: 30;
  color: var(--primary);
  text-shadow: 0 0 1rem rgba(212, 175, 55, 0.4);
}
.brand-dot {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(0,0,0,0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}
html.dark .brand-dot { background: rgba(255,255,255,0.08); }

.stage-inner {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 0;
}

.characters {
  position: relative;
  width: 450px;
  height: 400px;
  max-width: 100%;
  transform: scale(1.15);
  transform-origin: bottom center;
}

@media (max-width: 1280px) {
  .characters { transform: scale(1.05); }
}

/* shared character base — OKEY TILE STYLE (matches in-game .tas) */
.char {
  position: absolute;
  bottom: 0;
  transform-origin: bottom center;
  transition: transform .7s cubic-bezier(.4, 0, .2, 1), height .7s cubic-bezier(.4, 0, .2, 1);
  background: linear-gradient(to bottom, #fdfbf7 0%, #e9e4d0 100%) !important;
  border: 2px solid #c8c0b0 !important;
  border-bottom: 5px solid #b0a590 !important;
  box-shadow: 
    3px 5px 15px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.8);
  border-radius: 10px !important;
  overflow: visible;
}

/* tile number — upper portion */
.tile-number {
  position: absolute;
  width: 100%;
  text-align: center;
  font-weight: 900;
  font-family: 'Georgia', 'Times New Roman', serif;
  z-index: 5;
  line-height: 1;
  pointer-events: none;
  text-shadow: 1px 2px 3px rgba(0,0,0,0.1);
  letter-spacing: -2px;
}

/* star decoration — pinned to bottom */
.tile-star {
  position: absolute;
  bottom: 12px;
  width: 100%;
  text-align: center;
  z-index: 5;
  pointer-events: none;
  opacity: 0.8;
}

/* eye groups */
.eyes {
  position: absolute;
  display: flex;
  transition: left .7s cubic-bezier(.4, 0, .2, 1), top .7s cubic-bezier(.4, 0, .2, 1);
}
.eye {
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: height .15s ease;
  flex: 0 0 auto;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.eye .pupil {
  background: #1a1a1a;
  border-radius: 50%;
  transition: transform .1s ease-out, opacity .15s ease;
}

/* dot groups */
.dots {
  position: absolute;
  display: flex;
  transition: left .2s ease-out, top .2s ease-out;
}
.dot {
  background: #1a1a1a;
  border-radius: 50%;
  width: 10px;
  height: 10px;
  transition: transform .1s ease-out;
  flex: 0 0 auto;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* =============================================
   MAVI TAŞ — arkadaki en uzun (340px)
   Numara: üst bölge, Gözler: orta, Yıldız: alt
   ============================================= */
.char-purple {
  left: 60px;
  width: 130px;
  height: 340px;
  z-index: 1;
}
.char-purple .tile-number { top: 65px; font-size: 5.5rem; }
.char-purple .tile-star { bottom: 15px; font-size: 2.8rem; }
.char-purple .eyes { gap: 26px; left: 26px; top: 155px; }
.char-purple .eye { width: 24px; height: 24px; }
.char-purple .eye .pupil { width: 10px; height: 10px; }

/* =============================================
   SİYAH TAŞ — orta boy (280px)
   Numara: üst bölge, Gözler: orta, Yıldız: alt
   ============================================= */
.char-black {
  left: 190px;
  width: 115px;
  height: 280px;
  z-index: 2;
}
.char-black .tile-number { top: 55px; font-size: 4.5rem; }
.char-black .tile-star { bottom: 14px; font-size: 2.2rem; }
.char-black .eyes { gap: 20px; left: 22px; top: 120px; }
.char-black .eye { width: 20px; height: 20px; }
.char-black .eye .pupil { width: 8px; height: 8px; }

/* =============================================
   KIRMIZI TAŞ — ön sol, geniş (210px)
   Numara: üst bölge, Gözler(dots): orta, Yıldız: alt
   ============================================= */
.char-orange {
  left: 0;
  width: 145px;
  height: 210px;
  z-index: 3;
}
.char-orange .tile-number { top: 40px; font-size: 5rem; }
.char-orange .tile-star { bottom: 12px; font-size: 2.4rem; }
.char-orange .dots { gap: 28px; left: 42px; top: 100px; }
.char-orange .dot { width: 12px; height: 12px; }

/* =============================================
   SARI TAŞ — ön sağ (220px), ağızlı
   Numara: üst bölge, Gözler(dots): orta, Ağız: ortanın altı, Yıldız: alt
   ============================================= */
.char-yellow {
  left: 320px;
  width: 115px;
  height: 220px;
  z-index: 4;
}
.char-yellow .tile-number { top: 38px; font-size: 4.2rem; }
.char-yellow .tile-star { bottom: 12px; font-size: 2rem; }
.char-yellow .dots { gap: 22px; left: 28px; top: 95px; }
.char-yellow .dot { width: 11px; height: 11px; }
.mouth {
  position: absolute;
  width: 36px; height: 4px;
  background: #1a1a1a;
  border-radius: 2px;
  left: 40px;
  top: 135px;
  transition: left .2s ease-out, top .2s ease-out;
}

/* blink */
.char.blink .eye { height: 2px !important; }
.char.blink .eye .pupil { opacity: 0; }

/* ============ RIGHT (panel) ============ */
.panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  background: var(--panel-bg);
  transition: background-color .25s ease;
}

.theme-toggle {
  display: none;
}
@media (max-width: 1023px) {
  .theme-toggle { display: none; }
}
.panel-inner { width: 100%; max-width: 420px; }

.mobile-brand {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 40px;
  font-weight: 600;
  font-size: 18px;
  color: var(--primary);
  text-shadow: 0 0 1rem rgba(212, 175, 55, 0.4);
}
@media (max-width: 1023px) {
  .mobile-brand { display: flex; }
}
.mobile-brand .brand-dot {
  width: 32px; height: 32px;
}

.panel-head {
  text-align: center;
  margin-bottom: 40px;
}
.panel-head h1 {
  font-size: 30px;
  margin: 0 0 8px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--primary);
  text-shadow: 0 0 1rem rgba(212, 175, 55, 0.3);
}
.panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.form { display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.field > span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.field input:not([type="checkbox"]) {
  width: 100%;
  height: 48px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  border-radius: 10px;
  padding: 0 14px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .25s ease;
  color: var(--text);
}
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover, 
.field input:-webkit-autofill:focus, 
.field input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px var(--input-bg) inset !important;
  -webkit-text-fill-color: var(--text) !important;
  transition: background-color 5000s ease-in-out 0s;
}
.field input::placeholder { color: var(--muted); }
.field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.password-wrap { position: relative; }
.password-wrap input { padding-right: 44px; }
.toggle-pass {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: var(--muted);
  width: 24px; height: 24px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.toggle-pass:hover { color: var(--text); }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.check {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--text);
  cursor: pointer;
}
.check input { accent-color: var(--primary); width: 16px; height: 16px; }

.link { color: var(--primary); text-decoration: none; font-size: 14px; font-weight: 500; }
.link.strong { font-weight: 600; text-shadow: 0 0 0.5rem rgba(212, 175, 55, 0.3); }
.link:hover { text-decoration: underline; text-shadow: 0 0 0.8rem rgba(212, 175, 55, 0.6); }

.btn-primary {
  background: linear-gradient(to bottom, #bd9a2e, #a88827);
  color: #fff;
  border: 1px solid #d4af37;
  border-radius: 8px;
  height: 48px;
  font-weight: bold;
  font-size: 15px;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity .15s ease;
  box-shadow: 0 4px 10px rgba(212, 175, 55, 0.2);
}
.btn-primary:hover { opacity: 0.9; box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }

.btn-outline {
  width: 100%;
  height: 48px;
  margin-top: 24px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  border-radius: 8px;
  font-weight: 500;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text);
  transition: background-color .15s ease, border-color .15s ease;
}
.btn-outline:hover { background: var(--panel-hover); border-color: var(--primary); }

.error-box {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--error-color);
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: 8px;
}
.error-box.shake {
  animation: errorShake .5s cubic-bezier(.36,.07,.19,.97) both;
}
.error-box.info {
  color: var(--info-color);
  background: var(--info-bg);
  border-color: var(--info-border);
}

@keyframes errorShake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

.signup {
  text-align: center;
  margin: 32px 0 0;
  font-size: 14px;
  color: var(--muted);
}

/* ============ FOOTER ============ */
.footer-links {
  display: flex;
  gap: 32px;
  font-size: 13px;
  color: var(--footer-link);
  z-index: 30;
}
.footer-links a {
  color: inherit;
  text-decoration: none;
}
.footer-links a:hover { color: var(--text); }

/* ============ ERROR ANIMATIONS ============ */
/* Purple — "bzzzzt" head buzz. transform-origin: bottom center on .char means
   the base stays planted and only the top edge vibrates side to side. */
.char-purple.error-anim {
  animation: purpleHeadBuzz 1.4s cubic-bezier(.45, .05, .55, .95) 1;
}
@keyframes purpleHeadBuzz {
  0%   { transform: skewX(0deg) skewY(0deg); }
  15%  { transform: skewX(-2.5deg) skewY(0.5deg); }
  35%  { transform: skewX(2deg) skewY(-0.3deg); }
  55%  { transform: skewX(-1.5deg) skewY(0.4deg); }
  75%  { transform: skewX(1deg); }
  100% { transform: skewX(0deg) skewY(0deg); }
}

/* Z mouth — "bzzzt" electric-shock mouth (Z-shape via SVG mask) */
.mouth.sad {
  width: 50px;
  height: 18px;
  background: var(--pupil);
  border: 0;
  border-radius: 0;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 18'><polyline points='4,4 46,4 4,14 46,14' fill='none' stroke='black' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 18'><polyline points='4,4 46,4 4,14 46,14' fill='none' stroke='black' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / contain no-repeat;
}

/* Tear drops (orange + yellow during error) */
.char.crying::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 14px;
  background: #6CBEFF;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  left: var(--tear-x, 60%);
  top: var(--tear-y, 60%);
  opacity: 0;
  animation: tearDrop 1.2s ease-in 1;
  pointer-events: none;
}
@keyframes tearDrop {
  0% { transform: translateY(0); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(60px); opacity: 0; }
}

.char-orange.crying { --tear-x: 92px; --tear-y: 110px; }
.char-yellow.crying { --tear-x: 62px; --tear-y: 60px; }

/* Sad eyes (purple + black) — eyes droop down/outward */
.eye.sad-eye .pupil {
  transform: translateY(3px) !important;
}
