:root {
  --rblx-green: #00b06f;
  --rblx-green-dark: #007f50;
  --rblx-blue: #00a2ff;
  --rblx-yellow: #ffd000;
  --rblx-red: #ff3e3e;
  --font-display: 'Fredoka', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font-body);
  background: #1a2847;
  color: #ffffff;
  overflow: hidden;
}

/* =========================================================
   FULLSCREEN FIXED 3D CANVAS
   ========================================================= */
#canvas-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 1;
}

/* =========================================================
   COMPACT PORTRAIT LAUNCHER OVERLAY
   ========================================================= */
.launcher-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: radial-gradient(circle at center, rgba(16, 24, 44, 0.85), rgba(8, 11, 20, 0.96));
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.launcher-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.05);
}

.launcher-card {
  width: 100%;
  max-width: 360px;
  background: rgba(20, 24, 36, 0.95);
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75);
}

.server-pill {
  display: inline-block;
  background: rgba(0, 176, 111, 0.2);
  border: 1px solid rgba(0, 230, 138, 0.45);
  color: #4ade80;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
  letter-spacing: 0.05em;
}

.launcher-card h1 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  line-height: 1.15;
  margin-bottom: 4px;
}

.launcher-sub {
  font-size: 0.8rem;
  color: #cbd5e1;
  margin-bottom: 16px;
}

.vs-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
}

.vs-avatar {
  width: 102px;
  background: #0f131d;
  border: 2px solid var(--rblx-yellow);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,0.45);
}

.vs-avatar img {
  width: 100%;
  height: 92px;
  object-fit: cover;
  display: block;
}

.vs-avatar span {
  display: block;
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--rblx-yellow);
  padding: 4px 2px;
}

.vs-badge {
  font-size: 1.3rem;
}

.btn-start {
  width: 100%;
  background: var(--rblx-green);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 13px 18px;
  border: none;
  border-radius: 14px;
  border-bottom: 4px solid var(--rblx-green-dark);
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0, 176, 111, 0.4);
  transition: transform 0.12s;
}

.btn-start:active {
  transform: translateY(2px);
}

.scroll-tip {
  display: block;
  margin-top: 10px;
  font-size: 0.72rem;
  color: #94a3b8;
}

/* =========================================================
   AUTO-HIDING MINIMAL TOP PILL
   ========================================================= */
.floating-top-pill {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100vw - 24px);
  max-width: 420px;
  z-index: 30;
  background: rgba(12, 16, 26, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 5px 8px 5px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Auto-dim when user isn't interacting */
.floating-top-pill.idle {
  opacity: 0.28;
}

.pill-stage {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--rblx-yellow);
  letter-spacing: 0.03em;
}

.pill-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.pill-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.pill-btn.accent {
  background: var(--rblx-blue);
  border-color: #38bdf8;
}

/* =========================================================
   SCROLLABLE PORTRAIT STORYTELLING CONTAINER
   ========================================================= */
.scroll-story-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 10;
  overflow-y: scroll;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.scroll-story-container::-webkit-scrollbar {
  width: 0px;
  background: transparent;
}

.story-section {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 12px 12px 16px;
  pointer-events: none; /* Let touches on top 70% pass through to 3D scene! */
}

/* Top 68% of every screen is completely empty so 3D world is 100% clear */
.spacer-3d {
  flex: 1;
  width: 100%;
  pointer-events: none;
}

/* Sleek Portrait Card at the bottom */
.glass-story-card {
  width: 100%;
  max-width: 420px;
  background: rgba(12, 16, 26, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 13px 15px;
  pointer-events: auto;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.glass-story-card.finale-card {
  border-color: rgba(255, 208, 0, 0.55);
}

/* When user taps 3D scene or Eye button, auto-hide the story cards! */
body.cards-hidden .glass-story-card {
  opacity: 0;
  transform: translateY(28px);
  pointer-events: none;
}

.card-badge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.badge-stage {
  font-size: 0.64rem;
  font-weight: 800;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.badge-stage.gold {
  color: #111;
  background: var(--rblx-yellow);
}

.badge-year {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--rblx-yellow);
}

.glass-story-card h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.2;
  margin-bottom: 6px;
}

.mini-photo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.mini-thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid var(--rblx-yellow);
  flex-shrink: 0;
  cursor: pointer;
}

