/* Кино друзей — вёрстка под телефон в духе iOS */
:root {
  --bg: #f2f2f7;
  --card: #fff;
  --text: #1c1c1e;
  --muted: #8e8e93;
  --line: #e5e5ea;
  --blue: #007aff;
  --red: #ff3b30;
  --green: #34c759;
  --purple: #af52de;
  --orange: #ff9500;
  --radius: 12px;
  --tabbar: 58px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--blue); text-decoration: none; }
h2 { font-size: 20px; margin: 24px 4px 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { margin-left: auto; }
.grow { flex: 1; min-width: 0; }

/* Шапка */
.topbar {
  position: sticky; top: 0; z-index: 10;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: rgba(242, 242, 247, .92);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
}
.topbar h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -.5px; overflow-wrap: anywhere; }
.back { display: inline-block; font-size: 17px; margin-bottom: 4px; }

.content {
  max-width: 600px; margin: 0 auto;
  padding: 4px 16px calc(var(--tabbar) + env(safe-area-inset-bottom) + 24px);
}

/* Нижняя панель вкладок */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(249, 249, 249, .94);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: .5px solid #c6c6c8;
}
.tabbar a {
  position: relative; flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: 11px; font-weight: 500;
}
.tabbar a.on { color: var(--blue); }
.tabbar svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.tabbar .dot {
  position: absolute; top: 5px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}

