[data-member-page] {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  background: radial-gradient(ellipse at 80% -25%, #2d1b36 0%, transparent 52%), var(--bg, #0f0d13);
}

[data-member-page] [hidden] { display: none !important; }

.member-main {
  flex: 1;
  padding-top: clamp(2rem, 6vw, 4.5rem);
  padding-bottom: clamp(4.5rem, 10vw, 8.5rem);
}

.member-back {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: var(--muted, #a49aaa);
  font-size: .88rem;
  text-decoration: none;
}

.member-back:hover, .member-footer a:hover { color: var(--accent, #e6adf1); }

.member-intro {
  margin-top: clamp(1.8rem, 5vw, 3.25rem);
  margin-bottom: 2rem;
}

.member-intro h1,
.member-loading h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.6rem);
  font-weight: 680;
  line-height: 1.16;
  letter-spacing: -.045em;
}

.member-intro p {
  max-width: 30rem;
  margin: .9rem 0 0;
  color: var(--muted, #a49aaa);
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.member-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.member-panel {
  color: var(--text, #f7f2fa);
  background: var(--panel, #19151f);
  border: 1px solid var(--border, #302735);
  border-radius: 1.25rem;
}

.member-loading { margin-top: 2rem; color: var(--muted, #a49aaa); }
.member-loading.member-panel { max-width: 40rem; padding: 2rem; }
.member-loading h1 { color: var(--text, #f7f2fa); }
.member-loading .button { margin-top: 1rem; }

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 29rem);
  gap: 3rem;
  max-width: 59rem;
  margin: clamp(2rem, 7vw, 5rem) auto 0;
  align-items: start;
}

.auth-layout .member-intro { margin: 1rem 0 0; }

.auth-panel {
  padding: clamp(1.25rem, 4vw, 2rem);
  background: linear-gradient(155deg, #251c2b, var(--panel, #19151f) 70%);
}

.auth-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .35rem;
  padding: .3rem;
  background: var(--bg, #0f0d13);
  border: 1px solid var(--border, #302735);
  border-radius: .8rem;
}

.auth-switch button {
  padding: .75rem;
  color: var(--muted, #a49aaa);
  background: transparent;
  border: 1px solid transparent;
  border-radius: .55rem;
  font: inherit;
  font-size: .92rem;
  cursor: pointer;
}

.auth-switch button[aria-pressed="true"] {
  color: var(--text, #f7f2fa);
  background: var(--panel, #19151f);
  border-color: var(--border, #302735);
}

.member-form {
  display: grid;
  gap: 1.15rem;
  margin-top: 1.75rem;
}

.member-form label {
  display: grid;
  gap: .5rem;
  font-size: .9rem;
  font-weight: 600;
}

.member-form input, #checkout-country {
  min-width: 0;
  width: 100%;
  padding: .85rem .95rem;
  border: 1px solid var(--border, #302735);
  border-radius: .65rem;
  background: var(--bg, #0f0d13);
  color: var(--text, #f7f2fa);
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
  color-scheme: dark;
}

.member-form input::placeholder { color: #84768b; }

.member-form input:focus-visible,
#checkout-country:focus-visible,
.auth-switch button:focus-visible,
.order-cancel:focus-visible {
  outline: 2px solid var(--accent, #e6adf1);
  outline-offset: 3px;
}

.member-form .button { width: 100%; }

.member-hint {
  color: var(--muted, #a49aaa);
  font-size: .8rem;
  font-weight: 400;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.member-feedback {
  margin: 0;
  padding: .75rem .9rem;
  border: 1px solid #613a4c;
  border-radius: .65rem;
  background: #2d1823;
  color: #ffc1d5;
  font-size: .86rem;
  line-height: 1.6;
}

.member-loading .member-feedback { margin-top: 1rem; }
.member-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
[data-member-page] button:disabled { opacity: .6; cursor: wait; }

.member-notice {
  margin-bottom: 1rem;
  padding: .95rem 1.15rem;
  color: var(--accent, #e6adf1);
  background: #281d2f;
  border: 1px solid #503759;
  border-radius: .8rem;
  font-size: .9rem;
  line-height: 1.55;
}

#orders-error, #retry-orders { margin-bottom: 1rem; }
.order-list { display: grid; gap: 1rem; }

.order-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 1.4rem;
  padding: clamp(1.15rem, 3vw, 1.75rem);
}

.order-new { border-color: #6c4974; }
.order-card h2 { margin: 0; font-size: clamp(1.25rem, 3vw, 1.5rem); line-height: 1.25; }
.order-card-details > p { margin: .55rem 0 0; color: var(--muted, #a49aaa); font-size: .88rem; overflow-wrap: anywhere; }
.order-card-details .order-service-dates { color: var(--text, #f7f2fa); line-height: 1.55; }
.order-service-dates time { white-space: nowrap; }

.order-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem 1.1rem;
  margin-top: 1.25rem;
  color: var(--muted, #a49aaa);
  font-size: .79rem;
}

.order-number-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .65rem;
  min-width: 0;
}

.order-number { overflow-wrap: anywhere; }
.order-copy.button {
  min-height: 2.25rem;
  padding-inline: .7rem;
  font-size: .79rem;
  white-space: nowrap;
}
.order-copy-feedback { color: var(--accent, #e6adf1); }
.order-card-costs { display: grid; justify-items: end; gap: .55rem; }
.order-card-costs p { margin: 0; }

.order-states { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
.order-state {
  padding: .26rem .6rem;
  border-radius: 10rem;
  background: #2d2534;
  color: #d9c6e2;
  font-size: .73rem;
  line-height: 1.35;
  white-space: nowrap;
}

.order-state small { margin-right: .1rem; font-size: .67rem; opacity: .8; }
.order-state[data-status="unpaid"] { background: #3a2a23; color: #f6c49e; }
.order-state[data-status="deploying"] { background: #37273f; color: #f1baf7; }
.order-state[data-status="paid"], .order-state[data-status="free"], .order-state[data-status="delivered"] { background: #20362e; color: #a4e8c7; }
.order-state[data-status="cancelled"] { background: #322832; color: #cbb8ca; }
.order-total { font-size: 1.45rem; font-weight: 680; white-space: nowrap; }
.order-total small { color: var(--muted, #a49aaa); font-size: .72rem; font-weight: 400; }
.order-breakdown { color: var(--muted, #a49aaa); font-size: .76rem; }
.order-adjustment { color: var(--accent, #e6adf1); }

.order-policy {
  padding: .9rem 1rem;
  border: 1px solid #654b5f;
  border-radius: .8rem;
  background: #271d2b;
  color: var(--text, #f7f2fa);
  font-size: .83rem;
  line-height: 1.65;
}

.order-card > .order-policy { grid-column: 1 / -1; }
.order-policy h3 { margin: 0; color: var(--accent, #e6adf1); font-size: .9rem; }
.order-policy ul { display: grid; gap: .35rem; margin: .5rem 0 .65rem; padding-left: 1.15rem; }
.order-support-contact { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .85rem; font-size: .83rem; }
.order-support-wechat { min-width: 0; color: var(--text, #f7f2fa); overflow-wrap: anywhere; }
.order-support-wechat code { padding: .18rem .42rem; border-radius: .28rem; background: var(--bg, #0f0d13); color: var(--accent, #e6adf1); font-family: var(--mono, monospace); font-size: .92rem; font-weight: 700; user-select: all; }
.order-support-link { color: var(--accent, #e6adf1); font-weight: 650; text-decoration: underline; text-underline-offset: .2em; }
#checkout-policy, #payment-policy { margin-bottom: .9rem; }

.order-detail-link {
  color: var(--accent, #e6adf1);
  padding: .3rem 0;
  font-size: .83rem;
  font-weight: 650;
}

.order-detail-link:hover { text-decoration: underline; text-underline-offset: .22em; }

.order-detail-grid {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15.5rem), 1fr));
  gap: .8rem;
}

.order-record {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--border, #302735);
  border-radius: .85rem;
  background: var(--bg, #0f0d13);
}

.order-record h3 { margin: 0 0 .5rem; font-size: .97rem; }

.order-delivery { grid-column: 1 / -1; }
.order-delivery .member-hint { margin-bottom: .45rem; }
.delivery-records { max-width: 54rem; }
.delivery-value { color: var(--text, #f7f2fa); font-family: var(--mono, monospace); white-space: break-spaces; }
.delivery-secret { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.delivery-secret .button { min-height: 30px; padding-inline: .6rem; font-size: .75rem; }
.delivery-instructions { white-space: pre-wrap; overflow-wrap: anywhere; }

.member-records { margin: 0; }
.member-records > div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: .75rem;
  padding: .55rem 0;
  font-size: .82rem;
}
.member-records > div + div { border-top: 1px solid var(--border, #302735); }
.member-records dt { color: var(--muted, #a49aaa); }
.member-records dd { margin: 0; text-align: end; overflow-wrap: anywhere; }
.delivery-records > div { grid-template-columns: 6.25rem minmax(0, 1fr); }
.delivery-records dd { text-align: start; }

.order-cancel {
  width: max-content;
  padding: .2rem 0;
  border: 0;
  background: transparent;
  color: var(--muted, #a49aaa);
  font: inherit;
  font-size: .8rem;
  text-decoration: underline;
  text-underline-offset: .19em;
  cursor: pointer;
}

.order-cancel:hover { color: var(--accent, #e6adf1); }

.order-payment {
  display: grid;
  grid-column: 1 / -1;
  gap: .65rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border, #302735);
}

.order-payment .button { min-height: 39px; padding-inline: .85rem; font-size: .8rem; }

.empty-orders { padding: clamp(2.5rem, 7vw, 4rem) 1rem; text-align: center; }
.empty-orders h2 { margin: 1.35rem 0 0; font-size: 1.35rem; }
.empty-orders p { margin: .55rem 0 1.5rem; color: var(--muted, #a49aaa); font-size: .9rem; }

.empty-mark {
  display: grid;
  align-content: center;
  gap: .24rem;
  width: 3.3rem;
  height: 3.8rem;
  margin: 0 auto;
  padding: .6rem;
  background: #2a1f30;
  border: 1px solid #604566;
  border-radius: .65rem;
  transform: rotate(-9deg);
}

.empty-mark span { height: 1px; background: #8f6c97; }
.empty-mark span:last-child { width: 55%; }

.member-dialog {
  width: min(calc(100% - 2rem), 28rem);
  padding: 1.5rem;
}

.member-dialog::backdrop { background: #08070bc7; backdrop-filter: blur(4px); }
.member-dialog h2 { margin: 0; }
.member-dialog p { margin: .65rem 0 1.25rem; color: var(--muted, #a49aaa); line-height: 1.6; }
.member-dialog .member-actions { justify-content: flex-end; }
.profile-dialog { width: min(calc(100% - 2rem), 34rem); max-height: calc(100dvh - 2rem); overflow-y: auto; }
.profile-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.profile-head .button { min-height: 36px; padding-inline: .8rem; }
.profile-records { margin-top: 1rem; }
.profile-form { gap: .85rem; margin-top: 1rem; }
.profile-form .button { justify-self: end; width: auto; }
.profile-form .member-feedback { margin: 0; color: #ffc1d5; }
.profile-form .member-notice { margin: 0; color: var(--accent, #e6adf1); }
.password-form { margin-top: 1.3rem; padding-top: 1rem; border-top: 1px solid var(--border, #302735); }
.password-form h3 { margin: 0; font-size: 1rem; }
.payment-dialog { max-height: calc(100dvh - 2rem); overflow-y: auto; }
.payment-dialog .payment-dialog-head p { margin-bottom: 1rem; }
.payment-dialog-action { display: grid; justify-items: start; gap: .7rem; }
.payment-dialog-action p { margin: 0; }
.payment-qr {
  width: min(100%, 216px);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  margin-inline: auto;
  padding: .4rem;
  border-radius: .65rem;
  background: #fff;
}
.payment-dialog .payment-dialog-footer { margin-top: 1.2rem; }
.payment-dialog #payment-status-message { margin: .9rem 0 0; }
.payment-dialog #payment-error { margin: .9rem 0 0; color: #ffc1d5; }

.checkout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 23rem);
  align-items: start;
  gap: clamp(1rem, 3vw, 2rem);
}

.config-panel, .order-summary { padding: clamp(1.15rem, 3vw, 1.75rem); }
.checkout-device { display: flex; align-items: center; gap: 1rem; }
.checkout-device h2, .order-summary h2 { margin: 0; font-size: 1.25rem; }
.checkout-device p { margin: .3rem 0 0; color: var(--muted, #a49aaa); font-size: .87rem; }

.checkout-device-icon {
  display: grid;
  flex: 0 0 3.4rem;
  height: 3.4rem;
  place-items: center;
  border: 1px solid #48364f;
  border-radius: .8rem;
  background: #2b2132;
}

.checkout-device-icon span {
  width: 1.6rem;
  height: 1.25rem;
  border: 1px solid #c391d1;
  border-bottom-width: 3px;
  border-radius: .32rem;
}

.checkout-fieldset { min-width: 0; margin: 1.65rem 0 0; padding: 0; border: 0; }
.checkout-fieldset legend { padding: 0; margin-bottom: .65rem; font-weight: 600; }
.checkout-fieldset legend .member-hint { margin-left: .3rem; }
.checkout-contact-fields { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .75rem; margin-top: .75rem; }
#checkout-country { max-width: 23rem; }
.checkout-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }

.checkout-option {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: .55rem;
  padding: .7rem .65rem;
  border: 1px solid var(--border, #302735);
  border-radius: .65rem;
  background: var(--bg, #0f0d13);
  cursor: pointer;
  transition: background .18s, border-color .18s;
}

.checkout-option:not(.checkout-option-sold-out):hover,
.checkout-option:has(:checked) {
  background: #2a1d31;
  border-color: #8e6499;
}

.checkout-option:has(:focus-visible) { outline: 2px solid var(--accent, #e6adf1); outline-offset: 3px; }
.checkout-option input { flex-shrink: 0; margin: 0; accent-color: var(--accent, #e6adf1); }
.checkout-option-copy { display: grid; min-width: 0; gap: .25rem; font-size: .85rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.checkout-option-copy small { color: var(--muted, #a49aaa); font-size: .75rem; font-weight: 400; }
.checkout-option-sold-out { cursor: default; }
.checkout-option-sold-out .checkout-option-copy > span { color: var(--muted, #a49aaa); }
.checkout-option-sold-out .checkout-option-copy small, .checkout-stock-status { color: #e7c7b7; }
.checkout-stock-status { margin-top: .6rem; font-size: .82rem; }
#submit-order:disabled { cursor: default; }
#checkout-form[aria-busy="true"] #submit-order { cursor: wait; }

.order-summary { background: linear-gradient(145deg, #251b2b, var(--panel, #19151f) 72%); }
.order-summary dl { display: grid; gap: .9rem; margin: 1.35rem 0; }
.order-summary dl div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem .5rem; align-items: baseline; font-size: .88rem; }
.order-summary dt { color: var(--muted, #a49aaa); }
.order-summary dd { margin: 0; white-space: nowrap; }
#summary-country { white-space: normal; overflow-wrap: anywhere; }

.order-summary .summary-total {
  margin-top: .2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border, #302735);
  font-weight: 660;
}

.summary-total dt { color: var(--text, #f7f2fa); }
.summary-total dd { color: var(--accent, #e6adf1); font-size: clamp(1.4rem, 5.75vw, 1.8rem); letter-spacing: -.035em; }
.order-summary .button { display: flex; width: 100%; justify-content: space-between; }
.order-summary .member-feedback { margin-bottom: .8rem; }
.summary-hint { margin: .75rem 0 0; text-align: center; }

.member-footer { padding: 1.5rem 0; border-top: 1px solid var(--border, #302735); }
.member-footer.floating-support-footer { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
.member-footer .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.member-footer nav { display: flex; flex-wrap: wrap; justify-content: end; gap: .5rem 1rem; }
.member-footer a { color: var(--muted, #a49aaa); font-size: .82rem; text-decoration: none; }
.member-footer .member-footer-brand { color: var(--text, #f7f2fa); font-size: .95rem; font-weight: 700; }

@media (max-width: 800px) {
  .checkout-layout { grid-template-columns: minmax(0, 1fr); }
  .auth-layout { gap: 1.5rem; }
}

@media (max-width: 620px) {
  .auth-layout { grid-template-columns: minmax(0, 1fr); }
  .auth-layout .member-intro { margin: 0; }
  .order-card { grid-template-columns: minmax(0, 1fr); }
  .order-card-costs { justify-items: start; grid-template-columns: 1fr auto; align-items: baseline; }
  .order-states { grid-column: 1; justify-content: flex-start; }
  .order-detail-card .order-states { grid-column: 1 / -1; }
  .order-total { grid-column: 2; grid-row: 1; justify-self: end; }
  .order-breakdown { grid-column: 1 / -1; }
  .order-detail-link { grid-column: 1 / -1; }
}

@media (max-width: 460px) {
  .checkout-option { flex-direction: column; align-items: flex-start; }
  .checkout-option-copy { font-size: .79rem; }
}
