:root {
  --ink: #172033;
  --muted: #667085;
  --line: rgba(203, 213, 225, 0.78);
  --green: #16a34a;
  --green-dark: #108b56;
  --teal: #0f766e;
  --header: #0f2f3a;
  --header-2: #123f45;
  --danger: #dc2626;
  --shadow: 0 24px 54px rgba(17, 24, 39, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #f7faf8;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", Arial, sans-serif;
  background: linear-gradient(180deg, #f7faf8 0%, #eef8f2 100%);
}

button,
a,
input {
  font: inherit;
}

.checkout-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.9) 58%, rgba(232, 248, 239, 0.92) 100%);
}

.checkout-header {
  min-height: 82px;
  display: flex;
  align-items: center;
  padding: 8px clamp(32px, 4vw, 76px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.checkout-brand {
  display: inline-flex;
  align-items: center;
  gap: 24px;
  color: var(--ink);
  text-decoration: none;
  font-size: 18px;
  font-weight: 900;
}

.checkout-brand img {
  width: 228px;
  height: auto;
  flex: 0 0 auto;
  border-radius: 0;
  object-fit: contain;
}

.checkout-main {
  width: min(1060px, calc(100% - 44px));
  display: grid;
  grid-template-columns: minmax(320px, 0.88fr) minmax(390px, 1fr);
  gap: clamp(24px, 3.6vw, 48px);
  align-items: center;
  margin: 0 auto;
  padding: 18px 0;
}

.order-summary,
.checkout-card {
  border: 1px solid rgba(22, 163, 74, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.order-summary {
  padding: 24px;
}

.summary-kicker {
  margin: 0 0 12px;
  color: var(--teal);
  font-size: 16px;
  line-height: 1.35;
  font-weight: 950;
}

.order-summary h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.16;
  font-weight: 950;
}

.summary-price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 14px 0 18px;
  color: #e11d48;
}

.summary-price span {
  font-size: 24px;
  font-weight: 950;
}

.summary-price strong {
  font-size: clamp(62px, 5.6vw, 84px);
  line-height: 0.9;
  font-weight: 950;
}

.summary-list,
.summary-delivery ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.summary-list {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.summary-list li,
.summary-delivery li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #263548;
  font-size: 17px;
  line-height: 1.35;
  font-weight: 850;
}

.summary-list span,
.summary-delivery span {
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.12);
  color: var(--green);
  font-weight: 950;
}

.summary-delivery {
  padding-top: 18px;
}

.summary-delivery h2 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.3;
  font-weight: 950;
}

.checkout-card {
  padding: 24px;
}

.checkout-heading {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.checkout-heading p {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 16px;
  font-weight: 950;
}

.checkout-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(26px, 2.6vw, 34px);
  line-height: 1.18;
  font-weight: 950;
}

form {
  display: grid;
  gap: 13px;
  margin-top: 16px;
}

.checkout-field {
  display: grid;
  gap: 7px;
}

.checkout-field span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #263548;
  font-size: 15px;
  font-weight: 950;
}

.checkout-field strong,
.checkout-field b {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.checkout-field input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.checkout-field input:focus {
  border-color: rgba(22, 163, 74, 0.62);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.1);
}

.checkout-field.has-error input {
  border-color: rgba(220, 38, 38, 0.72);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.08);
}

.checkout-field em {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  font-style: normal;
  font-weight: 750;
}

.field-error {
  min-height: 16px;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.25;
  font-weight: 850;
}

.consent-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(203, 213, 225, 0.72);
  border-radius: 8px;
  background: rgba(249, 250, 251, 0.76);
}

.terms-review {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(203, 213, 225, 0.72);
  border-radius: 8px;
  background: rgba(249, 250, 251, 0.76);
}

.terms-review-note {
  margin: 0;
  color: #344054;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 850;
}

.terms-review-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.terms-review-button {
  min-height: 50px;
  display: grid;
  gap: 3px;
  padding: 9px 11px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 8px;
  background: #fff;
  color: #263548;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}

.terms-review-button span {
  font-size: 14px;
  font-weight: 950;
}

.terms-review-button strong {
  color: var(--teal);
  font-size: 13px;
  font-weight: 950;
}

.consent-row input:disabled {
  cursor: not-allowed;
}

.consent-row:has(input:disabled) {
  opacity: 0.72;
}

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

.consent-row span {
  color: #344054;
  font-size: 14px;
  line-height: 1.55;
  font-weight: 850;
}

.consent-row button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--teal);
  cursor: pointer;
  font-weight: 950;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.consent-error {
  margin-top: -8px;
}

