/* Планер Восхищения - нежный стиль клуба.
   Изюминка: статус поста - нить с шестью бусинами (.beads). */

:root {
  --paper: #FBF0EC;      /* пудровый фон */
  --cream: #FFE2CD;      /* кремовый клуба */
  --card: #FFF8F4;       /* карточки */
  --blush: #F0B0C0;      /* нежно-розовый */
  --blush-soft: #F7D3DC;
  --wine: #4A1026;       /* винный - основной текст */
  --raspberry: #961E42;  /* малиновый - акценты */
  --rose: #E83E6E;       /* розовый кнопок */
  --muted: #9A6B78;
  --line: #EBCFD3;
  --ok: #3F8A5E;
  --danger: #B3263E;

  --f-display: "Prata", Georgia, serif;
  --f-body: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-script: "Marck Script", cursive;

  --r-card: 20px;
  --r-pill: 999px;
  --shadow: 0 6px 22px rgba(74, 16, 38, .08);
  --nav-h: 76px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--wine);
  font: 400 16px/1.45 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; border-radius: 8px; }

#app { max-width: 560px; margin: 0 auto; min-height: 100%; }

.screen {
  padding: calc(18px + var(--safe-t)) 18px calc(var(--nav-h) + var(--safe-b) + 28px);
  animation: rise .28s ease-out both;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen, .sheet { animation: none !important; } }

/* ---------- типографика ---------- */
.eyebrow {
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); font-weight: 500;
}
h1, .h1 { font: 400 30px/1.15 var(--f-display); margin: 4px 0 0; letter-spacing: -.01em; }
h2, .h2 { font: 400 21px/1.2 var(--f-display); margin: 0; }
.script { font-family: var(--f-script); font-weight: 400; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- шапка ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 18px;
}
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--cream); color: var(--raspberry);
  display: grid; place-items: center; font: 400 18px var(--f-display);
  border: 0; flex: none; overflow: hidden; padding: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.back {
  border: 0; background: none; padding: 6px 8px 6px 0; display: inline-flex;
  align-items: center; gap: 4px; color: var(--wine); font-size: 15px;
}

/* ---------- приветствие ---------- */
.hello { margin: 6px 0 22px; }
.hello .script { font-size: 44px; line-height: 1; color: var(--raspberry); }
.hello .date { margin-top: 6px; color: var(--muted); }

