/* ==========================================================================
   Kroatien Kocht! – Adria-Konoba-Look
   Signatur: die rot-weiße šahovnica (Schachbrett-Ribbon) aus dem kroatischen
   Wappen zieht sich als Band durch Header, Login und Siegerpodest.
   ========================================================================== */

@font-face {
  font-family: 'Lilita One';
  src: url('/fonts/lilita-latin.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('/fonts/nunito-latin.woff2') format('woff2');
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --ink: #0c2b3e;
  --ink-soft: #47616f;
  --sea: #0e7c9e;
  --sea-deep: #085b76;
  --aqua: #e7f4f3;
  --red: #e5484d;
  --red-deep: #c73538;
  --sun: #ffb93b;
  --card: #ffffff;
  --radius: 20px;
  --shadow: 0 6px 20px rgba(12, 43, 62, 0.10);
  --display: 'Lilita One', 'Arial Black', sans-serif;
  --body: 'Nunito', -apple-system, 'Segoe UI', sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--body);
  font-weight: 600;
  color: var(--ink);
  background:
    radial-gradient(90rem 40rem at 50% -20rem, #cdeaec 0%, var(--aqua) 60%);
  min-height: 100dvh;
}

.hidden { display: none !important; }

button { font: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }

/* ---------- Signatur: šahovnica-Ribbon ---------- */

.checker-ribbon {
  height: 14px;
  background:
    repeating-conic-gradient(var(--red) 0% 25%, #fff 0% 50%) 0 0 / 14px 14px;
  border-radius: 99px;
}

/* ---------- Buttons & Felder ---------- */

.btn {
  border: none;
  border-radius: 99px;
  background: var(--red);
  color: #fff;
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  padding: 0.8em 1.4em;
  box-shadow: 0 4px 0 var(--red-deep);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--red-deep); }
.btn-big { width: 100%; font-size: 1.2rem; padding: 0.9em; }
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  box-shadow: none;
  border: 2px solid #cfdfe2;
}
.btn-sea { background: var(--sea); box-shadow: 0 4px 0 var(--sea-deep); }
.btn:disabled { opacity: 0.5; }

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sea-deep);
  margin-bottom: 6px;
}
.field input, .field textarea {
  width: 100%;
  border: 2px solid #cfe3e6;
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  font-weight: 700;
  outline: none;
}
.field input:focus-visible, .field textarea:focus-visible,
.btn:focus-visible, .tab:focus-visible, .score-chip:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 2px;
}
.field textarea { resize: none; }

.hint { font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 12px; }
.error {
  background: #ffe8e8;
  color: var(--red-deep);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

/* ---------- Login ---------- */

.login {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(180deg, #ffd98a 0%, #ffc46a 18%, #7ec8d6 46%, var(--sea) 100%);
  overflow: hidden;
}
.login-sky { position: relative; flex: 1; min-height: 160px; }
.login-sun {
  position: absolute;
  top: 24px; right: 28px;
  width: 74px; height: 74px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff3c9, var(--sun) 70%);
  box-shadow: 0 0 60px 20px rgba(255, 185, 59, 0.55);
  animation: sun-pulse 5s ease-in-out infinite;
}
.login-boat {
  position: absolute;
  bottom: 8px; left: 10%;
  font-size: 3rem;
  animation: boat-bob 6s ease-in-out infinite;
}
@keyframes sun-pulse { 50% { box-shadow: 0 0 80px 28px rgba(255, 185, 59, 0.7); } }
@keyframes boat-bob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-10px) rotate(3deg) translateX(14px); }
}

