:root {
  --green: #008557;
  --green-hover: #006b65;
  --bg: #f0f2f4;
  --card: #fff;
  --text: #1a1a1a;
  --muted: #5c6560;
  --border: #d8dde0;
  --terms-bg: #e8f5ef;
  --radius: 12px;
  --shadow: 0 8px 28px rgba(0, 40, 30, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang TC", "Microsoft JhengHei", "Heiti TC", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.5;
}

.site-header {
  background: var(--green);
  color: #fff;
  text-align: center;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.site-header-logo-link {
  display: block;
  width: min(100%, 120px);
  max-width: 120px;
  margin: 0 0 0.85rem;
  line-height: 0;
  text-decoration: none;
  color: inherit;
}

.site-header-logo-link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.95);
  outline-offset: 3px;
  border-radius: 6px;
}

.site-header-logo {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  object-fit: contain;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.15rem, 4vw, 1.5rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.site-header .sub {
  margin: 0.35rem 0 0;
  font-size: clamp(0.85rem, 2.8vw, 1rem);
  font-weight: 400;
  font-style: italic;
  opacity: 0.95;
}

.lang-switch {
  position: fixed;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 50;
  display: flex;
  gap: 0.25rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem;
  box-shadow: var(--shadow);
}

.lang-switch :is(button, a) {
  border: none;
  background: transparent;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.lang-switch :is(button, a).active {
  background: var(--green);
  color: #fff;
}

.lang-switch a {
  text-decoration: none;
  display: inline-block;
}

.wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-top: 5px solid var(--green);
  padding: 1.35rem 1.25rem 1.5rem;
}

.card-title {
  text-align: center;
  color: var(--green);
  font-size: clamp(1.05rem, 3.5vw, 1.2rem);
  font-weight: 700;
  margin: 0 0 0.25rem;
}

.card-title .en {
  display: block;
  font-size: 0.82em;
  font-weight: 500;
  font-style: italic;
  margin-top: 0.2rem;
  color: #0a5c40;
}

.preview-row {
  display: grid;
  grid-template-columns: repeat(2, 5.85rem);
  gap: 0.5rem;
  justify-content: center;
  margin: 1rem 0 1.25rem;
}

@media (min-width: 540px) {
  .preview-row {
    grid-template-columns: repeat(4, 5.85rem);
  }
}

.preview-box {
  width: 5.85rem;
  height: 5.85rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.15;
  padding: 4px;
  overflow: hidden;
}

.preview-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 8px;
}

.preview-a {
  background: #ffd6e0;
  color: #c41e3a;
}

.preview-b {
  background: #cfe8ff;
  color: #1565c0;
}

.preview-c {
  background: #c8bfe7;
  color: var(--green);
}

.preview-d {
  background: #4a4f54;
  color: #fff;
  font-size: 1.4rem;
  position: relative;
  animation: mysteryPulse 1.3s ease-in-out infinite;
  box-shadow: 0 0 0 rgba(255, 255, 255, 0.35);
}

.preview-d::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0) 35%, rgba(255, 255, 255, 0.32) 50%, rgba(255, 255, 255, 0) 65%);
  transform: translateX(-130%);
  animation: mysteryShine 1.6s linear infinite;
}

.preview-d span {
  position: relative;
  z-index: 1;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.45);
}

@keyframes mysteryPulse {
  0%, 100% {
    opacity: 0.9;
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255, 255, 255, 0.22);
  }
  50% {
    opacity: 1;
    transform: scale(1.03);
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.42);
  }
}

@keyframes mysteryShine {
  0% {
    transform: translateX(-130%);
  }
  100% {
    transform: translateX(130%);
  }
}

.field {
  margin-bottom: 1.1rem;
}

.field label .zh {
  display: block;
  font-weight: 600;
}

.field label .en {
  display: block;
  font-size: 0.82em;
  color: var(--muted);
  font-style: italic;
  font-weight: 400;
}

.color-options {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.45rem;
}

.color-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  min-height: 48px;
  transition: border-color 0.15s, background 0.15s;
}

.color-option:hover {
  border-color: #9bc4b0;
  background: #fafcfb;
}

.color-option:has(input:focus-visible) {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.color-option input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--green);
  flex-shrink: 0;
}

