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

body {
  font-family: 'Inter', sans-serif;
  background: #F5F0E8;
  color: #333366;
  min-width: 900px;
}

/* ─── Header ─────────────────────────────────────────── */
.site-header {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #CCCCFF 0%, #9999CC 100%);
  padding: 40px 80px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.header-deco {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.deco-line {
  display: block;
  height: 1px;
  width: 120px;
  background: #7777AA;
}

.deco-line--short {
  width: 60px;
}

.deco-flowers {
  color: #7777AA;
  font-family: 'Inter', sans-serif;
  font-size: 22px;
}

.deco-flowers--small {
  font-size: 12px;
  font-style: italic;
  color: rgba(119,119,170,0.6);
}

.subtitle {
  color: #555588;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 4px;
}

.title {
  color: #333366;
  font-family: 'Fraunces', serif;
  font-size: 52px;
  font-weight: 500;
  letter-spacing: -1px;
}

.tagline {
  color: #555588;
  font-family: 'Fraunces', serif;
  font-size: 15px;
  font-style: italic;
}

.bg-flower {
  position: absolute;
  font-size: 88px;
  opacity: 0.2;
  pointer-events: none;
  line-height: 1;
}
.bg-flower--tl { left: 40px;   top: 20px; }
.bg-flower--tr { right: 40px;  top: 10px; }
.bg-flower--bl { left: 120px;  top: 60px; font-size: 60px; opacity: 0.15; }
.bg-flower--br { right: 200px; top: 65px; font-size: 60px; opacity: 0.15; }

/* ─── Floral Banner ───────────────────────────────────── */
.floral-banner {
  background: linear-gradient(90deg, #EDD8B8 0%, #E8CDAA 50%, #EDD8B8 100%);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  font-size: 24px;
  letter-spacing: 4px;
  color: #8B5A2B;
  opacity: 0.65;
  white-space: nowrap;
  overflow: hidden;
}

/* ─── Main 3-Column Layout ────────────────────────────── */
.main-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 24px 32px 40px;
  background: #F5F0E8;
  align-items: flex-start;
}

.col-left {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.col-center {
  flex: 1;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.col-right {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ─── Grid Label ──────────────────────────────────────── */
.grid-label {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #7C5A1E;
  letter-spacing: 3px;
  text-align: center;
}

.candidates-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.grid-row {
  display: flex;
  gap: 12px;
}

/* ─── Candidate Card ──────────────────────────────────── */
.candidate-card {
  flex: 1;
  height: 220px;
  border-radius: 14px;
  background: #1a1a1a;
  border: 2px solid #E8DCC8;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.candidate-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.candidate-card.selected {
  outline: 3px solid #9999CC;
  outline-offset: 2px;
  transform: translateY(-2px);
}

.candidate-card.matched {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.3);
}

.card-top {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: #CCCCFF;
}

.card-portrait {
  position: absolute;
  top: 0;
  left: 8px;
  width: calc(100% - 16px);
  height: 100%;
  object-fit: contain;
  object-position: center top;
  display: block;
}

.card-number-badge {
  position: absolute;
  top: 6px;
  left: 8px;
  font-family: 'Fraunces', serif;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: rgba(0,0,0,0.35);
  border-radius: 6px;
  padding: 1px 6px;
  line-height: 1.4;
  backdrop-filter: blur(2px);
}

.card-flowers-label {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  color: #fff;
  opacity: 0.75;
  text-align: center;
  width: 100%;
}

.card-number {
  font-family: 'Fraunces', serif;
  font-size: 30px;
  font-weight: 600;
  color: #fff;
  opacity: 0.9;
}

.card-emoji {
  font-size: 26px;
}

.card-corner-flower {
  position: absolute;
  font-family: 'Inter', sans-serif;
  pointer-events: none;
}

.card-corner-flower--tl {
  top: 6px;
  left: 6px;
  font-size: 16px;
  opacity: 0.8;
}

.card-corner-flower--br {
  bottom: 6px;
  right: 6px;
  font-size: 14px;
  opacity: 0.6;
}

.card-bottom {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.card-name {
  font-family: 'Fraunces', serif;
  font-size: 13px;
  font-weight: 600;
  color: #333366;
}

.card-desc {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  color: #8E8E93;
  line-height: 1.4;
}

/* ─── Center: Propose a Match ─────────────────────────── */
.match-panel {
  background: #fff;
  border: 2px solid #E8DCC8;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.match-title {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  font-weight: 500;
  color: #333366;
  text-align: center;
}

.match-slots {
  display: flex;
  flex-direction: row;
  gap: 12px;
  flex: 1;
}

.match-card-slot {
  flex: 1;
  min-height: 220px;
  border-radius: 14px;
  background: linear-gradient(180deg, #F7F4EE 0%, #EFE9DC 100%);
  border: 2px dashed #D4C4A0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.match-card-slot:hover {
  border-color: #9999CC;
}

.match-card-slot.has-value {
  background: linear-gradient(180deg, #E8E8FF 0%, #DDDDFF 100%);
  border-color: #9999CC;
  border-style: solid;
}

.match-slot-icon {
  font-size: 28px;
  opacity: 0.5;
}

.match-card-slot.has-value .match-slot-icon {
  display: none;
}

.match-slot-label {
  font-family: 'Fraunces', serif;
  font-size: 12px;
  color: #B0A080;
  text-align: center;
  padding: 0 8px;
}

.match-card-slot.has-value .match-slot-label {
  font-size: 18px;
  font-weight: 600;
  color: #333366;
}

/* ─── Submit Button ───────────────────────────────────── */
.submit-btn {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(90deg, #7777AA 0%, #9999CC 100%);
  border: none;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.submit-btn:hover {
  opacity: 0.9;
}

.submit-btn:active {
  transform: scale(0.98);
}

.submit-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ─── Feedback Box ────────────────────────────────────── */
.feedback-box {
  background: linear-gradient(180deg, #F0F0FF 0%, #E8E8FF 100%);
  border: 2px solid rgba(153,153,204,0.33);
  border-radius: 14px;
  padding: 16px;
}

.feedback-msg {
  font-family: 'Fraunces', serif;
  font-size: 12px;
  font-style: italic;
  color: #555588;
  line-height: 1.6;
  text-align: center;
}

/* ─── Panel Boxes ─────────────────────────────────────── */
.panel-box {
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.matched-box,
.bank-box {
  background: #fff;
  border: 2px solid #E8DCC8;
}

/* ─── Panel Box Header ────────────────────────────────── */
.panel-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-box-title {
  font-family: 'Fraunces', serif;
  font-size: 13px;
  font-weight: 600;
  color: #333366;
}

.count-badge {
  width: 28px;
  height: 28px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.count-badge--green { background: #7777AA; }
.count-badge--gold  { background: #9999CC; }

.divider {
  height: 1px;
  background: #F0EFEC;
}

/* ─── Match Slots (sidebar list) ──────────────────────── */
.match-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  border-radius: 8px;
  background: #F7F6F3;
  border: 1px solid #E8DCC8;
  padding: 0 12px;
  transition: background 0.3s, border-color 0.3s;
}

.match-slot.filled {
  background: #F0F0FF;
  border-color: #CCCCFF;
}

.slot-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #E0D8C8;
  flex-shrink: 0;
  transition: background 0.3s;
}

.match-slot.filled .slot-dot {
  background: #7777AA;
}

.slot-text {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-style: italic;
  color: #C5BBA8;
}

.slot-text--first {
  color: #C5BBA8;
}

.match-slot.filled .slot-text {
  color: #333366;
  font-style: normal;
  font-weight: 600;
}

/* ─── Bank ────────────────────────────────────────────── */
.bank-row {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}

.bank-token {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
  user-select: none;
  border: none;
}

.bank-token:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.bank-token.selected {
  outline: 3px solid #9999CC;
  outline-offset: 2px;
  transform: scale(1.1);
}

.bank-token.matched-out {
  opacity: 0.2;
  pointer-events: none;
  cursor: default;
}

/* ─── Footer ──────────────────────────────────────────── */
.site-footer {
  background: #333366;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-style: italic;
  color: rgba(204,204,255,0.35);
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow: hidden;
}

.footer-dot {
  color: rgba(255,255,255,0.07);
}

/* ─── Win Modal ───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(51,51,102,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal {
  background: linear-gradient(180deg, #F0F0FF 0%, #E8E8FF 100%);
  border-radius: 24px;
  border: 2px solid rgba(153,153,204,0.4);
  padding: 48px 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 32px 80px rgba(0,0,0,0.25);
}

.modal-flowers {
  font-size: 36px;
  letter-spacing: 8px;
}

.modal-title {
  font-family: 'Fraunces', serif;
  font-size: 42px;
  font-weight: 500;
  color: #333366;
}

.modal-msg {
  font-family: 'Fraunces', serif;
  font-size: 15px;
  font-style: italic;
  color: #555588;
  line-height: 1.6;
}

.modal .submit-btn {
  margin-top: 8px;
  width: auto;
  padding: 0 32px;
}

/* ─── Shake animation for wrong guess ────────────────── */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

.shake {
  animation: shake 0.4s ease;
}
