:root {
  --ground: #F6F2EC;
  --card: #FFFFFF;
  --ink: #2A1E14;
  --muted: #6B5A4A;
  --line: #E3D8C9;
  --field: #CDBFAC;
  --accent: #A85A0C;
  --accent-dark: #7A4008;
  --amber: #D98A2B;
  --star: #E9A23B;
  --star-line: #B8730F;
  --soft: #F3EBDF;
  --danger: #A3321F;
  --ok: #2F7D4A;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
h1, h2, .brand-title, .big-num, .huge-num {
  font-family: 'Bricolage Grotesque', Inter, sans-serif;
}
h1 { margin: 0; font-weight: 800; font-size: 30px; line-height: 1.15; }
h2 { margin: 28px 0 12px; font-weight: 600; font-size: 21px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 720px; margin: 0 auto; padding: 24px 16px 64px; }
main { display: flex; flex-direction: column; gap: 16px; }

/* Kopf */
.site-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-bottom: 16px; margin-bottom: 24px; border-bottom: 2px solid var(--ink);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand svg { color: var(--accent); flex: none; }
.brand > span { display: flex; flex-direction: column; }
.brand-title { font-weight: 800; font-size: 28px; line-height: 1.1; }
.brand-sub { color: var(--muted); font-size: 14px; }
.admin-nav { display: flex; align-items: center; gap: 16px; font-weight: 600; }
.admin-nav form { margin: 0; }
.login-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 600; text-decoration: none; }
.pill.pill-admin { background: var(--ink); color: #FFFFFF; }
.admin-box { display: flex; flex-direction: column; gap: 12px; border-style: dashed; border-color: var(--field); }
.admin-box-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.rank-main .pill { display: inline-block; margin-top: 4px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 18px; border: none; border-radius: 10px;
  background: var(--accent); color: #FFFFFF; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--accent-dark); color: #FFFFFF; }
.btn-big { min-height: 52px; font-size: 17px; border-radius: 12px; width: 100%; }
.btn-light { background: #F2B66B; color: var(--ink); }
.btn-light:hover { background: #E9A23B; color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--field); }
.btn-ghost:hover { background: var(--soft); color: var(--ink); }
.link-btn { min-height: 44px; padding: 0; border: none; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.link-btn:hover { color: var(--accent-dark); text-decoration: underline; }
.danger, .btn-ghost.danger { color: var(--danger); }
:focus-visible { outline: 3px solid #1F5FAD; outline-offset: 2px; }

/* Karten */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.empty { text-align: center; padding: 32px 16px; display: flex; flex-direction: column; gap: 8px; }
.flash { background: #E6F2EA; color: #1E5232; border-radius: 10px; padding: 10px 14px; margin: 0 0 16px; }
.errors { background: #FBE9E5; color: #7E2414; border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; gap: 4px; }

.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }

/* Rangliste */
.ranking { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.rank-card {
  display: flex; align-items: center; gap: 16px; padding: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  color: var(--ink); text-decoration: none;
}
.rank-card:hover { color: var(--ink); border-color: var(--amber); }
.rank {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; background: #EFE6D9;
}
.rank-1 { background: #E9B949; }
.rank-2 { background: #C9CDD3; }
.rank-3 { background: #D39A6A; }
.rank-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rank-name { font-weight: 600; font-size: 18px; overflow-wrap: anywhere; }
.rank-score { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.big-num { font-weight: 800; font-size: 28px; line-height: 1; }

/* Besuchsseite */
.back { align-self: flex-start; font-weight: 600; text-decoration: none; padding: 10px 0; }
.visit-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.visit-total { display: flex; flex-direction: column; align-items: flex-end; }
.huge-num { font-weight: 800; font-size: 44px; line-height: 1; }
.bars { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.bar-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 36px; align-items: center; gap: 12px; }
.bar { display: block; height: 8px; border-radius: 4px; background: #EFE6D9; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 4px; background: var(--amber); }
.bar-val { font-weight: 600; text-align: right; }

.share { display: flex; flex-direction: column; gap: 10px; padding: 20px; background: var(--ink); color: #FFFFFF; border-radius: 14px; }
.share-title { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.share-hint { font-size: 13px; color: #D9CBB8; }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; }
.share-link {
  flex: 1 1 220px; min-width: 0; padding: 12px; border-radius: 8px;
  background: #3D2D20; font-size: 14px; overflow-wrap: anywhere;
}
.share-link.light { background: var(--soft); color: var(--ink); }

.review { display: flex; flex-direction: column; gap: 10px; }
.review-head { display: flex; justify-content: space-between; align-items: center; }
.review-who { font-weight: 600; }
.review-total { font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 10px; border-radius: 999px; background: var(--soft); font-size: 13px; }
.comment { color: #4A3B2E; font-style: italic; }
.review form { margin: 0; }
.pill { padding: 2px 10px; border-radius: 999px; background: #EFE6D9; color: var(--ink); font-size: 13px; font-weight: 500; }
.pill-open { background: #DCEFE2; color: #1E5232; }

/* Formulare */
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.field input, .field textarea {
  min-height: 44px; padding: 10px 12px; border: 1px solid var(--field); border-radius: 10px;
  background: var(--card); color: var(--ink); font: inherit; font-weight: 400;
}
.field textarea { resize: vertical; }
.rate-form, .form-card { display: flex; flex-direction: column; gap: 16px; }
.form-card h2 { margin: 0; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.grid-form .btn-big { grid-column: 1 / -1; }
.narrow { max-width: 420px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.rate-head { display: flex; flex-direction: column; }

/* Sterne */
.stars-card { padding: 4px 16px; }
.stars {
  border: none; margin: 0; padding: 10px 0;
  display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
}
.stars + .stars { border-top: 1px solid var(--soft); }
.stars legend { float: left; padding: 0; font-weight: 500; }
.star-row { display: flex; flex-direction: row-reverse; justify-content: flex-end; margin-left: auto; }
.star-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-row label { width: 22px; height: 44px; display: flex; align-items: center; cursor: pointer; }
.star-row label.half-left { justify-content: flex-end; }
.star-row label.half-right { justify-content: flex-start; }
.star-row svg { width: 15px; height: 30px; fill: none; stroke: #9C8C78; stroke-width: 1.6; stroke-linejoin: round; transition: fill .1s; overflow: visible; }
.star-value { margin-left: auto; min-width: 28px; text-align: right; font-weight: 700; color: var(--accent); }
.star-value + .star-row { margin-left: 4px; }
.star-row input:checked ~ label svg,
.star-row label:hover svg,
.star-row label:hover ~ label svg { fill: var(--star); stroke: var(--star-line); }
.star-row input:focus-visible + label { outline: 3px solid #1F5FAD; outline-offset: -2px; border-radius: 8px; }

.thanks { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 48px 16px; text-align: center; }
.thanks .btn-big { max-width: 320px; }

/* Admin */
.admin-item { display: flex; flex-direction: column; gap: 12px; }
.admin-item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.admin-item-head .rank-name { color: var(--ink); text-decoration: none; }
.admin-item-head .rank-name:hover { color: var(--accent); }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-actions form { margin: 0; }
.edit summary { cursor: pointer; font-weight: 600; color: var(--accent); min-height: 44px; display: flex; align-items: center; }
.edit .grid-form { margin-top: 8px; }

@media (max-width: 480px) {
  h1 { font-size: 26px; }
  .bar-row { grid-template-columns: 100px minmax(0, 1fr) 32px; gap: 8px; }
  .star-row label { width: 20px; }
  .star-row svg { width: 14px; height: 28px; }
  .huge-num { font-size: 38px; }
}
