/* Gin Tasting – Farben: Flaschenglas, Wacholderbeere, Zeste */
:root {
  color-scheme: light;
  --bg: #E7EFEB;          /* helles Flaschenglas */
  --surface: #FFFFFF;
  --ink: #1C2B29;         /* Kiefernnadel */
  --muted: #56665F;
  --juniper: #34466F;     /* Wacholderbeere */
  --juniper-2: #5A6EA3;
  --berry-off: #D3DBE8;
  --zest: #B9781A;        /* Orangenzeste, Kronengold */
  --leaf: #4F7148;
  --line: #C5D3CC;
  --danger: #A33A2C;
  --serif: "IM Fell English", "Iowan Old Style", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111920;
    --surface: #1A252E;
    --ink: #E4ECE8;
    --muted: #9AAAA4;
    --juniper: #93A6DA;
    --juniper-2: #C1CDEE;
    --berry-off: #2A3647;
    --zest: #EDB04D;
    --leaf: #8DB27F;
    --line: #2D3B45;
    --danger: #E58A78;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
[hidden] { display: none !important; }
a { color: var(--juniper); }
:focus-visible { outline: 3px solid var(--zest); outline-offset: 2px; }

.wrap { max-width: 720px; margin: 0 auto; padding: 1rem 1rem 4rem; }
.wrap-wide { max-width: 1040px; }
.narrow { max-width: 440px; margin: 3rem auto; }
.narrow-panel { max-width: 480px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.12; margin: 0 0 .5rem; }
h1 { font-size: clamp(2.3rem, 8vw, 3.8rem); }
h2 { font-size: 1.65rem; }
h3 { font-size: 1.3rem; margin-top: 1.5rem; }
p { margin: 0 0 .8rem; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.empty { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 1.1rem; }

/* Kopf */
.hero { padding: 2.2rem 0 1.4rem; margin-bottom: 1.6rem; border-bottom: 1px solid var(--line); }
.hero .meta { color: var(--muted); display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.hero .intro { max-width: 58ch; font-size: 1.05rem; }
.hero-admin { padding-top: .8rem; }

/* Buttons & Formulare */
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .7rem 1.2rem;
  border: 1px solid var(--juniper); border-radius: 999px;
  background: var(--juniper); color: var(--surface);
  font: 700 .95rem/1 var(--sans); text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--juniper-2); border-color: var(--juniper-2); }
.btn-ghost { background: transparent; color: var(--juniper); }
.btn-ghost:hover { background: var(--berry-off); color: var(--ink); }
.btn-small { min-height: 36px; padding: .45rem .85rem; font-size: .85rem; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: var(--surface); }
.btn:disabled { opacity: .35; cursor: default; pointer-events: none; }
.linklike { background: none; border: 0; padding: 0; font: inherit; font-size: .88rem; color: var(--muted); text-decoration: underline; cursor: pointer; }
.linklike.danger { color: var(--danger); }

label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 1rem; }
input[type=text], input[type=password], input[type=date], textarea {
  display: block; width: 100%; margin-top: .3rem;
  font: 400 1rem/1.4 var(--sans); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: .65rem .75rem;
}
textarea { resize: vertical; min-height: 3.2rem; }
input:focus, textarea:focus { border-color: var(--juniper); }
.check { display: flex; gap: .55rem; align-items: center; font-weight: 500; }
.check input { width: 1.15rem; height: 1.15rem; accent-color: var(--juniper); }
.grid-2 { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.3rem 1.2rem; margin-bottom: 1.4rem; }
.flash { padding: .8rem 1rem; margin: .5rem 0 1rem; background: var(--surface); border-left: 4px solid var(--leaf); border-radius: 6px; }
.flash-error { border-left-color: var(--danger); }

