/* -- Reset & base -- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0b0d10;
  --bg-accent: #151920;
  --surface: #151a20;
  --surface2: #1c222a;
  --border: #2a313c;
  --accent: #df6b50;
  --accent2: #f2b35d;
  --text: #eef1f5;
  --muted: #98a3b3;
  --radius: 14px;
  --shadow: 0 8px 32px rgba(0, 0, 0, .35);
  --font-body: 'Manrope', 'Trebuchet MS', sans-serif;
  --font-title: 'Playfair Display', Georgia, serif;
}

body {
  background:
    radial-gradient(circle at 18% -12%, rgba(223, 107, 80, .14), transparent 38%),
    radial-gradient(circle at 100% 0%, rgba(242, 179, 93, .08), transparent 35%),
    linear-gradient(160deg, var(--bg), var(--bg-accent));
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* -- Header -- */
header {
  backdrop-filter: blur(8px);
  background: rgba(12, 15, 19, .78);
  border-bottom: 1px solid var(--border);
  padding: 0 .9rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 62px;
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: .2px;
}

header h1 span { color: var(--accent); }

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.member-badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .35rem .7rem;
  font-size: .8rem;
  cursor: pointer;
}

.member-badge:hover { border-color: var(--accent); }

/* -- Nav -- */
nav {
  display: flex;
  gap: .3rem;
  padding: .7rem .9rem 0;
}

nav button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 700;
  padding: .5rem .8rem;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}

nav button.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* -- Main -- */
main {
  padding: .9rem;
  max-width: 1120px;
  margin: 0 auto;
}

/* -- Progress tracker -- */
.progress-panel {
  background: rgba(21, 26, 32, .94);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .7rem;
  margin-bottom: .8rem;
}

.progress-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .6rem;
}

.progress-title {
  font-size: .8rem;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: .35px;
  text-transform: uppercase;
}

.progress-overall {
  font-size: .8rem;
  color: var(--text);
}

.progress-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: .45rem;
}

.progress-row {
  background: rgba(28, 34, 42, .75);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .45rem .55rem;
}

.progress-row.is-current {
  border-color: rgba(223, 107, 80, .55);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: .6rem;
  font-size: .8rem;
  margin-bottom: .28rem;
}

.progress-name {
  font-weight: 700;
}

.progress-count {
  color: var(--muted);
}

.progress-bar {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: #222a34;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.progress-empty {
  color: var(--muted);
  font-size: .85rem;
}

/* -- Controls -- */
.controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: .65rem;
  margin-bottom: .75rem;
}

.search-box,
.controls select {
  background: rgba(28, 34, 42, .86);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: .9rem;
  padding: .62rem .85rem;
  outline: none;
}

.search-box:focus,
.controls select:focus { border-color: var(--accent); }

.bulk-rate-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  align-items: center;
  justify-content: space-between;
  background: rgba(21, 26, 32, .92);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .55rem .65rem;
  margin-bottom: 1rem;
}

.bulk-rate-label {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
}

.bulk-rate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.rate-next-btn {
  font-size: .85rem;
  padding: .44rem .86rem;
  box-shadow: 0 0 0 1px rgba(242, 179, 93, .22) inset;
}

.rate-next-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.bulk-rate-count {
  color: var(--muted);
  font-size: .78rem;
}

