/* Цвета берём из темы Telegram (telegram-web-app.js сам выставляет --tg-theme-*), запасные — светлая тема. */
:root {
  --bg: var(--tg-theme-secondary-bg-color, #f1f1f4);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #fff));
  --text: var(--tg-theme-text-color, #111);
  --hint: var(--tg-theme-hint-color, #8a8a8e);
  --link: var(--tg-theme-link-color, #2a7ae2);
  --accent: var(--tg-theme-button-color, #2a7ae2);
  --accent-text: var(--tg-theme-button-text-color, #fff);
  --danger: var(--tg-theme-destructive-text-color, #e53935);
  --line: color-mix(in srgb, var(--hint) 25%, transparent);
  --ok: #2e9d4f;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
main { padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; }
body.has-tabs main { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
h1 { font-size: 22px; margin: 4px 4px 12px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--hint);
  font-weight: 600; margin: 20px 8px 6px; }
p { margin: 6px 4px; }
.hint { color: var(--hint); font-size: 14px; }
.center { text-align: center; padding: 40px 16px; }
.error { color: var(--danger); }

.card { background: var(--card); border-radius: 14px; padding: 12px; margin-bottom: 8px; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.tap { cursor: pointer; }
.tap:active { opacity: .7; }
.chevron { color: var(--hint); font-size: 20px; }
.count { color: var(--hint); font-size: 15px; }

.avatar { width: 42px; height: 42px; border-radius: 50%; flex: none; object-fit: cover;
  background: var(--accent); color: var(--accent-text); display: flex; align-items: center;
  justify-content: center; font-weight: 600; font-size: 18px; }

.wish { display: flex; gap: 12px; }
.wish.taken { opacity: .55; }
.thumb { width: 76px; height: 76px; border-radius: 10px; object-fit: cover; flex: none;
  background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 32px; }
.wish-title { font-weight: 600; word-break: break-word; }
.wish-meta { font-size: 14px; margin-top: 2px; }
.wish-note { font-size: 14px; color: var(--hint); margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
.badge { display: inline-block; font-size: 13px; padding: 1px 8px; border-radius: 10px; margin: 6px 6px 0 0;
  background: var(--bg); }
.badge.ok { color: var(--ok); }
.badge.bad { color: var(--danger); }
.badge.mine { background: var(--accent); color: var(--accent-text); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

button, .btn { font: inherit; font-size: 15px; border: 0; border-radius: 10px; padding: 8px 14px; cursor: pointer;
  background: var(--accent); color: var(--accent-text); }
button.secondary { background: var(--bg); color: var(--link); }
button.danger { background: transparent; color: var(--danger); }
button.wide { width: 100%; padding: 12px; font-size: 16px; margin-top: 8px; }
button:disabled { opacity: .5; }

label { display: block; font-size: 13px; color: var(--hint); margin: 12px 4px 4px; }
input, textarea { width: 100%; font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; }
input:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 72px; resize: vertical; }
.status { font-size: 14px; margin: 6px 4px 0; min-height: 1em; }
.photo-edit { display: flex; align-items: center; gap: 12px; }
.photo-edit .thumb { width: 96px; height: 96px; }

#tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
#tabs button { flex: 1; background: none; color: var(--hint); border-radius: 0; padding: 8px 0 10px; font-size: 12px; }
#tabs button.active { color: var(--accent); }
#tabs .icon { display: block; font-size: 22px; }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: rgba(0,0,0,.8); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px;
  max-width: 90%; text-align: center; z-index: 10; }
body.has-tabs #toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
