@import url('https://fonts.googleapis.com/css2?family=Yeseva+One&family=PT+Serif:wght@400;700&display=swap');

@font-face {
  font-family: 'PiecesofEightCyrillicAA';
  src: url('/public/fonts/piecesofeightcyrillicaa.woff2') format('woff2'),
       url('/public/fonts/piecesofeightcyrillicaa.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-pirate: 'PiecesofEightCyrillicAA', 'Yeseva One', serif;
  --dark: #3b2415;
  --cream: #f1e3c6;
  --beige: #e7d6ad;
  --cream-light: #f9efd6;
  --red: #8c1f28;
  --maroon: #6b2229;
  --brown: #6b4b30;
  --brown-light: #7a5c3e;
  --gold-text: #e9d4a3;
  --gold-muted: #c9ac7c;
  --gold-border: #b8863b;
  --ink: #241207;
  --max-width: 520px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--beige);
  font-family: 'PT Serif', Georgia, serif;
  color: var(--dark);
}

.heading { font-family: 'Yeseva One', serif; }

@keyframes pulseHint { 0%, 100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.18); opacity: 1; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  background: var(--cream);
  overflow-x: hidden;
  box-shadow: 0 0 60px rgba(0,0,0,.25);
  min-height: 100vh;
  position: relative;
}

/* sticky top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(43,26,13,.92);
  backdrop-filter: blur(4px);
}
.topbar img { width: 34px; height: 34px; object-fit: contain; }
.topbar .brand { font-family: var(--font-pirate); color: var(--gold-text); font-size: 20px; letter-spacing: .5px; }
.topbar form button {
  margin-left: auto; background: none; border: 1px solid var(--gold-text); color: var(--gold-text);
  padding: 6px 12px; border-radius: 6px; font-family: 'PT Serif', serif; font-size: 12px; cursor: pointer;
}

/* hero */
.hero { position: relative; }
.hero img { width: 100%; display: block; }
.hero .fade {
  position: absolute; left: 0; right: 0; bottom: 0; height: 38%;
  background: linear-gradient(to top, rgba(20,12,6,.85), rgba(20,12,6,0));
}
.hero .hint {
  position: absolute; left: 0; right: 0; bottom: 14px; text-align: center;
  animation: bob 2.2s ease-in-out infinite; font-size: 13px; color: var(--cream); letter-spacing: 1px;
}

/* generic section */
.section { padding: 34px 22px 30px; background: var(--cream); }
.section.alt { background: var(--beige); }
.section.dark { background: var(--dark); }
.section-heading {
  text-align: center; font-family: var(--font-pirate); font-size: 34px; color: var(--maroon); margin-bottom: 10px;
}
.section-heading.on-dark { color: var(--gold-text); }
.section-sub { text-align: center; font-family: var(--font-pirate); font-size: 18px; color: var(--brown-light); margin-bottom: 22px; }
.section-sub.on-dark { color: var(--gold-muted); }

/* key message banner */
.key-banner { text-align: center; padding: 22px; background: var(--maroon); }
.key-banner .tag { font-family: var(--font-pirate); font-size: 16px; letter-spacing: 1px; color: var(--gold-text); }
.key-banner .msg { font-family: var(--font-pirate); font-size: 30px; color: var(--cream); margin-top: 8px; line-height: 1.3; }
.key-banner .note { font-family: var(--font-pirate); font-size: 17px; color: var(--gold-muted); margin-top: 8px; line-height: 1.4; }

/* schedule */
.schedule-list { display: flex; flex-direction: column; }
.schedule-item { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px dashed rgba(107,34,41,.25); }
.schedule-item .time { flex: none; width: 64px; font-family: 'Yeseva One', serif; font-size: 15px; color: var(--red); }
.schedule-item .title { font-weight: 700; font-size: 15px; }
.schedule-item .desc { font-size: 13px; color: var(--brown); margin-top: 2px; }

