:root {
  --green-900: #06230f;
  --green-800: #0c3a1f;
  --green-700: #124a28;
  --gold: #d8b25a;
  --gold-soft: #f1dea4;
  --ink: #16241a;
  --cream: #fbf7ec;
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--cream);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(216, 178, 90, 0.18), transparent 60%),
    radial-gradient(800px 800px at 100% 100%, rgba(18, 74, 40, 0.9), transparent 70%),
    linear-gradient(180deg, var(--green-800), var(--green-900));
  background-attachment: fixed;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top, 0px)) 16px calc(28px + env(safe-area-inset-bottom, 0px));
}

.head { text-align: center; margin-bottom: 22px; }
.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}
h1 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 700;
  font-size: clamp(30px, 8vw, 40px);
  line-height: 1.1;
  color: var(--gold-soft);
}
.sub { margin: 10px 0 0; font-size: 13.5px; color: rgba(251, 247, 236, 0.75); }

/* ---- picker ---- */
.picker { margin-bottom: 18px; }
.label { display: block; font-size: 13px; font-weight: 500; margin: 0 0 8px 2px; color: var(--gold-soft); }
.combo { position: relative; }
.combo input {
  width: 100%;
  height: 52px;
  padding: 0 44px 0 16px;
  border: 1.5px solid rgba(216, 178, 90, 0.55);
  border-radius: var(--radius);
  background: var(--cream);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  outline: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.combo input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(216, 178, 90, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25); }
.clear {
  position: absolute; right: 8px; top: 8px;
  width: 36px; height: 36px;
  border: 0; border-radius: 10px;
  background: transparent; color: #6b6b6b;
  font-size: 24px; line-height: 1; cursor: pointer;
}
.clear:hover { background: rgba(0, 0, 0, 0.06); }

#options {
  position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% + 6px);
  max-height: min(340px, 55vh); overflow-y: auto;
  margin: 0; padding: 6px; list-style: none;
  background: #fff; color: var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}
#options li {
  padding: 11px 12px; border-radius: 9px;
  font-size: 14px; font-weight: 500; cursor: pointer;
}
#options li[aria-selected="true"] { background: #eef4ec; }
#options li:hover { background: #f3f6f1; }
#options li.empty { color: #777; font-weight: 400; cursor: default; }
#options mark { background: #f6e7b8; color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---- card ---- */
.card-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 746 / 1066;
  border-radius: 6px;
  overflow: hidden;
  background: var(--green-700);
  box-shadow: 0 0 0 1px rgba(216, 178, 90, 0.4), 0 24px 60px rgba(0, 0, 0, 0.5);
  scroll-margin-top: 16px;
}
.card-frame canvas { display: block; width: 100%; height: 100%; }
.card-frame.busy canvas { opacity: 0.65; transition: opacity 0.2s; }
.loading {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
}
.loading span {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(241, 222, 164, 0.3); border-top-color: var(--gold-soft);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.btn {
  flex: 1 1 180px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 20px;
  border-radius: var(--radius);
  font: inherit; font-size: 15.5px; font-weight: 600;
  text-decoration: none; cursor: pointer;
  border: 1.5px solid transparent;
}
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: linear-gradient(180deg, #e7c878, #c99a3c); color: #1c1606; box-shadow: 0 8px 22px rgba(201, 154, 60, 0.35); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; color: var(--gold-soft); border-color: rgba(216, 178, 90, 0.6); }
.btn.ghost:hover { background: rgba(216, 178, 90, 0.1); }

.hint { margin: 14px 0 0; text-align: center; font-size: 13.5px; color: rgba(251, 247, 236, 0.75); }
.foot { margin-top: 30px; text-align: center; font-size: 12px; color: rgba(251, 247, 236, 0.5); }
