/* Дизайн «Яркий мудборд»: жёлтый фон, толстые чёрные рамки, жёсткие тени, раскладка как в Pinterest */
:root {
  --bg: #FFE45C; --card: #FFFFFF; --ink: #111111; --muted: #4A4A4A;
  --blue: #2B44D6; --coral: #FF6B4A; --mint: #7CE3A1; --pink: #FFC9DA;
  --shadow: 4px 4px 0 var(--ink); --shadow-s: 3px 3px 0 var(--ink);
  font-family: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); -webkit-tap-highlight-color: transparent; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 14px; }
button, input, select, textarea { font: inherit; color: inherit; }
a.btn { text-decoration: none; color: inherit; }

/* шапка */
.top { padding-top: calc(18px + env(safe-area-inset-top)); }
.top-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.title { margin: 0; flex: 1; min-width: 0; font-size: 30px; font-weight: 700; line-height: 1; letter-spacing: -1px; text-transform: uppercase; word-break: break-word; outline: none; cursor: text; }
.stats { font-size: 13px; font-weight: 700; padding-top: 6px; }
.top-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* кнопки */
.btn { border: 2px solid var(--ink); border-radius: 10px; background: var(--card); box-shadow: var(--shadow-s); padding: 9px 14px; font-weight: 700; cursor: pointer; white-space: nowrap; transition: transform .08s, box-shadow .08s; }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn.icon { width: 46px; height: 46px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.dark { background: var(--ink); color: var(--bg); }
.btn.coral { background: var(--coral); }
.btn.ghost { box-shadow: none; }
.btn[disabled] { opacity: .5; }
.btn svg { display: block; }

/* добавление */
.add { display: flex; gap: 8px; margin: 14px 0 12px; }
.add input { flex: 1; min-width: 0; height: 48px; border: 2px solid var(--ink); border-radius: 10px; background: var(--card); padding: 0 14px; font-size: 16px; outline: none; }
.add input:focus { box-shadow: var(--shadow-s); }
.add .btn { width: 52px; height: 48px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* фильтры */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; margin-bottom: 14px; }
.toolbar .chips { flex: 1 1 100%; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chip { height: 36px; padding: 0 13px; border: 2px solid var(--ink); border-radius: 18px; background: var(--card); font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.chip.hot { background: var(--coral); }
.chip.drop { background: var(--mint); }
.chip.on { background: var(--ink); color: var(--bg); }
select { height: 36px; border: 2px solid var(--ink); border-radius: 10px; background: var(--card); padding: 0 6px; font-size: 13px; font-weight: 700; }

/* мудборд-сетка */
.grid { columns: 2; column-gap: 10px; }
@media (min-width: 640px) { .grid { columns: 3; column-gap: 14px; } }
@media (min-width: 960px) { .grid { columns: 4; } }
.card { break-inside: avoid; margin-bottom: 14px; background: var(--card); border: 2px solid var(--ink); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; gap: 5px; position: relative; }
.card.done { opacity: .5; }
.card.flash { animation: flash 1.4s ease; }
@keyframes flash { 0%,100% { transform: none; } 20% { transform: rotate(-3deg) scale(1.05); box-shadow: 8px 8px 0 var(--blue); } 45% { transform: rotate(2deg) scale(1.03); } }
.pic { position: relative; display: block; color: var(--ink); border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; background: var(--tint, #FFF1A8); }
.pic img { display: block; width: 100%; height: auto; max-height: 300px; object-fit: contain; background: #fff; }
.noimg { display: flex; align-items: center; justify-content: center; height: var(--h, 150px); }
.badge { position: absolute; font-size: 10px; font-weight: 700; border: 1.5px solid var(--ink); border-radius: 6px; padding: 1px 6px; z-index: 1; }
.badge.hot { top: 6px; left: 6px; background: var(--coral); }
.badge.res { top: 6px; right: 6px; background: var(--mint); max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge.trend { bottom: 6px; right: 6px; font-size: 12px; transform: rotate(-4deg); }
.badge.trend.down { background: var(--mint); }
.badge.trend.up { background: #FF9E9E; }
.site { font-size: 11px; font-weight: 500; color: var(--muted); padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card h3 { margin: 0; padding: 0 2px; font-size: 14px; line-height: 1.2; }
.price { font-size: 18px; font-weight: 700; padding: 0 2px; }
.note { margin: 0; padding: 4px 6px; font-size: 12px; background: #FFF6BF; border: 1.5px dashed var(--ink); border-radius: 6px; white-space: pre-wrap; }
.actions { display: flex; gap: 5px; padding-top: 3px; }
.actions .btn { flex: 1; min-width: 0; height: 36px; padding: 0 6px; font-size: 13px; box-shadow: 2px 2px 0 var(--ink); border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.actions .btn.grow { flex: 3; }
.actions .grow { flex: 1; }

.empty { text-align: center; padding: 40px 16px; margin: 10px 0 30px; background: var(--card); border: 2px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow); line-height: 1.55; }
.empty b { font-size: 20px; text-transform: uppercase; }
.show-done { display: block; text-align: center; font-size: 14px; font-weight: 700; margin: 18px 0 40px; }
.banner { background: var(--card); border: 2px solid var(--ink); border-radius: 12px; box-shadow: var(--shadow-s); padding: 12px 14px; margin-top: 14px; font-size: 14px; font-weight: 500; }

/* модальные окна */
dialog { border: 0; padding: 0; background: transparent; max-width: 560px; width: 100%; color: var(--ink); overflow: visible; }
dialog::backdrop { background: rgba(17, 17, 17, .55); }
.sheet { background: var(--bg); border: 2px solid var(--ink); border-radius: 18px; box-shadow: 6px 6px 0 var(--ink); padding: 18px; max-height: 88vh; overflow: auto; margin: 0 10px; }
@media (max-width: 600px) {
  dialog { margin: auto 0 0; max-width: 100%; max-height: 100%; }
  .sheet { margin: 0; border-radius: 18px 18px 0 0; border-bottom: 0; box-shadow: none; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
}
.sheet h2 { margin: 0 0 12px; font-size: 22px; text-transform: uppercase; letter-spacing: -.5px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 13px; font-weight: 700; }
.field input, .field textarea, .field select { height: auto; border: 2px solid var(--ink); background: var(--card); border-radius: 10px; padding: 10px 12px; font-size: 15px; font-weight: 500; outline: none; }
.field input:focus, .field textarea:focus { box-shadow: var(--shadow-s); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 4px 10px 2px; }
.thumbs img { width: 84px; height: 84px; object-fit: contain; background: #fff; border-radius: 10px; border: 2px solid var(--ink); cursor: pointer; flex-shrink: 0; }
.thumbs img.on { box-shadow: 0 0 0 3px var(--blue); }
.prios { display: flex; gap: 6px; }
.prios button { flex: 1; border: 2px solid var(--ink); background: var(--card); border-radius: 10px; padding: 9px 4px; cursor: pointer; font-size: 13px; font-weight: 700; }
.prios button.on { background: var(--coral); box-shadow: var(--shadow-s); }
.sheet-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.hint { font-size: 13px; line-height: 1.45; }
.links { display: grid; gap: 8px; }
.links a { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--card); border: 2px solid var(--ink); border-radius: 12px; box-shadow: var(--shadow-s); text-decoration: none; color: inherit; font-weight: 700; }
.links a small { margin-left: auto; font-weight: 500; color: var(--muted); }
.copy { display: flex; gap: 6px; margin-bottom: 10px; }
.copy input { flex: 1; min-width: 0; border: 2px solid var(--ink); background: var(--card); border-radius: 10px; padding: 10px; font-size: 13px; }
.spinner { width: 38px; height: 38px; border: 4px solid var(--ink); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; margin: 24px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translate(-50%, 160%); background: var(--ink); color: var(--bg); border: 2px solid var(--ink); border-radius: 12px; box-shadow: 4px 4px 0 var(--blue); padding: 11px 16px; font-size: 14px; font-weight: 700; transition: transform .25s; z-index: 50; max-width: 90vw; text-align: center; }
.toast.show { transform: translate(-50%, 0); }
.confetti { position: fixed; top: -12px; width: 12px; height: 12px; border: 2px solid var(--ink); pointer-events: none; z-index: 60; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); } }

/* архив «Сбылось» */
.chip.star { background: #FFFFFF; }
.chip.star.on { background: var(--ink); color: var(--bg); }
body.archive .grid { columns: 1; }
@media (min-width: 560px) { body.archive .grid { columns: 2; } }
@media (min-width: 960px) { body.archive .grid { columns: 3; } }
.framed { display: block; border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; background: var(--bg); }
.framed img { display: block; width: 100%; height: auto; }
.empty-frame { position: relative; aspect-ratio: 4 / 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 20px; text-align: center; background: repeating-linear-gradient(-45deg, #FFE45C 0 14px, #FFEB85 14px 28px); }
.empty-frame b { font-size: 20px; line-height: 1.15; background: #fff; border: 2px solid var(--ink); border-radius: 8px; padding: 8px 12px; box-shadow: var(--shadow-s); }
.empty-frame small { font-weight: 700; }
.stamp { position: absolute; top: 14px; right: 14px; transform: rotate(12deg); width: 96px; height: 96px; border-radius: 50%; background: var(--coral); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; }
.bigpick { display: flex; align-items: center; gap: 10px; padding: 14px; background: var(--card); border: 2px solid var(--ink); border-radius: 12px; box-shadow: var(--shadow-s); font-weight: 700; font-size: 16px; cursor: pointer; }
.frame-preview { display: block; width: 100%; max-width: 360px; margin: 0 auto 6px; border: 2px solid var(--ink); border-radius: 10px; }
.dot { width: 14px; height: 14px; flex-shrink: 0; border: 2px solid var(--ink); border-radius: 4px; }

/* перетаскивание */
.drag-ghost { opacity: .35; }
.drag-chosen { transform: rotate(-2deg); box-shadow: 8px 8px 0 var(--blue); }