/* Сообщения */
.messages { margin: 6px 0 12px; }
.msg { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 8px; background: var(--card); }
.msg-success { background: #e3f8e8; color: #1b6e30; }
.msg-error { background: #ffe5e3; color: #a1170e; }
.msg-info { background: #e5f0ff; color: #0a4fa8; }

/* Списки */
.list { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.list + .list { margin-top: 20px; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; color: var(--text);
  border-bottom: .5px solid var(--line);
}
.row:last-child { border-bottom: 0; }
a.row:active { background: #e5e5ea; }
.row.movie { display: block; }
.movie-head { display: flex; align-items: center; gap: 10px; }
.movie-title { flex: 1; font-size: 19px; font-weight: 600; overflow-wrap: anywhere; }
.emojis { font-size: 20px; margin: 6px 0 2px; display: flex; gap: 6px; flex-wrap: wrap; }
.chev { color: #c7c7cc; font-size: 22px; line-height: 1; margin-left: auto; }
.count {
  min-width: 30px; padding: 4px 10px; border-radius: 999px;
  background: var(--blue); color: #fff; font-weight: 700; font-size: 15px; text-align: center;
}
.settings { margin-top: 28px; }

.tag { flex: none; font-size: 12px; padding: 3px 8px; border-radius: 5px; font-weight: 500; }
.tag-film { background: rgba(255, 149, 0, .15); color: #c66a00; }
.tag-series { background: rgba(175, 82, 222, .15); color: var(--purple); }

/* Аватарки */
.avatar {
  flex: none; display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--blue); color: #fff; font-weight: 600;
}
.avatar.pale { background: #c7c7cc; }
.avatar.big { width: 56px; height: 56px; font-size: 24px; }
.profile { display: flex; align-items: center; gap: 14px; margin: 8px 4px 20px; }
.person form { margin: 0; }

/* Карточка фильма */
.movie-meta { display: flex; align-items: center; gap: 12px; margin: 0 2px 16px; }
.movie-meta .emojis { margin: 0; }
.watch {
  display: flex; align-items: center; gap: 12px;
  padding: 16px; margin-bottom: 10px; border-radius: var(--radius);
  background: var(--red); color: #fff; font-weight: 600; font-size: 17px;
}
.watch small { display: block; font-weight: 400; opacity: .85; }
.watch .play { font-size: 22px; }
.watch .arrow { margin-left: auto; }

.card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-head .avatar { width: 30px; height: 30px; font-size: 14px; }
.card-head a { color: var(--text); }
.text { margin: 10px 0 0; overflow-wrap: anywhere; }

/* Шильдики */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(118, 118, 128, .12); color: var(--text); font-size: 14px; white-space: nowrap;
}
.chip.on { background: var(--blue); color: #fff; }
.chips-scroll {
  display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px 2px;
  scrollbar-width: none;
}
.chips-scroll::-webkit-scrollbar { display: none; }
.pick .chip { cursor: pointer; user-select: none; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick .chip:has(input:checked) { background: var(--blue); color: #fff; }

/* Кнопки */
.btn {
  display: block; width: 100%; margin-top: 14px; padding: 14px 16px;
  border: 0; border-radius: var(--radius);
  background: var(--blue); color: #fff; font: inherit; font-weight: 600; font-size: 17px; text-align: center;
  cursor: pointer;
}
.btn:active { opacity: .7; }
.btn-light { background: rgba(0, 122, 255, .12); color: var(--blue); }
.btn-danger { background: var(--card); color: var(--red); }
.btn-small { display: inline-block; width: auto; margin: 0; padding: 8px 14px; font-size: 15px; }

/* Формы */
.form { margin: 0; }
.group { background: var(--card); border-radius: var(--radius); padding: 4px 16px; margin-bottom: 16px; }
.field { display: block; padding: 10px 0; border-bottom: .5px solid var(--line); }
.group > .field:last-child, .group > :last-child .field { border-bottom: 0; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=url], input[type=password], input[type=search], textarea {
  width: 100%; padding: 8px 0; border: 0; outline: 0;
  background: transparent; color: var(--text); font: inherit; font-size: 17px;
}
textarea { resize: vertical; min-height: 96px; }
ul.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--red); font-size: 14px; }

.segmented { display: flex; background: rgba(118, 118, 128, .12); border-radius: 9px; padding: 2px; }
.segmented label { flex: 1; position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; padding: 7px; border-radius: 7px; text-align: center; font-size: 15px; font-weight: 500; }
.segmented input:checked + span { background: var(--card); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.segmented label > div, .segmented ul { display: contents; }

.new-badge { padding: 12px 0; border-top: .5px solid var(--line); }
.new-badge summary { color: var(--blue); cursor: pointer; list-style: none; font-weight: 500; }
.new-badge summary::-webkit-details-marker { display: none; }
.new-badge .inline { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.new-badge .field { border-bottom: .5px solid var(--line); }
.emoji-pick {
  flex: none; width: 52px; height: 52px; padding: 0;
  border: 1.5px dashed #c7c7cc; border-radius: var(--radius);
  background: transparent; color: var(--blue); font-size: 22px; line-height: 1; cursor: pointer;
}
.emoji-pick.chosen { border: 0; background: rgba(118, 118, 128, .12); font-size: 30px; }

/* Лист снизу с выбором эмодзи */
.sheet {
  position: fixed; inset: 0; z-index: 30;
  display: flex; align-items: flex-end;
  background: rgba(0, 0, 0, .35);
}
.sheet[hidden] { display: none; }
.sheet-panel {
  width: 100%; max-width: 600px; margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-radius: 14px 14px 0 0; overflow: hidden;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.sheet-close { border: 0; background: none; color: var(--blue); font: inherit; font-weight: 600; cursor: pointer; }
.sheet emoji-picker {
  width: 100%; height: min(420px, 62vh);
  --num-columns: 8; --emoji-size: 1.6rem; --border-size: 0;
  --background: var(--card); --indicator-color: var(--blue);
}
body.sheet-open { overflow: hidden; }

.search input {
  width: 100%; padding: 9px 12px; margin-bottom: 12px;
  border-radius: 10px; background: rgba(118, 118, 128, .12);
}
.add-friend { display: flex; gap: 10px; align-items: center; background: var(--card); border-radius: var(--radius); padding: 6px 6px 6px 16px; }
.add-friend input { flex: 1; min-width: 0; }

.empty { text-align: center; color: var(--muted); padding: 24px 8px; }
.empty .btn { margin-top: 12px; }
.big { font-size: 56px; }
.login { text-align: center; padding-top: 24px; }
.login .form { text-align: left; margin-top: 24px; }
