/* =========================================================
   Veiniklubi — disainisuund 1c "Klubi" (tume roheline + messing)
   ========================================================= */
:root {
  --bg: #0E1A15;
  --surface: #14241D;
  --surface-alt: #10201A;
  --brass: #C9A253;
  --brass-hover: #DCB865;
  --brass-pressed: #8F7233;
  --text: #EFE8DA;
  --text-strong: #F5EFE3;
  --text-muted: #9FB0A6;
  --border: rgba(201, 162, 83, 0.30);
  --border-subtle: rgba(201, 162, 83, 0.24);
  --border-input: rgba(201, 162, 83, 0.28);
  --danger: #E0A0A0;
  --glow: radial-gradient(circle at 50% 40%, rgba(201, 162, 83, 0.12), transparent 70%);
  --radius: 8px;
  --shadow: 0 18px 48px rgba(14, 26, 21, 0.30);
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Jost', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
* { text-wrap: pretty; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; color: var(--text-strong); margin: 0; line-height: 1.2; }
a { color: var(--brass); text-decoration: none; }
a:hover { color: var(--brass-hover); text-decoration: underline; }

.eyebrow {
  font-size: 11px; letter-spacing: 0.20em; text-transform: uppercase; color: var(--brass);
  display: inline-flex; align-items: center; gap: 8px;
}
.eyebrow::before { content: ""; width: 14px; height: 1px; background: var(--brass); display: inline-block; }
.muted { color: var(--text-muted); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.page { padding: 20px 0 64px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-lg { display: flex; flex-direction: column; gap: 22px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow { flex: 1; }
.spacer { flex: 1; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(14, 26, 21, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
}
.site-header .wrap { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.brand { font-family: var(--serif); font-size: 20px; color: var(--text-strong); white-space: nowrap; }
.brand:hover { text-decoration: none; color: var(--brass-hover); }
.nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nav a {
  color: var(--text-muted); padding: 8px 10px; border-radius: var(--radius);
  font-size: 14px; min-height: 44px; display: inline-flex; align-items: center;
}
.nav a:hover { color: var(--text-strong); text-decoration: none; background: var(--surface); }
.nav a.active { color: var(--brass); }
.nav-toggle {
  display: none; background: var(--surface); border: 1px solid var(--border); color: var(--text);
  width: 44px; height: 44px; border-radius: var(--radius); font-size: 20px; cursor: pointer; align-items: center; justify-content: center;
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .nav {
    display: none; position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--surface-alt); border-bottom: 1px solid var(--border); padding: 8px 16px 16px;
  }
  .nav.open { display: flex; }
  .nav a { width: 100%; }
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.card-tight { padding: 14px 16px; }
.card h2, .card h3 { color: var(--text-strong); }
.card-link:hover { border-color: var(--brass); text-decoration: none; }
.divider { border: 0; border-top: 1px solid var(--border-subtle); margin: 4px 0; }

.grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .grid.cols-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 700px) { .grid.cols-2-1 { grid-template-columns: 1fr; } }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--sans); font-size: 16px; min-height: 44px; padding: 10px 18px;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
  text-decoration: none;
}
.btn:hover { border-color: var(--brass); color: var(--text-strong); text-decoration: none; }
.btn-primary {
  background: var(--brass); color: var(--surface-alt); border-color: var(--brass);
  font-family: var(--serif); font-size: 18px; letter-spacing: 0.02em; min-height: 52px; padding: 12px 24px; font-weight: 500;
}
.btn-primary:hover { background: var(--brass-hover); color: var(--surface-alt); border-color: var(--brass-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; background: var(--brass); }
.btn-cta { width: 100%; min-height: 58px; font-size: 20px; }
.btn-locked { background: var(--brass-pressed) !important; color: var(--text-strong) !important; border-color: var(--brass-pressed) !important; cursor: default; }
.btn-ghost { background: transparent; }
.btn-danger { border-color: rgba(224, 160, 160, 0.5); color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-sm { min-height: 44px; font-size: 14px; padding: 8px 12px; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], textarea, select {
  width: 100%; font-family: var(--sans); font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-input); border-radius: var(--radius);
  padding: 12px 14px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--brass); }
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
.field { margin-bottom: 14px; }
.field-row { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .field-row.two { grid-template-columns: 1fr 1fr; } .field-row.three { grid-template-columns: 1fr 1fr 1fr; } }

/* ---------- Flash / alerts ---------- */
.flash { border-radius: var(--radius); padding: 12px 16px; margin: 16px 0; border: 1px solid var(--border); }
.flash.success { background: rgba(201, 162, 83, 0.10); border-color: var(--border); color: var(--text-strong); }
.flash.error { background: rgba(224, 160, 160, 0.10); border-color: rgba(224, 160, 160, 0.4); color: var(--danger); }
.inline-error { color: var(--danger); font-size: 14px; }

/* ---------- Score buttons (1..10) ---------- */
.score-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.score-btn {
  height: 56px; min-width: 44px; border-radius: var(--radius);
  font-family: var(--serif); font-size: 22px; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}
.score-btn:hover:not(:disabled) { border-color: var(--brass); }
.score-btn.selected { background: var(--brass); color: var(--surface-alt); border-color: var(--brass); }
.score-btn:disabled { cursor: default; }
.score-view.locked .score-btn:not(.selected) { opacity: 0.5; }

/* ---------- Glass number ---------- */
.glass-ring {
  width: 168px; height: 168px; border-radius: 50%; border: 1px solid rgba(201, 162, 83, 0.4);
  background: var(--glow); display: flex; align-items: center; justify-content: center; margin: 0 auto;
}
.glass-number { font-family: var(--serif); font-size: 104px; line-height: 1; color: var(--brass); }

/* ---------- Wine picker chips ---------- */
.wine-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wine-chip {
  min-width: 44px; height: 44px; padding: 0 12px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-family: var(--serif); font-size: 18px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.wine-chip.active { border-color: var(--brass); color: var(--brass); }
.wine-chip .lock { font-size: 12px; color: var(--text-muted); }
.wine-chip.locked .lock { color: var(--brass); }

/* ---------- Cover / thumbnails ---------- */
.cover { aspect-ratio: 3 / 2; background: var(--surface-alt); overflow: hidden; position: relative; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover .placeholder {
  position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 12px;
  background-image: repeating-linear-gradient(135deg, rgba(201, 162, 83, 0.14) 0 6px, transparent 6px 14px);
  color: var(--brass); font-size: 12px;
}
.thumb { width: 96px; height: 96px; border-radius: var(--radius); object-fit: cover; background: var(--surface-alt); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); background: var(--surface-alt); }
.gallery .g-item { position: relative; }
.gallery .g-del {
  position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(14, 26, 21, 0.8); border: 1px solid var(--border); color: var(--text); cursor: pointer; font-size: 14px; line-height: 1;
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { border-collapse: collapse; width: 100%; font-size: 14px; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
table.data thead th { position: sticky; top: 60px; background: var(--surface-alt); color: var(--text-muted); font-weight: 500; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
table.data tr.winner td { color: var(--brass); }
.badge { display: inline-block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted); }
.badge.brass { color: var(--brass); border-color: var(--border); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.none { background: transparent; border: 1px solid var(--text-muted); }
.dot.given { background: var(--text-muted); }
.dot.locked { background: var(--brass); }
.price { color: var(--brass); font-variant-numeric: tabular-nums; }
.score-pill { font-family: var(--serif); font-size: 18px; color: var(--brass); }

/* ---------- Comments ---------- */
.comment { padding: 12px 0; border-bottom: 1px solid var(--border-subtle); }
.comment .meta { font-size: 13px; color: var(--text-muted); display: flex; gap: 8px; align-items: center; }
.comment .author { color: var(--text-strong); }

/* ---------- Sortable (drag) ---------- */
.sortable-item { cursor: grab; }
.sortable-item.dragging { opacity: 0.5; }
.sortable-item .handle { cursor: grab; color: var(--text-muted); font-size: 20px; padding: 4px 8px; touch-action: none; user-select: none; }

/* ---------- Utility ---------- */
.hidden { display: none !important; }
.pill-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.pill-toggle button { background: transparent; border: 0; color: var(--text-muted); padding: 8px 14px; min-height: 40px; cursor: pointer; font-size: 14px; }
.pill-toggle button.active { background: var(--brass); color: var(--surface-alt); }
.list-reset { list-style: none; padding: 0; margin: 0; }
.tag-source { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.tag-source.klubi { color: var(--brass); }
.tag-source.isiklik { color: var(--text-muted); }

.footer { padding: 32px 0; color: var(--text-muted); font-size: 13px; border-top: 1px solid var(--border-subtle); margin-top: 32px; }

/* ---------- Veinisisestusvoog (bottom-sheet wizard) ---------- */
.wizard { position: fixed; inset: 0; z-index: 100; background: rgba(8, 15, 12, 0.66); display: flex; align-items: flex-end; justify-content: center; }
.wizard-sheet {
  width: 100%; max-width: 640px; max-height: 94dvh; background: var(--bg);
  border: 1px solid var(--border); border-radius: 16px 16px 0 0;
  display: flex; flex-direction: column; box-shadow: 0 -18px 48px rgba(8, 15, 12, 0.5);
}
@media (min-width: 700px) { .wizard { align-items: center; } .wizard-sheet { border-radius: 16px; max-height: 88dvh; } }
.wz-header {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border-subtle);
  position: sticky; top: 0; background: var(--bg); border-radius: 16px 16px 0 0;
}
.wz-header .wz-title { font-family: var(--serif); font-size: 18px; color: var(--text-strong); flex: 1; }
.wz-iconbtn { width: 44px; height: 44px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.wz-body { padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 16px; }
.wz-footer { padding: 12px 16px 20px; border-top: 1px solid var(--border-subtle); display: flex; gap: 10px; }
.wz-lockbar { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-muted); flex-wrap: wrap; }
.wz-lockbar .lock-val { color: var(--brass); }

.chip-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.big-chip {
  min-height: 52px; min-width: 44px; padding: 12px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 16px; cursor: pointer; text-align: left; transition: border-color 140ms ease, color 140ms ease;
}
.big-chip:hover { border-color: var(--brass); }
.big-chip.active { border-color: var(--brass); color: var(--brass); }
.big-chip.add { border-style: dashed; color: var(--text-muted); }

.recent-row { display: flex; gap: 8px; flex-wrap: wrap; }
.recent-row .big-chip { min-height: 44px; padding: 8px 14px; }

.continent-tabs { display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; scrollbar-width: none; }
.continent-tabs::-webkit-scrollbar { display: none; }
.continent-tab { white-space: nowrap; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font-size: 14px; cursor: pointer; min-height: 44px; }
.continent-tab.active { color: var(--surface-alt); background: var(--brass); border-color: var(--brass); }
@media (min-width: 900px) {
  .continents-desktop { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
}

/* Värvivalik (mull/valge/orange/rosé/punane/dessert) */
.color-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { flex: 1 1 calc(33.333% - 8px); min-width: 88px; height: 60px; border-radius: var(--radius); cursor: pointer; border: 2px solid transparent; position: relative; }
.swatch.active { border-color: var(--text-strong); box-shadow: 0 0 0 2px var(--brass); }
.swatch span { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font-size: 11px; color: rgba(8,15,12,0.85); font-weight: 600; }
.swatch.mull { background: #EFE7C2; }
.swatch.valge { background: #E8D9A0; }
.swatch.orange { background: #D98A3C; }
.swatch.rose { background: #E39FA6; }
.swatch.punane { background: #6E1226; }
.swatch.dessert { background: #B5762A; }
.swatch.punane span { color: rgba(245,239,227,0.9); }

.ac-wrap { position: relative; }
.ac-list { list-style: none; margin: 4px 0 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); max-height: 200px; overflow-y: auto; }
.ac-list li { padding: 10px 12px; cursor: pointer; min-height: 40px; border-bottom: 1px solid var(--border-subtle); }
.ac-list li:hover, .ac-list li.active { background: rgba(201,162,83,0.12); color: var(--brass); }

.tag-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }

/* ---------- Küsitluse kuupäevakalender ---------- */
.poll-cal { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--surface); max-width: 360px; }
.poll-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.poll-cal-head .m { font-family: var(--serif); font-size: 17px; color: var(--text-strong); }
.poll-cal-nav { background: var(--surface-alt); border: 1px solid var(--border); color: var(--text); width: 38px; height: 38px; border-radius: var(--radius); cursor: pointer; font-size: 16px; }
.poll-cal-nav:hover { border-color: var(--brass); }
.poll-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.poll-cal-wd { text-align: center; font-size: 11px; color: var(--text-muted); padding: 2px 0; text-transform: uppercase; letter-spacing: 0.04em; }
.poll-cal-day { aspect-ratio: 1; min-height: 40px; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--text); cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.poll-cal-day:hover:not(:disabled):not(.empty) { border-color: var(--brass); }
.poll-cal-day.today { border-color: var(--border); }
.poll-cal-day.selected { background: var(--brass); color: var(--surface-alt); border-color: var(--brass); }
.poll-cal-day.empty { visibility: hidden; cursor: default; }
.poll-cal-day:disabled { color: var(--text-muted); opacity: 0.35; cursor: default; }
.poll-sel-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border-subtle); border-radius: var(--radius); }
.poll-sel-row .d { flex: 1; font-size: 14px; }
.poll-sel-row input[type=time] { width: auto; min-width: 110px; }
.poll-sel-row .rm { background: transparent; border: 0; color: var(--text-muted); cursor: pointer; font-size: 18px; width: 32px; height: 32px; border-radius: 50%; }
.poll-sel-row .rm:hover { color: var(--danger); background: var(--surface); }

/* ---------- Grupeeritud vaade (Minu veinid maade kaupa) ---------- */
.mw-group { grid-column: 1 / -1; }
.group-head {
  font-family: var(--serif); font-size: 22px; color: var(--brass);
  margin: 20px 0 2px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 10px;
}
.group-head .count { font-family: var(--sans); font-size: 13px; color: var(--text-muted); }
.group-sub {
  font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-muted); margin: 10px 0 2px;
}

/* two-column participant on tablet+ */
@media (min-width: 768px) {
  .participant-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
  .content-narrow { max-width: 720px; margin: 0 auto; }
}