/* myths flip card */
.flip-wrap { position: relative; perspective: 1400px; cursor: pointer; }
.flip-inner {
  position: relative; width: 100%; transition: transform .7s cubic-bezier(.4,.2,.2,1); transform-style: preserve-3d;
}
.flip-wrap.flipped .flip-inner { transform: rotateY(180deg); }
.flip-inner img {
  width: 100%; display: block; border-radius: 10px; backface-visibility: hidden;
  box-shadow: 0 8px 24px rgba(59,36,21,.3);
}
.flip-inner img.back { position: absolute; top: 0; left: 0; transform: rotateY(180deg); }
.flip-hint {
  position: absolute; top: -10px; right: -6px; width: 40px; height: 40px; border-radius: 50%;
  background: var(--red); color: var(--cream); display: flex; align-items: center; justify-content: center;
  font-size: 20px; box-shadow: 0 4px 12px rgba(0,0,0,.35); animation: pulseHint 1.4s ease-in-out infinite;
}
.flip-wrap.flipped .flip-hint { display: none; }
.flip-caption { text-align: center; font-size: 12.5px; color: var(--brown-light); margin-top: 10px; }

/* dress code */
.dresscode img { width: 100%; display: block; }

/* pirate card game */
.pirate-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.pirate-card-col { display: flex; flex-direction: column; gap: 8px; }
.pirate-flip { position: relative; aspect-ratio: 3/4; perspective: 1200px; cursor: pointer; }
.pirate-flip-inner {
  position: relative; width: 100%; height: 100%; transition: transform .6s cubic-bezier(.4,.2,.2,1);
  transform-style: preserve-3d;
}
.pirate-card-col.flipped .pirate-flip-inner { transform: rotateY(180deg); }
.pirate-face {
  position: absolute; inset: 0; backface-visibility: hidden; border-radius: 10px; overflow: hidden;
  border: 2px solid var(--gold-border); box-shadow: 0 6px 16px rgba(0,0,0,.4);
}
.pirate-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pirate-face.back { transform: rotateY(180deg); }
.pirate-label { text-align: center; font-size: 12px; color: var(--gold-text); }
.pirate-vote-btn {
  border: none; border-radius: 20px; padding: 8px 6px; font-family: var(--font-pirate); font-size: 16px;
  font-weight: 700; cursor: pointer; background: var(--red); color: var(--cream); display: none;
}
.pirate-card-col.flipped .pirate-vote-btn { display: block; }
.pirate-vote-btn.voted { background: #5c3a22; }

/* oath */
.oath-img-wrap {
  position: relative; border-radius: 10px; overflow: hidden; margin-bottom: 22px;
  box-shadow: 0 8px 20px rgba(59,36,21,.3); background: var(--beige); line-height: 0;
}
.oath-img-wrap img { width: 100%; display: block; mix-blend-mode: darken; }
.oath-overlay { position: absolute; inset: 0; pointer-events: none; }
.oath-blank { position: absolute; display: flex; }
.oath-blank span { flex: 1; display: flex; align-items: center; justify-content: center; font-family: 'Yeseva One', serif; color: var(--ink); }

.oath-start-btn {
  font-family: var(--font-pirate); font-size: 23px; letter-spacing: .5px; background: var(--red); color: var(--cream);
  border: none; border-radius: 30px; padding: 16px 30px; cursor: pointer; box-shadow: 0 6px 16px rgba(0,0,0,.25);
  display: block; margin: 0 auto;
}
.oath-progress-bar { height: 6px; background: rgba(107,34,41,.2); border-radius: 4px; overflow: hidden; margin-bottom: 18px; }
.oath-progress-fill { height: 100%; background: var(--red); border-radius: 4px; transition: width .3s; }
.oath-step-num { text-align: center; font-size: 13px; color: var(--brown-light); margin-bottom: 6px; }
.oath-step-label { text-align: center; font-family: 'Yeseva One', serif; font-size: 19px; color: var(--maroon); margin-bottom: 18px; }
.oath-options { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.oath-option-btn {
  font-family: var(--font-pirate); font-weight: 700; font-size: 18px; letter-spacing: .3px; background: var(--cream);
  border: 2px solid var(--red); color: var(--maroon); border-radius: 10px; padding: 10px 16px; cursor: pointer;
}
.oath-finish-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.oath-share-btn { font-family: var(--font-pirate); font-weight: 700; font-size: 17px; background: var(--red); color: var(--cream); border: none; border-radius: 24px; padding: 12px 22px; cursor: pointer; }
.oath-reset-btn { font-family: var(--font-pirate); font-weight: 700; font-size: 17px; background: transparent; color: var(--maroon); border: 2px solid var(--maroon); border-radius: 24px; padding: 12px 22px; cursor: pointer; }
.oath-status { text-align: center; font-size: 12px; color: var(--brown-light); margin-top: 10px; }

/* registration form */
.reg-card { background: var(--beige); border: 2px solid var(--gold-border); border-radius: 14px; padding: 20px 18px; box-shadow: 0 8px 20px rgba(59,36,21,.25); }
.reg-card input[type="text"] {
  width: 100%; box-sizing: border-box; padding: 12px 14px; border: 2px solid var(--red); border-radius: 8px;
  font-family: 'PT Serif', serif; font-size: 15px; background: var(--cream-light); color: var(--dark); margin-bottom: 14px;
}
.quick-btn {
  width: 100%; font-family: var(--font-pirate); font-size: 21px; background: var(--maroon); color: var(--cream);
  border: none; border-radius: 10px; padding: 14px 10px; cursor: pointer; margin-bottom: 24px; box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.reg-card label.field-label { display: block; font-family: var(--font-pirate); font-weight: 700; font-size: 21px; margin-bottom: 8px; }
.field-title { font-family: var(--font-pirate); font-weight: 700; font-size: 21px; margin-bottom: 10px; }
.transport-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.transport-option {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 2px solid rgba(107,34,41,.3);
  border-radius: 8px; cursor: pointer; background: transparent;
}
.transport-option.selected { border-color: var(--red); background: var(--cream-light); }
.transport-option input { width: 18px; height: 18px; accent-color: var(--red); }
.transport-option span { font-family: var(--font-pirate); font-size: 18px; }
.seats-row { margin: 4px 0 18px 4px; }
.seats-row .label { font-family: var(--font-pirate); font-size: 17px; color: var(--brown); margin-bottom: 8px; }
.seats-buttons { display: flex; gap: 8px; }
.seat-btn { flex: 1; padding: 8px 0; border-radius: 8px; border: 2px solid var(--red); background: var(--cream-light); color: var(--maroon); font-weight: 700; font-family: var(--font-pirate); font-size: 17px; cursor: pointer; }
.seat-btn.selected { background: var(--red); color: var(--cream); }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.pill-option {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px; border: 2px solid rgba(107,34,41,.3);
  border-radius: 20px; cursor: pointer; background: transparent;
}
.pill-option.selected { border-color: var(--red); background: var(--cream-light); }
.pill-option input { width: 16px; height: 16px; accent-color: var(--red); }
.pill-option span { font-family: var(--font-pirate); font-size: 17px; }
.meat-other-input {
  width: 100%; box-sizing: border-box; padding: 10px 12px; border: 2px solid var(--red); border-radius: 8px;
  font-family: 'PT Serif', serif; font-size: 14px; background: var(--cream-light); margin-bottom: 14px;
}
.companions-select {
  width: 100%; box-sizing: border-box; padding: 10px 12px; border: 2px solid var(--red); border-radius: 8px;
  font-family: var(--font-pirate); font-size: 17px; color: var(--maroon); background: var(--cream-light);
}
.check-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--red); }
.check-row span { font-family: var(--font-pirate); font-size: 17px; }
.reg-error { text-align: center; font-size: 13px; color: var(--red); font-weight: 700; margin-bottom: 12px; }
.submit-btn {
  width: 100%; font-family: var(--font-pirate); font-size: 22px; background: var(--red); color: var(--cream);
  border: none; border-radius: 10px; padding: 15px 10px; cursor: pointer; box-shadow: 0 6px 16px rgba(0,0,0,.25);
}

/* team screen */
.team-screen { padding: 34px 22px 40px; background: var(--dark); }
.team-title { text-align: center; font-family: var(--font-pirate); font-size: 32px; color: var(--gold-text); margin-bottom: 22px; }
.cert-card { background: var(--cream); border: 3px solid var(--gold-border); border-radius: 14px; padding: 26px 20px; box-shadow: 0 10px 26px rgba(0,0,0,.4); margin-bottom: 22px; }
.cert-eyebrow { text-align: center; font-family: var(--font-pirate); font-size: 15px; letter-spacing: 2px; color: var(--red); margin-bottom: 16px; }
.cert-line { text-align: center; font-size: 13px; color: var(--brown); margin-bottom: 6px; }
.cert-name { text-align: center; font-family: var(--font-pirate); font-size: 26px; color: var(--dark); margin-bottom: 10px; }
.cert-nick { text-align: center; font-family: var(--font-pirate); font-size: 23px; color: var(--red); margin-bottom: 16px; }
.cert-footer { text-align: center; font-family: var(--font-pirate); font-size: 14px; color: var(--brown-light); }
.team-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 28px; }
.cert-download-btn { font-family: var(--font-pirate); font-weight: 700; font-size: 17px; background: var(--red); color: var(--cream); border: none; border-radius: 24px; padding: 12px 22px; cursor: pointer; }
.cert-share-btn { font-family: var(--font-pirate); font-weight: 700; font-size: 17px; background: transparent; color: var(--gold-text); border: 2px solid var(--gold-text); border-radius: 24px; padding: 12px 22px; cursor: pointer; }
.cert-status { text-align: center; font-size: 12px; color: var(--gold-muted); margin-bottom: 24px; }
.route-map-placeholder { background: var(--beige); border: 2px dashed var(--red); border-radius: 14px; padding: 22px 18px; text-align: center; }
.route-map-placeholder[href] { display: block; text-decoration: none; color: inherit; cursor: pointer; }
.route-map-placeholder .t { font-family: var(--font-pirate); font-size: 19px; color: var(--maroon); margin-bottom: 8px; }
.route-map-placeholder .d { font-size: 14px; color: var(--brown); }
.route-map-placeholder a { display: inline-block; margin-top: 10px; color: var(--maroon); font-weight: 700; }
.route-map-placeholder .map-link {
  display: inline-block; margin-top: 12px; font-family: var(--font-pirate); font-size: 16px; color: var(--cream);
  background: var(--red); padding: 10px 18px; border-radius: 20px;
}

