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

:root {
  --like:    #4CAF50;
  --dislike: #FF5252;
  --radius:  20px;
  --shadow:  0 12px 48px rgba(0,0,0,0.18);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f0f4f8;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

/* ── Page wrapper ── */
.page, #app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 80px rgba(0,0,0,0.10);
}

/* ── Header ── */
header {
  background: linear-gradient(135deg, #FF6B6B 0%, #FFE66D 100%);
  padding: 16px 16px 12px;
  text-align: center;
  color: white;
  position: relative;
}
.home-header { padding: 24px 16px 18px; }
.duell-header { padding: 16px 16px 12px; }

header h1 {
  font-size: 2.4rem;
  font-weight: 900;
  text-shadow: 0 2px 6px rgba(0,0,0,0.2);
  margin-bottom: 4px;
  line-height: 1.15;
}
.home-header h1 { font-size: 2rem; }
.duell-header h1 { font-size: 1.3rem; }
header p { font-size: 0.82rem; opacity: 0.92; }

.back-link {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.9;
  background: rgba(255,255,255,0.2);
  padding: 5px 10px;
  border-radius: 20px;
}
.back-link:hover { opacity: 1; background: rgba(255,255,255,0.3); }

/* ── Content wrapper ── */
.content-wrapper {
  flex: 1;
  padding: 18px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border: none;
  border-radius: 14px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s, opacity 0.15s;
  line-height: 1;
}
.btn:active { transform: scale(0.97); }
.btn-primary  { background: linear-gradient(135deg, #FF6B6B, #FF8E53); color: white; }
.btn-primary:hover { opacity: 0.92; }
.btn-secondary { background: #f2f2f2; color: #555; }
.btn-secondary:hover { background: #eaeaea; }
.btn-sm { padding: 7px 12px; font-size: 0.78rem; border-radius: 10px; }
.btn-duell { background: linear-gradient(135deg, #6A3093, #a044ff); color: white; }

/* ── Home: Profiles ── */
.profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.profile-card {
  border: 2px solid #f0f0f0;
  border-radius: 20px;
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.profile-card:hover { border-color: #FFE66D; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
.profile-avatar { font-size: 3rem; line-height: 1; }
.profile-name { font-size: 1.1rem; font-weight: 800; color: #222; }
.profile-stats { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.badge { padding: 3px 9px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; }
.badge-like    { background: #E8F5E9; color: #2E7D32; }
.badge-dislike { background: #FFEBEE; color: #C62828; }
.badge-open    { background: #FFF8E1; color: #F57F17; }
.profile-btns { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.delete-btn {
  position: absolute;
  top: 8px; right: 10px;
  background: none;
  border: none;
  color: #ccc;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 50%;
}
.delete-btn:hover { background: #FFEBEE; color: #FF5252; }

/* ── Home: New profile & Duel ── */
.new-profile-box, .duell-box {
  border: 2px dashed #e0e0e0;
  border-radius: 20px;
  padding: 20px;
}
.new-profile-box h2, .duell-box h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: #444;
}
.new-profile-form, .duell-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.new-profile-form input, .duell-form select {
  flex: 1;
  min-width: 140px;
  padding: 10px 14px;
  border: 2px solid #e4e4e4;
  border-radius: 12px;
  font-size: 0.95rem;
  outline: none;
}
.new-profile-form input:focus, .duell-form select:focus { border-color: #FF6B6B; }
.vs-label { font-weight: 800; font-size: 1rem; color: #aaa; }

/* ── Swipe: Progress ── */
#progress-container { padding: 10px 16px 6px; background: #fff; }
#progress-bar { height: 8px; background: #e8e8e8; border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
#progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #FF6B6B, #4CAF50);
  border-radius: 4px;
  transition: width 0.5s ease;
  width: 0%;
}
#progress-text { text-align: center; font-size: 0.78rem; color: #999; }

/* ── Swipe: Card Area ── */
#card-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  min-height: 420px;
}
#card-stack { position: relative; width: 300px; height: 390px; }

.food-card {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  box-shadow: var(--shadow);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 24px;
  overflow: hidden;
  will-change: transform;
  touch-action: none;
}
.food-card:active { cursor: grabbing; }
.card-emoji { font-size: 88px; line-height: 1; margin-bottom: 18px; pointer-events: none; display: block; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15)); }
.card-name  { font-size: 1.7rem; font-weight: 800; color: white; text-align: center; text-shadow: 0 2px 10px rgba(0,0,0,0.25); pointer-events: none; line-height: 1.2; }
.card-category { margin-top: 10px; padding: 4px 14px; background: rgba(255,255,255,0.28); border-radius: 20px; font-size: 0.78rem; color: white; font-weight: 600; pointer-events: none; }

.card-overlay {
  position: absolute;
  top: 22px;
  padding: 7px 16px;
  border-radius: 10px;
  font-size: 1.2rem;
  font-weight: 900;
  border: 3px solid;
  opacity: 0;
  pointer-events: none;
  letter-spacing: 0.04em;
}
.like-overlay    { left: 18px;  color: var(--like);    border-color: var(--like);    background: rgba(255,255,255,0.92); transform: rotate(-16deg); }
.dislike-overlay { right: 18px; color: var(--dislike); border-color: var(--dislike); background: rgba(255,255,255,0.92); transform: rotate(16deg); }

/* ── Swipe: Done State ── */
#done-state {
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 20px;
}
.done-emoji { font-size: 80px; line-height: 1; margin-bottom: 6px; }
#done-state h2 { font-size: 1.8rem; color: #333; }
#done-state p  { color: #777; margin-bottom: 4px; }

/* ── Swipe: Buttons ── */
#swipe-buttons {
  display: flex; justify-content: center; align-items: center;
  gap: 20px; padding: 10px 20px 12px; background: #fff;
}
#swipe-buttons button {
  border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border-radius: 50%; transition: transform 0.1s ease, background 0.2s;
}
#swipe-buttons button:hover:not(:disabled) { background: #f5f5f5; }
#swipe-buttons button:active:not(:disabled) { transform: scale(0.88); }

#btn-dislike { width: 66px; height: 66px; background: #FFEBEE !important; box-shadow: 0 4px 16px rgba(255,82,82,0.2); }
#btn-dislike span { font-size: 28px; }
#btn-dislike small { font-size: 0.62rem; color: var(--dislike); font-weight: 700; }

#btn-like { width: 66px; height: 66px; background: #E8F5E9 !important; box-shadow: 0 4px 16px rgba(76,175,80,0.2); }
#btn-like span { font-size: 28px; }
#btn-like small { font-size: 0.62rem; color: var(--like); font-weight: 700; }

#btn-undo { width: 50px; height: 50px; }
#btn-undo span { font-size: 20px; }
#btn-undo small { font-size: 0.58rem; color: #aaa; }
#btn-undo:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Nav buttons (swipe page) ── */
#nav-buttons {
  display: flex; gap: 8px; padding: 8px 14px 16px;
  background: #fff; border-top: 1px solid #f0f0f0;
}
.nav-link, .nav-link-btn {
  flex: 1; padding: 9px 4px;
  border: 1.5px solid #e8e8e8; background: white;
  border-radius: 14px; font-size: 0.73rem; font-weight: 600; color: #555;
  text-align: center; text-decoration: none; display: block;
  cursor: pointer; font-family: inherit; transition: background 0.18s;
}
.nav-link:hover, .nav-link-btn:hover { background: #f9f9f9; }

/* ── Modal ── */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.52); display: flex; align-items: flex-end; justify-content: center; z-index: 200; }
.modal-content { background: white; width: 100%; max-width: 480px; max-height: 88vh; border-radius: 24px 24px 0 0; display: flex; flex-direction: column; overflow: hidden; }
.add-modal-content { max-height: 70vh; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 14px; border-bottom: 1px solid #f2f2f2; flex-shrink: 0; }
.modal-header h2 { font-size: 1.1rem; color: #222; }
.close-btn { background: none; border: none; cursor: pointer; font-size: 1.1rem; padding: 5px 8px; border-radius: 50%; color: #999; }
.close-btn:hover { background: #f2f2f2; }
.modal-body { overflow-y: auto; padding: 16px 20px 28px; flex: 1; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.83rem; font-weight: 700; color: #444; margin-bottom: 7px; }
.label-hint { font-weight: 400; color: #aaa; }
.form-group input { width: 100%; padding: 12px 14px; border: 2px solid #e4e4e4; border-radius: 14px; font-size: 1rem; outline: none; transition: border-color 0.2s; }
.form-group input:focus { border-color: #FF6B6B; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }

/* ── Results / Liste ── */
.stats-row { display: flex; gap: 10px; }
.stat-box { flex: 1; padding: 12px 8px; border-radius: 16px; text-align: center; }
.stat-box.likes    { background: #E8F5E9; }
.stat-box.dislikes { background: #FFEBEE; }
.stat-box.pending  { background: #FFF8E1; }
.stat-num   { font-size: 2.2rem; font-weight: 900; display: block; line-height: 1; }
.stat-label { font-size: 0.7rem; color: #666; margin-top: 4px; display: block; }

.list-section h2 { font-size: 1rem; font-weight: 700; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 2px solid #f2f2f2; color: #333; }
.food-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.food-pill { padding: 5px 12px; border-radius: 20px; font-size: 0.82rem; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.food-pill.like    { background: #E8F5E9; color: #2E7D32; }
.food-pill.dislike { background: #FFEBEE; color: #C62828; }
.food-pill.unrated { background: #f4f4f4; color: #777; }

.share-box { border: 2px dashed #e0e0e0; border-radius: 16px; padding: 14px; }
.share-box p { font-size: 0.82rem; color: #888; margin-bottom: 8px; font-weight: 600; }
.share-box input { width: 100%; padding: 8px 12px; border: 1px solid #e0e0e0; border-radius: 10px; font-size: 0.82rem; color: #555; background: #f9f9f9; margin-bottom: 8px; }

.bottom-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.bottom-actions .btn { flex: 1; }

.empty-box { text-align: center; padding: 30px 20px; background: #f9f9f9; border-radius: 20px; }
.empty-box p { color: #888; margin-bottom: 14px; }

/* ── Duell ── */
.vs-badge { font-size: 1.5rem; margin: 0 4px; }
.duell-section { border-radius: 20px; padding: 18px; }
.green-section  { background: #E8F5E9; }
.orange-section { background: #FFF8E1; }
.red-section    { background: #FFEBEE; }
.duell-section h2 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; color: #333; }
.section-hint { font-size: 0.8rem; color: #666; margin-bottom: 10px; }
.food-pill.like-big    { background: #C8E6C9; color: #1B5E20; font-size: 0.88rem; padding: 7px 14px; }
.food-pill.conflict-pill { background: #FFF9C4; color: #795548; }

/* ── Weekly Menu ── */
.menu-grid { display: flex; flex-direction: column; gap: 10px; }
.menu-day {
  display: flex; align-items: center; gap: 14px;
  background: #f9f9f9; border-radius: 16px; padding: 12px 16px;
  border: 2px solid #f0f0f0; transition: border-color 0.2s;
}
.menu-day:hover { border-color: #FFE66D; }
.menu-day-name { font-size: 0.78rem; font-weight: 700; color: #999; min-width: 68px; text-transform: uppercase; letter-spacing: 0.05em; }
.menu-dish-emoji { font-size: 2rem; line-height: 1; }
.menu-dish-name  { font-size: 1rem; font-weight: 700; color: #222; flex: 1; }
.menu-dish-cat   { font-size: 0.7rem; color: #aaa; font-weight: 600; text-align: right; }

/* ── Unicorn ── */
.unicorn-popup {
  position: fixed; z-index: 9999; pointer-events: none;
  display: flex; align-items: flex-end;
  animation: unicorn-pop 2.8s ease-in-out forwards;
  filter: drop-shadow(0 4px 14px rgba(0,0,0,0.25));
}
.unicorn-body  { font-size: 3.2rem; line-height: 1; }
.unicorn-food  { font-size: 1.9rem; margin-left: -6px; margin-bottom: 2px; animation: unicorn-chew 0.35s ease-in-out infinite alternate; }
@keyframes unicorn-pop {
  0%   { transform: scale(0)    rotate(-25deg); opacity: 0; }
  12%  { transform: scale(1.4)  rotate(  8deg); opacity: 1; }
  22%  { transform: scale(1)    rotate(  0deg); opacity: 1; }
  72%  { transform: scale(1)    rotate(  0deg); opacity: 1; }
  88%  { transform: scale(1.15) rotate( -8deg); opacity: 0.7; }
  100% { transform: scale(0)    rotate( 20deg); opacity: 0; }
}
@keyframes unicorn-chew {
  from { transform: translateY(0)   rotate(-5deg); }
  to   { transform: translateY(-4px) rotate(5deg); }
}

.hidden { display: none !important; }

@media (max-width: 360px) {
  #card-stack { width: 270px; height: 350px; }
  .card-emoji { font-size: 72px; }
  .card-name  { font-size: 1.45rem; }
}