/* -- Cards -- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .9rem;
}

.card {
  background: linear-gradient(180deg, rgba(24, 29, 35, .98), rgba(21, 26, 32, .94));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .16s, border-color .16s, box-shadow .16s;
}

.card:hover {
  transform: translateY(-1px);
  border-color: #3b4654;
  box-shadow: var(--shadow);
}

.card-img,
.card-img-placeholder {
  width: 100%;
  height: 170px;
  background: var(--surface2);
}

.card-img { object-fit: cover; display: block; }

.card-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.card-body { padding: .9rem; }

.card-name {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: .2rem;
}

.card-meta {
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: .35rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-bottom: .45rem;
}

.meta-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .12rem .5rem;
  font-size: .7rem;
  color: var(--muted);
}

.card-price {
  font-weight: 700;
  color: var(--accent2);
  font-size: .84rem;
}

.card-votes {
  margin-top: .52rem;
  display: flex;
  flex-wrap: wrap;
  gap: .28rem;
}

.vote-chip {
  background: var(--surface2);
  border-radius: 999px;
  padding: .13rem .45rem;
  font-size: .74rem;
  display: flex;
  align-items: center;
  gap: .18rem;
}

.vote-chip .star { color: var(--accent2); }

.avg-score {
  margin-top: .45rem;
  font-size: .8rem;
  color: var(--muted);
}

.avg-score strong {
  color: var(--accent2);
  font-size: .93rem;
}

/* -- Modal -- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 10, .78);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1rem .6rem;
  overflow-y: auto;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 700px;
  position: relative;
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: .7rem;
  right: .7rem;
  background: var(--surface2);
  border: none;
  color: var(--text);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
}

.modal-close:hover { background: var(--accent); }

.modal-img,
.modal-img-placeholder {
  width: 100%;
  height: 200px;
  background: var(--surface2);
  border-radius: var(--radius) var(--radius) 0 0;
}

.modal-img { object-fit: cover; }

.modal-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
}

.modal-body { padding: 1rem; }

.modal-title {
  font-family: var(--font-title);
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: .2rem;
}

.modal-sub {
  color: var(--muted);
  font-size: .88rem;
  margin-bottom: .9rem;
}

.modal-sub a { color: var(--accent); text-decoration: none; }
.modal-sub a:hover { text-decoration: underline; }

.menu-section { margin-bottom: 1rem; }

.menu-section h3 {
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .45rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: .26rem;
}

.menu-section ul { list-style: none; }

.menu-section li {
  padding: .33rem 0;
  font-size: .93rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .45rem;
}

.menu-section li::before { content: '•'; color: var(--accent); }

.dietary-tags {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  margin-bottom: .9rem;
}

.dietary-tag {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .18rem .58rem;
  font-size: .72rem;
  color: var(--muted);
}

.meal-tier { margin-bottom: .8rem; }
.meal-tier + .meal-tier { border-top: 1px solid var(--border); padding-top: .8rem; }

.meal-tier-label {
  font-size: .73rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: .58rem;
}

.rate-section {
  background: var(--surface2);
  border-radius: 12px;
  padding: .85rem;
  margin-top: .9rem;
}

.rate-section h3 { font-size: .88rem; font-weight: 800; margin-bottom: .68rem; }

.star-picker {
  display: flex;
  gap: .35rem;
  align-items: center;
  flex-wrap: wrap;
}

.star-btn {
  background: none;
  border: none;
  font-size: 1.65rem;
  cursor: pointer;
  color: var(--border);
  transition: color .1s, transform .1s;
  padding: 0;
}

.star-btn:hover,
.star-btn.active { color: var(--accent2); }

.star-btn:hover { transform: scale(1.1); }

.clear-vote {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: .74rem;
  padding: .2rem .58rem;
  cursor: pointer;
}

.clear-vote:hover { border-color: var(--accent); color: var(--accent); }

.running-total {
  color: var(--muted);
  font-size: .82rem;
  margin-top: .35rem;
}

.running-total strong {
  color: var(--accent2);
  font-size: .95rem;
}

.all-votes { margin-top: .55rem; }

.all-votes-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .85rem;
  padding: .3rem 0;
  border-bottom: 1px solid var(--border);
}

.all-votes-row:last-child { border-bottom: none; }
.all-votes-row .member { color: var(--muted); }
.stars-display { color: var(--accent2); letter-spacing: 1px; }
.no-vote { color: #647282; font-size: .8rem; }

/* -- Rankings -- */
.rankings-header {
  font-size: .84rem;
  color: var(--muted);
  margin-bottom: .75rem;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: .7rem;
  background: rgba(22, 27, 33, .95);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .68rem .78rem;
  margin-bottom: .52rem;
  cursor: pointer;
  transition: border-color .15s;
}

.rank-row:hover { border-color: var(--accent); }

.rank-num {
  font-size: .98rem;
  font-weight: 800;
  color: var(--muted);
  width: 1.7rem;
  text-align: center;
  flex-shrink: 0;
}

.rank-num.top {
  color: var(--accent2);
  border: 1px solid rgba(242, 179, 93, .4);
  border-radius: 999px;
  padding: .08rem;
}

.rank-info { flex: 1; }
.rank-name { font-weight: 800; }
.rank-meta { font-size: .78rem; color: var(--muted); }

.rank-score {
  font-size: 1.16rem;
  font-weight: 800;
  color: var(--accent2);
  flex-shrink: 0;
  text-align: right;
}

.rank-score small { font-size: .66rem; color: var(--muted); font-weight: 500; }

/* -- Setup and picker modals -- */
.setup-modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 10, .86);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .75rem;
}

.setup-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  width: 100%;
  max-width: 440px;
}

.setup-box h2 { margin-bottom: .45rem; }
.setup-box p { color: var(--muted); font-size: .9rem; margin-bottom: 1rem; }

.member-list { display: flex; flex-direction: column; gap: .45rem; margin-bottom: .85rem; }

.member-row { display: flex; gap: .5rem; align-items: center; }

.member-row input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .94rem;
  padding: .5rem .68rem;
  outline: none;
}

.member-row input:focus { border-color: var(--accent); }

.rm-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: .2rem;
}

.rm-btn:hover { color: var(--accent); }

.btn {
  border: none;
  border-radius: 9px;
  font-size: .93rem;
  font-weight: 700;
  padding: .56rem .98rem;
  cursor: pointer;
  transition: opacity .15s;
}

.btn:hover { opacity: .88; }

.btn-primary { background: var(--accent); color: #fff; }

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
}

.btn-ghost:hover { color: var(--text); border-color: #4a5565; }
.btn-sm { font-size: .78rem; padding: .38rem .72rem; }

.setup-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

.who-list { display: flex; flex-direction: column; gap: .45rem; margin: .95rem 0; }

.who-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .95rem;
  padding: .64rem .88rem;
  cursor: pointer;
  text-align: left;
}

.who-btn:hover { border-color: var(--accent); }

/* -- Empty state -- */
.empty { text-align: center; padding: 2rem .8rem; color: var(--muted); }
.empty p { font-size: 1rem; margin-bottom: .35rem; }

/* -- Responsive enhancements -- */
@media (min-width: 700px) {
  header { padding: 0 1.4rem; }
  nav { padding: .9rem 1.4rem 0; }
  main { padding: 1.2rem 1.4rem 1.5rem; }

  .controls {
    grid-template-columns: minmax(260px, 1.4fr) repeat(3, minmax(170px, .9fr));
    margin-bottom: .9rem;
  }

  .progress-list {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
  }

  .modal-body { padding: 1.25rem 1.35rem; }
}