.footer-bar { padding: 22px; text-align: center; background: var(--dark); color: var(--gold-muted); font-family: var(--font-pirate); font-size: 16px; }

/* admin (reuses page tokens but simpler) */
.wrap { max-width: var(--max-width); margin: 0 auto; padding: 20px; }
.card { background: var(--beige); border: 2px solid var(--gold-border); border-radius: 14px; padding: 20px 18px; }
.section-title { font-family: 'Yeseva One', serif; font-size: 1rem; margin: 22px 0 10px; border-bottom: 1px solid rgba(59,36,21,.2); padding-bottom: 8px; }
label { display: block; font-weight: 700; margin-top: 14px; margin-bottom: 4px; }
input[type="password"] { width: 100%; padding: 10px; font-size: 1rem; border: 2px solid var(--red); border-radius: 6px; background: var(--cream-light); }
button { font-family: 'PT Serif', serif; }
.btn { display: block; width: 100%; padding: 12px; border-radius: 8px; border: none; cursor: pointer; text-align: center; text-decoration: none; }
.btn-primary { background: var(--red); color: var(--cream); }
.btn-secondary { background: transparent; color: var(--maroon); border: 2px solid var(--maroon); }
.error-box { background: rgba(140,31,40,.1); border: 1px solid var(--red); color: var(--red); padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.small-note { font-size: .85rem; color: var(--brown); margin-top: 4px; }
table.admin-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-bottom: 20px; background: #fff; }
table.admin-table th, table.admin-table td { border: 1px solid #ccc; padding: 6px 8px; text-align: left; }
table.admin-table th { background: var(--dark); color: #fff; }
.summary-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 24px; }
@media (min-width: 700px) { .summary-grid { grid-template-columns: 1fr 1fr; } }
.summary-box { background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 12px 14px; }
.summary-box h3 { font-family: 'Yeseva One', serif; font-size: .95rem; margin-top: 0; }
.rating-row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid #eee; }
