/* ── Design tokens ── */
:root {
  --white: #faf8f6;
  --white-pure: #ffffff;
  --rose-gold: #b76e79;
  --rose-gold-light: #e8c4c8;
  --rose-gold-pale: #f5e6e8;
  --rose-gold-dark: #9a5a64;
  --text: #3d3234;
  --text-muted: #8a7578;
  --success: #7a9e7e;
  --error: #c47070;
  --shadow: 0 4px 24px rgba(183, 110, 121, 0.12);
  --shadow-lg: 0 8px 40px rgba(183, 110, 121, 0.18);
  --radius: 16px;
  --radius-sm: 10px;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Josefin Sans', system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-weight: 300;
  color: var(--text);
  background: var(--white);
  min-height: 100dvh;
  line-height: 1.6;
  overflow-x: hidden;
}

#app {
  min-height: 100dvh;
  position: relative;
}

/* ── Utilities ── */
.hidden {
  display: none !important;
}

.view {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(1.5rem + var(--safe-top)) 1.25rem calc(1.5rem + var(--safe-bottom));
  animation: fadeIn 0.5s ease;
}

.view-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Typography ── */
.eyebrow {
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--rose-gold);
  margin-bottom: 1rem;
}

.title-display {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2.4rem, 8vw, 3.2rem);
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.title-display em {
  font-style: italic;
  color: var(--rose-gold);
}

.title-section {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.8rem, 6vw, 2.4rem);
  text-align: center;
  margin-bottom: 1rem;
}

.lead {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.subtitle {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-style: italic;
  color: var(--rose-gold-dark);
  margin-bottom: 2rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--rose-gold) 0%, var(--rose-gold-dark) 100%);
  color: var(--white-pure);
  box-shadow: var(--shadow);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--white-pure);
  color: var(--rose-gold);
  border: 1px solid var(--rose-gold-light);
}

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

/* ── Decorations ── */
.decoration {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
}

.decoration--1 {
  width: 280px;
  height: 280px;
  top: -80px;
  right: -80px;
  background: radial-gradient(circle, var(--rose-gold-pale) 0%, transparent 70%);
}

.decoration--2 {
  width: 200px;
  height: 200px;
  bottom: 10%;
  left: -60px;
  background: radial-gradient(circle, var(--rose-gold-pale) 0%, transparent 70%);
}

/* ── Game header ── */
.game-header {
  max-width: 420px;
  margin: 0 auto 1.5rem;
  width: 100%;
}

.level-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.level-badge__label {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.level-badge__num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
  color: var(--rose-gold);
  line-height: 1;
}

.progress-wrap {
  width: 100%;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.progress-bar {
  height: 6px;
  background: var(--rose-gold-pale);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--rose-gold-light), var(--rose-gold));
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* ── Question area ── */
.game-main {
  flex: 1;
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.question-container {
  flex: 1;
}

.question-text {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 4.5vw, 1.65rem);
  font-weight: 400;
  line-height: 1.4;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.question-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  font-style: italic;
}

/* Choice options */
.options-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.option-btn {
  display: block;
  width: 100%;
  padding: 1rem 1.25rem;
  background: var(--white-pure);
  border: 1px solid var(--rose-gold-pale);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 300;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.option-btn:hover,
.option-btn:focus-visible {
  border-color: var(--rose-gold-light);
}

.option-btn.selected {
  border-color: var(--rose-gold);
  background: var(--rose-gold-pale);
}

.option-btn.correct {
  border-color: var(--success);
  background: #eef5ef;
}

.option-btn.incorrect {
  border-color: var(--error);
  background: #fdf0f0;
}

/* Text input */
.text-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.text-input {
  width: 100%;
  padding: 1rem 1.25rem;
  border: 1px solid var(--rose-gold-pale);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 300;
  color: var(--text);
  background: var(--white-pure);
  outline: none;
  transition: border-color 0.15s;
}

.text-input:focus {
  border-color: var(--rose-gold);
}

.text-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

/* Multi-select */
.multiselect-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.multiselect-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem 1.25rem;
  background: var(--white-pure);
  border: 1px solid var(--rose-gold-pale);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.multiselect-item.selected {
  border-color: var(--rose-gold);
  background: var(--rose-gold-pale);
}

.multiselect-check {
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--rose-gold-light);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: transparent;
  transition: background 0.15s, color 0.15s;
}

