/* Светлая «пивная» тема: кремовый фон, белые карточки, янтарный акцент. Одинаковая в браузере и в Telegram. */
:root {
  --bg: #fbf6ec;
  --surface: #ffffff;
  --bg2: #f4ecdf;
  --line: #ece1cf;
  --text: #2b2118;
  --hint: #8c7c69;
  --link: #b8650f;
  --accent: #e8961c;
  --accent-dark: #c97a0a;
  --accent-soft: #fdecd0;
  --accent-text: #ffffff;
  --star: #f4a91f;
  --star-off: #e9dfcf;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(80, 50, 10, .05), 0 6px 20px rgba(80, 50, 10, .07);
  --font-display: "Unbounded", -apple-system, BlinkMacSystemFont, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.45 "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
main { max-width: 680px; margin: 0 auto; padding: 0 16px 16px; }
h1 { font: 600 24px/1.2 var(--font-display); margin: 10px 0 6px; letter-spacing: -.01em; }
h2 { font: 600 17px/1.25 var(--font-display); margin: 28px 0 12px; }
.hint { color: var(--hint); font-size: 14px; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  max-width: 680px; margin: 0 auto; padding: 14px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px);
}
.tg .topbar { display: none; }
.logo { font: 700 19px var(--font-display); color: var(--text); letter-spacing: -.02em; }
.me-link { font-weight: 700; padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
  display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -1px 0 var(--line), 0 -6px 20px rgba(80, 50, 10, .05);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; font-size: 21px; color: var(--hint); min-width: 60px; filter: grayscale(1) opacity(.6); transition: filter .15s; }
.tabbar a span { font-size: 11px; margin-top: 3px; font-weight: 600; }
.tabbar a.active { color: var(--accent-dark); filter: none; }

input, textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #b3a594; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea { min-height: 104px; resize: vertical; }
label { display: block; margin: 16px 0 6px; font-size: 13px; font-weight: 700; color: var(--hint); text-transform: uppercase; letter-spacing: .04em; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

.btn {
  display: inline-block; border: 0; border-radius: 14px; padding: 14px 20px; cursor: pointer;
  font: inherit; font-weight: 700; background: linear-gradient(180deg, #f2a833, var(--accent));
  color: var(--accent-text); box-shadow: 0 4px 14px rgba(232, 150, 28, .35); transition: transform .1s, box-shadow .15s;
}
.btn:active { transform: scale(.98); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn:disabled { opacity: .45; box-shadow: none; }

.search { margin: 4px 0 10px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 14px; border-radius: 999px; background: var(--surface);
  color: var(--text); font-size: 14px; font-weight: 600; border: 1.5px solid var(--line); cursor: pointer; font-family: inherit;
  transition: background .15s, border-color .15s;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip small { opacity: .6; margin-left: 4px; }
.segmented { display: flex; gap: 6px; margin: 6px 0 8px; }

.card {
  display: flex; gap: 14px; align-items: center; padding: 12px 14px 12px 12px; margin: 10px 0;
  background: var(--surface); border-radius: var(--radius); color: var(--text); box-shadow: var(--shadow);
  transition: transform .12s;
}
.card:active { transform: scale(.99); }
.thumb {
  flex: none; width: 56px; height: 74px; border-radius: 12px; display: grid; place-items: center;
  font-size: 28px; background: linear-gradient(160deg, #fff3dc, #f8dfb5); overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .body { flex: 1; min-width: 0; }
.card .title { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .sub { color: var(--hint); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score { text-align: right; flex: none; }
.score b { font: 700 21px var(--font-display); display: block; }
.score .stars { font-size: 12px; letter-spacing: 1px; }
.score small { color: var(--hint); font-size: 12px; display: block; margin-top: 2px; }

/* Звёзды: серый слой + золотой поверх, обрезанный по ширине. */
.stars { position: relative; display: inline-block; line-height: 1; letter-spacing: 2px; color: var(--star-off); white-space: nowrap; user-select: none; }
.stars::before { content: "★★★★★"; }
.stars .fill { position: absolute; inset: 0 auto 0 0; overflow: hidden; color: var(--star); }
.stars .fill::before { content: "★★★★★"; }
.stars.input { font-size: 46px; cursor: pointer; touch-action: none; }
.rate-value { font: 700 30px var(--font-display); margin-left: 12px; vertical-align: middle; color: var(--accent-dark); }

.hero { display: flex; gap: 18px; align-items: center; margin-top: 8px; }
.hero .thumb { width: 124px; height: 164px; font-size: 56px; border-radius: 18px; box-shadow: var(--shadow); }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.meta span { background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600; }

.summary { display: flex; gap: 22px; align-items: center; background: var(--surface); padding: 18px; border-radius: var(--radius); box-shadow: var(--shadow); }
.big { font: 700 46px/1 var(--font-display); color: var(--accent-dark); }
.dist { flex: 1; }
.dist .bar { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--hint); font-weight: 600; }
.dist .track { flex: 1; height: 7px; border-radius: 4px; background: var(--star-off); overflow: hidden; }
.dist .track i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #f7c04a, var(--star)); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 13px; font-weight: 600; padding: 5px 11px; border-radius: 999px; background: var(--accent-soft); color: #8a5208; }

.review { padding: 14px 0; border-bottom: 1px solid var(--line); }
.review .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.review .who { font-weight: 800; }
.review .beer { font-size: 14px; font-weight: 600; }
.review p { margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.panel { background: var(--surface); border-radius: var(--radius); padding: 16px; margin-top: 14px; box-shadow: var(--shadow); }
.stat-row { display: flex; gap: 10px; }
.stat { flex: 1; background: var(--surface); border-radius: var(--radius); padding: 16px; text-align: center; box-shadow: var(--shadow); }
.stat b { display: block; font: 700 28px var(--font-display); color: var(--accent-dark); }

.empty { text-align: center; color: var(--hint); padding: 40px 0; }
.toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #2b2118; color: #fff; padding: 11px 18px; border-radius: 14px; z-index: 60; max-width: 90vw;
  font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}

.search-row { display: flex; gap: 8px; align-items: center; margin: 4px 0 10px; }
.search-row .search { margin: 0; }
.icon-btn { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--surface); border: 1.5px solid var(--line); font-size: 20px; }

.scan-hero { text-align: center; padding: 24px 0 8px; }
.scan-hero .emoji { font-size: 44px; width: 96px; height: 96px; margin: 0 auto 8px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(160deg, #fff3dc, #f8d9a3); box-shadow: var(--shadow); }
.scan-actions { display: grid; gap: 10px; margin-top: 20px; }
.photo { width: 100%; max-height: 320px; object-fit: contain; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); display: block; }
.source { display: inline-block; font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 999px; background: var(--accent-soft); color: #8a5208; margin: 14px 0 4px; }
.spinner { width: 36px; height: 36px; margin: 24px auto 8px; border-radius: 50%; border: 3px solid var(--bg2); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.candidate { display: flex; gap: 8px; align-items: center; }
.candidate .card { flex: 1; min-width: 0; }
.candidate .btn { flex: none; padding: 10px 14px; }

.gallery { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.gallery::-webkit-scrollbar { display: none; }
.gallery > div { flex: none; width: 120px; color: var(--hint); font-size: 12px; }
.gallery img { width: 120px; height: 160px; object-fit: cover; border-radius: 14px; display: block; margin-bottom: 6px; background: var(--bg2); box-shadow: var(--shadow); }
.gallery span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.review-photo { display: block; width: 120px; height: 160px; object-fit: cover; border-radius: 14px; margin: 8px 0; box-shadow: var(--shadow); }
.photo-edit { display: flex; gap: 12px; align-items: flex-end; }
.photo-edit img { width: 120px; height: 160px; object-fit: cover; border-radius: 14px; box-shadow: var(--shadow); }

[data-zoom] { cursor: zoom-in; }
.lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .94);
  display: flex; align-items: center; justify-content: center; touch-action: pan-y pinch-zoom;
  animation: lb-in .15s ease-out;
}
@keyframes lb-in { from { opacity: 0; } }
.lb-img { width: 100%; height: calc(100% - 120px); object-fit: contain; user-select: none; -webkit-user-drag: none; }
.lb-top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; color: #fff; font-size: 14px;
}
.lb-close, .lb-nav { background: rgba(255, 255, 255, .12); color: #fff; border: 0; border-radius: 50%; cursor: pointer; font: inherit; }
.lb-close { width: 40px; height: 40px; font-size: 18px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; font-size: 28px; line-height: 1; }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-caption {
  position: absolute; bottom: 0; left: 0; right: 0; text-align: center; color: rgba(255, 255, 255, .85);
  font-size: 14px; padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
}

.rec-on { background: linear-gradient(180deg, #ef6b5b, #d64545); box-shadow: 0 4px 14px rgba(214, 69, 69, .35); color: #fff; animation: rec-pulse 1.4s ease-in-out infinite; }
@keyframes rec-pulse { 50% { opacity: .75; } }
.transcript { font-style: italic; margin: 10px 0 0; }

/* Кнопки-«label» (выбор файла) не должны наследовать стиль подписей полей. */
label.btn { text-transform: none; letter-spacing: normal; font-size: 16px; font-weight: 700; color: var(--accent-text); }
label.btn.ghost { color: var(--text); }

/* Встроенная камера */
.camera { position: fixed; inset: 0; z-index: 55; background: #000; }
.camera video { width: 100%; height: 100%; object-fit: cover; }
.cam-frame {
  position: absolute; left: 10%; right: 10%; top: 22%; bottom: 30%; border-radius: 22px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); border: 2px solid rgba(255, 255, 255, .85); pointer-events: none;
}
.cam-hint {
  position: absolute; left: 0; right: 0; top: calc(14% - 10px); text-align: center; color: #fff;
  font-weight: 700; text-shadow: 0 1px 6px rgba(0, 0, 0, .5);
}
.cam-close { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 16px; }
.cam-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; padding: 20px 0 calc(28px + env(safe-area-inset-bottom)); }
.cam-shutter {
  width: 76px; height: 76px; border-radius: 50%; border: 5px solid rgba(255, 255, 255, .9);
  background: var(--accent); box-shadow: 0 4px 18px rgba(0, 0, 0, .35); cursor: pointer;
}
.cam-shutter:active { transform: scale(.94); }
.camera.flash::after { content: ""; position: absolute; inset: 0; background: #fff; animation: flash .25s ease-out forwards; }
@keyframes flash { from { opacity: .8; } to { opacity: 0; } }
