:root {
  --maxw: 900px;
  --radius: 14px;
  --border: #e9e9e9;
  --btnbg: #f7f7f7;
  --btnbd: #cccccc;
  --text: #111;
  --muted: #333;
  --hint: #666;
  --error: crimson;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: #fff;
}

.container {
  max-width: var(--maxw);
  margin: 24px auto;
  padding: 0 16px;
}

h1 { margin: 0 0 6px; font-size: 28px; }

.lead { margin: 0 0 16px; color: var(--muted); }

.form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 14px; }

.button-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

input {
  padding: 12px;
  font-size: 16px;
  width: 320px;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.btn {
  padding: 12px 14px;
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid var(--btnbd);
  border-radius: 12px;
  background: var(--btnbg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  user-select: none;
  color: inherit;
}

.btn-secondary {
  background: #fff;
}

.btn:disabled { opacity: 0.6; cursor: default; }

.msg { margin-top: 10px; font-size: 14px; }
.msg.is-error { color: var(--error); }

.result {
  margin-top: 18px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

/* WICHTIG: Ergebnisblock wirklich weg */
.result.is-hidden { display: none; }

.preview {
  flex: 1 1 560px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fafafa;
}

.preview img {
  display: block;
  width: 100%;
  height: auto;
}

/* WICHTIG: IMG zuverlässig weg (höhere Spezifität als .preview img) */
img.is-hidden { display: none; }

.actions {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: static; /* default: kein sticky */
}

.hint { margin: 0; font-size: 13px; color: var(--hint); }

.hof-card {
  margin-top: 28px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  background:
    radial-gradient(circle at top right, rgba(87, 119, 153, 0.1), transparent 26%),
    linear-gradient(180deg, #fcfcfc 0%, #f7f7f7 100%);
}

.hof-card__head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #4f5b67;
}

.hof-card h2,
.embed-box h3,
.modal__head h2 {
  margin: 0;
}

.hof-card__lead {
  margin: 8px 0 0;
  max-width: 760px;
  color: var(--muted);
}

.hof-status {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
}

.hof-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.hof-item,
.hof-list__empty {
  display: grid;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.88);
}

.hof-item {
  grid-template-columns: auto 1fr auto;
}

.hof-item__rank {
  min-width: 56px;
  font-size: 13px;
  font-weight: 700;
  color: #4f5b67;
}

.hof-item__name {
  font-size: 18px;
  font-weight: 700;
}

.hof-item__count {
  font-size: 14px;
  color: var(--muted);
}

.hof-list__empty {
  color: var(--muted);
}

.embed-box {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.embed-box__head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.code {
  width: 100%;
  min-height: 120px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  resize: vertical;
  font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #fff;
  color: #1c1c1c;
}

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

.modal.is-hidden {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, 0.56);
}

.modal__panel {
  position: relative;
  width: min(100%, 560px);
  border-radius: 18px;
  background: #fff;
  padding: 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.modal__head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

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

.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

body.has-modal {
  overflow: hidden;
}

/* Mobile */
@media (max-width: 820px) {
  .container { margin: 14px auto; }
  h1 { font-size: 24px; }

  .form { flex-direction: column; align-items: stretch; }
  input { width: 100%; }
  .btn { width: 100%; }
  .button-group { width: 100%; }

  .result { flex-direction: column; }
  .actions { width: 100%; flex: 0 0 auto; }
  .hof-card,
  .modal__panel { padding: 16px; }
  .hof-card__head,
  .embed-box__head {
    flex-direction: column;
  }
  .hof-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .hof-item__rank {
    min-width: 0;
  }
}

/* Desktop: sticky nur hier */
@media (min-width: 821px) {
  .actions {
    position: sticky;
    top: 16px;
  }
}
