/* =========================================================
   components.css — кнопки, картки, форми, модальні вікна,
   лайтбокс, тости, бейджі, порожні стани
   ========================================================= */

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 18px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  border: 1.5px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text);
  transition: transform .15s var(--ease), box-shadow .2s, background .2s, border-color .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .6; cursor: progress; transform: none; }

.btn-primary { background: var(--accent-strong); color: var(--on-accent); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent-strong) 30%, transparent); }
.btn-primary:hover { box-shadow: 0 10px 22px color-mix(in srgb, var(--accent-strong) 38%, transparent); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-light { background: rgba(255, 255, 255, .85); color: #3A2E33; }
.btn-danger { background: var(--danger); color: #FFFFFF; }
:root[data-theme="dark"] .btn-danger, :root[data-theme="cosmos"] .btn-danger { color: #2A1A20; }
.btn-danger-text { color: var(--danger); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .88rem; }
.btn-hero {
  width: 100%;
  min-height: 64px;
  margin: 4px 0 18px;
  font-size: 1.15rem;
  background: linear-gradient(120deg, var(--accent-strong), color-mix(in srgb, var(--accent-strong) 70%, var(--accent-2)));
  color: var(--on-accent);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent-strong) 35%, transparent);
}
.btn-hero .dice { display: inline-block; font-size: 1.5rem; transition: transform .5s var(--ease); }
.btn-hero:hover .dice { transform: rotate(200deg); }
@media (min-width: 760px) { .btn-hero { width: auto; padding: 14px 36px; } }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  flex: none;
  padding: 0;
  font-size: 1.05rem;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: var(--text);
}
.icon-btn:hover { background: var(--surface-2); }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Картки ---------- */
.card {
  position: relative;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .25s var(--ease), box-shadow .25s;
}
.card + .card { margin-top: 16px; }
.card-title { font-size: 1.25rem; margin-bottom: 12px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.card-danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }

/* Плавна поява при скролі */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* ---------- Бейджі й чипи ---------- */
.badge, .chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: .8rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text);
  white-space: nowrap;
}
.badge-accent { background: var(--accent-soft); color: var(--accent-strong); }
.badge-done { background: color-mix(in srgb, var(--success) 16%, var(--surface)); color: var(--success); }

/* ---------- Картка події ---------- */
.event-card:hover { box-shadow: var(--shadow-hover); }
.event-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; font-size: .9rem; color: var(--muted); font-weight: 600; }
.event-mood { font-size: 1.2rem; line-height: 1; }
.event-title { font-size: 1.3rem; margin-bottom: 6px; }
.event-place { margin: 0 0 6px; color: var(--muted); font-weight: 600; }
.event-rating { margin: 0 0 6px; color: #C98A0B; letter-spacing: 2px; }
:root[data-theme="dark"] .event-rating, :root[data-theme="cosmos"] .event-rating { color: #F3C45B; }
.event-desc {
  white-space: pre-line;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.event-card.is-expanded .event-desc { -webkit-line-clamp: unset; display: block; }
.link-btn { padding: 0; margin-top: 4px; background: none; border: 0; color: var(--accent-strong); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.event-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; max-width: 760px; }
.event-photos.count-1 { grid-template-columns: 1fr; max-width: 560px; }
.event-photos.count-1 .photo-frame { aspect-ratio: 16 / 10; }
.event-photos.count-2 { grid-template-columns: repeat(2, 1fr); }
.tl-item.is-highlight .event-card { animation: highlight 2.2s ease; }
@keyframes highlight {
  0%, 40% { box-shadow: 0 0 0 4px var(--accent), var(--shadow-hover); }
  100% { box-shadow: var(--shadow); }
}

/* Рамка для мініатюри фото (кнопка, яка відкриває лайтбокс) */
.photo-frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.photo-frame img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); animation: fade-in .4s ease; }
.photo-frame:hover img { transform: scale(1.05); }
.photo-frame.is-missing::after { content: '🖼️'; position: absolute; inset: 0; display: grid; place-items: center; opacity: .5; }
.photo-more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #FFFFFF;
  background: rgba(20, 10, 14, .5);
}
@keyframes fade-in { from { opacity: 0; } }

