:root {
  --violet: #7a2ee6;
  --violet-hover: #6f24d9;
  --text: #f4f4f5;
  --muted: rgba(255,255,255,.55);
  --card: rgba(13, 17, 21, .72);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body {
  overflow: hidden;
  background: #080d12;
  color: var(--text);
  font-family: Arial, Helvetica, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}
button, input { font: inherit; }

.page {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: grid;
  place-items: center;
  isolation: isolate;
  overflow: hidden;
}

.background-video {
  position: absolute;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  pointer-events: none;
}

.background-dim {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: rgba(0, 0, 0, .44);
  pointer-events: none;
}

.screen-card {
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}

.login-card {
  width: 820px;
  min-height: 425px;
  display: grid;
  grid-template-columns: 47.3% 52.7%;
  overflow: hidden;
  border-radius: 13px;
  background: var(--card);
  box-shadow: 0 26px 80px rgba(0,0,0,.18);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
}

.login-card:not(.is-active),
.gender-card:not(.is-active) {
  position: absolute;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(.985);
}

.left-panel,
.right-panel {
  min-width: 0;
  display: flex;
  align-items: center;
}

.left-panel {
  justify-content: center;
  padding: 41px 16px 39px;
}

.left-inner {
  width: 100%;
  max-width: 355px;
  margin: 0 auto;
}

h1 {
  margin: 0 0 11px;
  text-align: center;
  color: #fff;
  font-size: 27px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -.8px;
}

.rules {
  margin: 0 0 28px;
  text-align: center;
  color: rgba(255,255,255,.94);
  font-size: 12px;
  line-height: 1.25;
  font-weight: 700;
}

.login-form { width: 100%; }

#nickname {
  width: 100%;
  height: 59px;
  padding: 0 18px;
  border-radius: 10px;
  border: 2px solid rgba(143, 55, 255, .97);
  outline: none;
  background: rgba(42, 43, 45, .88);
  color: #fff;
  font-size: 17px;
  font-weight: 400;
  box-shadow: 0 0 0 0 rgba(122,46,230,0);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

#nickname::placeholder { color: #8e8d93; opacity: 1; }
#nickname:focus {
  border-color: #9340ff;
  box-shadow: 0 0 0 1px rgba(147,64,255,.04);
  background: rgba(43, 44, 46, .92);
}

#nickname.invalid {
  border-color: #ef4444;
  animation: inputShake .24s ease;
}

@keyframes inputShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.voice-toggle {
  width: 100%;
  height: 59px;
  margin-top: 22px;
  padding: 0 15px;
  display: flex;
  align-items: center;
  gap: 13px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  background: rgba(54, 55, 57, .85);
  color: #fff;
  text-align: left;
  cursor: pointer;
  appearance: none;
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 41px;
  height: 23px;
  border-radius: 999px;
  background: #62676c;
  transition: background .18s ease;
}

.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #1d2934;
  transition: transform .18s ease, background .18s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,.28);
}

.voice-toggle[aria-checked="true"] .switch { background: var(--violet); }
.voice-toggle[aria-checked="true"] .switch-knob {
  transform: translateX(18px);
  background: #fff;
}

.voice-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  line-height: 1.1;
}
.voice-copy strong {
  color: #f7f7f7;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}
.voice-copy small {
  margin-top: 3px;
  color: #9e9e9f;
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
}

.start-button {
  width: 100%;
  height: 59px;
  margin-top: 23px;
  border: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #fff;
  background: var(--violet);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: none;
  transition: background .15s ease, transform .06s ease;
}
.start-button:hover { background: var(--violet-hover); }
.start-button:active { transform: translateY(1px); }
.start-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.right-panel {
  border-left: 1px solid rgba(255,255,255,.055);
  padding: 47px 37px 43px;
}
.right-panel p {
  margin: 0;
  color: rgba(255,255,255,.95);
  font-size: 14px;
  line-height: 1.28;
  font-weight: 800;
  letter-spacing: -.15px;
}

/* Cinsiyet seçim ekranı */
.gender-card {
  width: 350px;
  min-height: 286px;
  padding: 19px 19px 20px;
  border-radius: 13px;
  background: rgba(48, 49, 51, .82);
  box-shadow: 0 26px 80px rgba(0, 0, 0, .20);
  backdrop-filter: blur(1.5px);
  -webkit-backdrop-filter: blur(1.5px);
}

.back-button {
  height: 38px;
  min-width: 110px;
  padding: 0 14px 0 12px;
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: var(--violet);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s ease, transform .06s ease;
}
.back-button:hover { background: var(--violet-hover); }
.back-button:active { transform: translateY(1px); }
.back-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gender-form { margin-top: 28px; }

.gender-option {
  position: relative;
  width: 100%;
  height: 52px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  border-radius: 13px;
  background: rgba(39, 39, 40, .86);
  cursor: pointer;
  user-select: none;
  transition: background .14s ease;
}
.gender-option + .gender-option { margin-top: 14px; }
.gender-option:hover { background: rgba(43, 43, 45, .95); }
.gender-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.custom-radio {
  position: relative;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 50%;
  background: #eef1f5;
  transition: background .16s ease;
}
.custom-radio span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  transform: translate(-50%, -50%);
}
.gender-option.is-selected .custom-radio { background: var(--violet); }
.gender-option.is-selected .custom-radio span { background: #a980f2; }

.gender-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #f7f7f7;
  font-size: 22px;
  font-weight: 400;
  white-space: nowrap;
}

