:root {
  color-scheme: dark;
  --bg: #090909;
  --panel: #151515;
  --panel-2: #1f1f1f;
  --header: #101010;
  --topbar: #111111;
  --item: #131313;
  --answer: #242424;
  --input: #0d0d0d;
  --line: #303030;
  --text: #f4f4f4;
  --muted: #b8b8b8;
  --strong: #ffffff;
  --button-text: #ffffff;
  --red: #e5232f;
  --red-dark: #a9141d;
  --ok: #1e9f63;
  --warn: #d69821;
  --error: #d84040;
  --shadow-red: rgba(229, 35, 47, 0.18);
  --logo-filter: none;
  --theme-toggle-bg: #f4f4f4;
  --theme-toggle-color: #141414;
  font-family: Arial, Helvetica, sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f4f4;
  --panel: #ffffff;
  --panel-2: #ececec;
  --header: #ffffff;
  --topbar: #ffffff;
  --item: #ffffff;
  --answer: #eeeeee;
  --input: #ffffff;
  --line: #cecece;
  --text: #141414;
  --muted: #555555;
  --strong: #000000;
  --button-text: #ffffff;
  --shadow-red: rgba(229, 35, 47, 0.2);
  --logo-filter: invert(1);
  --theme-toggle-bg: #141414;
  --theme-toggle-color: #f4f4f4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--text);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(16px, 4vw, 56px) 22px;
  border-bottom: 1px solid var(--line);
  background: var(--header);
}

.hero-copy {
  display: flex;
  align-items: center;
  gap: clamp(18px, 4vw, 36px);
  min-width: 0;
}

.site-logo {
  width: min(260px, 34vw);
  min-width: 180px;
  height: auto;
  filter: var(--logo-filter) drop-shadow(0 18px 28px var(--shadow-red));
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1.02;
}

h2 {
  margin: 28px 0 12px;
  color: var(--strong);
  font-size: 20px;
}

.button,
.download-button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--red);
  border-radius: 8px;
  background: var(--red);
  color: var(--button-text);
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button.secondary,
button.secondary {
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--text);
}

.danger {
  border-color: var(--error);
  background: var(--error);
}

.front-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 24px;
  width: min(1420px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 56px) 56px;
}

.front-panel {
  min-width: 0;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 2px solid var(--red);
  padding-bottom: 10px;
}

.section-title span {
  font-size: 24px;
  font-weight: 800;
}

.section-title p {
  margin: 0;
  color: var(--muted);
}

.accordion-list {
  display: grid;
  gap: 10px;
}

.accordion-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--item);
  overflow: hidden;
}

.accordion-item summary {
  min-height: 56px;
  padding: 16px 48px 16px 16px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  position: relative;
}

.accordion-item summary::-webkit-details-marker {
  display: none;
}

.accordion-item summary::after {
  content: "+";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--red);
  font-size: 24px;
}

.accordion-item[open] summary::after {
  content: "-";
}

.accordion-content {
  border-top: 1px solid var(--line);
  box-shadow: inset 4px 0 0 var(--red);
  margin: 0;
  padding: 18px 18px 18px 22px;
  background: var(--answer);
  color: var(--text);
  line-height: 1.55;
}

.accordion-content p:first-child {
  margin-top: 0;
}

.file-meta,
.empty {
  color: var(--muted);
}

.download-button {
  margin-top: 10px;
}

.admin-body {
  background: var(--bg);
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(14px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--strong);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.admin-logo {
  width: 132px;
  max-width: 36vw;
  height: auto;
  filter: var(--logo-filter);
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.theme-toggle {
  min-width: 42px;
  width: 42px;
  min-height: 42px;
  padding: 0;
  border-color: var(--theme-toggle-bg);
  background: var(--theme-toggle-bg);
  color: var(--theme-toggle-color);
  font-size: 22px;
  line-height: 1;
}

.theme-icon {
  width: 22px;
  height: 22px;
  display: block;
}

.admin-nav a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--muted);
  text-decoration: none;
}

.admin-nav a:hover {
  border-color: var(--red);
  color: var(--strong);
}

.admin-shell {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 26px clamp(14px, 3vw, 34px) 60px;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.page-heading p {
  margin: 0;
  color: var(--muted);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.4fr);
  gap: 18px;
  align-items: start;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

.card h2,
.card h3 {
  margin-top: 0;
}

.stack {
  display: grid;
  gap: 12px;
}

.field-block,
label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.field-label {
  color: var(--muted);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input);
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

.rich-editor {
  display: grid;
  gap: 8px;
}

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rich-link-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 12px;
}

.rich-link-panel[hidden] {
  display: none;
}

.rich-link-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.rich-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rich-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.rich-area {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input);
  color: var(--text);
  padding: 12px;
  line-height: 1.5;
  outline: none;
}

.rich-area:focus {
  border-color: var(--red);
}

.rich-area a,
.accordion-content a {
  color: var(--red);
  font-weight: 800;
}

.rich-source {
  display: none;
}

.row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: auto;
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 14px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actions form {
  margin: 0;
}

.link-button {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}

.flash {
  border-radius: 8px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--panel-2);
}

.flash-success {
  border: 1px solid var(--ok);
}

.flash-warning {
  border: 1px solid var(--warn);
}

.flash-error {
  border: 1px solid var(--error);
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
}

.auth-card {
  width: min(480px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 24px;
  display: grid;
  gap: 14px;
}

.auth-card h1 {
  font-size: 34px;
}

.auth-logo {
  width: min(320px, 100%);
  height: auto;
  filter: var(--logo-filter);
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a::after {
  content: "/";
  margin-left: 8px;
  color: var(--line);
}

.breadcrumbs a:last-child::after {
  content: "";
}

.file-browser {
  min-width: 760px;
}

.badge {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 13px;
}

.sortable-list {
  display: grid;
  gap: 10px;
}

.sortable-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
  transition: transform 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.sortable-row.is-dragging {
  opacity: 0.55;
  border-color: var(--red);
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--red);
  cursor: grab;
  font-weight: 900;
}

.sortable-main {
  min-width: 0;
}

.sortable-title {
  display: block;
  color: var(--strong);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 24px clamp(16px, 4vw, 56px) 34px;
  background: var(--header);
}

.footer-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 124px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 9px 14px;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  text-align: center;
}

dialog.imprint-dialog {
  width: min(720px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 0;
}

dialog.imprint-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.dialog-inner {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.dialog-head h2 {
  margin: 0;
}

.cookie-banner {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

.cookie-banner.is-visible {
  display: flex;
}

.cookie-banner p {
  margin: 0;
  color: var(--muted);
}

.sortable-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}

.sort-save {
  margin-top: 12px;
}

.sort-save:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .site-header,
  .admin-topbar,
  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-nav {
    justify-content: flex-start;
  }

  .front-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .front-grid {
    padding-top: 20px;
  }

  .section-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .hero-copy {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-logo {
    width: min(260px, 100%);
  }
}

@media (max-width: 620px) {
  .site-header {
    padding-top: 24px;
  }

  .row,
  .password-field,
  .rich-link-grid,
  .rich-toolbar {
    grid-template-columns: 1fr;
  }

  .button,
  .download-button,
  button:not(.theme-toggle) {
    width: 100%;
  }

  .theme-toggle {
    width: 42px;
  }

  .site-footer .footer-link {
    width: 100%;
  }

  .cookie-banner,
  .dialog-head {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    flex-direction: column;
  }

  .sortable-row {
    grid-template-columns: 1fr;
  }

  .drag-handle {
    width: 100%;
  }

  .actions .link-button,
  .actions button {
    width: 100%;
  }
}
