/* /login — compact Plex UI on chip backdrop; market captcha inline */
:root {
  --login-text: #e6edf7;
  --login-dim: #8fa3bf;
  --login-cyan: #00e5ff;
  --login-fs-body: var(--fs-xs, 11px);
  --login-fs-note: var(--fs-sm, 12px);
  --login-fs-h1: var(--fs-2xl, 22px);
  --login-fs-btn: var(--fs-base, 13px);
}
* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
}
body.login-page {
  background: #02050d;
  color: var(--login-text);
  font-family: var(--font-mono);
  font-size: var(--login-fs-body);
  overflow-x: hidden;
}
#loginBg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}
.login-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(ellipse at 30% 50%, transparent 35%, rgba(0, 0, 0, .55) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, .35), transparent 22%, transparent 78%, rgba(0, 0, 0, .45));
}
.login-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(18px, 5vw, 56px);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  backdrop-filter: blur(8px);
}
.login-brand { display: inline-flex; align-items: center; text-decoration: none; flex: 0 0 auto; }
.login-brand picture { display: inline-flex; align-items: center; }
.login-brand .k2tp-logo {
  display: block;
  height: 64px;
  width: auto;
  max-width: 240px;
  object-fit: contain;
}
@media (max-width: 767px) {
  .login-brand .k2tp-logo {
    height: 48px;
    width: auto;
    max-width: 180px;
  }
}
.login-switch { font-size: var(--login-fs-note); color: var(--login-dim); text-align: right; }
.login-switch a {
  color: #fafcfd;
  font-weight: bold;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.login-stage {
  position: relative;
  z-index: 2;
  min-height: calc(100vh - 58px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 24px 16px 32px;
}
@media (min-width: 900px) {
  .login-stage {
    align-items: center;
    justify-content: flex-end;
    padding: 24px 9vw 24px 24px;
  }
}
.login-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 28px 26px 24px;
  border-radius: 20px;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(0, 229, 255, .10), transparent 60%),
    linear-gradient(180deg, rgba(12, 20, 40, .78), rgba(5, 9, 22, .9));
  backdrop-filter: blur(22px) saturate(140%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .65), 0 0 60px rgba(0, 140, 255, .10);
  animation: login-rise .55s cubic-bezier(.2, .8, .2, 1) both;
}
.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  background: linear-gradient(155deg, rgba(0, 229, 255, .55), rgba(255, 255, 255, .07) 38%, rgba(37, 99, 235, .45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}
@keyframes login-rise {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
}
@media (prefers-reduced-motion: reduce) {
  .login-card { animation: none; }
}
.login-card h1 {
  margin: 0 0 18px;
  font-size: var(--login-fs-h1);
  font-weight: 700;
}
.login-sub {
  color: var(--login-dim);
  font-size: var(--login-fs-note);
  line-height: 1.55;
  margin: -10px 0 18px;
}
.login-sub:empty { display: none; }
.login-setup {
  font-size: 11px;
  line-height: 1.55;
  color: #cbd5e1;
  margin: 0 0 16px;
  padding: 10px 12px;
  background: rgba(0, 229, 255, .07);
  border: 1px solid rgba(0, 229, 255, .28);
  border-radius: 10px;
}
.login-setup b { color: #ffc857; }
.login-card label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #9fb4d1;
  margin-bottom: 6px;
}
.login-card input {
  width: 100%;
  height: 42px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 10px;
  padding: 0 12px;
  color: var(--login-text);
  font-size: 13px;
  font-family: inherit;
  margin-bottom: 14px;
  transition: border-color .18s, box-shadow .18s;
}
.login-card input:focus {
  outline: none;
  border-color: rgba(0, 229, 255, .65);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, .12);
}
.login-card button {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  font-family: inherit;
  font-size: var(--login-fs-btn);
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}
.login-card button:disabled { opacity: .5; cursor: default; }
.login-card button[type=submit] {
  color: #fff;
  border: 0;
  background: var(--btn-fill, #346ce8);
  box-shadow: 0 10px 28px rgba(52, 108, 232, .35);
}
.login-card button[type=submit]:hover:not(:disabled) {
  background: var(--btn-fill-hover, #5986ec);
  transform: translateY(-1px);
}
.login-hint {
  font-size: 10px;
  color: var(--login-dim);
  margin: -8px 0 12px;
}
.login-msg {
  display: none;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: var(--login-fs-note);
  line-height: 1.45;
}
.login-msg.err {
  display: block;
  background: rgba(237, 41, 57, .12);
  border: 1px solid rgba(237, 41, 57, .45);
  color: var(--k-down, #ed2939);
}
.login-msg.ok {
  display: block;
  background: rgba(17, 166, 142, .12);
  border: 1px solid rgba(17, 166, 142, .45);
  color: var(--k-up, #11a68e);
}
.login-captcha { margin: 4px 0 10px; }
.login-captcha-builtin .captcha-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.login-captcha-builtin .captcha-q {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 10px;
  background: rgba(0, 229, 255, .08);
  border: 1px dashed rgba(0, 229, 255, .4);
  font: 600 14px ui-monospace, monospace;
}
.login-captcha-builtin .captcha-row input { margin-bottom: 0; flex: 1; min-width: 0; }
.login-captcha-builtin .captcha-refresh {
  width: 42px;
  flex: 0 0 42px;
  margin: 0;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .12);
  color: var(--login-text);
}
#turnstileHost { margin-bottom: 10px; }

.login-cap-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 229, 255, .22);
  background: rgba(0, 229, 255, .05);
}
.login-cap-strip.done { border-color: rgba(17, 166, 142, .35); background: rgba(17, 166, 142, .06); }
.login-cap-strip.done p { color: var(--k-up, #11a68e); }
/* Override .login-card button { width:100% } for the Verify control. */
.login-cap-strip .login-cap-open {
  flex: 0 0 auto;
  width: auto;
  min-width: 72px;
  max-width: 36%;
  height: 32px;
  padding: 0 10px;
  margin: 0;
  font-size: 11px;
  border: 1px solid #245174;
  background: #0a3150;
  color: #e8f7ff;
}
.login-cap-strip p {
  margin: 0;
  flex: 1 1 0;
  min-width: 0;
  font-size: 11px;
  color: #b6c9dc;
  line-height: 1.4;
}
.login-cap-strip .login-cap-open:hover:not(:disabled) { border-color: var(--login-cyan); }
@media (max-width: 480px) {
  .login-cap-strip {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .login-cap-strip .login-cap-open {
    max-width: none;
    width: 100%;
  }
}

/* Market captcha modal — centered viewport overlay */
.mk-cap-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  pointer-events: none;
}
.mk-cap-modal.open {
  display: flex;
  pointer-events: auto;
}
.mk-cap-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 5, 13, .78);
  backdrop-filter: blur(8px);
}
.mk-cap-modal-panel {
  position: relative;
  z-index: 1;
  width: auto;
  max-width: min(360px, 94vw);
  max-height: min(92vh, 900px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  margin: auto;
  display: flex;
  justify-content: center;
}
.mk-cap-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid #245174;
  background: rgba(7, 21, 35, .94);
  color: #cfe9ff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .35);
}
.mk-cap-modal-close:hover { border-color: var(--login-cyan); color: #fff; }