.login-card {
  background: var(--card);
  border-radius: 28px 28px 0 0;
  padding: 18px 22px calc(26px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(8, 60, 80, 0.35);
  max-width: 460px;
  width: 100%;
  margin: 0 auto;
}
.app-title {
  font-family: var(--display);
  font-size: clamp(2.4rem, 11vw, 3.2rem);
  line-height: 0.95;
  color: var(--sea-deep);
  margin: 16px 0 8px;
  text-transform: uppercase;
}
.app-sub { color: var(--ink-soft); margin-bottom: 18px; line-height: 1.45; }

/* ---------- App-Shell ---------- */

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--sea);
  padding: calc(8px + env(safe-area-inset-top)) 16px 10px;
  border-radius: 0 0 22px 22px;
  box-shadow: var(--shadow);
}
.topbar .checker-ribbon { margin-bottom: 8px; }
.topbar-row { display: flex; align-items: center; justify-content: space-between; }
.topbar-title {
  font-family: var(--display);
  color: #fff;
  font-size: 1.35rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.topbar-me {
  background: rgba(255, 255, 255, 0.18);
  border: none;
  border-radius: 99px;
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 6px 12px;
}

#main { flex: 1; padding: 18px 16px calc(92px + env(safe-area-inset-bottom)); }

.view-title {
  font-family: var(--display);
  color: var(--sea-deep);
  font-size: 1.55rem;
  text-transform: uppercase;
}
.view-sub { color: var(--ink-soft); font-size: 0.92rem; margin: 4px 0 16px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

/* ---------- Gerichte-Liste ---------- */

.dish-list { display: grid; gap: 14px; }

.dish-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 2px solid transparent;
}
.dish-card.mine { border-color: var(--sun); }
.dish-emoji {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  font-size: 1.9rem;
  background: var(--aqua);
  border-radius: 16px;
}
.dish-info { min-width: 0; }
.dish-title-row { font-weight: 900; font-size: 1.02rem; overflow-wrap: anywhere; }
.dish-meta { font-size: 0.82rem; color: var(--ink-soft); margin-top: 2px; }
.dish-desc { font-size: 0.85rem; color: var(--ink-soft); font-style: italic; margin-top: 4px; }
.dish-cta { display: grid; gap: 6px; justify-items: end; }
.dish-cta .btn { font-size: 0.8rem; padding: 0.55em 1em; white-space: nowrap; }
.badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--sea-deep);
  background: var(--aqua);
  border-radius: 99px;
  padding: 3px 9px;
  white-space: nowrap;
}
.badge.done { background: #e2f6e5; color: #1b7f3a; }

.empty-card {
  text-align: center;
  padding: 34px 18px;
  color: var(--ink-soft);
}
.empty-card .big { font-size: 2.6rem; margin-bottom: 8px; }

/* ---------- Rating-Sheet ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(8, 43, 60, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  background: #fff;
  border-radius: 26px 26px 0 0;
  width: 100%;
  max-width: 560px;
  padding: 12px 20px calc(22px + env(safe-area-inset-bottom));
  animation: sheet-up 0.22s ease-out;
  max-height: 88dvh;
  overflow-y: auto;
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0.4; } }
.sheet-grip { width: 44px; height: 5px; border-radius: 99px; background: #d6e4e7; margin: 0 auto 12px; }
.sheet-title { font-family: var(--display); font-size: 1.25rem; color: var(--sea-deep); }
.sheet-sub { font-size: 0.85rem; color: var(--ink-soft); margin: 4px 0 14px; }
.sheet-actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 6px; }

.scale { margin-bottom: 16px; }
.scale-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-weight: 900; margin-bottom: 8px;
}
.scale-label .val { font-family: var(--display); color: var(--red); font-size: 1.15rem; min-width: 2ch; text-align: right; }
.scale-chips { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.score-chip {
  border: none;
  border-radius: 10px;
  background: var(--aqua);
  color: var(--sea-deep);
  font-weight: 900;
  font-size: 0.9rem;
  padding: 9px 0;
  transition: transform 0.06s ease;
}
.score-chip.on { background: var(--red); color: #fff; box-shadow: 0 2px 0 var(--red-deep); }
.score-chip:active { transform: scale(0.92); }

/* ---------- Emoji-Picker ---------- */

.emoji-picker { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-opt {
  border: 2px solid transparent;
  background: var(--aqua);
  border-radius: 12px;
  font-size: 1.35rem;
  padding: 7px 0;
}
.emoji-opt.on { border-color: var(--red); background: #ffeaea; }

/* ---------- Ranking / Countdown ---------- */

.progress-list { display: grid; gap: 10px; }
.progress-row {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
}

.countdown-card {
  background: linear-gradient(160deg, var(--sea) 0%, var(--sea-deep) 100%);
  border-radius: var(--radius);
  color: #fff;
  text-align: center;
  padding: 26px 18px;
  box-shadow: var(--shadow);
}
.countdown-card .checker-ribbon { margin: 0 auto 18px; max-width: 220px; }
.countdown-kicker { font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.78rem; opacity: 0.85; }
.countdown-digits {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 14px 0 6px;
}
.cd-cell { min-width: 64px; }
.cd-num {
  font-family: var(--display);
  font-size: 2.2rem;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 8px 4px;
  font-variant-numeric: tabular-nums;
}
.cd-lab { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 6px; opacity: 0.85; }
.countdown-note { font-size: 0.88rem; opacity: 0.9; margin-top: 10px; }

/* Podium */
.podium {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  align-items: end;
  margin: 18px 0 20px;
}
.podium-slot { text-align: center; }
.podium-emoji { font-size: 2rem; }
.podium-name { font-weight: 900; font-size: 0.85rem; overflow-wrap: anywhere; }
.podium-score { font-size: 0.78rem; color: var(--ink-soft); }
.podium-block {
  margin-top: 8px;
  border-radius: 14px 14px 0 0;
  background: var(--sea);
  color: #fff;
  font-family: var(--display);
  font-size: 1.5rem;
  display: grid;
  place-items: center;
}
.podium-slot.p1 .podium-block { height: 96px; background: var(--sun); color: var(--ink); }
.podium-slot.p2 .podium-block { height: 70px; }
.podium-slot.p3 .podium-block { height: 52px; background: var(--red); }
.podium-slot.p1 .podium-emoji { font-size: 2.6rem; }

.winner-banner {
  text-align: center;
  margin-bottom: 6px;
}
.winner-banner .crown { font-size: 3rem; display: block; animation: crown-drop 0.8s ease; }
@keyframes crown-drop { from { transform: translateY(-30px); opacity: 0; } }
.winner-banner h3 {
  font-family: var(--display);
  font-size: 1.7rem;
  color: var(--red);
  text-transform: uppercase;
}

.result-table { display: grid; gap: 10px; }
.result-row {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
}
.result-rank { font-family: var(--display); color: var(--sea-deep); font-size: 1.15rem; }
.result-who { font-weight: 900; font-size: 0.95rem; }
.result-dish { font-size: 0.8rem; color: var(--ink-soft); }
.result-cats { font-size: 0.72rem; color: var(--ink-soft); margin-top: 3px; }
.result-comments {
  margin-top: 8px;
  border-top: 2px dashed #e2eef0;
  padding-top: 8px;
}
.result-comments-label {
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--sea-deep);
  margin-bottom: 4px;
}
.result-comment {
  font-size: 0.84rem;
  font-style: italic;
  color: var(--ink-soft);
  margin-bottom: 3px;
}
.result-total { font-family: var(--display); font-size: 1.3rem; color: var(--red); text-align: right; }
.result-total small { display: block; font-family: var(--body); font-weight: 800; font-size: 0.62rem; color: var(--ink-soft); }

/* ---------- Tabbar ---------- */

.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 30;
  max-width: 560px;
  margin: 0 auto;
  background: #fff;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -6px 24px rgba(12, 43, 62, 0.14);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
}
.tab {
  border: none;
  background: none;
  color: var(--ink-soft);
  font-weight: 800;
  font-size: 0.72rem;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 6px 0;
  border-radius: 14px;
}
.tab-ico { font-size: 1.35rem; }
.tab.active { background: var(--aqua); color: var(--sea-deep); }

/* ---------- Toast & Confetti ---------- */

.toast {
  position: fixed;
  bottom: calc(100px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  border-radius: 99px;
  padding: 10px 18px;
  font-weight: 800;
  font-size: 0.9rem;
  z-index: 80;
  box-shadow: var(--shadow);
  animation: toast-in 0.2s ease-out;
  max-width: 90vw;
  text-align: center;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

#confetti {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
