/* ───────── Lay Summary Generator — base ───────── */
*,
*::before,
*::after { box-sizing: border-box; }

:root {
  --bg-0: #06060f;
  --bg-1: #0c0c1a;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-strong: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #e7e9f3;
  --text-muted: #9a9eb3;
  --accent-a: #00e0d4;
  --accent-b: #7b5cff;
  --accent-c: #f472b6;
  --danger: #f87171;
  --warn: #fbbf24;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 30px 80px -30px rgba(0, 0, 0, 0.7),
                 0 1px 0 0 rgba(255, 255, 255, 0.05) inset;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  position: relative;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-a); }

/* ───────── Animated mesh background ───────── */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(123, 92, 255, 0.20), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(0, 224, 212, 0.15), transparent 60%),
    linear-gradient(180deg, #050510 0%, #0a0a1c 100%);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: drift 24s ease-in-out infinite;
}
.blob-1 {
  width: 480px; height: 480px;
  background: radial-gradient(circle, var(--accent-b), transparent 60%);
  top: -120px; left: -80px;
}
.blob-2 {
  width: 540px; height: 540px;
  background: radial-gradient(circle, var(--accent-a), transparent 60%);
  bottom: -160px; right: -120px;
  animation-delay: -8s;
}
.blob-3 {
  width: 360px; height: 360px;
  background: radial-gradient(circle, var(--accent-c), transparent 65%);
  top: 50%; left: 40%;
  opacity: 0.30;
  animation-delay: -16s;
}
@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33%      { transform: translate3d(40px, -30px, 0) scale(1.06); }
  66%      { transform: translate3d(-30px, 20px, 0) scale(0.96); }
}

/* ───────── Layout ───────── */
main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px;
  max-width: 1200px;
  margin: 0 auto;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.brand:hover { color: inherit; }
.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-a);
}
.brand-accent {
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.top-links a {
  color: var(--text-muted);
  font-size: 14px;
}
.top-links a:hover { color: var(--text); }

.hero {
  text-align: center;
  padding: 40px 12px 30px;
}
.hero h1 {
  font-size: clamp(28px, 4.6vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 800;
  margin: 0 0 14px;
}
.grad {
  background: linear-gradient(120deg, var(--accent-a), var(--accent-b) 50%, var(--accent-c));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .sub {
  font-size: clamp(15px, 1.6vw, 17px);
  color: var(--text-muted);
  max-width: 660px;
  margin: 0 auto;
}

/* ───────── Cards (glass) ───────── */
.card {
  background: var(--surface);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 26px;
  margin-top: 22px;
  animation: cardIn 0.45s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hidden { display: none !important; }
.muted { color: var(--text-muted); margin: 0; }
.small { font-size: 13px; }

/* ───────── Input form ───────── */
.field { margin-bottom: 18px; }
.field:last-of-type { margin-bottom: 22px; }
.field-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.005em;
  margin-bottom: 8px;
  color: var(--text);
}
.field-label.small { font-size: 13px; margin-top: 10px; }

#paper-text {
  width: 100%;
  min-height: 200px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  padding: 14px 16px;
  font: inherit;
  font-size: 14.5px;
  line-height: 1.55;
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#paper-text:focus {
  outline: none;
  border-color: var(--accent-a);
  box-shadow: 0 0 0 3px rgba(0, 224, 212, 0.15);
}
#paper-text::placeholder { color: var(--text-muted); opacity: 0.65; }

#article-url {
  width: 100%;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  margin-top: 4px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#article-url:focus {
  outline: none;
  border-color: var(--accent-a);
  box-shadow: 0 0 0 3px rgba(0, 224, 212, 0.15);
}

.field-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  font-size: 12.5px;
}
.field-meta .warn { color: var(--warn); }

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.radio-pill {
  cursor: pointer;
  user-select: none;
}
.radio-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.radio-pill span {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  transition: all 0.15s ease;
}
.radio-pill:hover span {
  color: var(--text);
  border-color: var(--text-muted);
}
.radio-pill input:checked + span {
  color: #0a0a1a;
  background: linear-gradient(120deg, var(--accent-a), var(--accent-b));
  border-color: transparent;
  font-weight: 600;
}
.radio-pill input:focus-visible + span {
  outline: 2px solid var(--accent-a);
  outline-offset: 2px;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 14.5px;
}
.checkbox-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.32);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.checkbox-row input[type="checkbox"]:checked {
  background: linear-gradient(120deg, var(--accent-a), var(--accent-b));
  border-color: transparent;
}
.checkbox-row input[type="checkbox"]:checked::after {
  content: "";
  width: 5px;
  height: 9px;
  border: solid #0a0a1a;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.linkedin-extra {
  margin-top: 10px;
  padding-left: 28px;
}