.multiselect-item.selected .multiselect-check {
  background: var(--rose-gold);
  border-color: var(--rose-gold);
  color: white;
}

/* True / False swipe cards */
.swipe-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.swipe-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: 1.5rem 1rem;
  background: var(--white-pure);
  border: 1px solid var(--rose-gold-pale);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.swipe-card.selected {
  border-color: var(--rose-gold);
  background: var(--rose-gold-pale);
  transform: scale(1.02);
}

.swipe-card__icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.swipe-card__label {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Date picker */
.date-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.date-preview {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5vw, 1.85rem);
  color: var(--text-muted);
  text-align: center;
  padding: 1rem;
  background: var(--white-pure);
  border: 1px dashed var(--rose-gold-light);
  border-radius: var(--radius-sm);
  transition: color 0.15s, border-color 0.15s;
}

.date-preview--label {
  width: 100%;
  display: block;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.date-preview--label:active {
  transform: scale(0.99);
}

.date-preview--label:focus-visible {
  outline: 2px solid var(--rose-gold-light);
  outline-offset: 2px;
}

.date-preview--filled {
  color: var(--rose-gold);
  border-style: solid;
  border-color: var(--rose-gold-pale);
}

.date-input {
  width: 100%;
  min-height: 52px;
  padding: 0.875rem 1.25rem;
  border: 1px solid var(--rose-gold-pale);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 300;
  color: var(--text);
  background: var(--white-pure);
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.date-input:focus {
  border-color: var(--rose-gold);
}

/* Slider */
.slider-wrap {
  padding: 1rem 0;
}

.slider-value {
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: var(--rose-gold);
  text-align: center;
  margin-bottom: 1rem;
}

.slider-input {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--rose-gold-pale);
  border-radius: 99px;
  outline: none;
}

.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose-gold), var(--rose-gold-dark));
  box-shadow: var(--shadow);
  cursor: pointer;
}

.slider-input::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose-gold), var(--rose-gold-dark));
  box-shadow: var(--shadow);
  cursor: pointer;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Apartment map */
.map-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--rose-gold-pale);
  background: var(--white-pure);
}

.apartment-map {
  width: 100%;
  display: block;
}

.map-zone {
  fill: var(--rose-gold-pale);
  stroke: var(--rose-gold-light);
  stroke-width: 1.5;
  cursor: pointer;
  transition: fill 0.15s;
}

.map-zone:hover,
.map-zone:focus {
  fill: var(--rose-gold-light);
}

.map-zone.selected {
  fill: var(--rose-gold);
  stroke: var(--rose-gold-dark);
}

.map-zone-label {
  font-family: var(--font-body);
  font-size: 9px;
  fill: var(--text-muted);
  pointer-events: none;
  text-anchor: middle;
}

.map-legend {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.75rem;
  font-style: italic;
}

/* Drag & drop ordering */
.order-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.order-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  background: var(--white-pure);
  border: 1px solid var(--rose-gold-pale);
  border-radius: var(--radius-sm);
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.order-item.dragging {
  opacity: 0.85;
  box-shadow: var(--shadow-lg);
  border-color: var(--rose-gold);
  cursor: grabbing;
}

.order-handle {
  color: var(--rose-gold-light);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.order-num {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--rose-gold);
  width: 1.5rem;
  flex-shrink: 0;
}

.order-text {
  flex: 1;
  font-size: 0.9rem;
}

.order-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 1rem;
  font-style: italic;
}

/* Drag & drop ordering — with photos (2x2 grid) */
.order-media-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.order-media-item {
  display: block;
  padding: 0.5rem;
  background: var(--white-pure);
  border: 1px solid var(--rose-gold-pale);
  border-radius: var(--radius);
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}

.order-media-item.dragging {
  opacity: 0.92;
  box-shadow: var(--shadow-lg);
  border-color: var(--rose-gold);
  cursor: grabbing;
  transform: scale(1.02);
  z-index: 2;
}

.order-media-photo-wrap {
  position: relative;
  width: 100%;
}

.order-media-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 1;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--rose-gold-pale);
  box-shadow: var(--shadow);
  line-height: 1;
}

.order-media-badge .order-num {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--rose-gold);
  width: auto;
  line-height: 1;
  display: block;
  text-align: center;
}

.order-media-photo {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-sm);
  object-fit: cover;
  object-position: center top;
  border: 1px solid var(--rose-gold-pale);
  background: var(--rose-gold-pale);
  pointer-events: none;
}

