/* ============================================================
   BOOP THE VEIL — Component Styles
   Every UI component lives here: screens, topbar, bottomnav,
   buttons, cards, modals, toasts, and game elements.
   Add new components at the bottom as the project grows.
============================================================ */

/* ============================================================
   SPLASH SCREEN
============================================================ */
#screen-splash {
  background: linear-gradient(160deg, #1A120B 0%, #3B2112 45%, #C26B3A 100%);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0;
}

#screen-splash::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 120% 80% at 50% 110%, rgba(232,213,176,.15) 0%, transparent 70%);
  pointer-events: none;
}

#screen-splash::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.splash-logo-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: fadeUp .8s ease both;
}

.splash-chibi {
  width: 180px;
  height: 180px;
  object-fit: contain;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 8px 24px rgba(201,152,42,.3));
}

.splash-chibi-fallback {
  font-size: 5rem;
  line-height: 1;
  animation: float 3s ease-in-out infinite;
}

.splash-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 10vw, 3rem);
  font-weight: 600;
  color: var(--ivory);
  letter-spacing: -0.01em;
  text-align: center;
  background: linear-gradient(90deg, var(--champagne), var(--gold-light), var(--champagne));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s linear infinite;
}

.splash-tagline {
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--champagne);
  opacity: .65;
  text-align: center;
  padding: 0 32px;
  margin-top: -8px;
}

.splash-loader {
  margin-top: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.splash-loader-bar {
  width: 120px;
  height: 3px;
  background: rgba(255,255,255,.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.splash-loader-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: var(--radius-full);
  width: 0%;
  transition: width .4s ease;
}

.splash-loader-text {
  font-size: .7rem;
  color: var(--champagne);
  opacity: .5;
  letter-spacing: .08em;
}

/* ============================================================
   INTRO CINEMATIC
============================================================ */
#screen-intro {
  background: var(--deep);
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.intro-slides {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.intro-slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  padding-top: calc(var(--safe-top) + 60px);
  padding-bottom: calc(var(--safe-bottom) + 160px);
  opacity: 0;
  transform: translateX(100%);
  transition: opacity .4s cubic-bezier(.4,0,.2,1),
              transform .4s cubic-bezier(.4,0,.2,1);
  text-align: center;
  gap: 24px;
  pointer-events: none;
}

.intro-slide.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.intro-slide.past {
  opacity: 0;
  transform: translateX(-100%);
}

.intro-slide-image {
  width: 180px;
  height: 180px;
  object-fit: contain;
  filter: drop-shadow(0 8px 32px rgba(201,152,42,.2));
}

.intro-slide-venue-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: var(--radius-lg);
}

.intro-slide-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 6vw, 2rem);
  font-weight: 600;
  color: var(--ivory);
  line-height: 1.2;
}

.intro-slide-desc {
  font-size: .9rem;
  color: var(--champagne);
  opacity: .8;
  line-height: 1.65;
  max-width: 300px;
}

.intro-dots {
  position: absolute;
  bottom: calc(var(--safe-bottom) + 116px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  align-items: center;
}

.intro-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  transition: all .3s ease;
}

.intro-dot.active {
  width: 20px;
  border-radius: 3px;
  background: var(--gold);
}

.intro-cta {
  position: absolute;
  bottom: calc(var(--safe-bottom) + 32px);
  left: 24px;
  right: 24px;
}

/* ============================================================
   MAIN APP SCREEN
============================================================ */
#screen-main {
  background: var(--ivory);
  flex-direction: column;
}

#main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-top: calc(var(--topbar-height) + var(--safe-top));
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.content-panel {
  display: none;
  padding: 16px;
  min-height: 100%;
  animation: fadeIn .2s ease;
}

.content-panel.active {
  display: block;
}

/* ============================================================
   TOP BAR
============================================================ */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding-top: var(--safe-top);
  height: calc(var(--topbar-height) + var(--safe-top));
  background: var(--deep);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: calc(var(--safe-left) + 10px);
  padding-right: calc(var(--safe-right) + 10px);
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.topbar-right {
  justify-content: flex-end;
}

