/* Холодильник и бумажка на магните */
:root {
  --steel-a: #dfe3e8; --steel-b: #f2f4f6; --steel-c: #cfd4da;
  --paper: #fffdf3; --line: #d6e2f0; --ink: #1f2937; --muted: #8a93a3; --done: #9aa3b2;
  --accent: #e5484d; --magnet: #ef4444; --ok: #22c55e;
  --tg-bg: var(--steel-b);
}
@media (prefers-color-scheme: dark) {
  :root { --steel-a: #3a3f46; --steel-b: #4a5059; --steel-c: #2f3339; }
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.08) 0 2px, rgba(0,0,0,.025) 2px 4px),
    linear-gradient(90deg, var(--steel-a), var(--steel-b) 45%, var(--steel-c));
  background-attachment: fixed;
}
.fridge { min-height: 100vh; min-height: 100dvh; display: flex; justify-content: center; padding: 34px 14px 40px; }

.note {
  position: relative; width: 100%; max-width: 440px; align-self: flex-start;
  background: var(--paper);
  background-image: repeating-linear-gradient(transparent 0 33px, var(--line) 33px 34px);
  background-position: 0 86px;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,.15), 0 14px 28px -12px rgba(0,0,0,.35);
  transform: rotate(-.6deg);
  padding: 22px 18px 16px;
}
.note::after { /* загнутый уголок */
  content: ""; position: absolute; right: 0; bottom: 0; width: 26px; height: 26px;
  background: linear-gradient(225deg, var(--steel-b) 50%, rgba(0,0,0,.08) 50%, #efe9d4 56%);
  border-radius: 0 0 3px 0;
}
.magnet {
  position: absolute; top: -16px; left: 50%; width: 38px; height: 38px; margin-left: -19px; border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #fca5a5, var(--magnet) 55%, #991b1b);
  box-shadow: 0 3px 6px rgba(0,0,0,.35), inset 0 -2px 3px rgba(0,0,0,.25);
}

.note-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 8px; }
h1 { font: 700 38px/1 "Caveat", "Segoe Script", cursive; margin: 0; color: #111; }
.note-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.who input { width: 86px; border: 0; border-bottom: 1px dashed #b7c3d4; background: transparent; font: inherit; color: var(--ink); padding: 2px 4px; outline: none; }
.who[hidden] { display: none; }
.sync { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); opacity: .7; }
.sync.off { background: var(--accent); }

.items { list-style: none; margin: 0; padding: 0; min-height: 68px; }
.items .hint { color: var(--muted); font-size: 14px; line-height: 34px; }
.item { display: flex; align-items: flex-start; gap: 10px; min-height: 34px; line-height: 34px; }
.item .box {
  flex: none; width: 22px; height: 22px; margin-top: 6px; border: 2px solid #475569; border-radius: 4px;
  background: transparent; cursor: pointer; padding: 0; position: relative;
}
.item .box:active { transform: scale(.92); }
.item.done .box::after {
  content: ""; position: absolute; left: 3px; top: -8px; width: 10px; height: 20px;
  border: solid #2563eb; border-width: 0 3px 3px 0; transform: rotate(40deg);
}
.item .text {
  flex: 1; min-width: 0; font: 500 24px/34px "Caveat", "Segoe Script", cursive; color: var(--ink);
  word-break: break-word; cursor: text;
}
.item .text:focus { outline: none; background: rgba(37,99,235,.06); }
.item.done .text { color: var(--done); text-decoration: line-through; text-decoration-thickness: 2px; }
.item .by { flex: none; font-size: 11px; color: var(--muted); line-height: 34px; max-width: 86px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .del { flex: none; border: 0; background: transparent; color: #b5bdc9; font-size: 22px; line-height: 34px; padding: 0 4px; cursor: pointer; }
.item .del:hover { color: var(--accent); }
.item.pending { opacity: .55; }

.add { display: flex; align-items: center; gap: 8px; height: 34px; margin-top: 2px; }
.add input {
  flex: 1; min-width: 0; border: 0; background: transparent; font: 500 24px/34px "Caveat", "Segoe Script", cursive;
  color: var(--ink); outline: none; padding: 0 0 0 32px;
}
.add input::placeholder { color: #b5bdc9; }
.add button {
  flex: none; width: 34px; height: 30px; border: 0; border-radius: 8px; background: var(--ink); color: #fff;
  font-size: 22px; line-height: 1; cursor: pointer;
}
.note-foot { display: flex; justify-content: flex-end; margin-top: 12px; }
.note-foot button {
  border: 1px solid #c9d2df; background: #fff; color: #475569; font: inherit; font-size: 13px;
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
.note-foot button:hover { background: #f1f5f9; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #111; color: #fff; padding: 8px 14px; border-radius: 999px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: .92; }

@media (max-width: 480px) {
  .fridge { padding: 28px 10px 30px; }
  .note { transform: none; padding: 20px 14px 14px; }
  h1 { font-size: 34px; }
  .item .by { display: none; }
}
