:root {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #0f172a;
  background-color: #f8fafc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #eef2ff, #fdf2f8);
  padding: 2rem;
}

body.modal-open {
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.auth-body {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(120deg, #d7ecff, #f3f4ff 60%, #ffffff);
  position: relative;
  overflow: hidden;
  padding: 2rem;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 440px);
  align-items: center;
  gap: 2rem;
  height: 100%;
  max-width: 1280px;
  width: 100%;
  justify-content: end;
  margin-left: auto;
  margin-right: 0;
}

.auth-illustration {
  position: relative;
  height: 450px;
  width: 100%;
}

.cloud {
  position: absolute;
  width: 260px;
  height: 110px;
  animation: drift 35s linear infinite;
  filter: drop-shadow(0 10px 25px rgba(134, 168, 231, 0.35));
}

.cloud span {
  position: absolute;
  display: block;
  background: radial-gradient(circle at 30% 30%, #ffffff 0%, #f2f7ff 70%);
  border-radius: 50%;
  opacity: 0.95;
}

.cloud span:nth-child(1) {
  width: 120px;
  height: 120px;
  top: 10px;
  left: -10px;
}

.cloud span:nth-child(2) {
  width: 150px;
  height: 150px;
  top: -10px;
  left: 60px;
}

.cloud span:nth-child(3) {
  width: 110px;
  height: 110px;
  top: 20px;
  left: 150px;
}

.cloud span:nth-child(4) {
  width: 80px;
  height: 80px;
  top: 40px;
  left: 50px;
}

.cloud span:nth-child(5) {
  width: 90px;
  height: 90px;
  top: 35px;
  left: 190px;
}

.cloud-one {
  top: 20%;
  left: 140%;
  animation-duration: 50s;
}

.cloud-two {
  top: 60%;
  left: 130%;
  animation-duration: 60s;
  animation-delay: -12s;
  transform: scale(1.2);
}


.cloud-three {
  top: 10%;
  left: 115%;
  animation-duration: 45s;
  animation-delay: -20s;
  transform: scale(0.8);
}

@keyframes drift {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-2000px);
  }
}

@keyframes fly {
  0% {
    transform: translate(-50%, -38%) rotate(32deg);
  }
  100% {
    transform: translate(-50%, -55%) rotate(32deg);
  }
}

.rocket {
  position: absolute;
  top: 42%;
  left: 58%;
  transform: translate(-50%, -46%) rotate(32deg);
  animation: fly 1.2s ease-in-out infinite alternate;
  filter: drop-shadow(0 18px 32px rgba(0, 0, 0, 0.35));
}

.rocket-body {
  width: 138px;
  height: 312px;
  background: linear-gradient(120deg, #d8dde5 0%, #f8fbff 45%, #c8ced8 100%);
  border-radius: 60% 60% 18px 18px;
  position: relative;
  overflow: visible;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    inset 0 -8px 22px rgba(0, 0, 0, 0.15),
    0 16px 28px rgba(0, 0, 0, 0.25);
}

.rocket-top {
  width: 150px;
  height: 173px;
  background: radial-gradient(ellipse at 32% 28%, #cfd5df 0%, #9aa2b3 45%, #646c7b 100%);
  border-radius: 60% 60% 32% 32% / 78% 78% 22% 22%;
  position: absolute;
  top: -131px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow:
    inset 0 -14px 22px rgba(0, 0, 0, 0.28),
    inset 0 12px 18px rgba(255, 255, 255, 0.18);
}

.rocket-top::after {
  content: '';
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%) rotate(-8deg);
  width: 66%;
  height: 26px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
  opacity: 0.4;
  filter: blur(4px);
}

.rocket-window {
  width: 65px;
  height: 65px;
  background: radial-gradient(circle at 30% 30%, #f6fbff 0%, #b7dcff 55%, #7393c7 100%);
  border: 6px solid #77839a;
  border-radius: 50%;
  position: absolute;
  top: 88px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.15),
    inset -8px -8px 12px rgba(0, 0, 0, 0.22),
    0 10px 14px rgba(0, 0, 0, 0.25);
}

.window-highlight {
  width: 22px;
  height: 12px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  position: absolute;
  top: 7px;
  left: 9px;
  transform: rotate(-30deg);
}

.body-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 60% 60% 18px 18px;
  background:
    linear-gradient(to right, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0.4) 45%, rgba(255,255,255,0.05) 100%),
    linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.08) 70%, rgba(0,0,0,0.15) 100%);
  mix-blend-mode: screen;
}

