:root {
  --maple-green: #1b4332;
  --maple-green-soft: #eef5f0;
  --maple-text: #183029;
  --maple-muted: #68766e;
  --maple-faint: #829088;
  --maple-label: #3d4f46;
  --maple-border: #dce4df;
  --maple-surface: #ffffff;
  --maple-danger: #8a2d1d;
  --maple-focus: 0 0 0 3px rgb(27 67 50 / 18%);
  --maple-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --maple-radius-md: 10px;
  --maple-pad-x: 32px;
  --maple-form-max: 400px;
  --maple-logo-gap: 24px;
  --maple-login-leaf: 4.5rem;
  --maple-login-word: 2.65rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
}

html { overflow-y: auto; }

body.login-body {
  background: var(--maple-surface);
  color: var(--maple-text);
  font-family: var(--maple-font-family);
  overflow-x: hidden;
  overflow-y: auto;
}

.login-shell {
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px var(--maple-pad-x) 72px;
}

.login-screen {
  position: relative;
  width: 100%;
  max-width: var(--maple-form-max);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.login-brand { margin: 0 0 var(--maple-logo-gap); }

.login-brand-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding-top: calc(var(--maple-login-leaf) + 0.55rem);
}

.login-leaf-orbit {
  position: absolute;
  top: 0;
  left: 50%;
  width: var(--maple-login-leaf);
  height: var(--maple-login-leaf);
  margin-left: calc(var(--maple-login-leaf) / -2);
  display: grid;
  place-items: center;
}

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

.login-wordmark {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--maple-login-word);
  line-height: 1;
  color: var(--maple-green);
  font-weight: 800;
  letter-spacing: 0;
  user-select: none;
}

.login-brand-m,
.login-brand-a,
.login-brand-ple {
  display: inline-block;
  font-size: 1em;
  font-weight: 800;
  line-height: 1;
  color: inherit;
}

.login-brand-m { margin-right: 0.1em; }
.login-brand-a { width: 1em; text-align: center; }
.login-brand-ple { margin-left: 0.1em; letter-spacing: 0.18em; }

.door-lang-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin: 0 0 10px;
}

.door-lang {
  position: relative;
}

.door-lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 4px 10px;
  border: 1px solid var(--maple-border);
  border-radius: 999px;
  background: var(--maple-surface);
  color: var(--maple-label);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  appearance: none;
}

.door-lang-btn:focus-visible {
  outline: none;
  box-shadow: var(--maple-focus);
}

.door-lang-caret {
  color: var(--maple-muted);
  font-size: 0.7rem;
}

.door-lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 8;
  min-width: 176px;
  max-height: 240px;
  overflow-x: hidden;
  overflow-y: auto;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  border: 1px solid var(--maple-border);
  border-radius: var(--maple-radius-md);
  background: var(--maple-surface);
  box-shadow: 0 8px 24px rgb(24 48 41 / 10%);
}

.door-lang-option {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--maple-text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  appearance: none;
}

.door-lang-option[aria-selected="true"] {
  color: var(--maple-green);
}

.door-lang-option:hover,
.door-lang-option:focus-visible {
  background: rgb(27 67 50 / 6%);
}

.door-lang-note {
  width: 100%;
  margin: 8px 0 0;
  color: var(--maple-muted);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

.login-form,
.door-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-label,
.door-copy {
  display: block;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--maple-label);
  text-align: center;
}

.door-copy {
  font-size: 0.98rem;
  color: var(--maple-muted);
}

html.maple-standalone #install-step {
  display: none !important;
}

.door-install {
  gap: 16px;
}

.door-install-title {
  color: var(--maple-label);
  font-size: 1.02rem;
}

.door-install-steps {
  width: 100%;
  max-width: 20.5rem;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.door-install-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--maple-text);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
}

.door-install-num {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--maple-green);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 24px;
  text-align: center;
}

.door-install-step-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.door-install-step-text {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.door-install-hint {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--maple-muted);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
}

.door-ios-share,
.door-ios-more,
.door-ios-addhome,
.door-android-menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--maple-border);
  border-radius: 8px;
  color: var(--maple-green);
  background: var(--maple-surface);
}

.door-ios-share-icon,
.door-ios-more-icon,
.door-ios-addhome-icon,
.door-android-menu-icon {
  display: block;
  width: 18px;
  height: 18px;
}

