@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/fonts/BeVietnamPro-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/fonts/BeVietnamPro-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-charcoal: #121212;
  --bg-glow: radial-gradient(circle at 20% 0%, rgba(42, 143, 106, 0.2), transparent 45%),
    radial-gradient(circle at 85% 15%, rgba(244, 208, 120, 0.12), transparent 42%),
    #121212;
  --glass-bg: rgba(24, 24, 28, 0.62);
  --glass-bg-strong: rgba(18, 18, 22, 0.82);
  --glass-border: rgba(255, 255, 255, 0.13);
  --glass-highlight: rgba(255, 255, 255, 0.08);
  --text-primary: #f5f5f2;
  --text-secondary: rgba(245, 245, 242, 0.74);
  --text-muted: rgba(245, 245, 242, 0.54);
  --gold: #f4d078;
  --gold-soft: #d9a441;
  --emerald: #2a8f6a;
  --emerald-bright: #49d19f;
  --danger-bg: rgba(196, 59, 69, 0.18);
  --danger-border: rgba(243, 128, 128, 0.36);
  --danger-text: #ffb8b8;
  --shadow-glass: 0 20px 48px rgba(0, 0, 0, 0.52);
  --font-sans: 'Be Vietnam Pro', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-glow);
  background-color: var(--bg-charcoal);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(18, 18, 18, 0.76);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.header-inner {
  width: min(1160px, 100%);
  margin: 0 auto;
  padding: 13px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  font-weight: 700;
  color: var(--gold);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--emerald-bright));
  box-shadow: 0 0 12px rgba(244, 208, 120, 0.7);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-link {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-decoration: none;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.nav-link:hover,
.nav-link.is-current {
  border-color: rgba(244, 208, 120, 0.45);
  color: var(--gold);
  background: rgba(244, 208, 120, 0.1);
}

/* Main container */
.page-main {
  flex: 1;
  width: min(1160px, 100%);
  margin: 0 auto;
  padding: 20px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.page-narrow {
  width: min(620px, 100%);
  margin: 0 auto;
}

.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  box-shadow: var(--shadow-glass), inset 0 1px 0 var(--glass-highlight);
  backdrop-filter: blur(20px) saturate(145%);
  -webkit-backdrop-filter: blur(20px) saturate(145%);
  padding: 20px;
}

/* Webview warning banner */
.webview-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(244, 208, 120, 0.12);
  border: 1px solid rgba(244, 208, 120, 0.36);
  color: #fbe5a8;
  font-size: 13px;
  line-height: 1.5;
}

.banner-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(244, 208, 120, 0.35);
  background: rgba(18, 18, 18, 0.5);
  color: var(--gold);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

/* Headings */
.hero-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hero-kicker {
  margin: 0;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--emerald-bright);
}