.checkout-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.checkout-secondary,
.checkout-primary {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 950;
  text-decoration: none;
  cursor: pointer;
}

.checkout-secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: #344054;
}

.checkout-primary {
  border: 0;
  background: linear-gradient(180deg, #22b86f, var(--green-dark));
  color: #fff;
  box-shadow: 0 16px 34px rgba(16, 139, 86, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.checkout-primary:disabled {
  cursor: wait;
  opacity: 0.72;
}

.checkout-result {
  display: none;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(22, 163, 74, 0.24);
  border-radius: 8px;
  background: rgba(240, 253, 244, 0.86);
  color: #14532d;
  outline: none;
}

.checkout-result.show {
  display: grid;
}

.checkout-result p,
.checkout-result strong,
.checkout-result small {
  margin: 0;
}

.checkout-result p {
  font-size: 15px;
  font-weight: 950;
}

.checkout-result strong {
  font-size: 18px;
  font-weight: 950;
}

.checkout-result small {
  color: #166534;
  font-size: 13px;
  font-weight: 850;
}

.checkout-legal-footer {
  margin-top: 18px;
  padding: 22px clamp(18px, 4vw, 72px);
  background: #0f2f3a;
  color: rgba(255, 255, 255, 0.84);
}

.checkout-legal-footer-inner {
  width: min(980px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto;
}

.checkout-legal-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
}

.checkout-legal-footer a {
  color: #fff;
  font-weight: 850;
  text-decoration: none;
}

.checkout-legal-footer a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.checkout-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10;
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 0 18px;
  border-radius: 999px;
  background: rgba(23, 32, 51, 0.94);
  color: #fff;
  box-shadow: 0 16px 32px rgba(17, 24, 39, 0.18);
  font-size: 15px;
  font-weight: 850;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.checkout-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.order-success-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
}

.order-success-overlay.show {
  opacity: 1;
  pointer-events: auto;
  animation: successOverlayIn 220ms ease forwards;
}

.order-success-dialog {
  position: relative;
  width: min(500px, 100%);
  display: grid;
  gap: 16px;
  padding: clamp(24px, 4vw, 34px);
  border-radius: 24px;
  background: #fff;
  color: var(--ink);
  text-align: center;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
  outline: none;
  transform: translateY(10px) scale(0.98);
}

.order-success-overlay.show .order-success-dialog {
  animation: successDialogIn 260ms ease forwards;
}

.order-success-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: #f2f4f7;
  color: #344054;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  font-weight: 850;
}

.order-success-close:focus-visible,
.order-success-primary:focus-visible,
.order-success-facebook:focus-visible {
  outline: 3px solid rgba(22, 163, 74, 0.28);
  outline-offset: 3px;
}

.order-success-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  justify-self: center;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(34, 184, 111, 0.16), rgba(16, 139, 86, 0.12));
  color: var(--green-dark);
}

.order-success-overlay.show .order-success-icon {
  animation: successIconIn 280ms ease forwards;
}

.order-success-icon span {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(180deg, #22b86f, var(--green-dark));
  color: #fff;
  font-size: 28px;
  font-weight: 950;
}

.order-success-dialog h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(28px, 4vw, 36px);
  line-height: 1.15;
  font-weight: 950;
}

.order-success-dialog p {
  margin: 0;
  color: #344054;
  font-size: 16px;
  line-height: 1.6;
  font-weight: 850;
}

