/* Core Styling & Design System */

:root {
  /* Common variables */
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
  
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
  
  --correct: #10b981; /* Premium Emerald */
  --present: #f59e0b; /* Warm Gold */
  --absent: #3f3f46;  /* Sleek Dark Gray */
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* THEMES */
body[data-theme="boy"] {
  --bg-start: #0f172a; /* Slate 900 */
  --bg-end: #1e1b4b;   /* Indigo 950 */
  --accent: #38bdf8;   /* Sky Blue */
  --accent-rgb: 56, 189, 248;
  --accent-gradient: linear-gradient(135deg, #38bdf8, #6366f1);
  --card-bg: rgba(15, 23, 42, 0.65);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --keyboard-key-bg: #1e293b;
  --keyboard-key-hover: #334155;
  --tile-empty-border: rgba(56, 189, 248, 0.25);
  --tile-active-border: #38bdf8;
}

body[data-theme="girl"] {
  --bg-start: #1e112a; /* Rich Plum */
  --bg-end: #3b1d2e;   /* Dark Rose Gold */
  --accent: #f472b6;   /* Rose Pink */
  --accent-rgb: 244, 114, 182;
  --accent-gradient: linear-gradient(135deg, #f472b6, #ec4899);
  --card-bg: rgba(30, 17, 42, 0.65);
  --text-main: #fdf2f8;
  --text-muted: #f472b6;
  --keyboard-key-bg: #2d1838;
  --keyboard-key-hover: #452454;
  --tile-empty-border: rgba(244, 114, 182, 0.25);
  --tile-active-border: #f472b6;
}

body[data-theme="neutral"] {
  --bg-start: #0f1e18; /* Dark Forest */
  --bg-end: #1b2a1e;   /* Dark Olive */
  --accent: #a7f3d0;   /* Light Sage Green */
  --accent-rgb: 167, 243, 208;
  --accent-gradient: linear-gradient(135deg, #a7f3d0, #fcd34d); /* Sage & Gold */
  --card-bg: rgba(15, 30, 24, 0.65);
  --text-main: #ecfdf5;
  --text-muted: #a7f3d0;
  --keyboard-key-bg: #1c2e26;
  --keyboard-key-hover: #294438;
  --tile-empty-border: rgba(167, 243, 208, 0.25);
  --tile-active-border: #a7f3d0;
}

/* Reset and Layout */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: radial-gradient(circle at center, var(--bg-start) 0%, var(--bg-end) 100%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Full-Screen Confetti Canvas */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99;
  pointer-events: none;
}

.app-container {
  width: 100%;
  max-width: 500px;
  padding: 16px;
  z-index: 10;
}

/* Glassmorphism Card Style */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius-lg);
  padding: 32px 24px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  display: none; /* Screens toggled by active class */
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.card.active {
  display: flex;
  flex-direction: column;
  opacity: 1;
  transform: translateY(0);
}

/* SCREEN 1: WELCOME SCREEN */
.emoji-container {
  font-size: 3.5rem;
  margin-bottom: 12px;
  animation: float 3s ease-in-out infinite;
}

.welcome-title {
  font-family: var(--font-title);
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.game-rules {
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--border-radius-md);
  padding: 16px;
  margin-bottom: 24px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  text-align: left;
}

.game-rules h3 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 6px;
}

.game-rules p {
  font-size: 0.88rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 16px;
}

/* Rule Examples */
.example-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.example-row:last-child {
  margin-bottom: 0;
}

.example-row p {
  margin-bottom: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.example-row p strong {
  color: #fff;
}

.tile.example {
  width: 32px;
  height: 32px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1.5px solid var(--tile-empty-border);
}

.tile.correct {
  background-color: var(--correct);
  border-color: var(--correct);
  color: #fff;
}

.tile.present {
  background-color: var(--present);
  border-color: var(--present);
  color: #fff;
}

.tile.absent {
  background-color: var(--absent);
  border-color: var(--absent);
  color: #fff;
}

.mode-select-box {
  margin-top: 8px;
}

.mode-select-box h3 {
  font-family: var(--font-title);
  font-size: 1rem;
  margin-bottom: 14px;
}

.mode-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Premium Buttons */
.btn {
  font-family: var(--font-body);
  border: none;
  border-radius: var(--border-radius-md);
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  transition: var(--transition-bounce);
  text-decoration: none;
}

.btn-primary-gradient {
  background: var(--accent-gradient);
  color: #000;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(var(--accent-rgb), 0.3);
}

.btn-primary-gradient:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(var(--accent-rgb), 0.5);
  filter: brightness(1.05);
}

.btn-primary-gradient:active {
  transform: translateY(-1px);
}

.btn-primary-gradient .btn-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.btn-primary-gradient .btn-desc {
  font-size: 0.8rem;
  font-weight: 400;
  opacity: 0.9;
  color: rgba(255, 255, 255, 0.9);
}

.btn-secondary-gradient {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-weight: 600;
}

.btn-secondary-gradient:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.btn-secondary-gradient:active {
  transform: translateY(-1px);
}

.btn-secondary-gradient .btn-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.btn-secondary-gradient .btn-desc {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
}


/* SCREEN 2: GAME SCREEN */
#game-screen {
  padding: 20px 16px;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
}

.btn-back {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  border-radius: var(--border-radius-sm);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem;
  transition: var(--transition-smooth);
}

.btn-back:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--accent);
}