.door-install-next {
  margin-top: 2px;
}

.door-install-find {
  display: inline-flex;
  align-self: center;
  margin: 4px auto 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--maple-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  appearance: none;
}

.door-install-find:focus-visible {
  outline: none;
  box-shadow: var(--maple-focus);
}

.door-install-find-copy {
  margin: 0;
  color: var(--maple-muted);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

#install-ios,
#install-android {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#install-android[hidden],
#install-ios[hidden],
#install-ios-chrome[hidden],
#install-ios-safari[hidden],
#install-ios-other[hidden],
#install-title-ios[hidden],
#install-title-android[hidden],
#install-ios-safari-link[hidden],
#install-ios-missing-help[hidden],
#install-android-steps[hidden],
#install-android-open[hidden],
#install-android-btn[hidden] {
  display: none !important;
}

@media (max-width: 390px) {
  .door-install-steps {
    max-width: 100%;
  }
}

@media (max-width: 360px) {
  .door-install-step {
    font-size: 0.9rem;
  }
  .door-install-hint {
    font-size: 0.75rem;
  }
}

.login-phone-field,
.login-password-field { position: relative; width: 100%; }

.login-phone-proceed {
  position: absolute;
  right: 12px;
  top: 50%;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--maple-radius-md);
  background: transparent;
  color: var(--maple-green);
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
  appearance: none;
}

.login-phone-proceed[hidden] { display: none !important; }
.login-phone-proceed:hover { color: #163828; }
.login-phone-proceed:focus-visible { outline: none; box-shadow: var(--maple-focus); }

input.login-input[type='tel'],
input.login-input[type='password'] {
  display: block;
  width: 100%;
  height: 56px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--maple-border);
  border-radius: var(--maple-radius-md);
  background: var(--maple-surface);
  color: var(--maple-text);
  font-family: inherit;
  font-size: max(18px, 16px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: center;
  letter-spacing: 0.15em;
  appearance: none;
}

input.login-input.has-proceed { padding-left: 48px; padding-right: 48px; }
input.login-input[type='password'] { letter-spacing: 0.12em; }

input.login-input::placeholder {
  color: var(--maple-faint);
  opacity: 1;
  text-align: center;
  letter-spacing: 0.15em;
  font-weight: 600;
  font-size: max(18px, 16px);
}

input.login-input:focus::placeholder { color: transparent; opacity: 0; }
input.login-input:focus {
  outline: none;
  border-color: var(--maple-green);
  box-shadow: var(--maple-focus);
}

.login-password-step[hidden],
.door-panel[hidden] { display: none !important; }

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

.login-status,
.door-status {
  min-height: 1.4em;
  margin: 2px 0 0;
  text-align: center;
  color: var(--maple-muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.login-status.bad,
.door-status.bad { color: var(--maple-danger); }

.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  margin: 0;
  padding: 0 14px;
  border-radius: var(--maple-radius-md);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  text-decoration: none;
}

.login-btn--primary {
  border: 1px solid var(--maple-green);
  background: var(--maple-green);
  color: #ffffff;
}

.login-btn--primary:hover { filter: brightness(1.06); }
.login-btn--secondary {
  border: 1.5px solid var(--maple-green);
  background: #fff;
  color: var(--maple-green);
}
.login-btn--secondary:hover {
  background: var(--maple-green-soft);
}
.login-btn--secondary:active {
  background: var(--maple-green-soft);
  filter: brightness(0.98);
}
.login-btn--ghost {
  border: 0;
  background: transparent;
  color: var(--maple-green);
  height: auto;
  min-height: 40px;
}

.login-btn:focus-visible { outline: none; box-shadow: var(--maple-focus); }
.login-btn[disabled] { opacity: 0.55; cursor: default; }
.login-btn[hidden] { display: none !important; }

.door-fallback {
  margin-top: 8px;
  text-align: center;
}

.door-steps {
  margin: 0;
  padding-left: 1.2em;
  color: var(--maple-muted);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.5;
}

.door-wait-signal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 4px 0 18px;
  color: var(--maple-green);
}

.door-wait-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: block;
}

.door-wait-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 42px;
}

.door-wait-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--maple-green);
  opacity: 0.2;
  transform: scale(0.85);
  animation: door-wait-dot 1.35s ease-in-out infinite;
}