.order-success-number-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid rgba(22, 163, 74, 0.28);
  border-radius: 16px;
  background: rgba(240, 253, 244, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.order-success-number-card span,
.order-success-number-card small {
  color: #166534;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 850;
}

.order-success-number-card strong {
  color: #14532d;
  font-size: clamp(18px, 4vw, 24px);
  line-height: 1.25;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.order-success-next {
  color: var(--muted);
}

.order-success-social {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(24, 119, 242, 0.18);
  border-radius: 16px;
  background: #f8fbff;
  text-align: left;
}

.order-success-social h3,
.order-success-social p,
.order-success-social ul {
  margin: 0;
}

.order-success-social h3 {
  color: #172033;
  font-size: 17px;
  line-height: 1.3;
  font-weight: 950;
}

.order-success-social p {
  color: #344054;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 850;
}

.order-success-social ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  padding: 0;
  list-style: none;
}

.order-success-social li {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #1d2939;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 850;
}

.order-success-social li span {
  color: #1877f2;
  font-weight: 950;
}

.order-success-facebook {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #1877f2;
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 950;
  box-shadow: 0 14px 28px rgba(24, 119, 242, 0.2);
}

.order-success-facebook:hover {
  background: #166fe5;
}

.order-success-facebook[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

.order-success-primary {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0 18px;
  border-radius: 12px;
  background: linear-gradient(180deg, #22b86f, var(--green-dark));
  color: #fff;
  box-shadow: 0 16px 34px rgba(16, 139, 86, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  text-decoration: none;
  font-size: 16px;
  font-weight: 950;
}

.order-success-primary:hover {
  background: linear-gradient(180deg, #20ad69, #0f7d4e);
}

body.modal-open {
  overflow: hidden;
}

@keyframes successOverlayIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes successDialogIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes successIconIn {
  from {
    transform: scale(0.9);
  }

  to {
    transform: scale(1);
  }
}

@media (max-width: 860px) {
  .checkout-shell {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .checkout-header {
    min-height: 70px;
    padding: 8px 16px;
    justify-content: center;
  }

  .checkout-brand {
    gap: 0;
    font-size: 15px;
  }

  .checkout-brand img {
    width: 150px;
    height: auto;
  }

  .checkout-brand span {
    display: none;
  }

  .checkout-main {
    width: min(100% - 24px, 560px);
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px 0;
  }

  .order-summary,
  .checkout-card {
    padding: 10px;
  }

  .summary-kicker {
    margin-bottom: 4px;
    font-size: 13px;
  }

  .order-summary h1 {
    font-size: 20px;
  }

  .summary-price {
    margin: 2px 0 8px;
  }

  .summary-price span {
    font-size: 18px;
  }

  .summary-price strong {
    font-size: 46px;
  }

  .summary-list,
  .summary-delivery ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px 8px;
  }

  .summary-list {
    padding-bottom: 7px;
  }

  .summary-delivery {
    padding-top: 7px;
  }

  .summary-delivery h2 {
    margin-bottom: 6px;
    font-size: 15px;
  }

  .summary-list li,
  .summary-delivery li {
    gap: 6px;
    font-size: 13px;
  }

  .summary-list span,
  .summary-delivery span {
    width: 19px;
    height: 19px;
  }

  .checkout-heading {
    padding-bottom: 7px;
  }

  .checkout-heading p {
    margin-bottom: 3px;
    font-size: 14px;
  }

  .checkout-heading h2 {
    font-size: 20px;
  }

  form {
    gap: 5px;
    margin-top: 7px;
  }

  .checkout-field {
    gap: 4px;
  }

  .checkout-field input {
    min-height: 34px;
    padding: 0 10px;
  }

  .checkout-field em {
    font-size: 11px;
    line-height: 1.28;
  }

  .field-error {
    min-height: 12px;
    font-size: 11px;
  }

  .consent-row {
    padding: 7px;
    gap: 8px;
  }

  .consent-row span {
    font-size: 12px;
    line-height: 1.38;
  }

  .terms-review {
    padding: 7px;
    gap: 7px;
  }

  .terms-review-actions {
    gap: 7px;
  }

  .terms-review-button {
    min-height: 42px;
    padding: 7px 8px;
  }

  .terms-review-button span,
  .terms-review-note {
    font-size: 12px;
  }

  .terms-review-button strong {
    font-size: 12px;
  }

  .checkout-actions {
    gap: 8px;
  }

  .checkout-legal-footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .checkout-secondary,
  .checkout-primary {
    min-height: 40px;
    padding: 0 10px;
    font-size: 14px;
  }
}

@media (max-width: 420px) {
  .checkout-main {
    width: calc(100% - 20px);
  }

  .order-success-dialog {
    padding: 24px 18px;
  }

  .order-success-social ul {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 560px) {
  .terms-review-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .checkout-field input,
  .checkout-toast {
    transition: none;
  }

  .order-success-overlay.show,
  .order-success-overlay.show .order-success-dialog,
  .order-success-overlay.show .order-success-icon {
    animation: none;
  }
}
