:root {
  --bg: #0b0c10;
  --surface: rgba(255, 255, 255, 0.055);
  --surface-solid: #17191d;
  --border: rgba(255, 255, 255, 0.12);
  --text: #f1f1f4;
  --muted: #a3a6b3;
  --accent: #a78bfa;
  --accent-dark: #8b5cf6;
  --accent-2: #f472b6;
  --accent-3: #38bdf8;
  --success: #4ade80;
  --danger: #f87171;
  --radius: 20px;
  --radius-sm: 14px;
  --nav-height: 78px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  position: relative;
}

.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(45vmax 45vmax at 8% -8%, rgba(167, 139, 250, 0.32), transparent 70%),
    radial-gradient(50vmax 50vmax at 110% 25%, rgba(244, 114, 182, 0.24), transparent 70%),
    radial-gradient(38vmax 38vmax at 25% 95%, rgba(56, 189, 248, 0.22), transparent 70%);
  filter: blur(50px);
}

@media (prefers-reduced-motion: no-preference) {
  .ambient-bg {
    animation: drift 34s ease-in-out infinite alternate;
  }
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(-2%, 2%, 0) scale(1.06);
  }
}

.glass {
  background: var(--surface);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  min-height: 100vh;
}

.page.has-bottom-nav {
  padding-bottom: calc(var(--nav-height) + 28px);
}

h1 {
  font-size: 1.1rem;
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1rem;
  margin: 24px 0 10px;
  font-weight: 700;
}

.tagline {
  color: var(--muted);
  margin: 0 0 20px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin: 0 -16px 20px;
  background: rgba(11, 12, 16, 0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.topbar-spacer {
  width: 40px;
  height: 40px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.hero {
  padding: 24px 20px;
  margin-bottom: 20px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  padding: 13px 20px;
  margin: 10px 0;
  border-radius: 999px;
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  font-family: inherit;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #16091f;
  box-shadow: 0 10px 28px rgba(167, 139, 250, 0.32);
}

.btn-primary:active {
  filter: brightness(0.95);
}

.btn-primary:disabled {
  opacity: 0.6;
  box-shadow: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-whatsapp {
  background: rgba(74, 222, 128, 0.14);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.45);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.14);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.45);
}

.btn-danger:disabled {
  opacity: 0.6;
}

.btn-small {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.82rem;
  margin: 0;
  flex: 1;
}

label {
  display: block;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.85rem;
}

input[type='text'],
select {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  margin: 8px 0 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

.upload-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 28px 16px;
  margin: 8px 0 4px;
  border-radius: var(--radius);
  border: 1.5px dashed var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.upload-dropzone svg {
  width: 30px;
  height: 30px;
  color: var(--accent);
}

.upload-dropzone .dropzone-label {
  font-weight: 600;
  color: var(--text);
}

.upload-dropzone input[type='file'] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.editor-section {
  margin: 8px 0 4px;
}

.editor-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-solid);
  touch-action: none;
}

.editor-toolbar {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.editor-panel {
  margin-top: 10px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  border: 1px solid var(--border);
}

.editor-panel input[type='text'] {
  margin: 0 0 10px;
}

.swatch-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.swatch {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 2px solid var(--border);
  padding: 0;
  cursor: pointer;
}

.swatch.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.35);
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.sticker-choice {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--surface);
  background-size: 70%;
  background-position: center;
  background-repeat: no-repeat;
  cursor: pointer;
}

.status-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  margin-bottom: 18px;
  font-weight: 700;
  font-size: 0.95rem;
}

.invite-link-box {
  font-size: 0.85rem;
}

.pending-photo,
.moment-photo {
  width: 100%;
  border-radius: var(--radius-sm);
  display: block;
  margin-bottom: 10px;
}

.caption {
  color: var(--muted);
  font-style: italic;
  margin: 4px 0 12px;
}

.comment {
  margin: 8px 0 0;
}

.score-badge,
.moment-score-badge,
.moment-waiting-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.82rem;
}

.moment-score-badge {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.4);
}

.moment-waiting-badge {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-3);
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.game-list,
.moments-list {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}

.game-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  margin-bottom: 10px;
  color: var(--text);
  text-decoration: none;
}

.game-list-status {
  font-size: 0.88rem;
  font-weight: 600;
}

.pending-section .glass,
.upload-section .glass {
  margin-bottom: 14px;
}

.score-view,
.upload-form {
  padding: 18px;
  margin-bottom: 14px;
}

.moment-card {
  padding: 16px;
  margin-bottom: 18px;
}

.moment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}

.moment-who {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-3);
}

.moment-when {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.moment-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-tile {
  padding: 16px 6px;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: space-around;
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(11, 12, 16, 0.72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 16px;
  border-radius: 12px;
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

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

.empty-state {
  text-align: center;
  padding: 48px 20px;
}

.empty-state svg {
  width: 56px;
  height: 56px;
  color: var(--accent);
  margin-bottom: 12px;
}

.empty-state p {
  color: var(--muted);
  margin: 0;
}

.error {
  color: var(--danger);
  margin-top: 8px;
}

@media (min-width: 540px) {
  .page {
    padding-top: 32px;
  }
}