.header-titles {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-title {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
}

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(var(--accent-rgb), 0.15);
  color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.header-placeholder {
  width: 70px; /* balance back button size */
}


/* Wordle Grid Layout */
.grid-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 24px;
  align-items: center;
}

.grid-row {
  display: flex;
  gap: 6px;
}

.tile {
  width: 52px;
  height: 52px;
  border: 2px solid var(--tile-empty-border);
  border-radius: 8px;
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  text-transform: uppercase;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
  background: transparent;
  transition: border-color 0.1s ease;
}

/* Typing state */
.tile.active {
  border-color: var(--tile-active-border);
  animation: pop 0.12s ease-out;
}

/* Flip Animations */
.tile.flip {
  animation: flipIn 0.5s ease-out forwards;
}

.tile.reveal-correct {
  background-color: var(--correct) !important;
  border-color: var(--correct) !important;
}

.tile.reveal-present {
  background-color: var(--present) !important;
  border-color: var(--present) !important;
}

.tile.reveal-absent {
  background-color: var(--absent) !important;
  border-color: var(--absent) !important;
}

/* Virtual Keyboard */
.keyboard-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: auto;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.key {
  font-family: var(--font-body);
  background-color: var(--keyboard-key-bg);
  border: none;
  border-radius: 6px;
  height: 48px;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, transform 0.05s ease;
}

.key:hover {
  background-color: var(--keyboard-key-hover);
}

.key:active {
  transform: scale(0.95);
}

.key.correct {
  background-color: var(--correct) !important;
}

.key.present {
  background-color: var(--present) !important;
}

.key.absent {
  background-color: var(--absent) !important;
  opacity: 0.4;
}

.key.wide-key {
  flex: 1.5;
  font-size: 0.8rem;
  text-transform: uppercase;
}


/* TOAST NOTIFIER */
.toast-container {
  position: fixed;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  background: rgba(239, 68, 68, 0.9); /* Red error alert */
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(-20px);
  animation: toastFadeIn 0.3s ease forwards, toastFadeOut 0.3s ease 2.2s forwards;
}


/* REVEAL / CONGRATS PANEL (INLINE) */
.shared-view-banner {
  background: rgba(var(--accent-rgb), 0.15);
  border: 1px dashed rgba(var(--accent-rgb), 0.4);
  color: var(--accent);
  padding: 8px 16px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 16px;
  text-transform: uppercase;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  animation: fadeIn 0.4s ease forwards;
  display: inline-block;
  align-self: center;
}

.reveal-card-inline {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius-md);
  padding: 20px 16px;
  margin-top: 12px;
  margin-bottom: 12px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeIn 0.5s ease-out forwards;
}

.reveal-emoji-compact {
  font-size: 2.2rem;
  margin-bottom: 8px;
  animation: bounceSlow 2s infinite;
}