.glass-story-card p {
  font-size: 0.78rem;
  line-height: 1.4;
  color: #e2e8f0;
  margin-bottom: 8px;
}

.mini-photo-row p {
  margin-bottom: 0;
}

.card-actions {
  display: flex;
  gap: 6px;
}

.btn-card {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 8px 10px;
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: transform 0.12s;
}

.btn-card:active {
  transform: scale(0.96);
}

.btn-card.blue {
  background: linear-gradient(135deg, #00a2ff, #6366f1);
}

.btn-card.green {
  background: linear-gradient(135deg, #00b06f, #059669);
}

.btn-card.orange {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
}

.btn-card.pulse {
  animation: pulseBtn 1.8s infinite;
}

@keyframes pulseBtn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
}

.scroll-hint-down {
  text-align: center;
  font-size: 0.66rem;
  color: #94a3b8;
  margin-top: 7px;
  letter-spacing: 0.03em;
}

/* =========================================================
   AUTO-HIDING BOTTOM DRAWER (EMOTES & SERVER CHAT)
   ========================================================= */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(5, 8, 15, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.drawer-backdrop.hidden {
  display: none;
}

.drawer-sheet {
  width: 100%;
  max-width: 420px;
  background: #141926;
  border-top: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px 22px 0 0;
  padding: 16px;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-display);
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.drawer-close {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
}

.emote-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.emote-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  padding: 10px 6px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  cursor: pointer;
}

.emote-btn.gold {
  border-color: var(--rblx-yellow);
  color: var(--rblx-yellow);
}

.emote-btn.green {
  border-color: var(--rblx-green);
  color: #4ade80;
}

.mini-chat-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  overflow: hidden;
}

.chat-messages {
  height: 95px;
  overflow-y: auto;
  padding: 8px 10px;
  font-size: 0.74rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-msg.system { color: #38bdf8; font-weight: 700; }
.chat-msg .author.ph { color: #facc15; font-weight: 700; }
.chat-msg .author.id { color: #4ade80; font-weight: 700; }
.chat-msg .author.gold { color: #f472b6; font-weight: 700; }
.chat-msg .author.you { color: #60a5fa; font-weight: 700; }

.chat-input-row {
  display: flex;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input-row input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 8px 10px;
  color: #fff;
  font-size: 0.76rem;
  outline: none;
}

.chat-input-row button {
  background: var(--rblx-blue);
  color: #fff;
  border: none;
  padding: 0 14px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

/* =========================================================
   BIRTHDAY LETTER MODAL
   ========================================================= */
.letter-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(6, 9, 15, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.letter-modal.hidden {
  display: none;
}

.letter-card {
  width: 100%;
  max-width: 390px;
  max-height: 90dvh;
  overflow-y: auto;
  background: linear-gradient(180deg, #1e2436 0%, #131722 100%);
  border: 2px solid var(--rblx-yellow);
  border-radius: 22px;
  padding: 18px 15px;
  position: relative;
  text-align: center;
}

.letter-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
}

.achievement-banner {
  display: inline-block;
  background: var(--rblx-yellow);
  color: #111;
  font-weight: 900;
  font-size: 0.68rem;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.letter-card h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin-bottom: 12px;
}

.letter-photos {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.polaroid {
  background: #fff;
  padding: 5px 5px 10px;
  border-radius: 8px;
  width: 105px;
  color: #1e293b;
  font-family: var(--font-display);
  font-size: 0.68rem;
}

.polaroid img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 4px;
}

.rotate-left { transform: rotate(-3deg); }
.rotate-right { transform: rotate(3deg); }

.letter-body {
  text-align: left;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 12px;
  font-size: 0.78rem;
  line-height: 1.48;
  color: #e2e8f0;
  margin-bottom: 14px;
}

.letter-body p {
  margin-bottom: 8px;
}

.letter-sign {
  text-align: right;
  color: var(--rblx-yellow);
  font-weight: 700;
  margin-bottom: 0;
}

/* =========================================================
   TOAST NOTIFICATIONS
   ========================================================= */
.toast-container {
  position: fixed;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  width: calc(100vw - 32px);
  max-width: 360px;
}

.roblox-toast {
  background: rgba(15, 23, 42, 0.92);
  border: 1.5px solid var(--rblx-yellow);
  color: #fff;
  padding: 8px 14px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.25s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