.gender-icon {
  width: 20px;
  height: 27px;
  fill: #fff;
  flex: 0 0 auto;
}

.gender-submit {
  width: 100%;
  height: 47px;
  margin-top: 18px;
  border: 0;
  border-radius: 8px;
  background: var(--violet);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s ease, transform .06s ease;
}
.gender-submit:hover { background: var(--violet-hover); }
.gender-submit:active { transform: translateY(1px); }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 900px) {
  body { overflow: auto; }
  .page {
    min-height: 100dvh;
    height: auto;
    padding: 24px 16px;
  }
  .background-video,
  .background-dim { position: fixed; }
  .login-card {
    width: min(100%, 440px);
    min-height: 0;
    grid-template-columns: 1fr;
  }
  .left-panel { padding: 31px 20px 25px; }
  .left-inner { max-width: none; }
  .right-panel {
    border-left: 0;
    border-top: 1px solid rgba(255,255,255,.07);
    padding: 24px 20px 30px;
  }
  .right-panel p { font-size: 13px; line-height: 1.35; }
}

@media (max-width: 430px) {
  .page { padding: 14px; }
  h1 { font-size: 26px; }
  .rules { font-size: 11.5px; }
  #nickname,
  .voice-toggle,
  .start-button { height: 56px; }
  .voice-copy strong { font-size: 12.5px; }
  .voice-copy small { font-size: 10.7px; }
  .desktop-break { display: none; }
  .gender-card {
    width: min(100%, 350px);
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .screen-card { transition: none !important; }
}

/* Kayıtlı üye giriş ekranı */
.member-card {
  width: 344px;
  min-height: 390px;
  padding: 19px 22px 20px;
  border-radius: 13px;
  background: rgba(48, 49, 51, .82);
  box-shadow: 0 26px 80px rgba(0,0,0,.20);
  backdrop-filter: blur(1.5px);
  -webkit-backdrop-filter: blur(1.5px);
}

.login-card:not(.is-active),
.gender-card:not(.is-active),
.member-card:not(.is-active) {
  position: absolute;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(.985);
}

.member-back {
  min-width: 108px;
}

.member-form {
  margin-top: 28px;
}

.member-input {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 17px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 9px;
  outline: none;
  background: rgba(58, 58, 60, .72);
  color: #fff;
  font-size: 18px;
  font-weight: 400;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

/* Kullanıcı adı ve şifre alanları arasında belirgin boşluk */
#memberPassword {
  margin-top: 24px;
}

.member-input::placeholder {
  color: rgba(255,255,255,.31);
  opacity: 1;
}

.member-input:focus {
  border-color: rgba(139, 55, 245, .92);
  background: rgba(60, 60, 62, .82);
  box-shadow: 0 0 0 1px rgba(122,46,230,.05);
}

.member-nickname {
  cursor: default;
}

.member-login-button {
  width: 100%;
  height: 42px;
  margin-top: 23px;
  border: 0;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--violet);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s ease, transform .06s ease;
}

.member-login-button:hover { background: var(--violet-hover); }
.member-login-button:active { transform: translateY(1px); }
.member-login-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.member-separator {
  width: 100%;
  margin: 24px 0 22px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 11px;
  color: rgba(255,255,255,.25);
}

.member-separator span {
  height: 1px;
  background: rgba(255,255,255,.14);
}

.member-separator em {
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
}

.passwordless-button {
  width: 100%;
  height: 43px;
  border: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(180deg, rgba(88,89,91,.72), rgba(63,64,66,.72));
  color: rgba(255,255,255,.86);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: filter .15s ease, transform .06s ease;
}

.passwordless-button:hover { filter: brightness(1.08); }
.passwordless-button:active { transform: translateY(1px); }
.passwordless-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .85;
}