/* Fortschritt beim Verkosten */
.progress { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: .7rem 0 .6rem; margin-bottom: 1rem; }
.progress .bar { height: 6px; border-radius: 3px; background: var(--berry-off); overflow: hidden; }
.progress .bar::after { content: ""; display: block; height: 100%; width: var(--p, 0%); background: var(--leaf); transition: width .3s; }
.progress span { display: block; margin-top: .3rem; font-size: .85rem; color: var(--muted); }

/* Gin-Karte als Flaschenetikett */
.gin {
  background: var(--surface);
  border: 4px double var(--ink);
  border-radius: 3px;
  padding: 1.4rem 1.1rem 1rem;
  margin-bottom: 1.8rem;
  scroll-margin-top: 4rem;
}
.gin.is-done { border-color: var(--leaf); }
.gin-head { text-align: center; padding-bottom: 1rem; margin-bottom: 1.1rem; border-bottom: 1px solid var(--line); }
.gin-no { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 1.05rem; }
.gin-head h2 { font-size: clamp(1.7rem, 6vw, 2.25rem); margin: .1rem 0 .35rem; }
.gin-meta, .gin-serve { margin: .1rem 0; color: var(--muted); font-size: .92rem; }
.gin-botanicals { margin: .3rem auto; max-width: 40ch; font-family: var(--serif); font-style: italic; font-size: 1.05rem; }

.crit-row { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: .3rem .75rem; margin-bottom: 1rem; }
.crit-name { font-weight: 700; }
.crit-val { font-family: var(--serif); font-size: 1.45rem; color: var(--juniper); min-width: 2ch; text-align: right; }

/* Zehn Wacholderbeeren */
.berries { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(10, minmax(0, 38px)); gap: 6px; }
.berries button {
  aspect-ratio: 1; width: 100%; padding: 0; border: 0; border-radius: 50%;
  background: var(--berry-off); cursor: pointer;
  transition: transform .12s ease, background-color .15s ease;
}
.berries button.on { background: radial-gradient(circle at 34% 30%, var(--juniper-2) 0 18%, var(--juniper) 62%); }
.berries button:active { transform: scale(.85); }
@media (hover: hover) { .berries button:hover { transform: scale(1.12); } }

.note { font-weight: 700; margin: .4rem 0 .6rem; }
.gin-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-size: .88rem; color: var(--muted); }
.gin-avg { font-family: var(--serif); font-size: 1.2rem; color: var(--ink); }
.save-state.is-error { color: var(--danger); }

.waiting { text-align: center; padding: 2.5rem 1.2rem; }