/* ---------- Галерея ---------- */
.gallery-item { position: relative; }
.gallery-item .photo-frame { aspect-ratio: auto; }
.gallery-item .photo-frame img { height: auto; }
.gallery-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 18px 10px 8px;
  font-size: .82rem;
  font-weight: 700;
  color: #FFFFFF;
  background: linear-gradient(transparent, rgba(20, 10, 14, .7));
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  pointer-events: none;
}
.page-gallery.is-dragging .gallery-drop-hint { display: grid; }
.gallery-drop-hint {
  display: none;
  position: fixed;
  inset: 12px;
  z-index: 40;
  place-items: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  border: 3px dashed var(--accent);
  border-radius: var(--radius);
  pointer-events: none;
}
.upload-status { min-height: 1.5em; font-weight: 700; color: var(--accent-strong); }

/* ---------- Картка ідеї ---------- */
.idea-card { display: flex; flex-direction: column; }
.idea-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.idea-card.is-done { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.idea-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin-bottom: 10px; }
.idea-title { font-size: 1.2rem; margin-bottom: 6px; }
.idea-desc { color: var(--muted); flex: 1; }
.idea-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; padding: 0; }
.idea-tags li { padding: 3px 9px; font-size: .8rem; font-weight: 700; background: var(--surface-2); border-radius: var(--radius-pill); }
.idea-card .card-actions { margin-top: 14px; }
.btn-wish[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }

.progress-wrap { margin: 0 0 14px; }
.progress-text { margin: 0 0 6px; font-weight: 700; }
.progress {
  height: 12px;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: inherit;
  transition: width .8s var(--ease);
}