.page-title {
  margin: 0;
  font-size: clamp(22px, 3.6vw, 30px);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

.page-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

/* Builder Layout */
.builder-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

.field-counter {
  font-size: 12px;
  color: var(--text-muted);
}

.input-control,
.textarea-control {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(13, 13, 16, 0.8);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.textarea-control {
  resize: vertical;
  min-height: 108px;
}

.input-control:focus,
.textarea-control:focus {
  border-color: rgba(244, 208, 120, 0.68);
  box-shadow: 0 0 0 3px rgba(244, 208, 120, 0.14);
}

.input-uppercase {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

/* Music selector pills */
.music-pills {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.music-pill {
  padding: 11px 14px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.music-pill.is-active {
  border-color: rgba(244, 208, 120, 0.65);
  background: linear-gradient(135deg, rgba(244, 208, 120, 0.18), rgba(42, 143, 106, 0.24));
  color: var(--gold);
}

.turnstile-box {
  min-height: 65px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Buttons & Alerts */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, border-color 0.18s ease;
}

.btn-primary {
  width: 100%;
  border: 1px solid rgba(244, 208, 120, 0.52);
  background: linear-gradient(135deg, rgba(244, 208, 120, 0.24), rgba(42, 143, 106, 0.36));
  color: var(--gold);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--gold);
}

.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-secondary {
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  font-size: 13.5px;
  padding: 10px 16px;
}

.btn-secondary:hover:not(:disabled) {
  border-color: rgba(244, 208, 120, 0.48);
  color: var(--gold);
}

.form-error {
  margin: 0;
  padding: 10px 13px;
  border-radius: 12px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
  font-size: 13px;
}

.form-success {
  margin: 0;
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(42, 143, 106, 0.2);
  border: 1px solid rgba(73, 209, 159, 0.42);
  color: var(--emerald-bright);
  font-size: 13.5px;
  font-weight: 700;
}

/* Preview panel */
.preview-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.preview-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
}

.preview-note {
  font-size: 12px;
  color: var(--text-muted);
}

.preview-frame-wrap {
  width: 100%;
  height: 480px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #121212;
}

.preview-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Checkout Panel */
.checkout-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.checkout-top {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

.checkout-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--gold);
}

.checkout-sub {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.qr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.qr-frame {
  padding: 12px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.qr-image {
  display: block;
  width: min(250px, 68vw);
  height: auto;
  border-radius: 8px;
  -webkit-touch-callout: default;
  user-select: auto;
  pointer-events: auto;
}

.qr-hint {
  margin: 0;
  max-width: 360px;
  text-align: center;
  font-size: 12.5px;
  color: var(--gold);
  line-height: 1.5;
}

.copy-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.copy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(13, 13, 16, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.copy-row.is-highlight {
  border-color: rgba(244, 208, 120, 0.48);
  background: rgba(244, 208, 120, 0.08);
}

.copy-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.copy-label {
  font-size: 11.5px;
  color: var(--text-muted);
}

.copy-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  word-break: break-word;
}

.copy-row.is-highlight .copy-value {
  color: var(--gold);
  letter-spacing: 0.05em;
}

.code-warning {
  margin: 2px 0 0;
  font-size: 12px;
  color: #fbe5a8;
}

.copy-btn {
  flex-shrink: 0;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid rgba(244, 208, 120, 0.35);
  background: rgba(244, 208, 120, 0.12);
  color: var(--gold);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.poll-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(42, 143, 106, 0.14);
  border: 1px solid rgba(73, 209, 159, 0.28);
  font-size: 13px;
  color: var(--text-secondary);
}

.poll-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-bright);
  box-shadow: 0 0 10px var(--emerald-bright);
  animation: thiep-pulse 1.5s ease-in-out infinite;
}

@keyframes thiep-pulse {
  0%, 100% {
    opacity: 0.45;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.15);
  }
}

.timeout-box {
  padding: 16px;
  border-radius: 16px;
  background: rgba(244, 208, 120, 0.08);
  border: 1px solid rgba(244, 208, 120, 0.34);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeout-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
}

.timeout-meta {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Unlocked celebratory card */
.unlocked-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}

.unlocked-badge {
  align-self: center;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(42, 143, 106, 0.22);
  border: 1px solid rgba(73, 209, 159, 0.45);
  color: var(--emerald-bright);
  font-size: 12px;
  font-weight: 700;
}

.share-link-box {
  padding: 12px 14px;
  border-radius: 13px;
  background: rgba(13, 13, 16, 0.8);
  border: 1px solid rgba(244, 208, 120, 0.35);
  color: var(--gold);
  font-size: 13.5px;
  font-weight: 700;
  word-break: break-all;
}

.lookup-reminder {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.lookup-reminder a {
  color: var(--gold);
  font-weight: 700;
}

/* Lookup & Terms helpers */
.result-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(13, 13, 16, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13.5px;
}

.info-key {
  color: var(--text-muted);
}

.info-val {
  font-weight: 700;
  color: var(--text-primary);
}

.terms-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.terms-heading {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
}

.terms-text {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.terms-list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* Footer */
.app-footer {
  width: min(1160px, 100%);
  margin: 0 auto;
  padding: 18px 16px 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-muted);
}

.footer-link {
  color: var(--gold);
  font-weight: 700;
  text-decoration: none;
}

.footer-link:hover {
  text-decoration: underline;
}

@media (min-width: 900px) {
  .builder-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 22px;
  }

  .preview-card {
    position: sticky;
    top: 78px;
  }

  .preview-frame-wrap {
    height: 580px;
  }
}
