main.login-page {
  min-height: calc(100dvh - 110px);
  padding-top: 110px;
  padding-bottom: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-wrapper {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

.title-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.title-wrapper p {
  font-size: 50px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #1f2b35;
}

.login-logo {
  width: 132px;
  height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

html:not(.dark-mode) .logo-dark,
.light-mode .logo-dark {
  display: none;
}

html:not(.dark-mode) .logo-light,
.light-mode .logo-light {
  display: block;
}

.dark-mode .logo-light {
  display: none;
}

.dark-mode .logo-dark {
  display: block;
}

.login-intro-inline {
  max-width: 760px;
  margin: 4px auto 20px;
  text-align: center;
}

.login-intro-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.35;
  color: #24313f;
}

.login-intro-sub {
  margin-top: 4px;
  font-size: 15px;
  line-height: 1.45;
  color: #5a6876;
}

.login-access-grid {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(300px, 360px);
  gap: 20px;
  align-items: start;
  justify-content: center;
}

.login-qr-panel {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  width: min(100%, 340px);
  justify-self: center;
}

.qr-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  margin-bottom: 8px;
}

.login-card-title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  color: #374859;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.qr-expiry {
  margin: 0 0 0 auto;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e7eef5;
  white-space: nowrap;
}

.qr-expiry-prefix {
  font-size: 11px;
  color: #657687;
  white-space: nowrap;
}

#qr-expire-countdown {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #223242;
  white-space: nowrap;
}

.qr-refresh-btn {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #c7d3de;
  border-radius: 10px;
  background: #e8eff5;
  color: #3f4e5d;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.qr-refresh-btn:disabled {
  opacity: 0.62;
  cursor: default;
}

.qr-box {
  margin-top: 10px;
  border-radius: 0;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
  padding: 0;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

#telegram-qr {
  width: 172px;
  height: 172px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 0;
  background: transparent;
}

#telegram-qr.is-loading::before,
#telegram-qr.is-empty::before {
  content: "QR";
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #88a2b0;
}

#telegram-qr canvas {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  border: 0;
  background: transparent;
  box-shadow: 0 8px 18px rgba(23, 41, 62, 0.16);
}

.qr-expired-overlay {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #354757;
  background: rgba(228, 237, 243, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
}

.qr-box.is-expired #telegram-qr canvas {
  filter: blur(5px) grayscale(1);
  opacity: 0.4;
}

.qr-box.is-expired .qr-expired-overlay {
  display: flex;
}

.qr-caption {
  margin-top: 8px;
  font-size: 13px;
  color: #667888;
  text-align: center;
}

.login-action-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(100%, 340px);
  justify-self: center;
  align-items: stretch;
}

.login-mobile-actions {
  display: none;
  width: 100%;
}

.desktop-btn-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  align-items: stretch;
}

.login-wrapper .common-btn {
  width: 100%;
  max-width: 340px;
  min-height: 54px;
  padding: 0 20px;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  white-space: normal;
  text-align: center;
  word-break: keep-all;
}

.login-wrapper .login-btn {
  color: #ffffff;
  border: 1px solid transparent;
  background: linear-gradient(90.06deg, #a179f5 46.35%, #2eb9c8 99.94%);
  box-shadow: 0 10px 20px rgba(74, 112, 192, 0.28);
}

.login-wrapper .join-btn {
  color: #44525f;
  border: 1px solid #d0d9e3;
  background: #e6ecf2;
}

.login-wrapper .login-btn:hover,
.login-wrapper .join-btn:hover {
  transform: translateY(-1px);
}

.miniapp-guide {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: #5c6a77;
  width: min(100%, 340px);
  text-align: left;
}

.is-disabled {
  pointer-events: none;
  opacity: 0.45;
}

.dark-mode .title-wrapper p {
  color: #f4faff;
}

.dark-mode .login-intro-title {
  color: #e7f2ff;
}

.dark-mode .login-intro-sub,
.dark-mode .miniapp-guide,
.dark-mode .qr-caption,
.dark-mode .login-card-title {
  color: #c0d0e8;
}

.dark-mode .qr-expiry-prefix {
  color: #9ab0c9;
}

.dark-mode #qr-expire-countdown {
  color: #e9f5ff;
}

.dark-mode .qr-expiry {
  background: rgba(126, 159, 208, 0.18);
}

.dark-mode .qr-refresh-btn {
  color: #d2e1f3;
  background: rgba(157, 183, 215, 0.15);
  border: 1px solid rgba(157, 183, 215, 0.35);
}

.dark-mode #telegram-qr {
  border-color: transparent;
  background: transparent;
}

.dark-mode #telegram-qr.is-loading::before,
.dark-mode #telegram-qr.is-empty::before {
  color: #8db7cb;
}

.dark-mode #telegram-qr canvas {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.dark-mode .qr-expired-overlay {
  color: #d5e8f5;
  background: rgba(8, 16, 27, 0.45);
}

.dark-mode .login-wrapper .login-btn {
  background: linear-gradient(90.06deg, #9f7cf0 46.35%, #30a9b7 99.94%);
  box-shadow: 0 12px 22px rgba(33, 144, 175, 0.3);
}

.dark-mode .login-wrapper .join-btn {
  color: #d1ddee;
  background: rgba(157, 183, 215, 0.17);
  border: 1px solid rgba(157, 183, 215, 0.31);
}

@media (max-width: 980px) {
  .login-wrapper {
    max-width: 680px;
  }

  .title-wrapper p {
    font-size: 44px;
  }

  .login-access-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    max-width: 340px;
    margin: 0 auto;
  }

  .login-qr-panel,
  .login-action-panel {
    width: 100%;
    max-width: 340px;
    justify-self: center;
  }

  .qr-meta {
    gap: 6px;
  }

  .qr-refresh-btn {
    font-size: 10px;
    padding: 0 8px;
  }

  .qr-expiry-prefix {
    font-size: 10px;
  }
}

@media (max-width: 768px) {
  main.login-page {
    min-height: calc(100dvh - 92px);
    padding-top: 88px;
    padding-bottom: 24px;
    align-items: center;
  }

  .login-wrapper {
    padding: 0 20px;
  }

  .title-wrapper p {
    font-size: 40px;
  }

  .login-logo {
    width: 118px;
    height: 118px;
  }

  .login-intro-inline {
    margin-bottom: 16px;
  }

  .login-intro-title {
    font-size: 18px;
  }

  .login-intro-sub {
    font-size: 14px;
  }

  .login-mobile-actions {
    display: block;
  }

  .login-desktop-actions {
    display: none;
  }

  .login-action-panel {
    gap: 12px;
  }

  .desktop-btn-group {
    gap: 12px;
  }

  .login-wrapper .common-btn {
    max-width: 100%;
    min-height: 50px;
  }

  .login-mobile-actions {
    width: 100%;
  }

  .miniapp-guide {
    width: 100%;
  }

  .miniapp-guide {
    font-size: 13px;
  }
}
