*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-muted: #5c5c7a;
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --accent-light: #eef2ff;
  --border: #e8e8f0;
  --danger: #dc2626;
  --success: #059669;
  --shadow: 0 4px 24px rgba(26, 26, 46, 0.06);
  --radius: 14px;
  --max-width: 980px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

a:hover {
  opacity: 0.85;
}

.container {
  width: min(100% - 2rem, var(--max-width));
  margin: 0 auto;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner,
.dashboard-head,
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
}

.brand {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text);
}

.site-nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

main.container {
  padding: 2rem 0 4rem;
}

.site-footer,
.portal-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  color: var(--text-muted);
  text-align: center;
}

.hero {
  padding: 3rem 0 2rem;
  max-width: 760px;
}

.hero h1,
.dashboard-head h1,
.page-head h1,
.auth-card h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.lead {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.eyebrow,
.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.muted {
  color: var(--text-muted);
}

.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 0.75rem 1.2rem;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

.btn:hover,
button.btn:hover {
  background: var(--accent-dark);
  opacity: 1;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--accent-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.btn-small {
  padding: 0.5rem 0.9rem;
  font-size: 0.9rem;
}

.btn-add {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  font-size: 2rem;
  line-height: 1;
  padding: 0;
}

.hero-actions,
.card-actions,
.form-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.card,
.auth-card,
.module-type-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.feature-grid,
.module-grid,
.module-type-grid {
  display: grid;
  gap: 1rem;
}

.feature-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 2rem 0;
}

.module-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.module-type-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.cta-panel {
  margin-top: 2rem;
  text-align: center;
}

.quick-links {
  margin-top: 2rem;
}

.quick-links h2 {
  margin-bottom: 0.35rem;
}

.quick-links-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.quick-link {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
}

.quick-link:hover {
  background: var(--accent-light);
  color: var(--accent);
  opacity: 1;
}

.stack-form,
.form-grid {
  display: grid;
  gap: 1rem;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid .full {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.92rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  font: inherit;
  background: #fff;
}

textarea {
  resize: vertical;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-weight: 400;
}

.checkbox input {
  margin-top: 0.25rem;
}

.auth-card {
  max-width: 520px;
  margin: 0 auto;
}

.alert {
  padding: 0.9rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.alert-success {
  background: #ecfdf5;
  color: var(--success);
}

.alert-error {
  background: #fef2f2;
  color: var(--danger);
}

.error-list {
  background: #fef2f2;
  color: var(--danger);
  border-radius: 10px;
  padding: 1rem 1rem 1rem 2rem;
  margin-bottom: 1rem;
}

.module-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
}

.modal-dialog {
  position: relative;
  width: min(100%, 720px);
  max-height: 90vh;
  overflow: auto;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.repeatable-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1rem 0;
}

.repeatable-items {
  display: grid;
  gap: 1rem;
}

.text-link {
  display: inline-block;
  margin-bottom: 0.5rem;
}

.page-portal {
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--bg) 280px);
}

.portal-hero {
  padding: 4rem 0 2rem;
  text-align: center;
}

.portal-hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  letter-spacing: -0.03em;
}

.portal-nav {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.portal-nav a {
  color: var(--text-muted);
  font-weight: 600;
}

.portal-main {
  padding-bottom: 4rem;
}

.portal-section {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}

.portal-section h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.about-name {
  font-size: 1.3rem;
  font-weight: 700;
}

.about-tagline,
.about-location {
  color: var(--text-muted);
}

.about-bio p + p {
  margin-top: 1rem;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.project-card h3 {
  margin-bottom: 0.5rem;
}

.project-card p {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tags span {
  font-size: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}

.account-section {
  margin-bottom: 1.5rem;
}

.account-section h2 {
  margin-bottom: 0.35rem;
}

.account-section .stack-form {
  margin-top: 1rem;
}

.module-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.module-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}

.module-badge-public,
.module-badge-interactive {
  background: #ecfdf5;
  color: var(--success);
  border-color: #bbf7d0;
}

.module-badge-optional_public {
  background: var(--accent-light);
  color: var(--accent);
  border-color: #c7d2fe;
}

.module-badge-private {
  background: #f8fafc;
  color: var(--text-muted);
}

.module-type-emoji {
  font-size: 1.6rem;
  margin-bottom: 0.35rem;
}

.module-type-grid {
  max-height: 60vh;
  overflow: auto;
}

.module-publish-toggle {
  padding: 0.75rem 0;
}

.align-end {
  align-self: end;
}

.compact-item {
  padding: 1rem;
}

.backend-preview {
  margin-top: 1rem;
  background: var(--bg);
}

.entry-list,
.poll-stats,
.portal-list {
  list-style: none;
  display: grid;
  gap: 0.75rem;
}

.entry-list li,
.portal-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  margin-left: 0.35rem;
}

.tag-pending {
  background: #fef3c7;
  color: #92400e;
}

.portal-list.check-list li::before {
  content: "○";
  margin-right: 0.5rem;
  color: var(--accent);
}

.link-list a {
  font-weight: 600;
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.countdown-card {
  text-align: center;
}

.countdown-emoji {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.countdown-days {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0.5rem 0;
}

.quote-card {
  font-size: 1.15rem;
}

.quote-card footer {
  margin-top: 0.75rem;
  color: var(--text-muted);
}

.wish-list .priority {
  display: inline-block;
  min-width: 4.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-right: 0.5rem;
}

.priority-hoch { color: #dc2626; }
.priority-mittel { color: var(--accent); }
.priority-niedrig { color: var(--text-muted); }

.interactive-section .portal-form {
  margin: 1.25rem 0;
}

.guestbook-entries {
  display: grid;
  gap: 1rem;
}

.guestbook-entry time {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0.25rem 0 0.5rem;
}

.poll-options {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.poll-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 500;
}

.poll-results {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.poll-result-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.poll-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}

.poll-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #7c3aed);
}

select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  font: inherit;
  background: #fff;
}

.media-grid,
.recipe-grid,
.updates-feed,
.feedback-list {
  display: grid;
  gap: 1rem;
}

.media-grid,
.recipe-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.media-type {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
}

.faq-list {
  display: grid;
  gap: 0.75rem;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
}

.faq-item p {
  margin-top: 0.75rem;
  color: var(--text-muted);
}

.update-item time {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.quiz-question-block {
  border: none;
  margin-bottom: 1rem;
  padding: 0;
}

.quiz-question-block legend {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.quiz-result {
  text-align: center;
}

.quiz-score {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.feedback-list blockquote footer {
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.gallery-item img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 10px;
}

.gallery-item figcaption {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.status-card {
  display: grid;
  gap: 0.5rem;
  align-items: start;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.4rem;
}

.status-open { background: #22c55e; }
.status-limited { background: #f59e0b; }
.status-busy { background: #ef4444; }

.modal-dialog {
  max-width: min(920px, 100%);
}

@media (max-width: 720px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .header-inner,
  .dashboard-head,
  .page-head,
  .module-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
}