.order-media-photo--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-muted);
}

/* Photo + map */
.photo-map-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.photo-map-photo {
  border: 1px solid var(--rose-gold-pale);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white-pure);
}

.photo-map-img {
  width: 100%;
  display: block;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.photo-map-img--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  color: var(--text-muted);
  background: var(--rose-gold-pale);
  font-size: 0.9rem;
  text-align: center;
}

.photo-map-img--placeholder code {
  background: rgba(255, 255, 255, 0.75);
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
}

.photo-map-legend {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

.photo-map {
  height: 280px;
  border-radius: var(--radius);
  border: 1px solid var(--rose-gold-pale);
  overflow: hidden;
  background: var(--white-pure);
}

.photo-map-fallback .photo-map-coords {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

/* Leaflet: keep it minimal and consistent */
.leaflet-container {
  font-family: var(--font-body);
}

/* Feedback toast */
.feedback {
  margin-top: 1rem;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  text-align: center;
  animation: fadeIn 0.3s ease;
}

.feedback.success {
  background: #eef5ef;
  color: #4a7350;
  border: 1px solid #c5dcc8;
}

.feedback.error {
  background: #fdf0f0;
  color: #a05050;
  border: 1px solid #e8c4c4;
}

.game-footer {
  max-width: 420px;
  margin: 1.5rem auto 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ── Overlay / Modal ── */
.overlay.hidden {
  display: none !important;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: calc(1rem + var(--safe-top)) 1rem calc(1rem + var(--safe-bottom));
}

.overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(61, 50, 52, 0.35);
  backdrop-filter: blur(6px);
}

.overlay__panel {
  position: relative;
  width: min(520px, 100%);
  background: var(--white-pure);
  border: 1px solid var(--rose-gold-pale);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.overlay__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--rose-gold-pale);
  background: linear-gradient(180deg, rgba(245, 230, 232, 0.5), rgba(255, 255, 255, 0));
}

.overlay__title {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--rose-gold);
}

.overlay__close {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--rose-gold-pale);
  background: var(--white-pure);
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.overlay__body {
  padding: 1rem;
}

.qr-video {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rose-gold-pale);
  background: var(--rose-gold-pale);
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.qr-help {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

.qr-help#qr-error {
  color: #a05050;
}

.qr-gallery-btn {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  min-height: 48px;
}

/* ── Complete view ── */
.complete-inner {
  justify-content: flex-start;
  padding-top: 1rem;
}

.complete-icon {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 0.5rem;
}

.complete-message {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-style: italic;
  text-align: center;
  color: var(--rose-gold-dark);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.hint-card {
  background: var(--white-pure);
  border-radius: var(--radius);
  border: 1px solid var(--rose-gold-pale);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.hint-card__label {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--rose-gold);
  padding: 1rem 1.25rem 0.5rem;
}

.hint-card__text {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 4.5vw, 1.5rem);
  line-height: 1.45;
  color: var(--text);
  text-align: center;
  padding: 0.5rem 1.25rem 1rem;
}

.hint-card__reveal-wrap {
  padding: 0 1.25rem 1.25rem;
}

.hint-reveal-btn {
  font-size: 0.8rem;
  min-height: 48px;
  letter-spacing: 0.06em;
}

.hint-card__image-section {
  border-top: 1px solid var(--rose-gold-pale);
}

.hint-card__image-wrap {
  position: relative;
  background: var(--rose-gold-pale);
}

.hint-card__image {
  width: 100%;
  height: auto;
  display: block;
}

.hint-card__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  min-height: 240px;
}

.hint-card__placeholder code {
  font-size: 0.75rem;
  background: rgba(255,255,255,0.7);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.complete-cta {
  font-size: 0.85rem;
  text-align: center;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 0.25rem;
}

.complete-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

/* ── Finale ── */
.finale-inner {
  text-align: center;
}

.finale-photo {
  width: min(420px, 100%);
  margin: 2rem auto 0;
  border-radius: var(--radius);
  border: 1px solid var(--rose-gold-pale);
  box-shadow: var(--shadow);
  display: block;
}

/* ── Locked ── */
.locked-inner {
  text-align: center;
}

.locked-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* ── Confetti burst (CSS only on success) ── */
@keyframes celebratePop {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.celebrate {
  animation: celebratePop 0.4s ease;
}