.rocket-stripe {
  position: absolute;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(to right, rgba(0,0,0,0.08), rgba(255,255,255,0.6), rgba(0,0,0,0.08));
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.35);
}

.rocket-stripe-top { top: 52px; }
.rocket-stripe-mid { top: 163px; }
.rocket-stripe-bottom { top: 235px; }

.engine-bell {
  position: absolute;
  left: 50%;
  bottom: -22px;
  transform: translateX(-50%);
  width: 110px;
  height: 70px;
  background: linear-gradient(180deg, #5c6574 0%, #282d37 100%);
  border-radius: 0 0 48% 48%;
  box-shadow:
    inset 0 12px 16px rgba(255, 255, 255, 0.06),
    inset 0 -6px 12px rgba(0, 0, 0, 0.4),
    0 10px 20px rgba(0, 0, 0, 0.35);
}

.engine-bell::after {
  content: '';
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 85px;
  height: 20px;
  background: linear-gradient(90deg, #dadfe7 0%, #f5f7fa 50%, #c6ccd7 100%);
  border-radius: 12px;
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,0.6),
    inset 0 -2px 4px rgba(0,0,0,0.15);
}

.rocket-fin {
  width: 120px;
  height: 98px;
  position: absolute;
  bottom: -2px;
  background: linear-gradient(135deg, #f05b46 0%, #c43f2d 100%);
  clip-path: polygon(0 100%, 100% 70%, 76% 0, 28% 0);
  transform-origin: 50% 20%;
}

.rocket-fin-left {
  left: -78px;
  transform: rotate(-14deg);
  filter: drop-shadow(-6px 8px 8px rgba(0,0,0,0.25));
}

.rocket-fin-right {
  right: -78px;
  transform: scaleX(-1) rotate(-14deg);
  filter: drop-shadow(6px 8px 8px rgba(0,0,0,0.25));
}

.rocket-exhaust {
  width: 105px;
  height: 188px;
  position: absolute;
  left: 50%;
  bottom: -238px;
  transform: translateX(-50%);
  filter: drop-shadow(0 0 30px rgba(255, 153, 0, 0.6));
}

.flame {
  position: absolute;
  left: 50%;
  bottom: -32%;
  transform: translateX(-50%);
  border-radius: 50% 50% 22% 22%;
  background: radial-gradient(ellipse at 50% 20%, #fff9db 0%, #ffd06b 30%, #ff8c1a 60%, rgba(255,112,0,0.65) 100%);
  clip-path: polygon(50% 0%, 78% 12%, 95% 38%, 80% 72%, 50% 100%, 20% 72%, 5% 38%, 22% 12%);
  animation: flame-pulse 0.24s ease-in-out infinite;
  mix-blend-mode: screen;
}

.flame-one {
  width: 105px;
  height: 188px;
}

.flame-two {
  width: 80px;
  height: 163px;
  opacity: 0.75;
  animation-duration: 0.32s;
}

.flame-three {
  width: 130px;
  height: 225px;
  opacity: 0.35;
  filter: blur(6px);
  animation-duration: 0.4s;
}

@keyframes flame-pulse {
  0% {
    transform: translateX(-50%) scaleY(1) translateY(6%);
    opacity: 0.95;
  }
  50% {
    transform: translateX(-50%) scaleY(1.25) translateY(-6%);
    opacity: 0.8;
  }
  100% {
    transform: translateX(-50%) scaleY(1) translateY(10%);
    opacity: 0.95;
  }
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 900px;
  margin: 0 auto 1.5rem;
}

.brand h1 {
  margin: 0;
}

main {
  display: grid;
  gap: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.group-search {
  margin-left: auto;
  width: 200px;
  padding: 0.5rem 0.85rem;
  border: 1px solid #cbd5f5;
  border-radius: 999px;
  font-size: 0.95rem;
}

.group-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.group-card {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #fff;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.group-card:focus-within,
.group-card:hover {
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
  transform: translateY(-2px);
}
.group-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.group-card__meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
}

.group-card__header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.group-card__toggle {
  border: none;
  background: #eef2ff;
  border-radius: 12px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #4f46e5;
  transition: transform 0.15s ease, background 0.15s ease;
}

.group-card__toggle.open svg {
  transform: rotate(180deg);
}

.group-card__toggle svg {
  transition: transform 0.15s ease;
}

.group-card__actions {
  display: flex;
  gap: 0.4rem;
}

.group-card__body {
  border-top: 1px solid #e2e8f0;
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.group-card__body[hidden] {
  display: none;
}

.group-card__urls {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.group-card__urls li {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.6rem 0.85rem;
}

.group-card__urls strong {
  display: block;
  font-size: 0.95rem;
}

.group-card__urls span {
  color: #475569;
  font-size: 0.85rem;
  word-break: break-all;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-menu {
  position: relative;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 0.4rem 0.75rem;
  background: #fff;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
  cursor: pointer;
  min-width: 220px;
}

.user-pill__text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-pill__text span:first-child {
  font-weight: 600;
}

.user-pill__text span.muted {
  font-size: 0.85rem;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f0f4ff;
  color: #4f46e5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.user-pill .caret {
  width: 16px;
  height: 16px;
  color: #64748b;
}

.user-menu__dropdown {
  position: absolute;
  right: 0;
  margin-top: 0.75rem;
  background: #fff;
  border-radius: 16px;
  padding: 0.35rem;
  box-shadow: 0 15px 40px rgba(15, 23, 42, 0.15);
  min-width: 220px;
  border: 1px solid #e2e8f0;
  display: none;
  z-index: 10;
}

.user-menu.open .user-menu__dropdown {
  display: block;
}

.dropdown-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-size: 0.95rem;
  cursor: pointer;
  display: block;
  text-decoration: none;
  color: inherit;
}

.dropdown-item:hover {
  background: #f1f5f9;
}

.icon-button {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: none;
  background: #4f46e5;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.icon-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 35px rgba(79, 70, 229, 0.5);
}

.icon-button.ghost {
  background: transparent;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
  box-shadow: none;
}

.icon-button.small {
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1.1rem;
  box-shadow: none;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
}

.icon-button.small.purple {
  background: #4f46e5;
  color: #fff;
  border: none;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
}

.card {
  background: #fff;
  padding: 1.5rem;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
}

.group-manage-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.url-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.url-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  gap: 1rem;
}

.url-list strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.15rem;
}

.url-list span {
  color: #475569;
  font-size: 0.9rem;
  word-break: break-all;
}

.primary-button,
.secondary-button,
.link-button,
.text-button {
  font-weight: 600;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.primary-button {
  background: #4f46e5;
  color: #fff;
  padding: 0.85rem 1.8rem;
  box-shadow: 0 10px 25px rgba(79, 70, 229, 0.35);
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(79, 70, 229, 0.4);
}

.secondary-button {
  background: transparent;
  color: #4f46e5;
  padding: 0.65rem 1.4rem;
  border: 2px solid #c7d2fe;
}

.link-button {
  background: none;
  color: #ef4444;
  padding: 0.35rem 0.75rem;
}

.text-button {
  background: transparent;
  border: none;
  color: #0f172a;
  padding: 0.45rem 0.75rem;
}

.url-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.url-form.compact {
  margin-top: 0.5rem;
  gap: 0.5rem;
  background: #fff;
  padding: 0.85rem;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.field span {
  display: block;
  font-size: 0.85rem;
  color: #475569;
  margin-bottom: 0.35rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #cbd5f5;
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.muted {
  color: #64748b;
}

.empty-state[hidden] {
  display: none;
}

.group-panel {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.25rem;
  background: #f8fafc;
}

.group-panel__header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
}

.group-panel__actions {
  display: flex;
  gap: 0.5rem;
}

.group-name-input {
  flex: 1;
  min-width: 200px;
  border: 1px solid #cbd5f5;
  border-radius: 12px;
  padding: 0.65rem 0.9rem;
  font-size: 1rem;
}

.group-url-list {
  margin-top: 1rem;
}

.group-url-list li {
  align-items: flex-start;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 1rem;
  overflow-y: auto;
  z-index: 50;
  transition: opacity 0.2s ease;
}

.modal[aria-hidden='true'] {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: #fff;
  border-radius: 20px;
  width: min(680px, 100%);
  padding: 1.25rem;
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.modal-header h3 {
  margin: 0;
}

.modal-section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.modal-section__header {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.modal-footer__actions {
  display: flex;
  gap: 0.5rem;
}

.link-button.danger {
  color: #dc2626;
}

.danger-button,
.modal-footer__actions .primary-button {
  min-width: 120px;
  text-align: center;
  padding: 0.65rem 1.5rem;
}

.danger-button {
  border: none;
  background: #dc2626;
  color: #fff;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.3);
}

.user-badge {
  margin-top: 0.15rem;
  font-size: 0.9rem;
}

.auth-card {
  background: #fff;
  padding: 1.5rem 1.75rem;
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
  position: fixed;
  top: 50%;
  right: 3rem;
  transform: translateY(-50%);
  z-index: 5;
}

.auth-card h1 {
  margin: 0 0 0.35rem;
}

.auth-card .muted {
  margin: 0 0 1rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.1rem;
}

.auth-link {
  display: inline-flex;
  align-self: flex-end;
  font-size: 0.85rem;
  color: #4f46e5;
  text-decoration: none;
  font-weight: 600;
  margin-top: -0.25rem;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-form[hidden] {
  display: none;
}

.auth-toggle {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: #f8fafc;
  border-radius: 999px;
  padding: 0.25rem;
  gap: 0.25rem;
}

.toggle-button {
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
}

.toggle-button.active {
  background: #fff;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.15);
  color: #4f46e5;
}

.google-button {
  width: 100%;
  background: #fff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.85rem 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.google-button img {
  width: 20px;
  height: 20px;
}

.divider {
  position: relative;
  text-align: center;
  margin: 1.5rem 0;
  color: #94a3b8;
  font-weight: 600;
}

.divider::before,
.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: #e2e8f0;
}

.divider::before {
  left: 0;
}

.divider::after {
  right: 0;
}

.inline-divider {
  margin: 0.75rem 0 0.5rem;
}

.auth-message {
  margin-top: 1rem;
  min-height: 1.25rem;
  font-weight: 600;
  color: #0f172a;
}

.simple-auth .auth-card {
  position: static;
  transform: none;
  margin: 3rem auto;
}

.auth-message[data-state='error'] {
  color: #dc2626;
}

.auth-message[data-state='success'] {
  color: #16a34a;
}

.error-text {
  color: #dc2626;
  font-weight: 600;
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

@media (max-width: 600px) {
  body {
    padding: 1rem;
  }

  .app-header {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-illustration {
    display: none;
  }

  .auth-card {
    position: static;
    transform: none;
    right: auto;
    top: auto;
    margin: 0 auto;
  }
}