/* ───────── Buttons ───────── */
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  letter-spacing: 0.005em;
}
.btn-primary {
  background: linear-gradient(120deg, var(--accent-a), var(--accent-b));
  color: #0a0a1a;
  box-shadow: 0 10px 30px -10px rgba(0, 224, 212, 0.55);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 36px -12px rgba(123, 92, 255, 0.6);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover {
  background: var(--surface-strong);
  border-color: var(--text-muted);
}
.btn-icon {
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
}

/* ───────── Loading ───────── */
.loader-shell {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 14px 4px;
}
.loader-ring {
  width: 56px; height: 56px;
  border-radius: 50%;
  background:
    conic-gradient(from 0deg, var(--accent-a), var(--accent-b), var(--accent-c), var(--accent-a));
  mask: radial-gradient(closest-side, transparent 60%, #000 62%);
  -webkit-mask: radial-gradient(closest-side, transparent 60%, #000 62%);
  animation: spin 1.2s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-label h3 { margin: 0 0 4px; font-size: 18px; }
.loader-label p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* ───────── Results grid ───────── */
.results-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  margin-top: 22px;
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}
.results-grid.single { max-width: 720px; }
.results-grid .card { margin-top: 0; }

.panel-card {
  display: flex;
  flex-direction: column;
  min-height: 280px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}
.panel-head h2 {
  margin: 0 0 2px;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.panel-head-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.icon-action {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.icon-action:hover {
  color: var(--text);
  border-color: var(--accent-a);
  background: rgba(0, 224, 212, 0.06);
}
.icon-action:active { transform: scale(0.95); }
.icon-action.busy {
  pointer-events: none;
  opacity: 0.5;
  animation: spin 0.9s linear infinite;
}
.icon-action.copied {
  color: var(--accent-a);
  border-color: var(--accent-a);
}

.panel-body {
  flex: 1;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  color: var(--text);
}
.panel-body p { margin: 0 0 12px; }
.panel-body p:last-child { margin-bottom: 0; }
.panel-body.regen {
  opacity: 0.45;
  filter: blur(0.5px);
  transition: opacity 0.2s ease;
}

.panel-foot {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

/* ───────── Toast ───────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(20, 20, 36, 0.95);
  border: 1px solid var(--accent-a);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px -10px rgba(0, 224, 212, 0.4);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ───────── Error ───────── */
.error-card {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.05);
}
.error-card h3 { margin: 0 0 8px; color: var(--danger); }
.error-card p { margin: 0 0 16px; color: var(--text); }

/* ───────── Footer ───────── */
.foot {
  text-align: center;
  padding: 30px 20px 50px;
  color: var(--text-muted);
  font-size: 13px;
}
.foot a { color: var(--accent-a); }

/* ───────── Max-words input row ───────── */
.word-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.word-input-row input[type="number"] {
  width: 110px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.18s ease;
}
.word-input-row input[type="number"]:focus {
  border-color: var(--accent-a);
}

/* ───────── Bilingual sections inside panels ───────── */
.lang-head {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-a);
  background: rgba(0, 224, 212, 0.08);
  border: 1px solid rgba(0, 224, 212, 0.25);
  padding: 2px 8px;
  border-radius: 6px;
  margin-right: 8px;
  vertical-align: middle;
}
.panel-body h4.lang-head {
  display: inline-block;
  margin: 18px 0 10px;
}
.panel-body h4.lang-head:first-child { margin-top: 4px; }

/* ───────── Title panel — always full-width above summary panels ───────── */
.panel-title { grid-column: 1 / -1; }
.panel-title .title-body {
  padding-top: 4px;
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  min-height: 0;
}
.panel-title .panel-head { margin-bottom: 6px; }

/* ───────── Language toggle (NL / EN switcher on each panel) ───────── */
.lang-toggle {
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  overflow: hidden;
  margin-right: 8px;
  background: rgba(255, 255, 255, 0.02);
}
.lang-toggle button {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.lang-toggle button + button {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}
.lang-toggle button:hover {
  color: var(--text);
}
.lang-toggle button.active {
  background: rgba(0, 224, 212, 0.16);
  color: var(--accent-a);
}
.lang-toggle button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ───────── Accessibility ───────── */
@media (prefers-reduced-motion: reduce) {
  .blob, .loader-ring { animation: none !important; }
  .card { animation: none !important; }
  .btn { transition: none !important; }
}