.filters {
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.filters > summary {
  padding: 14px 18px;
  font-weight: 800;
  cursor: pointer;
  list-style-position: inside;
}
.filters-body { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 18px 18px; }
.filters-body .field { margin: 0; }
.filters-body .btn { grid-column: 1 / -1; justify-self: start; }
@media (min-width: 760px) { .filters-body { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .filters-body { grid-template-columns: repeat(6, 1fr); } }

/* Зірочки оцінки */
.stars { display: inline-flex; gap: 2px; margin-top: 10px; }
.star-btn { padding: 2px; background: none; border: 0; font-size: 1.35rem; line-height: 1; color: #C98A0B; transition: transform .15s; }
:root[data-theme="dark"] .star-btn, :root[data-theme="cosmos"] .star-btn { color: #F3C45B; }
.star-btn:hover { transform: scale(1.2); }
.star-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input label { font-size: 1.9rem; line-height: 1; color: var(--border); cursor: pointer; transition: color .15s, transform .15s; }
.star-input label:hover,
.star-input label:hover ~ label,
.star-input input:checked ~ label { color: #E0A21B; }
.star-input input:focus-visible + label { outline: 3px solid var(--accent-strong); outline-offset: 2px; border-radius: 4px; }

/* «Слот-машина» для випадкової ідеї */
.slot {
  display: grid;
  place-items: center;
  min-height: 140px;
  padding: 20px;
  text-align: center;
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-2));
  border-radius: var(--radius);
}
.slot-text.tick { animation: tick .12s ease; }
@keyframes tick { from { opacity: .2; transform: translateY(-14px); } }
.random-result .idea-card { box-shadow: none; animation: pop .5s var(--ease); }
.random-result .reveal { opacity: 1; transform: none; }
@keyframes pop { 0% { transform: scale(.85); opacity: 0; } 60% { transform: scale(1.03); opacity: 1; } 100% { transform: scale(1); } }
.random-again { margin-top: 14px; width: 100%; }

/* ---------- Форми ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; min-width: 0; border: 0; padding: 0; }
.field > span, .field > legend, .field-label { font-weight: 700; font-size: .92rem; padding: 0; }
.field-hint { color: var(--muted); font-size: .85rem; }
.field-row { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 560px) { .field-row { grid-template-columns: 1fr 1fr; } }

input[type="text"], input[type="search"], input[type="date"], input:not([type]), select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .2s, box-shadow .2s;
}
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
  outline: none;
}
input[type="date"] { -webkit-appearance: none; appearance: none; display: block; }
input::-webkit-date-and-time-value { text-align: left; }
.field.has-error input, .field.has-error textarea { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .85rem; font-weight: 700; }

.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.save-status { min-height: 1.4em; margin: 0; color: var(--success); font-weight: 700; }

/* Вибір настрою (емодзі-кнопки) */
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span {
  display: grid;
  place-items: center;
  min-width: 48px; height: 48px;
  padding: 0 12px;
  font-size: 1.3rem;
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  transition: transform .15s, border-color .15s, background .15s;
}
.choice.choice-text span { font-size: .95rem; font-weight: 700; }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.06); }
.choice input:focus-visible + span { outline: 3px solid var(--accent-strong); outline-offset: 2px; }

/* Вибір теми — кольорові кружечки */
.theme-picker { display: flex; flex-wrap: wrap; gap: 10px; }
.theme-option span { flex-direction: column; gap: 2px; height: auto; padding: 10px 14px; font-size: .85rem; font-weight: 700; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .08); }
.swatch-rose { background: linear-gradient(135deg, #E5677D 50%, #F4B183 50%); }
.swatch-sky { background: linear-gradient(135deg, #5B8DEF 50%, #9CD0E4 50%); }
.swatch-forest { background: linear-gradient(135deg, #6A9A6E 50%, #D9B26F 50%); }
.swatch-dark { background: linear-gradient(135deg, #1C1719 50%, #F28CA0 50%); }
.swatch-cosmos { background: url('../assets/favicon-32.png') center / cover; }

/* ---------- Вибір фото (drag & drop) ---------- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 22px 16px;
  text-align: center;
  background: var(--surface-2);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.photo-picker input:focus-visible + .dropzone { outline: 3px solid var(--accent-strong); outline-offset: 2px; }
.dropzone-icon { font-size: 2rem; }
.dropzone-hint { font-size: .82rem; color: var(--muted); }
.picker-grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin: 10px 0 0; padding: 0; }
.picker-grid:empty { display: none; }
.picker-item { position: relative; }
.picker-item .photo-frame { cursor: default; }
.picker-item.is-new .photo-frame { outline: 2px solid var(--accent); outline-offset: -2px; }
.picker-remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: .9rem;
  color: #FFFFFF;
  background: rgba(20, 10, 14, .7);
  border: 0;
  border-radius: 50%;
}

/* ---------- Модальні вікна (<dialog>) ---------- */
dialog.modal {
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}
dialog.modal::backdrop { background: rgba(20, 10, 14, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.modal-box {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  animation: modal-in .3s var(--ease);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.modal-title { margin: 0; font-size: 1.3rem; }
.modal-body { flex: 1; overflow-y: auto; padding: 20px; padding-bottom: calc(20px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
@keyframes modal-in { from { opacity: 0; transform: translateY(24px); } }

@media (min-width: 640px) {
  dialog.modal { width: min(640px, calc(100% - 48px)); height: auto; max-height: calc(100% - 48px); margin: auto; }
  .modal-box { height: auto; max-height: calc(100vh - 48px); border-radius: var(--radius); box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
  dialog.modal-confirm { width: min(440px, calc(100% - 48px)); }
}
/* Маленьке вікно підтвердження — по центру й на телефоні */
dialog.modal-confirm { height: auto; width: calc(100% - 32px); margin: auto; }
dialog.modal-confirm .modal-box { height: auto; border-radius: var(--radius); }
.confirm-text { font-size: 1.05rem; }

/* ---------- Лайтбокс ---------- */
dialog.lightbox { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; }
dialog.lightbox::backdrop { background: rgba(10, 5, 8, .92); }
dialog.lightbox .modal-box { height: 100%; max-height: 100vh; background: transparent; border-radius: 0; box-shadow: none; color: #FFFFFF; }
dialog.lightbox .modal-head { background: transparent; border: 0; }
dialog.lightbox .modal-title { font-family: var(--font-body); font-size: 1rem; font-weight: 700; }
dialog.lightbox .icon-btn { color: #FFFFFF; }
dialog.lightbox .icon-btn:hover { background: rgba(255, 255, 255, .15); }
dialog.lightbox .modal-body { display: flex; padding: 0 0 env(safe-area-inset-bottom); overflow: hidden; }
.lb-figure { display: flex; flex-direction: column; width: 100%; margin: 0; }
.lb-stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 8px; touch-action: pan-y; }
.lb-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; user-select: none; -webkit-user-select: none; animation: fade-in .3s ease; }
.lb-nav {
  position: absolute;
  top: 50%;
  width: 48px; height: 48px;
  transform: translateY(-50%);
  font-size: 2rem;
  line-height: 1;
  color: #FFFFFF;
  background: rgba(255, 255, 255, .14);
  border: 0;
  border-radius: 50%;
}
.lb-nav:hover { background: rgba(255, 255, 255, .26); }
.lb-nav:disabled { opacity: .25; cursor: default; }
.lb-prev { left: 8px; }
.lb-next { right: 8px; }
.lb-info { padding: 12px 16px 16px; max-width: 760px; width: 100%; margin: 0 auto; }
.lb-meta { margin: 0 0 8px; color: rgba(255, 255, 255, .85); font-size: .9rem; }
.lb-caption { background: rgba(255, 255, 255, .1) !important; border-color: rgba(255, 255, 255, .2) !important; color: #FFFFFF; }
.lb-caption::placeholder { color: rgba(255, 255, 255, .7); }
.lb-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.lb-actions .btn { color: #FFFFFF; border-color: rgba(255, 255, 255, .3); background: transparent; }
.lb-actions .btn:hover { background: rgba(255, 255, 255, .12); }
@media (min-width: 640px) {
  dialog.lightbox { width: 100%; max-height: 100%; }
  dialog.lightbox .modal-box { max-height: 100vh; }
  .lb-prev { left: 20px; } .lb-next { right: 20px; }
}

/* ---------- Тости (короткі повідомлення) ---------- */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(92vw, 440px);
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  padding: 12px 18px;
  font-weight: 700;
  color: #FFFFFF;
  background: #3A2E33;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  animation: toast-in .35s var(--ease);
  pointer-events: auto;
}
.toast-success { background: #2E6B47; }
.toast-error { background: #A3231B; }
.toast-out { opacity: 0; transform: translateY(10px); transition: opacity .3s, transform .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }

/* ---------- Порожні стани ---------- */
.empty {
  padding: 40px 20px;
  text-align: center;
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
}
.empty-icon { display: block; font-size: 3rem; margin-bottom: 8px; animation: float 3s ease-in-out infinite; }
.empty-title { font-size: 1.3rem; }
.empty p { color: var(--muted); max-width: 420px; margin-left: auto; margin-right: auto; }
@keyframes float { 50% { transform: translateY(-6px); } }

/* ---------- Важливі дати ---------- */
.dates-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 760px) { .dates-list { grid-template-columns: repeat(2, 1fr); } }
.date-item { display: flex; align-items: center; gap: 14px; margin: 0 !important; }
.date-item.is-soon { border-color: var(--accent); }
.date-item.is-today { background: linear-gradient(120deg, var(--accent-soft), var(--surface)); border-color: var(--accent); }
.date-badge {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 64px; height: 64px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 16px;
}
.date-day { font-family: var(--font-head); font-size: 1.6rem; font-weight: 700; line-height: 1; }
.date-month { font-size: .75rem; font-weight: 800; text-transform: uppercase; }
.date-label { margin: 0; font-weight: 800; font-size: 1.05rem; }
.date-item p.muted { margin: 0; font-size: .9rem; }

/* ---------- Листи в майбутнє ---------- */
.letters { display: grid; gap: 14px; }
@media (min-width: 760px) { .letters { grid-template-columns: repeat(2, 1fr); } }
.letter { margin: 0 !important; display: flex; flex-direction: column; gap: 6px; }
.letter-head { display: flex; align-items: flex-start; gap: 12px; }
.letter-icon { font-size: 2rem; line-height: 1; }
.letter h3 { margin: 0 0 2px; font-size: 1.15rem; }
.letter p.muted { margin: 0; font-size: .9rem; }
.letter.is-locked { background: repeating-linear-gradient(-45deg, var(--surface), var(--surface) 12px, var(--surface-2) 12px, var(--surface-2) 24px); }
.letter.is-ready { border-color: var(--accent); }
.letter.is-ready .letter-icon { animation: float 2s ease-in-out infinite; }
.letter-text { white-space: pre-line; padding: 14px; margin: 6px 0 0; background: var(--surface-2); border-radius: var(--radius-sm); font-family: var(--font-head); font-size: 1.05rem; line-height: 1.6; }
.letter-full { white-space: pre-line; font-family: var(--font-head); font-size: 1.15rem; line-height: 1.7; }

/* ---------- Налаштування ---------- */
.cover-preview { margin-bottom: 12px; }
.cover-preview .photo-frame { aspect-ratio: 16 / 9; max-width: 420px; }
.cover-placeholder { display: grid; place-items: center; aspect-ratio: 16 / 9; max-width: 420px; color: var(--muted); background: linear-gradient(135deg, var(--hero-1), var(--hero-2)); border-radius: var(--radius-sm); font-weight: 700; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.file-btn { position: relative; }
.file-btn:focus-within { outline: 3px solid var(--accent-strong); outline-offset: 2px; }
.storage-info { font-size: .9rem; }

/* =========================================================
   Наші побачення
   ========================================================= */
.plan-when { margin: 10px 0 0; font-size: .92rem; }
.empty-wrap { grid-column: 1 / -1; }
.date-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 1100px) { .date-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
.date-card { margin: 0 !important; min-width: 0; }
.date-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin-bottom: 8px; }
.date-card-head .stars { margin-top: 0; }
.date-card-meta { margin: 0 0 4px; color: var(--muted); font-weight: 600; font-size: .9rem; }
.date-card-title { margin: 0 0 4px; font-size: 1.3rem; }
.date-photos {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 104px;
  gap: 8px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
}
.date-photos > * { scroll-snap-align: start; }
.photo-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  aspect-ratio: 1;
  font-weight: 800;
  font-size: .85rem;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.photo-add span:first-of-type { font-size: 1.5rem; }
.photo-add:focus-within { outline: 3px solid var(--accent-strong); outline-offset: 2px; }
.photo-add.is-busy { opacity: .6; pointer-events: none; }
.pick-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; max-height: 50vh; overflow-y: auto; }
.pick-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.pick-item:hover { background: var(--surface-2); }

/* =========================================================
   Гра «Питання для нас»
   ========================================================= */
.game-cats { margin: 0 0 18px; padding: 0; border: 0; }
.game-cats legend { margin-bottom: 8px; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cat-chip { position: relative; }
.cat-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cat-chip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 14px;
  font-weight: 700;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.cat-chip small { padding: 1px 7px; font-size: .75rem; background: var(--surface-2); border-radius: var(--radius-pill); }
.cat-chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.cat-chip input:focus-visible + span { outline: 3px solid var(--accent-strong); outline-offset: 2px; }
.cat-chip .lock { font-size: .75rem; }

.game-table { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 8px 0 28px; }
.game-turn { margin: 0; min-height: 1.6em; font-size: 1.05rem; }
.q-card {
  width: min(100%, 520px);
  perspective: 1200px;
}
.q-card-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 300px;
  padding: 36px 28px 44px;
  text-align: center;
  color: #FFFFFF;
  background:
    linear-gradient(160deg, rgba(14, 15, 31, .55), rgba(14, 15, 31, .85)),
    url('../assets/arp273.jpg') center 30% / cover;
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(14, 15, 31, .35);
  transform-style: preserve-3d;
}
.q-card.is-adult .q-card-inner {
  background:
    linear-gradient(160deg, rgba(120, 16, 48, .65), rgba(40, 6, 20, .9)),
    url('../assets/arp273.jpg') center 30% / cover;
}
.q-card.flip .q-card-inner { animation: card-flip .6s var(--ease); }
@keyframes card-flip {
  0% { transform: rotateY(-90deg) scale(.95); opacity: 0; }
  100% { transform: rotateY(0) scale(1); opacity: 1; }
}
.q-cat {
  align-self: center;
  margin-bottom: 18px;
  padding: 4px 14px;
  font-size: .85rem;
  font-weight: 800;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: var(--radius-pill);
}
.q-text { margin: 0; font-family: var(--font-head); font-size: clamp(1.35rem, 4.6vw, 1.8rem); line-height: 1.35; }
.q-num { position: absolute; right: 18px; bottom: 14px; font-size: .8rem; font-weight: 700; opacity: .8; }
.game-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.btn-big { min-height: 52px; padding: 12px 26px; font-size: 1.05rem; }
.game-progress { margin: 0; font-size: .9rem; }
.game-list > summary { font-weight: 800; cursor: pointer; }
.q-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.q-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 4px 8px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }

/* =========================================================
   Вхід (хмарна версія) і встановлення застосунку
   ========================================================= */
body.logged-out .site-header .menu-btn,
body.logged-out .main-nav,
body.logged-out .nav-backdrop { display: none !important; }
body.logged-out .app-body { margin-left: 0 !important; }
.auth {
  max-width: 420px;
  margin: 6vh auto 40px;
  text-align: center;
}
.auth-logo { width: 120px; height: 120px; margin: 0 auto 14px; border-radius: 30px; box-shadow: 0 18px 50px rgba(14, 15, 31, .35); }
.auth .card { text-align: left; margin-top: 18px; }
.auth-switch { margin-top: 14px; text-align: center; }
.account-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.install-steps { margin: 8px 0 0; padding-left: 20px; }
.install-steps li { margin-bottom: 4px; }