/* Krönung */
.crown-list { list-style: none; margin: 1rem 0 1.4rem; padding: 0; display: grid; gap: .7rem; }
.crown-opt { position: relative; }
.crown-opt input { position: absolute; opacity: 0; inset: 0; pointer-events: none; }
.crown-opt label {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .9rem;
  margin: 0; padding: .9rem 1rem; cursor: pointer; font-weight: 500;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.crown-opt label strong { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.3rem; line-height: 1.2; }
.crown-opt .mine { font-family: var(--serif); font-size: 1.1rem; color: var(--muted); }
.crown-icon { width: 30px; height: 30px; color: var(--berry-off); transition: color .2s, transform .25s; }
.crown-opt input:checked + label { border: 2px solid var(--zest); padding: calc(.9rem - 1px) calc(1rem - 1px); }
.crown-opt input:checked + label .crown-icon { color: var(--zest); transform: rotate(-10deg) scale(1.15); }
.crown-opt input:focus-visible + label { outline: 3px solid var(--zest); outline-offset: 2px; }

/* Ergebnis */
.winner {
  text-align: center; padding: 2.2rem 1rem 1.6rem; margin-bottom: 2rem;
  background: var(--surface); border: 4px double var(--zest); border-radius: 3px;
}
.winner .crown-big { width: 84px; height: 84px; color: var(--zest); animation: crown-drop 1s cubic-bezier(.3, 1.5, .5, 1) .25s both; }
.winner-name { font-size: clamp(2.2rem, 9vw, 3.4rem); margin: .2rem 0 .6rem; }
@keyframes crown-drop {
  from { transform: translateY(-60px) rotate(-20deg); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.ranking { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.ranking > li {
  counter-increment: rank; position: relative;
  padding: 1rem 0 1rem 2.6rem; border-bottom: 1px solid var(--line);
}
.ranking > li::before {
  content: counter(rank); position: absolute; left: 0; top: .85rem;
  font-family: var(--serif); font-size: 1.8rem; color: var(--muted);
}
.ranking > li.is-mine::before { color: var(--zest); }
.rank-top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.rank-name { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.4rem; line-height: 1.2; }
.rank-stats { display: flex; gap: .9rem; align-items: center; white-space: nowrap; }
.rank-crowns { display: inline-flex; align-items: center; gap: .25rem; font-weight: 700; color: var(--zest); }
.crown-mini { width: 18px; height: 18px; }
.rank-avg { font-family: var(--serif); font-size: 1.15rem; }
.crit-bars { margin: .7rem 0 .3rem; display: grid; gap: .25rem; font-size: .85rem; }
.crit-bars > div { display: grid; grid-template-columns: minmax(7rem, 9rem) 1fr; gap: .6rem; align-items: center; }
.crit-bars dt { color: var(--muted); }
.crit-bars dd { margin: 0; display: grid; grid-template-columns: 1fr 2.6rem; gap: .5rem; align-items: center; text-align: right; }
.crit-bars .bar { display: block; height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--juniper) var(--w), var(--berry-off) var(--w)); }

/* Admin */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: .4rem 0; }
.brand { font-family: var(--serif); font-size: 1.4rem; color: var(--ink); text-decoration: none; }
.badge { display: inline-block; padding: .2rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--berry-off); color: var(--ink); white-space: nowrap; }
.badge-tasting { background: var(--leaf); color: var(--surface); }
.badge-crowning { background: var(--zest); color: #1C2B29; }
.badge-finished { background: var(--juniper); color: var(--surface); }

.linkbox { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.linkbox code { flex: 1 1 100%; padding: .6rem .75rem; background: var(--bg); border-radius: 6px; font-size: .85rem; overflow-wrap: anywhere; }
.regen { margin-top: .8rem; }

.steps { list-style: none; margin: 0 0 1.1rem; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.steps li { padding-top: .45rem; border-top: 4px solid var(--line); font-size: .86rem; color: var(--muted); }
.steps li.done { border-color: var(--leaf); }
.steps li.now { border-color: var(--zest); color: var(--ink); font-weight: 700; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; }

.gin-rows { list-style: none; margin: 0; padding: 0; }
.gin-rows > li { padding: .75rem 0; border-bottom: 1px solid var(--line); }
.gin-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; }
.gin-row .muted { margin-left: .3rem; }
.tools { display: flex; gap: .35rem; }
details { margin-top: .4rem; }
summary { cursor: pointer; color: var(--juniper); font-weight: 700; font-size: .9rem; }
.gin-form { margin-top: .9rem; }

.guest-list { list-style: none; margin: 0; padding: 0; }
.guest-list li { display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: baseline; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.guest-list form { margin-left: auto; }

.table-scroll { overflow-x: auto; }
.results { width: 100%; border-collapse: collapse; font-size: .9rem; }
.results th, .results td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.results th { color: var(--muted); font-weight: 700; }
#ergebnis h2 { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

.event-list { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.event-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid var(--line); }
.event-list a { color: inherit; text-decoration: none; }
.event-list a strong { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.45rem; }
.event-list a:hover strong { color: var(--juniper); }
.danger-zone { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }

@media (max-width: 520px) {
  .steps { grid-template-columns: repeat(2, 1fr); }
  .berries { gap: 4px; }
  .rank-top { flex-direction: column; gap: .3rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
