:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #ec4899;
  --text-dark: #1f2937;
  --text-muted: #6b7280;
  --bg-card: #ffffff;
  --bg-soft: #f9fafb;
  --border: #e5e7eb;
  --danger: #DC2626;
  --success: #10B981;
  --bg-dark: #0f172a;
  --bg-dark-2: #1f2937;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1f2937 50%, #0f172a 100%);
  background-attachment: fixed;
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  position: relative;
}

#particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.container {
  position: relative;
  z-index: 1;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  color: #fff;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  object-fit: cover;
}

.brand-name {
  font-size: 20px;
  font-weight: 700;
  flex: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.lang-switch {
  flex-shrink: 0;
  position: relative;
}

.lang-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.18) 0%,
    rgba(255, 255, 255, 0.06) 100%
  );
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  width: auto;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: background 0.2s, border-color 0.2s, transform 0.05s;
}

.lang-chip:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.25) 0%,
    rgba(255, 255, 255, 0.1) 100%
  );
  border-color: rgba(255, 255, 255, 0.4);
}

.lang-chip:active {
  transform: none;
}

.lang-chip .lang-globe {
  font-size: 14px;
}

.lang-menu {
  list-style: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: linear-gradient(
    135deg,
    rgba(15, 23, 42, 0.55) 0%,
    rgba(15, 23, 42, 0.7) 100%
  );
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  padding: 6px;
  min-width: 140px;
  z-index: 100;
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.lang-menu li {
  color: #fff;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s;
}

.lang-menu li:hover {
  background: rgba(255, 255, 255, 0.1);
}

.lang-menu li.active {
  background: rgba(99, 102, 241, 0.3);
  color: #fff;
  font-weight: 600;
}

/* Glass container — 參數對齊 landing_page 的 backdrop-filter glass card */
.step {
  display: none;
  background-color: rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 32px 24px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.step.active {
  display: block;
}

.step h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #fff;
}

.hint {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.6;
  margin-bottom: 20px;
}

.hint strong {
  color: #fff;
}

.banner {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(236, 72, 153, 0.2));
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.banner-location {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.28), rgba(234, 88, 12, 0.2));
  border-color: rgba(245, 158, 11, 0.45);
  text-align: left;
  line-height: 1.5;
}

.banner code {
  background: rgba(255, 255, 255, 0.18);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-weight: 600;
  color: #fff;
}

.hidden {
  display: none !important;
}

form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

input[type="email"],
input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

input[type="email"]::placeholder,
input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

input[type="email"]:focus,
input[type="text"]:focus {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25);
}

input[type="text"] {
  letter-spacing: 8px;
  text-align: center;
  font-size: 24px;
  font-weight: 600;
}

button,
.primary {
  width: 100%;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.05s, box-shadow 0.2s;
  text-decoration: none;
  text-align: center;
  display: inline-block;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

button:active,
.primary:active {
  transform: scale(0.98);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.link-btn {
  background: transparent;
  color: var(--primary);
  font-size: 14px;
  margin-top: 16px;
  text-decoration: underline;
  width: auto;
  padding: 8px 12px;
  box-shadow: none;
}

.link-btn:active {
  box-shadow: none;
}

.error {
  color: var(--danger);
  font-size: 14px;
  margin-top: 12px;
  min-height: 18px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(99, 102, 241, 0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

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

.success-icon,
.error-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  color: #fff;
  margin: 0 auto 16px;
}

.success-icon {
  background: linear-gradient(135deg, #10B981, #059669);
}

.error-icon {
  background: linear-gradient(135deg, #DC2626, #B91C1C);
}

.reward {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.error-message {
  color: var(--danger);
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 16px;
}

/* 禮物盒列表 */
.giftbox-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  text-align: left;
}

.gift-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
}

.gift-card:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.35);
}

.gift-card.used {
  opacity: 0.5;
}

.gift-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.gift-card-body {
  flex: 1;
  min-width: 0;
}

.gift-card-title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.gift-card-meta {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.gift-card-action {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: auto;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
}

.gift-card-action:disabled {
  background: #ccc;
  cursor: not-allowed;
  box-shadow: none;
}

.empty {
  padding: 40px 20px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  text-align: center;
}

.footer-note {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 12px;
  font-style: italic;
}

/* 手動輸入兌換碼區 */
.manual-redeem {
  margin: 12px 0 20px;
  text-align: left;
}

.ghost {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border: 1px dashed rgba(255, 255, 255, 0.4);
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: none;
}

.ghost:active {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.manual-redeem-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-direction: row;
}

.manual-redeem-form input[type="text"] {
  flex: 1;
  letter-spacing: 1px;
  text-align: left;
  font-size: 16px;
  font-weight: 500;
  text-transform: lowercase;
}

.manual-redeem-form button {
  width: auto;
  padding: 14px 24px;
  flex-shrink: 0;
}

footer {
  margin-top: auto;
  padding-top: 24px;
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
}

footer a {
  color: #fff;
  text-decoration: underline;
}

.intro-link {
  margin-top: 18px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
}

.intro-link a {
  color: #fff;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
  padding-bottom: 1px;
  white-space: nowrap;
}

.intro-link a:hover {
  border-bottom-color: #fff;
}

.intro-desc {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
}

/* ────────────────────────────────────────────────────────── */
/* Confirm modal（會員升級確認對話框）                          */
/* ────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.7);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: modal-fade-in 0.15s ease-out;
}

.modal-overlay.hidden {
  display: none;
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  animation: modal-slide-up 0.2s ease-out;
}

@keyframes modal-slide-up {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 12px;
  text-align: left;
}

.modal-card p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 20px;
  white-space: pre-line;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-actions button {
  flex: 1;
  width: auto;
  padding: 12px 16px;
  font-size: 14px;
  margin: 0;
}

.modal-cancel {
  background: var(--bg-soft) !important;
  color: var(--text-muted) !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
}

.modal-cancel:active {
  box-shadow: none !important;
}
