*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --cream: #fff8f0;
  --warm-white: #fffdf9;
  --cookie: #c87941;
  --cookie-dark: #8b4513;
  --chocolate: #3d2314;
  --caramel: #e8a849;
  --pink: #ff8fab;
  --mint: #7ecba1;
  --shadow: rgba(61, 35, 20, 0.15);
  --glass: rgba(255, 253, 249, 0.72);
  --radius: 20px;
}

html {
  font-size: 16px;
}

body {
  font-family: "Vazirmatn", system-ui, sans-serif;
  background: linear-gradient(145deg, #2d1810 0%, #5c3317 35%, #8b5a2b 70%, #c87941 100%);
  min-height: 100vh;
  color: var(--chocolate);
  overflow-x: hidden;
}

.bg-shapes {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.shape {
  position: absolute;
  font-size: clamp(2rem, 6vw, 4rem);
  opacity: 0.12;
  animation: float 8s ease-in-out infinite;
}

.shape-1 { top: 8%; left: 10%; animation-delay: 0s; }
.shape-2 { top: 20%; right: 8%; animation-delay: -2s; }
.shape-3 { bottom: 25%; left: 5%; animation-delay: -4s; }
.shape-4 { bottom: 10%; right: 15%; animation-delay: -1s; }
.shape-5 { top: 50%; left: 45%; animation-delay: -3s; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-18px) rotate(8deg); }
}

.app {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.hidden {
  display: none !important;
}

.auth-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.auth-admin {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--cream);
  background: rgba(255, 253, 249, 0.15);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
}

.btn-login,
.btn-logout {
  background: rgba(255, 253, 249, 0.12);
  color: var(--cream);
  border: 1px solid rgba(255, 248, 240, 0.25);
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease;
}

.btn-login:hover,
.btn-logout:hover {
  background: rgba(255, 253, 249, 0.22);
}

.login-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 24, 16, 0.55);
  backdrop-filter: blur(4px);
}

.login-box {
  position: relative;
  background: var(--warm-white);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
}

.login-box h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--chocolate);
  text-align: center;
}

.login-box input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid rgba(200, 121, 65, 0.25);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  margin-bottom: 1rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.login-box input:focus {
  border-color: var(--cookie);
}

.login-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-sm {
  flex: 1;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
}

.btn-ghost-dark {
  background: var(--cream);
  color: var(--chocolate);
  border: 1px solid rgba(200, 121, 65, 0.2);
  border-radius: 999px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}

.hero {
  text-align: center;
  margin-bottom: 1.75rem;
}

.hero-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--caramel), var(--cookie));
  color: var(--warm-white);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
  box-shadow: 0 4px 16px rgba(232, 168, 73, 0.4);
}

.hero h1 {
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  font-weight: 800;
  color: var(--cream);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  margin-bottom: 0.4rem;
}

.hero-sub {
  color: rgba(255, 248, 240, 0.85);
  font-size: 0.95rem;
}

.next-card {
  background: var(--glass);
  backdrop-filter: blur(16px);
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  text-align: center;
  box-shadow: 0 12px 40px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  margin-bottom: 1.5rem;
  animation: pop-in 0.5s ease;
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.next-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cookie);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

.next-person {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.next-emoji {
  font-size: 3rem;
  animation: wiggle 2s ease-in-out infinite;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg) scale(1.05); }
}

.next-name {
  font-size: 2rem;
  font-weight: 800;
  color: var(--chocolate);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, var(--cookie) 0%, var(--caramel) 100%);
  color: var(--warm-white);
  padding: 0.9rem 2rem;
  box-shadow: 0 6px 24px rgba(200, 121, 65, 0.45);
  width: 100%;
  max-width: 280px;
}

.btn-primary:hover {
  box-shadow: 0 8px 28px rgba(200, 121, 65, 0.55);
  transform: translateY(-2px);
}

.btn-icon {
  font-size: 1.3rem;
}

.queue-section {
  background: var(--warm-white);
  border-radius: var(--radius);
  padding: 1.25rem 1rem 1rem;
  box-shadow: 0 8px 32px var(--shadow);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.5rem 0.75rem;
  border-bottom: 2px dashed rgba(200, 121, 65, 0.25);
  margin-bottom: 0.5rem;
}

.section-head h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--chocolate);
}

.count-badge {
  background: var(--cream);
  color: var(--cookie-dark);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

.queue-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  background: var(--cream);
  transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.queue-item.first {
  background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
  border: 2px solid var(--caramel);
  box-shadow: 0 4px 16px rgba(232, 168, 73, 0.25);
  transform: scale(1.02);
}

.queue-item.moving {
  animation: slide-out 0.4s ease forwards;
}

@keyframes slide-out {
  to {
    opacity: 0;
    transform: translateX(-30px) scale(0.95);
  }
}

.queue-rank {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--warm-white);
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--cookie-dark);
  flex-shrink: 0;
}

.queue-item.first .queue-rank {
  background: var(--caramel);
  color: var(--warm-white);
}

.queue-emoji {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.queue-name {
  flex: 1;
  font-weight: 600;
  font-size: 1rem;
}

.queue-tag {
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--mint);
  color: #1a4d32;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.btn-ghost {
  background: rgba(255, 253, 249, 0.15);
  color: var(--cream);
  border: 1px solid rgba(255, 248, 240, 0.3);
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-ghost:hover {
  background: rgba(255, 253, 249, 0.25);
}

.footer-note {
  font-size: 0.75rem;
  color: rgba(255, 248, 240, 0.6);
}

.footer-note code {
  background: rgba(0, 0, 0, 0.2);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.7rem;
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--chocolate);
  color: var(--cream);
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
  z-index: 100;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (max-width: 400px) {
  .next-name { font-size: 1.6rem; }
  .next-emoji { font-size: 2.5rem; }
}