.color-swatch {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.sw-orange {
  background: linear-gradient(135deg, #ff9a3c, #ff6b1a);
}

.sw-camo {
  /* 與其他色票同為平滑漸層，避免斜紋在視覺上過於搶眼 */
  background: linear-gradient(135deg, #8b9568 0%, #5c6b4a 100%);
}

.sw-brown {
  background: linear-gradient(135deg, #ddb788 0%, #652a0c 100%);
}

.sw-purple {
  background: linear-gradient(135deg, #b388ff, #7c4dff);
}

.color-text {
  font-size: 0.95rem;
  font-weight: 600;
}

.color-text small {
  display: block;
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

input[type="text"],
input[type="email"],
input[type="tel"] {
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.65rem 0.75rem;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 48px;
}

input:focus {
  border-color: var(--green);
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 133, 87, 0.2);
}

.terms-box {
  background: var(--terms-bg);
  border: 1px solid #b8dcc8;
  border-radius: 10px;
  padding: 0.85rem 0.9rem;
  margin-bottom: 1rem;
}

.terms-box .terms-row {
  font-size: 0.9rem;
}

.terms-box input[type="checkbox"] {
  margin-top: 0.2rem;
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--green);
  flex-shrink: 0;
}

.legal-popup-list {
  margin: 0;
  padding-left: 1.15rem;
  list-style-type: disc;
}

.legal-popup-list li {
  margin: 0.45rem 0;
  line-height: 1.45;
}

.terms-agree-line {
  display: inline;
  line-height: 1.5;
}

.terms-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.terms-agree-text {
  flex: 1;
  min-width: 0;
}

.terms-agree-hit {
  cursor: pointer;
  font-weight: inherit;
}

.terms-agree-line .link-btn {
  display: inline;
  padding: 0;
  margin: 0 0.1rem;
  vertical-align: baseline;
  font-size: inherit;
  font-weight: 600;
}

.btn-captcha-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--green);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 0;
}

.btn-captcha-refresh:hover {
  background: var(--terms-bg);
  color: var(--green-hover);
}

.btn-captcha-refresh svg {
  display: block;
}

.captcha-field-label {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

.link-btn {
  background: none;
  border: none;
  color: var(--green);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.link-btn:hover {
  color: var(--green-hover);
}

.submit-btn {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--green);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  min-height: 48px;
  transition: background 0.15s;
}

.submit-btn:hover {
  background: var(--green-hover);
}

.submit-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.submit-btn .en {
  display: block;
  font-size: 0.78em;
  font-weight: 500;
  font-style: italic;
  margin-top: 0.15rem;
}

.legal-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.15rem 0 0.95rem;
}

.legal-section {
  font-size: 0.9rem;
  color: var(--text);
}

.legal-block + .legal-block {
  margin-top: 0.9rem;
}

.legal-title {
  margin: 0 0 0.35rem;
  color: var(--green);
  font-size: 0.95rem;
  font-weight: 700;
}

.legal-list {
  margin: 0;
  padding-left: 1.1rem;
  color: #2e3632;
}

.legal-list li {
  margin-bottom: 0.25rem;
}

.state-page {
  text-align: center;
  padding: 2rem 1rem;
}

.state-page h2 {
  color: var(--green);
  margin: 0 0 0.5rem;
}

.state-page p {
  color: var(--muted);
  margin: 0;
}

.error-msg {
  color: #b00020;
  font-size: 0.9rem;
  margin-top: 0.35rem;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 30, 20, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 540px) {
  .modal-backdrop {
    align-items: center;
    padding: 1rem;
  }
}

.modal {
  background: #fff;
  width: 100%;
  max-width: 520px;
  max-height: min(88vh, 640px);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.25s ease;
}

@media (min-width: 540px) {
  .modal {
    border-radius: 14px;
    transform: scale(0.94);
    opacity: 0;
  }
}

.modal-backdrop.open .modal {
  transform: translateY(0);
}

@media (min-width: 540px) {
  .modal-backdrop.open .modal {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 2px solid var(--green);
  background: #fafcfb;
  border-radius: 14px 14px 0 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--green);
}

.modal-header-close-only {
  justify-content: flex-end;
}

.modal-close {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  border-radius: 8px;
}

.modal-close:hover {
  background: #eee;
  color: var(--text);
}

.modal-body {
  overflow-y: auto;
  padding: 1rem 1.1rem 1.25rem;
  -webkit-overflow-scrolling: touch;
}

.modal-body h4 {
  color: var(--green);
  margin: 1rem 0 0.4rem;
  font-size: 1rem;
}

.modal-body h4:first-child {
  margin-top: 0;
}

.modal-body ol,
.modal-body ul {
  margin: 0.35rem 0 0;
  padding-left: 1.25rem;
}

.modal-body li {
  margin-bottom: 0.25rem;
}

.modal-body .en-block {
  font-size: 0.85em;
  color: var(--muted);
  font-style: italic;
  margin-top: 0.35rem;
}

.success-modal .modal {
  max-height: none;
}

.success-modal .modal-body {
  text-align: center;
  padding: 1.5rem 1.25rem;
}

.card-title .en:empty,
.submit-btn .en:empty {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.success-api-details {
  margin-top: 1rem;
  text-align: left;
  font-size: 0.9rem;
  color: var(--text);
}

.success-detail-line {
  margin: 0.5rem 0 0;
  word-break: break-word;
}

.success-detail-line code {
  font-size: 0.85rem;
  background: #f0f4f2;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}

.success-detail-label {
  color: var(--green);
  font-weight: 600;
}

#captcha-api-img {
  flex-shrink: 0;
}

/* Razor 與 demo 對齊之補充 */
body.razor-app #demo-phase-radios {
  display: none !important;
}

.field-validation-error,
.validation-summary {
  color: #b00020;
  font-size: 0.9rem;
}

.validation-summary ul {
  margin: 0;
  padding-left: 1.2rem;
}

.razor-success-inline {
  position: static !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  background: transparent !important;
  align-items: flex-start !important;
  padding-top: 0.5rem !important;
}

.razor-success-inline .modal {
  transform: none !important;
  opacity: 1 !important;
  border-radius: 14px !important;
  margin: 0 auto;
}

canvas#captcha-canvas-hidden {
  display: none !important;
}

