:root {
  color-scheme: dark only;
  --bg: #08090c;
  --surface: #101216;
  --surface-2: #17191f;
  --border: #2b2e36;
  --text: #f3f4f6;
  --muted: #a6a8ad;
  --gold: #ffd700;
  --gold-soft: #8a7500;
  --confirm: #198754;
  --confirm-hover: #157347;
  --decline: #c0392b;
  --decline-hover: #a93226;
  --warning: #ffd700;
  --radius: 20px;
  --shadow: 0 28px 70px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(circle at top, rgba(255, 215, 0, .09), transparent 36rem),
    var(--bg) !important;
  color: var(--text) !important;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

.page-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.card {
  width: min(100%, 620px);
  background: linear-gradient(180deg, rgba(20, 22, 27, .98), rgba(12, 13, 17, .98)) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent) !important;
}

.brand-header {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 22px 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.brand-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 12px;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--gold) !important;
  letter-spacing: .16em;
  font-size: .72rem;
  font-weight: 800;
}

h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(1.25rem, 5vw, 1.65rem); line-height: 1.12; }

.state-view {
  min-height: 320px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  padding: 48px 26px;
  color: var(--muted);
}

.state-view h2 { color: var(--text); margin: 16px 0 8px; }
.state-view p { margin: 0; max-width: 33rem; line-height: 1.55; }

.spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(255,215,0,.2);
  border-top-color: var(--gold);
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.state-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  font-weight: 900;
}
.state-icon-error { background: rgba(192,57,43,.14); color: #ff8173; border: 1px solid rgba(192,57,43,.35); }

.person-block { padding: 24px 22px 18px; }
.muted-label { color: var(--muted); font-size: .82rem; margin: 0 0 4px; }
.person-block h2 { margin: 0; font-size: clamp(1.55rem, 7vw, 2.05rem); }

.status-badge {
  display: inline-flex;
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 800;
  border: 1px solid;
}
.status-badge.waiting { color: #ffe66a; background: rgba(255,215,0,.10); border-color: rgba(255,215,0,.25); }
.status-badge.confirmed { color: #74d9a2; background: rgba(25,135,84,.14); border-color: rgba(25,135,84,.34); }
.status-badge.declined { color: #ff8d82; background: rgba(192,57,43,.14); border-color: rgba(192,57,43,.34); }

.event-panel {
  margin: 0 16px;
  padding: 20px;
  border-radius: 16px;
  background: var(--surface-2) !important;
  border: 1px solid var(--border) !important;
}
.event-kicker { display: block; color: var(--gold); font-size: .68rem; letter-spacing: .15em; font-weight: 900; margin-bottom: 5px; }
.event-title-row h3 { margin: 0 0 18px; font-size: 1.25rem; }

.details-grid { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-item { min-width: 0; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.05); }
.detail-item.wide { grid-column: 1 / -1; }
.detail-item dt { color: var(--muted); font-size: .72rem; margin-bottom: 4px; }
.detail-item dd { margin: 0; font-weight: 700; line-height: 1.35; }

.instruction { margin: 20px 22px 14px; color: #d7d8db; line-height: 1.5; font-size: .92rem; }
.actions { padding: 0 16px 22px; display: grid; gap: 11px; }

.action-button {
  width: 100%;
  min-height: 58px;
  border: 0 !important;
  border-radius: 14px;
  color: white !important;
  font-weight: 850;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: transform .12s ease, filter .12s ease, background .12s ease;
}
.action-button:active { transform: scale(.985); }
.action-button:disabled { opacity: .58; cursor: wait; }
.action-button.confirm { background: var(--confirm) !important; }
.action-button.confirm:hover { background: var(--confirm-hover) !important; }
.action-button.decline { background: var(--decline) !important; }
.action-button.decline:hover { background: var(--decline-hover) !important; }
.button-symbol { font-size: 1.2rem; line-height: 1; }

.response-result {
  margin: 4px 16px 22px;
  padding: 25px 20px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
}
.result-icon { width: 50px; height: 50px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; font-weight: 900; }
.response-result.confirmed .result-icon { background: rgba(25,135,84,.16); color: #7ae0a8; border: 1px solid rgba(25,135,84,.35); }
.response-result.declined .result-icon { background: rgba(192,57,43,.16); color: #ff8d82; border: 1px solid rgba(192,57,43,.35); }
.response-result h3 { margin: 0 0 7px; }
.response-result p { margin: 0; color: var(--muted); line-height: 1.5; }
.responded-at { margin-top: 8px !important; font-size: .78rem; }

.footer { padding: 15px 22px 18px; border-top: 1px solid rgba(255,255,255,.06); color: #777a80; font-size: .72rem; text-align: center; }
.footer strong { color: #9c9fa6; }

.dialog-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.72); backdrop-filter: blur(5px); }
.dialog-card { width: min(100%, 430px); background: #14161b !important; border: 1px solid #30333a !important; border-radius: 18px; box-shadow: 0 25px 60px rgba(0,0,0,.55); padding: 22px; }
.dialog-card h2 { margin: 0 0 8px; font-size: 1.25rem; }
.dialog-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.dialog-button { min-height: 48px; border-radius: 12px; border: 0; background: var(--confirm); color: white; font-weight: 800; cursor: pointer; }
.dialog-button.secondary { background: #252830; color: #e8e9eb; }
.dialog-button.decline { background: var(--decline); }

@media (max-width: 420px) {
  .page-shell { padding-left: 10px; padding-right: 10px; }
  .brand-header { padding-left: 17px; padding-right: 17px; }
  .brand-logo { width: 52px; height: 52px; }
  .person-block { padding-left: 17px; padding-right: 17px; }
  .event-panel { margin-left: 10px; margin-right: 10px; padding: 15px; }
  .details-grid { grid-template-columns: 1fr; }
  .detail-item.wide { grid-column: auto; }
  .instruction { margin-left: 17px; margin-right: 17px; }
  .actions { padding-left: 10px; padding-right: 10px; }
  .dialog-actions { grid-template-columns: 1fr; }
}

@media (min-width: 700px) {
  .actions { grid-template-columns: 1.18fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