/* ---------- карточки ---------- */
.card {
  background: var(--card); border-radius: var(--r-card); padding: 18px;
  box-shadow: var(--shadow); margin-bottom: 14px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.link { color: var(--raspberry); font-weight: 600; font-size: 14px; text-decoration: none; background: none; border: 0; padding: 0; }

/* неделя: четыре числа без «шаблонной» плашки - тонкая нить сверху */
.week { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.week b { display: block; font: 500 28px/1.15 var(--f-body); color: var(--wine); letter-spacing: -.02em; }
.week span { font-size: 11.5px; color: var(--muted); }

/* ---------- задачи ---------- */
.task { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; }
.check {
  width: 24px; height: 24px; border-radius: 50%; flex: none; margin-top: 1px;
  border: 1.5px solid var(--blush); background: #fff; display: grid; place-items: center; padding: 0;
}
.check.on { background: var(--rose); border-color: var(--rose); }
.check.on::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.task .t { flex: 1; min-width: 0; }
.task.done .t-text { text-decoration: line-through; color: var(--muted); }
.task .meta { font-size: 12.5px; color: var(--muted); }
.task .meta.late { color: var(--danger); }
.task .del { border: 0; background: none; color: var(--muted); padding: 2px 4px; }

/* ---------- бусины статуса (изюминка) ---------- */
.beads { display: flex; align-items: center; gap: 0; position: relative; }
.beads::before {           /* нить */
  content: ""; position: absolute; left: 6px; right: 6px; top: 50%;
  height: 1.5px; background: var(--line); transform: translateY(-50%);
}
.bead {
  position: relative; z-index: 1; flex: 1; display: flex; justify-content: center;
  border: 0; background: none; padding: 0;
}
.bead i {
  width: 12px; height: 12px; border-radius: 50%; display: block;
  background: var(--paper); border: 1.5px solid var(--blush);
  transition: transform .15s ease;
}
.bead.on i { background: var(--blush); border-color: var(--blush); }
.bead.cur i { background: var(--rose); border-color: var(--rose); box-shadow: 0 0 0 4px rgba(232, 62, 110, .18); }
.bead.pub i { background: var(--raspberry); border-color: var(--raspberry); }
.beads.big .bead i { width: 20px; height: 20px; }
.beads.big { padding: 6px 0; }
.beads.big .bead:active i { transform: scale(1.2); }
.bead-labels { display: flex; margin-top: 8px; }
.bead-labels span { flex: 1; text-align: center; font-size: 10.5px; color: var(--muted); line-height: 1.2; }
.bead-labels span.cur { color: var(--raspberry); font-weight: 600; }

/* ---------- чипсы и фильтры ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; margin: 0 -18px 12px; padding-left: 18px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--card);
  border-radius: var(--r-pill); padding: 8px 14px; font-size: 14px; white-space: nowrap;
}
.chip b { font-weight: 600; color: var(--muted); margin-left: 4px; }
.chip.on { background: var(--wine); color: #fff; border-color: var(--wine); }
.chip.on b { color: var(--blush); }
.chips:last-child { margin-bottom: 0; }

/* ---------- карточка поста в списке ---------- */
.post {
  display: flex; gap: 14px; align-items: stretch; width: 100%; text-align: left;
  background: var(--card); border: 0; border-radius: var(--r-card); padding: 14px;
  box-shadow: var(--shadow); margin-bottom: 12px;
}
.post .thumb {
  width: 66px; flex: none; aspect-ratio: 3 / 4; border-radius: 12px;
  background: var(--blush-soft) center/cover no-repeat;
  display: grid; place-items: center; color: var(--raspberry);
}
.post .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.post .type { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--raspberry); font-weight: 600; }
.post .title { font: 400 17px/1.25 var(--f-display); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.post .hook { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post .when { font-size: 12.5px; color: var(--muted); }
.post .beads { margin-top: auto; }

/* ---------- форма поста ---------- */
.field { margin-bottom: 16px; }
.field label, .label { display: block; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.input, textarea.input {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 14px;
  padding: 12px 14px; font-size: 16px; color: var(--wine); resize: none;
}
textarea.input { min-height: 96px; line-height: 1.45; }
.input:focus { outline: none; border-color: var(--blush); box-shadow: 0 0 0 3px rgba(240, 176, 192, .35); }
.title-input { font: 400 24px/1.25 var(--f-display); border: 0; background: none; padding: 4px 0; width: 100%; color: var(--wine); resize: none; field-sizing: content; min-height: 1.3em; }
.title-input:focus { outline: none; }
.title-input::placeholder { color: var(--blush); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.cover {
  aspect-ratio: 3 / 4; width: 132px; border-radius: 16px; border: 1.5px dashed var(--blush);
  background: var(--card) center/cover no-repeat; display: grid; place-items: center;
  color: var(--raspberry); font-size: 13px; text-align: center; padding: 10px; position: relative;
}
.cover.has { border-style: solid; border-color: transparent; }
.cover input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.cover-row { display: flex; gap: 14px; align-items: flex-end; }

/* ---------- кнопки ---------- */
.btn {
  border: 0; border-radius: 16px; padding: 14px 18px; font-weight: 600; font-size: 16px;
  background: var(--rose); color: #fff; width: 100%;
}
.btn.ghost { background: var(--card); color: var(--wine); border: 1px solid var(--line); }
.btn.danger { background: none; color: var(--danger); font-weight: 500; }
.btn:disabled { opacity: .5; }

/* ---------- сетка Instagram ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin: 0 -18px; }
.tile {
  aspect-ratio: 3 / 4; border: 0; padding: 8px; position: relative;
  background: var(--blush-soft) center/cover no-repeat; color: var(--wine);
  display: flex; align-items: flex-end; text-align: left;
}
.tile span { font: 400 13px/1.2 var(--f-display); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile.has span { display: none; }
.tile .badge {
  position: absolute; top: 6px; right: 6px; background: rgba(255, 248, 244, .92);
  color: var(--raspberry); font-size: 10.5px; padding: 2px 7px; border-radius: var(--r-pill); font-weight: 600;
}
.ig-head { display: flex; align-items: center; gap: 14px; margin: 4px 0 18px; }
.ig-head .avatar { width: 64px; height: 64px; font-size: 26px; }

/* ---------- пустые состояния ---------- */
.empty { text-align: center; padding: 40px 18px; color: var(--muted); }
.empty .h2 { color: var(--wine); margin-bottom: 6px; }
.empty .btn { margin-top: 18px; width: auto; padding: 12px 22px; }

/* ---------- нижнее меню ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(255, 248, 244, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  max-width: 560px; margin: 0 auto;
}
.nav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; color: var(--muted); text-decoration: none;
}
.nav a.on { color: var(--raspberry); font-weight: 600; }
.nav svg { width: 24px; height: 24px; }
.nav .plus {
  width: 58px; height: 58px; border-radius: 50%; border: 0; justify-self: center;
  background: var(--rose); color: #fff; display: grid; place-items: center;
  box-shadow: 0 8px 20px rgba(232, 62, 110, .35); margin-top: -26px;
}
.nav .plus svg { width: 26px; height: 26px; }

/* ---------- нижний лист ---------- */
.veil { position: fixed; inset: 0; background: rgba(74, 16, 38, .28); z-index: 30; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-width: 560px; margin: 0 auto;
  background: var(--paper); border-radius: 26px 26px 0 0; padding: 12px 18px calc(22px + var(--safe-b));
  animation: up .22s ease-out both; max-height: 90vh; overflow: auto;
}
.sheet .grip { width: 40px; height: 4px; background: var(--line); border-radius: 4px; margin: 0 auto 14px; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); transform: translateX(-50%);
  background: var(--wine); color: #fff; padding: 10px 16px; border-radius: 14px; font-size: 14px; z-index: 40;
  box-shadow: var(--shadow);
}

/* ---------- вход ---------- */
.login {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: center;
  padding: 32px 26px calc(32px + var(--safe-b)); text-align: center;
}
.login .mark { font: 400 15px var(--f-body); letter-spacing: .32em; text-transform: uppercase; color: var(--raspberry); }
.login .script { font-size: 54px; color: var(--wine); line-height: 1.05; margin: 22px 0 10px; }
.login p { color: var(--muted); margin: 0 auto 30px; max-width: 300px; }
.login .beads { width: 100%; max-width: 240px; margin: 0 auto 34px; }
.login .tg { min-height: 48px; display: flex; justify-content: center; }
.login .note { font-size: 13px; color: var(--muted); margin-top: 22px; }
.login .err { color: var(--danger); margin-top: 16px; font-size: 14px; }

.offline { background: var(--wine); color: #fff; text-align: center; font-size: 13px; padding: 6px; position: sticky; top: 0; z-index: 25; }

.install ol { padding-left: 20px; margin: 8px 0 0; }
.install li { margin-bottom: 6px; }