.door-wait-dot:nth-child(2) { animation-delay: 0.18s; }
.door-wait-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes door-wait-dot {
  0%, 100% { opacity: 0.18; transform: scale(0.85); }
  35% { opacity: 1; transform: scale(1); }
}

.door-wait,
.door-wait-success {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  color: var(--maple-muted);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.45;
}

.door-wait-success { display: none; }

.door-wait-spinner {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 2px solid var(--maple-border);
  border-top-color: var(--maple-green);
  border-radius: 50%;
  animation: door-wait-spin 0.75s linear infinite;
}

@keyframes door-wait-spin {
  to { transform: rotate(360deg); }
}

.door-wait-check {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--maple-green);
  position: relative;
}

.door-wait-check::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 3px;
  width: 4px;
  height: 7px;
  border: solid #fff;
  border-width: 0 1.7px 1.7px 0;
  transform: rotate(45deg);
}

#wait-step.is-success .door-wait-signal,
#wait-step.is-success .door-wait,
#wait-step.is-success .door-resend { display: none; }
#wait-step.is-success .door-wait-success { display: flex !important; }
#wait-step.is-success .door-wait-dot,
#wait-step.is-success .door-wait-spinner {
  animation: none;
}

#wait-step.is-settled .door-wait-signal { display: none; }
#wait-step.is-settled .door-wait-spinner { display: none; }

.door-resend,
.door-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 16px auto 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--maple-green);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  appearance: none;
}

.door-back {
  color: var(--maple-muted);
  text-decoration: none;
}

.door-back:hover {
  color: var(--maple-green);
}

.door-resend[hidden],
.door-back[hidden] { display: none !important; }

.door-resend:disabled {
  color: var(--maple-muted);
  text-decoration: none;
  cursor: default;
}

.door-resend:focus-visible,
.door-back:focus-visible {
  outline: none;
  box-shadow: var(--maple-focus);
}

.door-choose-title {
  margin: 0 0 1rem;
  color: var(--maple-ink, #183029);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}
.door-choice {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-top: 4px;
}
.door-choice .login-btn {
  width: 100%;
  height: 48px;
}
.door-dest {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  width: 100%;
  min-height: 4.5rem;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(24, 48, 41, 0.12);
  touch-action: manipulation;
  padding: 0.95rem 1rem;
  border: 1px solid var(--maple-line, #dce4df);
  border-radius: 0.85rem;
  background: #fff;
  color: var(--maple-ink, #183029);
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(24, 48, 41, 0.06);
}
.door-dest:hover {
  filter: brightness(0.99);
}
.door-dest:focus-visible {
  outline: none;
  box-shadow: var(--maple-focus);
}
.door-dest-product {
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.25;
}
.door-dest-detail {
  color: var(--maple-muted, #3d4f46);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
}

.door-qr {
  display: flex;
  justify-content: center;
  margin: 8px 0 10px;
}

.door-qr svg { display: block; }

.door-qr-url {
  margin: 0 0 12px;
  text-align: center;
  color: var(--maple-muted);
  font-size: 0.82rem;
  font-weight: 600;
  word-break: break-all;
}

.door-secondary {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

@media (max-width: 420px) {
  .door-wait-signal { gap: 10px; margin-bottom: 16px; }
  .door-wait-icon { width: 26px; height: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .door-wait-dot,
  .door-wait-spinner { animation: none; }
  .door-wait-dot { opacity: 0.45; transform: none; }
}

.door-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--maple-border);
  border-radius: 50%;
  background: var(--maple-surface);
  color: var(--maple-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  appearance: none;
}

.door-help-btn:focus-visible {
  outline: none;
  box-shadow: var(--maple-focus);
}

.door-help[hidden] { display: none !important; }

.door-help {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.door-help-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(24 48 41 / 28%);
}

.door-help-card {
  position: relative;
  width: 100%;
  max-width: 320px;
  padding: 28px 22px 22px;
  border: 1px solid var(--maple-border);
  border-radius: var(--maple-radius-md);
  background: var(--maple-surface);
  box-shadow: 0 12px 40px rgb(24 48 41 / 12%);
}

.door-help-copy {
  margin: 0;
  color: var(--maple-text);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
}

.door-help-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--maple-muted);
  font-family: inherit;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  appearance: none;
}

.door-help-close:focus-visible {
  outline: none;
  box-shadow: var(--maple-focus);
}
