:root {
  color-scheme: dark;
  --bg: #121212;
  --card: #1e1e1e;
  --text: #9a9a9a;
  --muted: #9a9a9a;
  --line: #333;
  --accent: #CD7F32;
  --on-accent: #e8e4dc;
  --danger: #ff6b6b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, sans-serif;
}

.wrap {
  width: min(28rem, 100%);
  margin: 0 auto;
  padding: calc(1.5rem + env(safe-area-inset-top, 0px)) 1rem calc(3rem + env(safe-area-inset-bottom, 0px));
}

h1 {
  margin: 0 0 1rem;
  font-size: 1.8rem;
}

h2 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}

.block-title {
  margin: 1.25rem 0 0.65rem;
  font-size: 1.15rem;
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.who {
  margin: 0;
  padding: 0.35rem 0;
  color: var(--muted);
}

a.who { color: var(--muted); }

.card, .tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.25rem;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.card p { margin: 0; }

label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 1rem;
}

input, textarea {
  width: 100%;
  padding: 0.9rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #161616;
  color: var(--text);
  font-size: 1.1rem;
  font-family: inherit;
}

textarea { resize: vertical; }

button {
  width: 100%;
  min-height: 3.2rem;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 1.15rem;
  font-weight: 600;
}

button.secondary {
  background: #2a2a2a;
  color: var(--text);
}

.error { margin: 0; color: var(--danger); }

.tiles {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.tile-link { display: block; color: inherit; }

.wine-card { padding: 0 0 1.1rem; overflow: hidden; }

.wine-card img {
  display: block;
  width: 100%;
  height: 12rem;
  object-fit: cover;
  margin-bottom: 0.85rem;
}

.wine-card h2,
.wine-card p { padding: 0 1.1rem; }

.wine-card h2 { margin: 0 0 0.3rem; }

.hero {
  display: block;
  width: 100%;
  max-height: 18rem;
  object-fit: cover;
  border-radius: 16px;
  margin: 0 0 1rem;
}

.tile-num {
  margin: 0.15rem 0 0.35rem;
  font-size: 1.7rem;
  font-weight: 700;
}

.muted, .note, .ratings { color: var(--muted); }

.note { margin: 0 0 0.85rem; }

.ratings { line-height: 1.45; }

.actions { margin: 0 0 0.75rem; }

a { color: var(--accent); text-decoration: none; }

.back { margin: 0 0 0.75rem; }

.btn-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.2rem;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 1.1rem;
  font-weight: 600;
}

.rate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.rate-grid button {
  background: #2a2a2a;
  color: var(--text);
}

.rate-grid button.active {
  background: var(--accent);
  color: var(--on-accent);
}

.field-title { margin: 0; }

.photo-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.photo-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.2rem;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 1.1rem;
  font-weight: 600;
  overflow: hidden;
}

.photo-btn input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  font-size: 0;
  cursor: pointer;
}

.list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.list .note { margin: 0; }

select {
  width: 100%;
  padding: 0.9rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #161616;
  color: var(--text);
  font-size: 1.1rem;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.15rem) calc(50% - 0.15rem),
    calc(100% - 0.75rem) calc(50% - 0.15rem);
  background-size: 0.4rem 0.4rem, 0.4rem 0.4rem;
  background-repeat: no-repeat;
}

.filters {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.filters .back { margin: 0; }