/* Profile avatar button */
.topbar-avatar-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  cursor: pointer;
  background: var(--terracotta);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  padding: 0;
  transition: border-color .15s, transform .15s;
}

.topbar-avatar-btn:hover,
.topbar-avatar-btn:focus-visible {
  border-color: var(--gold-light);
  transform: scale(1.05);
}

.topbar-avatar-btn:active {
  transform: scale(.95);
}

#topbar-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

#topbar-avatar-initials {
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 600;
  color: var(--ivory);
  pointer-events: none;
}

.topbar-icon-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.06);
  color: var(--champagne);
  font-size: .72rem;
  font-weight: 500;
  transition: background .15s, transform .15s;
  white-space: nowrap;
  border: none;
  min-height: 32px;
}

.topbar-icon-btn:hover,
.topbar-icon-btn:focus-visible {
  background: rgba(255,255,255,.12);
}

.topbar-icon-btn:active {
  transform: scale(.93);
  background: rgba(255,255,255,.16);
}

.topbar-icon-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Wedding Coins — center, most prominent */
.topbar-coins-btn {
  position: absolute;
  left: 50%;
  top: calc(var(--safe-top) + (var(--topbar-height) / 2));
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(201,152,42,.15);
  border: 1px solid rgba(201,152,42,.3);
  border-radius: var(--radius-full);
  padding: 5px 14px;
  transition: background .15s;
  min-height: 32px;
}

.topbar-coins-btn:hover,
.topbar-coins-btn:focus-visible {
  background: rgba(201,152,42,.22);
}

.topbar-coins-btn:active {
  transform: translate(-50%, -50%) scale(.96);
}

.topbar-coins-icon {
  font-size: 1rem;
  pointer-events: none;
}

#topbar-coins-amount {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--gold-light);
  min-width: 36px;
  text-align: center;
  pointer-events: none;
}

#topbar-coins-amount.bump {
  animation: coinBump .3s ease;
}

/* ============================================================
   BOTTOM NAVIGATION — 4 tabs
============================================================ */
#bottomnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  background: var(--deep);
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  padding-top: 8px;
  z-index: 100;
  min-height: calc(var(--nav-height) + var(--safe-bottom));
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  padding: 6px 4px;
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: .6rem;
  font-weight: 500;
  transition: color .15s, transform .15s;
  border: none;
  background: transparent;
  min-width: 0;
  min-height: 44px;
}

.nav-item:active {
  transform: scale(.88);
}

.nav-item.active {
  color: var(--gold);
}

.nav-item svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  transition: transform .2s ease;
}

.nav-item.active svg {
  transform: translateY(-1px);
}

.nav-label {
  font-size: .6rem;
  font-weight: 500;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.2;
}

.nav-item.active .nav-label::after {
  content: '';
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
  margin: 3px auto 0;
}

/* ============================================================
   BUTTONS
============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform .18s ease, box-shadow .18s ease, background .15s ease;
  width: 100%;
  text-align: center;
  min-height: 48px;
}

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

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

.btn-primary {
  background: var(--gold);
  color: var(--deep);
  box-shadow: 0 4px 18px rgba(201,152,42,.35);
}

.btn-primary:hover:not(:disabled) {
  background: var(--gold-light);
  box-shadow: 0 6px 24px rgba(201,152,42,.45);
}

.btn-outline {
  background: transparent;
  color: var(--ivory);
  border: 1.5px solid rgba(255,255,255,.25);
}

.btn-outline:hover:not(:disabled) {
  background: rgba(255,255,255,.06);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 10px 16px;
  font-size: .85rem;
  box-shadow: none;
  min-height: 40px;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--ink);
}

.btn-sm {
  padding: 8px 16px;
  font-size: .82rem;
  min-height: 36px;
}

/* ============================================================
   CARDS
============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-body {
  padding: 16px;
}

.card-dark {
  background: var(--deep);
  border-color: rgba(255,255,255,.06);
}

/* ============================================================
   COIN TOAST
============================================================ */
#coin-toast {
  position: fixed;
  top: calc(var(--topbar-height) + var(--safe-top) + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  background: var(--deep);
  border: 1px solid rgba(201,152,42,.4);
  border-radius: var(--radius-full);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--gold-light);
  white-space: nowrap;
  opacity: 0;
  transition: opacity .3s ease, transform .3s ease;
  z-index: 200;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}

