body:has(> .purchase-header),
body:has(#purchase-mode:target),
#purchase-content,
.error-body {
  color-scheme: dark;
  --bg: #071015;
  --panel: #101b22;
  --panel-soft: #15242d;
  --line: #2c414c;
  --text: #f5f8fa;
  --muted: #a9bac4;
  --cyan: #56d5df;
  --cyan-dark: #163f47;
  --amber: #f3bd68;
  --danger: #ff8f8f;
}

* {
  box-sizing: border-box;
}

body:has(> .purchase-header),
body:has(#purchase-mode:target),
.error-body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% 5%, rgba(56, 150, 164, 0.16), transparent 32rem),
    linear-gradient(180deg, #08131a 0%, var(--bg) 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
}

.purchase-header a,
.purchase-shell a,
.purchase-footer a,
.error-card a {
  color: var(--cyan);
}

.purchase-header,
.purchase-footer,
.purchase-shell {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.purchase-header {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(123, 157, 174, 0.3);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.14em;
  font-size: 0.82rem;
  font-weight: 700;
}

.brand-link img {
  width: 112px;
  height: 38px;
  object-fit: contain;
  background: #fff;
}

.secure-label {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
}

.purchase-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.purchase-header-actions > a {
  font-size: 0.78rem;
  text-decoration: none;
}

.purchase-shell {
  padding: 70px 0 54px;
}

.purchase-intro {
  max-width: 780px;
  margin-bottom: 34px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--cyan);
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  font-weight: 800;
}

.purchase-shell h1,
.purchase-shell h2,
.purchase-shell p,
.error-card h1,
.error-card h2,
.error-card p {
  margin-top: 0;
}

.purchase-shell h1,
.error-card h1 {
  margin-bottom: 18px;
  font-size: clamp(2rem, 5vw, 3.7rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.purchase-intro > p:last-child {
  color: var(--muted);
  line-height: 1.9;
}

.notice {
  display: grid;
  gap: 5px;
  padding: 18px 20px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  line-height: 1.6;
}

.notice-error {
  border-color: rgba(255, 143, 143, 0.55);
  color: var(--danger);
}

.notice-neutral {
  border-color: rgba(243, 189, 104, 0.5);
  color: var(--amber);
}

.purchase-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 22px;
  align-items: start;
}

@media (max-width: 1040px) {
  .purchase-grid {
    grid-template-columns: 1fr;
  }
}

.order-card,
.checkout-card,
.delivery-note,
.error-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(16, 27, 34, 0.96);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
}

.order-card,
.checkout-card {
  padding: clamp(24px, 4vw, 38px);
}

.product-heading {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.product-heading img {
  width: 76px;
  height: 76px;
  object-fit: contain;
}

.product-heading span {
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.product-heading h2 {
  margin: 7px 0 0;
  font-size: clamp(1.3rem, 3vw, 2rem);
}

.order-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 0;
  padding: 24px 0;
}

.order-details div {
  padding-inline: 18px;
  border-left: 1px solid var(--line);
}

.order-details div:first-child {
  padding-left: 0;
  border-left: 0;
}

.order-details dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.order-details dd {
  margin: 8px 0 0;
  font-weight: 800;
}

.mac-id-panel {
  display: grid;
  gap: 9px;
  padding: 20px;
  border: 1px solid rgba(86, 213, 223, 0.38);
  border-radius: 12px;
  background: rgba(22, 63, 71, 0.45);
}

.mac-id-panel > span {
  color: var(--muted);
  font-size: 0.8rem;
}

.mac-id-panel code {
  color: var(--text);
  font-size: clamp(1rem, 3vw, 1.35rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  word-break: break-all;
}

.mac-id-panel small,
.tax-note,
.external-note span,
.delivery-note p,
.renewal-note p {
  color: var(--muted);
  line-height: 1.7;
}

.renewal-note {
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px solid rgba(126, 214, 106, 0.42);
  border-radius: 12px;
  background: rgba(42, 78, 45, 0.22);
}

.renewal-note strong {
  color: var(--green);
}

.renewal-note p {
  margin: 8px 0 0;
}

.price-row,
.domestic-price {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px;
}

.price-row span,
.domestic-price span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.price-row strong {
  font-size: clamp(2rem, 5vw, 3rem);
}

.domestic-price {
  margin: 12px 0 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.domestic-price[hidden] {
  display: none;
}

.tax-note {
  margin-bottom: 24px;
  font-size: 0.86rem;
}

.purchase-shell button {
  width: 100%;
  padding: 17px 20px;
  border: 0;
  border-radius: 10px;
  background: var(--cyan);
  color: #051015;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.purchase-shell button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.purchase-shell button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.external-note {
  display: grid;
  gap: 6px;
  margin-top: 18px;
  font-size: 0.8rem;
}

.external-note .link-payment-guidance {
  margin-top: 2px;
  padding-left: 18px;
  font-size: 0.77rem;
}

.registration-form {
  display: grid;
  gap: 22px;
}

.checkout-status {
  margin: -4px 0 0;
  color: var(--danger);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.65;
}

.checkout-status[hidden] {
  display: none;
}

.registration-heading {
  display: grid;
  gap: 7px;
}

.registration-heading h2,
.registration-heading p,
.agreement-title {
  margin: 0;
}

.registration-heading h2 {
  font-size: 1.28rem;
}

.registration-heading p,
.agreement-title {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.65;
}

.registration-form label:not(.consent-row) {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  width: 100%;
  gap: 9px;
}

.registration-form label:not(.consent-row) > * {
  min-width: 0;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
  font-weight: 700;
}

.field-label em,
.consent-row em {
  flex: 0 0 auto;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(86, 213, 223, 0.16);
  color: var(--cyan);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.field-label em.optional {
  background: rgba(169, 186, 196, 0.13);
  color: var(--muted);
}

.registration-form input[type="text"],
.registration-form input[type="email"],
.registration-form select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  background: #0a141a;
  color: var(--text);
  font: inherit;
}

.registration-form input:focus,
.registration-form select:focus {
  outline: 2px solid rgba(86, 213, 223, 0.75);
  outline-offset: 2px;
}

.registration-form small,
.registration-links {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.65;
}

.agreement-block {
  display: grid;
  gap: 11px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(21, 36, 45, 0.58);
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.consent-row span {
  display: block;
}

.consent-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--cyan);
}

.registration-links {
  margin: 0;
}

.external-note strong::before {
  content: "↗";
  margin-right: 7px;
  color: var(--cyan);
}

.delivery-note {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 24px;
  margin-top: 22px;
  padding: 25px 30px;
}

.delivery-note p {
  margin: 0;
}

.purchase-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 0 38px;
  border-top: 1px solid rgba(123, 157, 174, 0.3);
  color: var(--muted);
  font-size: 0.8rem;
}

.error-body {
  display: grid;
  place-items: center;
  padding: 30px;
}

.error-card {
  width: min(680px, 100%);
  padding: clamp(28px, 6vw, 46px);
}

.error-card h1 {
  font-size: clamp(1.7rem, 5vw, 2.7rem);
}

.error-card p {
  color: var(--muted);
  line-height: 1.8;
}

@media (max-width: 780px) {
  .purchase-header,
  .purchase-footer,
  .purchase-shell {
    width: min(100% - 28px, 1120px);
  }

  .secure-label,
  .brand-link span {
    display: none;
  }

  .purchase-shell {
    padding-top: 44px;
  }

  .purchase-grid {
    grid-template-columns: 1fr;
  }

  .order-details {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .order-details div,
  .order-details div:first-child {
    padding: 0 0 14px;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }

  .order-details div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .delivery-note {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .order-card,
  .checkout-card {
    padding: 22px 18px;
  }

  .price-row,
  .domestic-price {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .price-row strong,
  .domestic-price b {
    justify-self: start;
  }
}
