:root {
  --indigo: #4f46e5;
  --navy: #172554;
  --glass-border: rgba(255, 255, 255, .64);
  --mobile-gutter: 1rem;
}

* { box-sizing: border-box; }
html { min-width: 320px; overflow-x: hidden; }
body {
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  min-width: 320px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 5%, rgba(251, 191, 36, .18), transparent 25rem),
    radial-gradient(circle at 90% 15%, rgba(129, 140, 248, .18), transparent 24rem),
    radial-gradient(circle at 50% 100%, rgba(45, 212, 191, .14), transparent 26rem),
    #f5f7ff;
}

.soft-grid {
  background-image: linear-gradient(rgba(99, 102, 241, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, .06) 1px, transparent 1px);
  background-size: 28px 28px;
}

.card-shadow {
  border: 1px solid var(--glass-border);
  box-shadow: 0 22px 60px rgba(79, 70, 229, .12), inset 0 1px 0 rgba(255, 255, 255, .72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.glass-card {
  border: 1px solid rgba(255, 255, 255, .58);
  background: linear-gradient(135deg, rgba(255, 255, 255, .78), rgba(255, 255, 255, .47));
  box-shadow: 0 22px 60px rgba(79, 70, 229, .13), inset 0 1px 0 rgba(255, 255, 255, .8);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.glass-header {
  border-bottom: 1px solid rgba(255, 255, 255, .64);
  background: rgba(255, 255, 255, .52);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.glass-output {
  border: 1px solid rgba(255, 255, 255, .2);
  background: linear-gradient(145deg, rgba(30, 41, 90, .86), rgba(79, 70, 229, .78));
  box-shadow: 0 24px 65px rgba(49, 46, 129, .24);
}
.field {
  width: 100%;
  border: 1px solid rgba(129, 140, 248, .28);
  border-radius: .85rem;
  background: rgba(255, 255, 255, .68);
  padding: .82rem 1rem;
  color: #1e293b;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field:focus { border-color: #818cf8; box-shadow: 0 0 0 4px rgba(129, 140, 248, .17), 0 6px 18px rgba(99, 102, 241, .09); }
textarea.field { resize: vertical; min-height: 7rem; }
.toast {
  position: fixed; z-index: 50; right: 1rem; bottom: 1rem;
  transform: translateY(5rem); opacity: 0; pointer-events: none;
  border-radius: .85rem; background: #172554; color: white;
  padding: .85rem 1.1rem; font-size: .875rem; transition: .25s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }
.prompt-output { white-space: pre-wrap; word-break: break-word; }
.brand-icon {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: .55rem;
  object-fit: cover;
  box-shadow: 0 3px 10px rgba(79, 70, 229, .25);
}
.brand-icon-lg { width: 2.5rem; height: 2.5rem; border-radius: .75rem; }
.portal-menu { display: flex; align-items: center; gap: .35rem; margin-left: auto; margin-right: 1.5rem; }
.portal-menu a { padding: .55rem .75rem; border-radius: .7rem; color: #64748b; font-size: .75rem; font-weight: 700; text-decoration: none; transition: background .2s, color .2s; }
.portal-menu a:hover, .portal-menu .portal-menu-active { color: #4338ca; background: #eef2ff; }
.portal-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
  color: #fff;
  background: radial-gradient(circle at 6% 15%, rgba(34, 211, 238, .2), transparent 28rem),
    radial-gradient(circle at 100% 85%, rgba(168, 85, 247, .32), transparent 32rem),
    linear-gradient(135deg, #06264a 0%, #111c52 52%, #301154 100%);
}
.portal-login-card {
  width: min(100%, 78rem);
  display: grid;
  grid-template-columns: minmax(20rem, .95fr) minmax(24rem, 1.05fr);
  gap: 3.5rem;
  padding: 2.5rem;
  border: 1px solid rgba(186, 230, 253, .28);
  border-radius: 2.25rem;
  background: rgba(255, 255, 255, .09);
  box-shadow: 0 2rem 6rem rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .18);
  backdrop-filter: blur(24px);
}
.portal-login-art {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 31rem;
  overflow: hidden;
  padding: 2rem;
  border: 1px solid rgba(125, 211, 252, .38);
  border-radius: 2rem;
  background: linear-gradient(145deg, rgba(14, 165, 233, .25), rgba(99, 102, 241, .18));
}
.portal-login-art img {
  position: relative;
  z-index: 1;
  width: min(100%, 25rem);
  aspect-ratio: 1;
  object-fit: cover;
  border: .55rem solid rgba(255, 255, 255, .9);
  border-radius: 2rem;
  box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, .32), 0 0 2rem rgba(34, 211, 238, .32);
}
.portal-art-glow { position: absolute; width: 20rem; height: 20rem; border-radius: 50%; background: #22d3ee; filter: blur(5rem); opacity: .25; }
.portal-art-caption { position: absolute; bottom: 1.2rem; z-index: 2; display: flex; gap: .6rem; align-items: center; font-size: .65rem; letter-spacing: .22em; color: rgba(255, 255, 255, .78); }
.portal-art-caption b { color: #67e8f9; font-size: 1rem; }
.portal-login-form { display: flex; flex-direction: column; justify-content: center; padding: 1rem 1.5rem; }
.portal-kicker { color: #bfdbfe; font-size: .85rem; font-weight: 800; letter-spacing: .2em; }
.portal-login-form h1 { margin: .8rem 0 .8rem; font-size: clamp(2.2rem, 4vw, 3.5rem); line-height: 1.05; font-weight: 800; letter-spacing: -.04em; }
.portal-lead { max-width: 28rem; color: #cbd5e1; font-size: 1.05rem; line-height: 1.65; }
.portal-label { display: block; margin-top: 1.75rem; color: #e0f2fe; font-size: .9rem; font-weight: 700; }
.portal-input { width: 100%; margin-top: .65rem; padding: 1rem 1.2rem; border: 1px solid rgba(186, 230, 253, .35); border-radius: 1rem; outline: none; color: #fff; background: rgba(255, 255, 255, .14); font: inherit; }
.portal-input::placeholder { color: rgba(219, 234, 254, .6); }
.portal-input:focus { border-color: #67e8f9; box-shadow: 0 0 0 4px rgba(34, 211, 238, .15); }
.portal-submit { width: 100%; margin-top: 1.75rem; padding: 1rem 1.25rem; border: 1px solid rgba(103, 232, 249, .6); border-radius: 1rem; color: #fff; background: linear-gradient(100deg, #0ea5e9, #4f46e5 70%, #7c3aed); font-size: 1rem; font-weight: 800; box-shadow: 0 .75rem 2rem rgba(79, 70, 229, .35); transition: transform .2s, filter .2s; }
.portal-submit:hover { filter: brightness(1.12); transform: translateY(-2px); }
.portal-submit span { margin-left: .5rem; font-size: 1.4rem; vertical-align: -.1rem; }
.portal-note { margin-top: 1.5rem; color: rgba(191, 219, 254, .65); font-size: .75rem; line-height: 1.6; }
.bg-indigo-600 { background-color: #6366f1 !important; }
.bg-indigo-500 { background-color: #818cf8 !important; }
.bg-emerald-500 { background-color: #14b8a6 !important; }
.bg-amber-100 { background-color: rgba(254, 243, 199, .78) !important; }
.bg-indigo-50 { background-color: rgba(238, 242, 255, .78) !important; }
.hover\:bg-indigo-700:hover { background-color: #4f46e5 !important; }
.hover\:bg-indigo-400:hover { background-color: #6366f1 !important; }
.hover\:bg-emerald-400:hover { background-color: #0d9488 !important; }
@media (max-width: 640px) { .hero-title { font-size: 2rem; line-height: 1.15; } }

@media (max-width: 640px) {
  :root { --mobile-gutter: max(1rem, env(safe-area-inset-left)); }

  body { padding-bottom: env(safe-area-inset-bottom); }

  .glass-header {
    position: sticky;
    top: 0;
    z-index: 20;
    padding-top: env(safe-area-inset-top);
  }

  .glass-header > div {
    min-height: 4.25rem;
    padding-left: var(--mobile-gutter);
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .glass-header .brand-icon-lg {
    width: 2.25rem;
    height: 2.25rem;
  }

  .glass-header p:first-child {
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .875rem;
  }

  .glass-header p:last-child { font-size: .6875rem; }
  .glass-header .text-sm { font-size: .75rem; }
  .glass-header button { padding: .5rem .625rem; }
  .portal-menu { display: none; }

  main.mx-auto {
    width: 100%;
    padding-left: var(--mobile-gutter);
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-top: 1.5rem;
    padding-bottom: 2rem;
  }

  main.mx-auto > section:first-child { margin-bottom: 1.5rem; }
  .hero-title { font-size: clamp(1.8rem, 8vw, 2.25rem); }
  .card-shadow,
  .glass-card,
  .glass-output { border-radius: 1.25rem; }
  .glass-card,
  .glass-output { padding: 1rem; }
  .glass-output { min-height: 27rem; }
  .field { min-height: 2.875rem; font-size: 1rem; }
  textarea.field { min-height: 8rem; }
  .source-check { flex: 0 0 auto; }
  #quick-actions { grid-template-columns: 1fr; }
  #quick-actions button { min-height: 2.875rem; }
  #output { overflow-wrap: anywhere; }

  .portal-login { padding: 1rem; align-items: start; }
  .portal-login-card { display: block; padding: 1rem; border-radius: 1.5rem; }
  .portal-login-art { min-height: auto; padding: 1rem; border-radius: 1.2rem; }
  .portal-login-art img { width: min(100%, 18rem); border-width: .35rem; border-radius: 1.25rem; }
  .portal-art-caption { bottom: .65rem; font-size: .5rem; letter-spacing: .12em; }
  .portal-login-form { padding: 2rem .25rem .75rem; }
  .portal-login-form h1 { font-size: 2.25rem; }
  .portal-lead { font-size: .95rem; }
}

@media (max-width: 380px) {
  .glass-header p:first-child { max-width: 9rem; }
  .glass-header .brand-icon-lg { width: 2rem; height: 2rem; }
  main.mx-auto { padding-left: .75rem; padding-right: .75rem; }
  .glass-card, .glass-output { padding: .875rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}