#coin-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   OVERLAY / BOTTOM SHEET
============================================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,18,11,.75);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.overlay.show {
  display: flex;
  animation: fadeIn .2s ease;
}

.sheet {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
  padding-bottom: calc(20px + var(--safe-bottom));
  animation: slideUp .3s cubic-bezier(.4,0,.2,1);
  position: relative;
}

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 0 auto 20px;
}

/* ============================================================
   STARS PURCHASE SHEET
============================================================ */
.stars-amount-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: var(--radius-md);
  border: 1.5px solid rgba(232,184,75,.25);
  background: linear-gradient(135deg, rgba(232,184,75,.08) 0%, rgba(232,184,75,.04) 100%);
  cursor: pointer;
  transition: all .2s ease;
  min-height: 72px;
  font-family: var(--font-body);
}

.stars-amount-btn:hover,
.stars-amount-btn:focus-visible {
  border-color: rgba(232,184,75,.6);
  background: linear-gradient(135deg, rgba(232,184,75,.16) 0%, rgba(232,184,75,.08) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(232,184,75,.2);
}

.stars-amount-btn:active {
  transform: scale(.94);
}

.stars-amount-btn.selected {
  border-color: #E8B84B;
  background: linear-gradient(135deg, rgba(232,184,75,.22) 0%, rgba(232,184,75,.12) 100%);
  box-shadow: 0 0 0 3px rgba(232,184,75,.15);
}

.stars-btn-icon {
  font-size: 1.4rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(232,184,75,.4));
}

.stars-btn-amount {
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
}

/* ============================================================
   LOADING SPINNER
============================================================ */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(201,152,42,.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ============================================================
   BADGE / STATUS PILL
============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .04em;
}

.badge-gold {
  background: rgba(201,152,42,.15);
  color: var(--gold);
  border: 1px solid rgba(201,152,42,.25);
}

.badge-success {
  background: rgba(45,122,79,.12);
  color: var(--success);
}

.badge-danger {
  background: rgba(184,48,48,.1);
  color: var(--danger);
}

.badge-muted {
  background: rgba(122,102,82,.1);
  color: var(--muted);
}

/* ============================================================
   FORM ELEMENTS
============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-label {
  font-size: .82rem;
  font-weight: 500;
  color: var(--ink);
}

.form-input,
.form-select,
.form-textarea {
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: var(--font-body);
  font-size: .95rem;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
  width: 100%;
  min-height: 48px;
  /* Strip iOS native styling overrides */
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--gold);
  outline: none;
  box-shadow: 0 0 0 3px rgba(201,152,42,.15);
}

.form-input::placeholder {
  color: var(--muted);
  opacity: .7;
}

/* ============================================================
   EMPTY STATE
============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  text-align: center;
  gap: 12px;
  min-height: 200px;
}

.empty-state-icon  { font-size: 2.5rem; }
.empty-state-title { font-family: var(--font-display); font-size: 1.2rem; color: var(--ink); }
.empty-state-desc  { font-size: .85rem; color: var(--muted); max-width: 240px; line-height: 1.5; }

/* ============================================================
   GAME ELEMENTS
============================================================ */
.budget-bar {
  height: 8px;
  background: rgba(255,255,255,.12);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.budget-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  transition: width .6s ease;
}

.budget-bar-fill.danger {
  background: linear-gradient(90deg, var(--danger), #E85050);
}

.combo-badge {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--gold-light);
  text-shadow: 0 0 20px rgba(201,152,42,.5);
  pointer-events: none;
  z-index: 150;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), opacity .2s ease;
}

.combo-badge.show { transform: translate(-50%, -50%) scale(1); }
.combo-badge.hide { opacity: 0; transform: translate(-50%, -60%) scale(.8); }

.float-item {
  position: absolute;
  cursor: pointer;
  transition: transform .15s ease;
  touch-action: manipulation;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.float-item:active { transform: scale(.85); }

.float-item img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(26,18,11,.2));
  pointer-events: none;
}