.reveal-title-compact {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.name-reveal-box-compact {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
  background: var(--accent-gradient);
  padding: 8px 24px;
  border-radius: 30px;
  box-shadow: 0 6px 20px rgba(var(--accent-rgb), 0.3);
}

.revealed-name-compact {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 2px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.sparkle-compact {
  font-size: 1rem;
  animation: rotateSparkle 3s linear infinite;
}

.reveal-message-compact {
  font-size: 0.95rem;
  line-height: 1.5;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
}

.reveal-details-compact {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.45;
}

.stats-box-compact {
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--border-radius-sm);
  padding: 8px 16px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255,255,255,0.05);
}

.stats-label-compact {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.7);
}

.stats-val-compact {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
}

.reveal-actions-inline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  align-items: stretch;
}

.share-heading {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 10px;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
}

.compact-btn {
  font-size: 0.85rem;
  padding: 11px 16px;
  font-weight: 700;
  width: 100%;
}


/* NO-FAIL CONTAINER */
.keep-guessing-row {
  display: flex;
  justify-content: center;
  margin-top: 12px;
  animation: fadeIn 0.4s ease forwards;
}

.btn-keep-guessing {
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--border-radius-md);
  color: #fff;
  font-weight: 700;
  padding: 12px 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
  transition: var(--transition-bounce);
  font-family: var(--font-body);
}

.btn-keep-guessing:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 18px rgba(var(--accent-rgb), 0.5);
}


/* KEYFRAMES ANIMATIONS */

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes rotateSparkle {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.2); }
  100% { transform: rotate(360deg) scale(1); }
}

@keyframes bounceSlow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes pop {
  0% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15%, 45%, 75% { transform: translateX(-6px); }
  30%, 60%, 90% { transform: translateX(6px); }
}

@keyframes flipIn {
  0% {
    transform: rotateX(0deg);
    background-color: transparent;
  }
  45% {
    transform: rotateX(90deg);
    background-color: transparent;
  }
  55% {
    transform: rotateX(90deg);
  }
  100% {
    transform: rotateX(0deg);
  }
}

@keyframes toastFadeIn {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastFadeOut {
  to { opacity: 0; transform: translateY(-30px); }
}

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

/* Shake class helper */
.row-shake {
  animation: shake 0.5s ease-in-out;
}

/* RESPONSIVE RETUNING */

@media(max-height: 700px) {
  .app-container {
    max-width: 440px;
    padding: 8px;
  }
  .card {
    padding: 20px 16px;
  }
  .tile {
    width: 42px;
    height: 42px;
    font-size: 1.3rem;
  }
  .key {
    height: 40px;
    font-size: 0.85rem;
  }
  .emoji-container {
    font-size: 2.5rem;
  }
}

@media(max-width: 375px) {
  .tile {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    border-width: 1.5px;
  }
  .key {
    height: 36px;
    font-size: 0.75rem;
    border-radius: 4px;
  }
  .keyboard-row {
    gap: 4px;
  }
}

/* ==========================================================================
   ADMIN PANEL STYLES
   ========================================================================== */
.admin-card {
  width: 100%;
  max-width: 500px;
  margin: 20px auto;
  text-align: left;
}

.admin-header {
  margin-bottom: 24px;
  text-align: center;
}

.admin-form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-form-group input, 
.admin-form-group select, 
.admin-form-group textarea {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 10px 12px;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.admin-form-group input:focus, 
.admin-form-group select:focus, 
.admin-form-group textarea:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.25);
}

.admin-form-group select option {
  background: #1e1b29;
  color: #fff;
}

.admin-form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.admin-button-group {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-status {
  text-align: center;
  font-size: 0.9rem;
  margin-top: 12px;
  padding: 10px;
  border-radius: 8px;
  display: none;
}

.admin-status.success {
  background: rgba(46, 213, 115, 0.15);
  color: #2ed573;
  border: 1px solid rgba(46, 213, 115, 0.3);
  display: block;
}

.admin-status.error {
  background: rgba(255, 71, 87, 0.15);
  color: #ff4757;
  border: 1px solid rgba(255, 71, 87, 0.3);
  display: block;
}