@media (max-width: 430px) {
  .member-card {
    width: min(100%, 344px);
    min-height: 390px;
    padding: 18px 20px 20px;
  }
}


/* Gerçek TRroom giriş entegrasyonu */
.login-error {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 50;
  max-width: min(92vw, 520px);
  padding: 11px 16px;
  border: 1px solid rgba(248, 113, 113, .36);
  border-radius: 9px;
  background: rgba(77, 16, 22, .94);
  color: #fee2e2;
  box-shadow: 0 14px 35px rgba(0,0,0,.32);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 8px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}
.login-error.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}
.screen-card.is-loading {
  pointer-events: none;
}
.screen-card.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 10;
  border-radius: inherit;
  background: rgba(0,0,0,.12);
}
.start-button:disabled,
.gender-submit:disabled,
.member-login-button:disabled,
.passwordless-button:disabled {
  cursor: wait;
  opacity: .72;
}
#memberNickname {
  color: rgba(255,255,255,.90);
}
@media (max-width: 430px) {
  .login-error {
    bottom: max(12px, env(safe-area-inset-bottom));
    width: calc(100vw - 28px);
  }
}


.install-app-card {
  width: 100% !important;
  height: 58px !important;
  min-height: 58px !important;
  max-height: 58px !important;
  margin: 10px 0 0 !important;
  padding: 7px 8px 7px 9px !important;
  display: grid !important;
  grid-template-columns: 38px minmax(0,1fr) 70px !important;
  align-items: center !important;
  column-gap: 9px !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  border-radius: 11px !important;
  background: rgba(22,25,31,.88) !important;
  box-shadow: 0 6px 18px rgba(0,0,0,.16), inset 0 1px 0 rgba(255,255,255,.035) !important;
  position: relative !important;
}
.install-app-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg,#b84cff,#7928e8);
}
.install-app-brand {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 9px !important;
  background: linear-gradient(145deg,#b342f6,#7625e8) !important;
  color: #fff !important;
  display: grid !important;
  place-items: center !important;
  box-shadow: 0 4px 12px rgba(118,37,232,.28) !important;
  overflow: hidden !important;
}
.install-app-brand img {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  object-fit: cover !important;
  border-radius: inherit !important;
}
.install-app-brand svg {
  width: 22px !important;
  height: 22px !important;
  display: block !important;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 1.8 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}
.install-app-brand svg circle { fill: currentColor !important; stroke: none !important; }
.install-app-copy {
  min-width: 0 !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  gap: 2px !important;
  text-align: left !important;
  overflow: hidden !important;
}
.install-app-copy strong {
  display: block !important;
  margin: 0 !important;
  color: rgba(255,255,255,.94) !important;
  font: 800 11.5px/1.15 Arial,Roboto,sans-serif !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.install-app-copy small {
  display: block !important;
  margin: 0 !important;
  color: rgba(255,255,255,.54) !important;
  font: 500 8.5px/1.2 Arial,Roboto,sans-serif !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.install-app-button {
  width: 70px !important;
  min-width: 70px !important;
  max-width: 70px !important;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  margin: 0 !important;
  padding: 0 9px !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: linear-gradient(135deg,#9f36f4,#7524e8) !important;
  color: #fff !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  font: 800 10.5px/1 Arial,Roboto,sans-serif !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  box-shadow: 0 4px 12px rgba(118,36,232,.25) !important;
  appearance: none !important;
  -webkit-appearance: none !important;
}
.install-app-button svg {
  display: block !important;
  width: 12px !important;
  height: 12px !important;
  min-width: 12px !important;
  max-width: 12px !important;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}
.install-app-button:hover { filter: brightness(1.08); }
.install-app-button:active { transform: translateY(1px); }
.install-app-button.is-installed {
  background: rgba(255,255,255,.09) !important;
  color: rgba(255,255,255,.58) !important;
  box-shadow: none !important;
  cursor: default !important;
}
@media (max-width: 360px) {
  .install-app-card { grid-template-columns: 34px minmax(0,1fr) 62px !important; column-gap: 7px !important; padding-left: 8px !important; }
  .install-app-brand { width: 32px !important; height: 32px !important; min-width: 32px !important; min-height: 32px !important; }
  .install-app-brand svg { width: 19px !important; height: 19px !important; }
  .install-app-copy strong { font-size: 10.5px !important; }
  .install-app-copy small { font-size: 7.8px !important; }
  .install-app-button { width: 62px !important; min-width: 62px !important; max-width: 62px !important; padding: 0 7px !important; font-size: 9.5px !important; }
}
