:root {
  --deep-red: #7a0f1f;
  --red: #a8112a;
  --red-bright: #c4172f;
  --gold: #c9a24b;
  --gold-light: #e6c576;
  --gold-pale: #f4d998;
  --cream: #faf3e6;
  --cream-dark: #f0e4cc;
  --ink: #3a2318;
  --ink-soft: #6b4a3a;
  --blossom: #e88ba0;
  --shadow: rgba(90, 20, 20, 0.25);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: 'Cormorant Garamond', 'Playfair Display', serif;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(circle at 15% 20%, rgba(201, 162, 75, 0.10), transparent 45%),
    radial-gradient(circle at 85% 15%, rgba(168, 17, 42, 0.08), transparent 40%),
    radial-gradient(circle at 50% 90%, rgba(201, 162, 75, 0.10), transparent 50%),
    repeating-linear-gradient(45deg, rgba(168, 17, 42, 0.025) 0px, rgba(168, 17, 42, 0.025) 2px, transparent 2px, transparent 14px),
    linear-gradient(180deg, #fdf7ea, #f4e9d2);
  overflow-x: hidden;
  position: relative;
}

.bg-motif {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.lantern {
  position: absolute;
  width: clamp(60px, 9vw, 110px);
  filter: drop-shadow(0 8px 14px var(--shadow));
  opacity: 0.9;
}

.lantern-left {
  top: -18px;
  left: clamp(-10px, 2vw, 40px);
}

.lantern-right {
  top: -18px;
  right: clamp(-10px, 2vw, 40px);
}

.blossom {
  position: absolute;
  width: clamp(36px, 6vw, 64px);
}

.blossom-a {
  top: 14%;
  left: 6%;
  transform: rotate(-12deg);
}

.blossom-b {
  top: 60%;
  right: 8%;
  transform: rotate(20deg);
}

.blossom-c {
  bottom: 6%;
  left: 12%;
  transform: rotate(6deg);
}

.page {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(100px, 14vw, 140px) 24px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-kicker {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  color: var(--red);
  margin: 0 0 4px;
  letter-spacing: 0.15em;
}

.hero-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  margin: 0;
  color: var(--deep-red);
  text-shadow: 0 2px 0 var(--gold-pale);
}

.hero-sub {
  margin: 14px 0 0;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  color: var(--ink-soft);
  font-style: italic;
}

.hero-divider {
  width: min(240px, 60vw);
  margin: 22px 0 8px;
}

.cards {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 320px));
  justify-content: center;
  gap: 28px;
  margin-top: 32px;
}

.cards-error {
  grid-column: 1 / -1;
  color: var(--ink-soft);
  font-style: italic;
  font-size: 1.1rem;
}

@media (max-width: 640px) {
  .cards {
    grid-template-columns: 1fr;
  }
}

.card {
  position: relative;
  border-radius: 18px;
  padding: 3px;
  background: linear-gradient(160deg, var(--gold-light), var(--gold) 45%, var(--gold-light) 100%);
  box-shadow: 0 18px 40px var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 50px var(--shadow);
}

.card::before,
.card::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--gold);
  z-index: 2;
}

.card::before {
  top: 10px;
  left: 10px;
  border-right: none;
  border-bottom: none;
}

.card::after {
  bottom: 10px;
  right: 10px;
  border-left: none;
  border-top: none;
}

.card-inner {
  position: relative;
  border-radius: 15px;
  background:
    radial-gradient(circle at 50% -10%, rgba(168, 17, 42, 0.06), transparent 55%),
    var(--cream);
  padding: 40px 24px 34px;
  overflow: hidden;
}

.card-inner::before {
  content: '囍';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 11rem;
  color: var(--red);
  opacity: 0.05;
  pointer-events: none;
}

.card-label-zh {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 2.1rem;
  color: var(--red);
  margin: 0;
  line-height: 1;
}

.card-label-en {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 8px 0 18px;
}

.card-count {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: clamp(3rem, 9vw, 4.4rem);
  color: var(--deep-red);
  margin: 0;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.card-count-unit {
  margin: 6px 0 0;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}

.card-date {
  margin: 18px 0 0;
  font-size: 1.05rem;
  font-style: italic;
  color: var(--ink-soft);
  border-top: 1px dashed var(--gold-light);
  padding-top: 14px;
}

.page-footer {
  margin-top: 56px;
  color: var(--ink-soft);
  font-style: italic;
  font-size: 1rem;
}

.edit-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: var(--cream);
  color: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.55;
  box-shadow: 0 4px 12px var(--shadow);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.edit-btn:hover,
.edit-btn:focus-visible {
  opacity: 1;
  transform: scale(1.08);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(58, 35, 24, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--cream);
  border: 1px solid var(--gold);
  border-radius: 16px;
  padding: 32px 28px 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
}

.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: var(--deep-red);
  margin: 0 0 2px;
  text-align: center;
}

.modal-title-zh {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 1.4rem;
  color: var(--gold);
  text-align: center;
  margin: 0 0 20px;
}

.field {
  display: block;
  margin-bottom: 16px;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.95rem;
  color: var(--ink-soft);
  letter-spacing: 0.03em;
}

.field-label em {
  font-style: normal;
  color: var(--red);
  margin-left: 4px;
}

.field input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--gold-light);
  background: #fff;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem;
  color: var(--ink);
}

.field input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(168, 17, 42, 0.12);
}

.events-fields {
  max-height: 340px;
  overflow-y: auto;
  margin-bottom: 4px;
  padding-right: 4px;
}

.event-row {
  position: relative;
  border: 1px solid var(--gold-light);
  border-radius: 10px;
  background: rgba(201, 162, 75, 0.06);
  padding: 14px 40px 4px 14px;
  margin-bottom: 14px;
}

.field-inline {
  margin-bottom: 12px;
}

.row-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: var(--cream);
  color: var(--red);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.row-remove:hover:not(:disabled) {
  background: var(--red);
  color: var(--cream);
}

.row-remove:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  color: var(--ink-soft);
}

.btn-add {
  display: block;
  width: 100%;
  margin: 4px 0 16px;
  padding: 9px 16px;
  background: transparent;
  border: 1px dashed var(--gold);
  color: var(--red);
  border-radius: 999px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.btn-add:hover {
  background: rgba(201, 162, 75, 0.12);
  transform: translateY(-1px);
}

.form-message {
  margin: -4px 0 16px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.92rem;
  background: rgba(168, 17, 42, 0.1);
  color: var(--deep-red);
  border: 1px solid rgba(168, 17, 42, 0.3);
}

.form-message.success {
  background: rgba(76, 122, 62, 0.1);
  color: #3c5e2e;
  border-color: rgba(76, 122, 62, 0.35);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.btn {
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  border-color: var(--gold-light);
  color: var(--ink-soft);
}

.btn-primary {
  background: linear-gradient(135deg, var(--red-bright), var(--deep-red));
  color: var(--gold-pale);
  box-shadow: 0 6px 16px rgba(168, 17, 42, 0.35);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 480px) {
  .lantern {
    width: 56px;
  }
  .card-inner {
    padding: 32px 18px 26px;
  }
}
