@font-face { font-family: Onest; src: url(fonts/onest-cyr.woff2) format('woff2'); font-weight: 400 600; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Onest; src: url(fonts/onest-lat.woff2) format('woff2'); font-weight: 400 600; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Literata; src: url(fonts/literata-cyr.woff2) format('woff2'); font-weight: 400 600; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Literata; src: url(fonts/literata-lat.woff2) format('woff2'); font-weight: 400 600; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Камертон: слоновая кость и латунь днём, графит и латунь ночью; теги — сталь */
:root {
  --bg: #f4efe6; --paper: #fbf8f2; --ink: #1d1b18; --soft: #6c6458; --line: #e4dccd;
  --accent: #94621a; --accent-bg: #efe2c8; --tag: #3f5a66; --tag-bg: #e0e8eb; --danger: #a33b2b;
  --btn: var(--ink); --btn-ink: var(--bg); --brass: linear-gradient(160deg, #f6dc96, #d9a64a 45%, #8f5e18);
  --serif: Literata, 'PT Serif', Georgia, serif; --sans: Onest, 'PT Sans', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #131416; --paper: #1b1c1f; --ink: #ece5d8; --soft: #a39b8d; --line: #2d2e32;
    --accent: #d9a84e; --accent-bg: #2c2516; --tag: #9fbccb; --tag-bg: #1e282d; --danger: #e48170; color-scheme: dark;
    --btn: var(--brass); --btn-ink: #1a1408; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot img { width: 72px; height: 72px; border-radius: 18px; animation: breathe 1.6s var(--ease-in-out) infinite alternate; }
@keyframes breathe { from { opacity: .45; transform: scale(.96); } to { opacity: 1; transform: none; } }

/* Каркас: на телефоне одна колонка, на компьютере список слева */
.shell { min-height: 100dvh; }
.side { padding: max(14px, env(safe-area-inset-top)) 18px 110px; max-width: 720px; margin: 0 auto; }
.main { display: none; }
.shell.open .side { display: none; }
.shell.open .main { display: block; }
@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: 360px 1fr; }
  .side { display: block !important; height: 100dvh; overflow: auto; border-right: 1px solid var(--line); padding-bottom: 110px; position: sticky; top: 0; max-width: none; }
  .main { display: block; }
}

.top { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.brand { font-family: var(--serif); font-size: 1.75rem; font-weight: 600; letter-spacing: -.02em; margin: 0 auto 0 0; display: flex; align-items: center; gap: 4px; }
.mark { width: 40px; height: 40px; margin-left: -8px; border: 0; background: none; border-radius: 12px; color: var(--accent); cursor: pointer; display: grid; place-items: center; position: relative; }
.mark svg { width: 24px; height: 24px; }
.mark:hover { background: var(--accent-bg); }
/* прозвучало «ля»: от значка расходится волна */
.mark::after { content: ''; position: absolute; inset: 6px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; pointer-events: none; }
.mark.ring::after { animation: ripple 1.2s var(--ease-out) 3; }
.mark.ring svg { animation: hum .09s linear 14; }
@keyframes ripple { from { opacity: .7; transform: scale(.6); } to { opacity: 0; transform: scale(2.2); } }
@keyframes hum { 50% { transform: translateX(.6px); } }
.icon { width: 44px; height: 44px; border: 0; background: none; border-radius: 12px; display: grid; place-items: center; cursor: pointer; color: var(--soft); position: relative; }
.icon:hover { background: var(--accent-bg); color: var(--ink); }
.icon svg { width: 21px; height: 21px; }
.icon .dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.summary { color: var(--soft); font-size: var(--fs-sm); margin: -6px 0 14px; }

.search { width: 100%; height: 46px; border: 1px solid var(--line); background: var(--paper); border-radius: 12px; padding: 0 14px; outline: none; }
.search:focus { border-color: var(--accent); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; }
.chip { flex: none; border: 0; text-decoration: none; background: var(--tag-bg); color: var(--tag); border-radius: 999px; padding: 7px 12px; font-size: var(--fs-sm); cursor: pointer; }
.chip.on { background: var(--tag); color: var(--paper); }

.group { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); margin: 22px 0 4px; }
.list { list-style: none; margin: 0; padding: 0; }
.item { display: block; padding: 13px 10px; margin: 0 -10px; border-radius: 10px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); }
.item:hover { background: var(--paper); }
.item.cur { background: var(--accent-bg); }
.item b { font-family: var(--serif); font-weight: 600; font-size: 1.08rem; display: block; }
.item span { color: var(--soft); font-size: var(--fs-sm); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.item small { color: var(--soft); font-size: .75rem; }
.empty { color: var(--soft); padding: 28px 0; }
.empty b { color: var(--ink); display: block; font-family: var(--serif); font-size: 1.2rem; margin-bottom: 4px; }

.new { position: fixed; right: 18px; bottom: max(18px, env(safe-area-inset-bottom)); height: 54px; padding: 0 20px 0 16px; border: 0; border-radius: 16px; background: var(--btn); color: var(--btn-ink);
  display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; box-shadow: 0 6px 20px rgba(40, 25, 10, .18); z-index: 5; }
.new svg { width: 20px; height: 20px; }
@media (min-width: 960px) { .new { left: 18px; right: auto; width: 324px; justify-content: center; } }

/* Заметка */
.note { max-width: 720px; margin: 0 auto; padding: max(10px, env(safe-area-inset-top)) 18px 120px; }
.bar { display: flex; align-items: center; gap: 2px; position: sticky; top: 0; background: var(--bg); padding: 6px 0; z-index: 3; margin: 0 -6px; }
.bar .grow { flex: 1; }
.saved { font-size: .75rem; color: var(--soft); padding: 0 6px; }
.icon.on { color: var(--accent); }
@media (min-width: 960px) { .back { visibility: hidden; } }
h1.title { font-family: var(--serif); font-size: var(--fs-2xl); font-weight: 600; margin: 18px 0 6px; letter-spacing: -.02em; word-break: break-word; }
.meta { color: var(--soft); font-size: var(--fs-sm); margin-bottom: 20px; }
.doc { font-size: 1.08rem; line-height: 1.65; }
.doc h2, .doc h3, .doc h4 { font-family: var(--serif); font-weight: 600; margin: 1.4em 0 .4em; }
.doc h2 { font-size: var(--fs-xl); } .doc h3 { font-size: var(--fs-lg); } .doc h4 { font-size: 1.05rem; }
.doc p { margin: 0 0 .8em; }
.doc ul, .doc ol { padding-left: 1.3em; margin: 0 0 .9em; }
.doc li { margin: .3em 0; }
.doc li.task { list-style: none; margin-left: -1.3em; display: flex; gap: 10px; align-items: flex-start; }
.doc li.task input { width: 20px; height: 20px; margin-top: .25em; accent-color: var(--accent); flex: none; }
.doc li.task.done > span { color: var(--soft); text-decoration: line-through; }
.doc blockquote { margin: 0 0 .9em; padding: 2px 0 2px 16px; border-left: 3px solid var(--accent); font-family: var(--serif); font-style: italic; color: var(--soft); }
.doc pre { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow: auto; font-size: .9rem; }
.doc code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; background: var(--paper); padding: 1px 4px; border-radius: 4px; }
.doc pre code { background: none; padding: 0; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }
.doc strong { font-weight: 600; }
.wl { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); cursor: pointer; }
.wl.miss { opacity: .6; border-bottom-style: dashed; }
.tg { color: var(--tag); background: var(--tag-bg); border-radius: 6px; padding: 0 5px; text-decoration: none; font-size: .92em; cursor: pointer; }
.doc .hint { color: var(--soft); cursor: text; }

.links { margin-top: 36px; border-top: 1px solid var(--line); padding-top: 14px; }
.links h5 { margin: 0 0 6px; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); font-weight: 500; }

/* Редактор */
.t-in { width: 100%; border: 0; background: none; outline: none; font-family: var(--serif); font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -.02em; margin: 18px 0 10px; padding: 0; }
.b-in { width: 100%; min-height: 55dvh; border: 0; background: none; outline: none; resize: none; font-size: 1.08rem; line-height: 1.65; padding: 0; }
.kit { display: flex; gap: 6px; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--bg); padding: 8px 0 max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.kit button { min-width: 44px; height: 40px; border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 0 12px; cursor: pointer; }
.placeholder { color: var(--soft); text-align: center; padding: 30vh 20px 0; font-family: var(--serif); font-size: 1.2rem; }
.placeholder svg { display: block; width: 56px; height: 56px; margin: 0 auto 14px; color: var(--accent); opacity: .35; stroke-width: 1.2; }

/* Вход: камертон по центру, вокруг — едва заметные круги, как звук в тишине */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.login::before { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-radial-gradient(circle at 50% 30%, transparent 0 38px, color-mix(in srgb, var(--accent) 12%, transparent) 38px 39px);
  -webkit-mask-image: radial-gradient(circle at 50% 30%, #000, transparent 62%); mask-image: radial-gradient(circle at 50% 30%, #000, transparent 62%); }
.login form { width: 100%; max-width: 340px; position: relative; text-align: center; }
.login h1 { font-family: var(--serif); font-size: 2.6rem; font-weight: 600; letter-spacing: -.02em; margin: 6px 0 6px; }
.login p { color: var(--soft); margin: 0 auto 26px; font-family: var(--serif); font-style: italic; font-size: 1.1rem; }
.login .la { display: block; margin-top: 22px; color: var(--soft); font-size: .72rem; letter-spacing: .22em; text-transform: uppercase; opacity: .7; }
.hero { border: 0; background: none; padding: 0; width: 132px; height: 158px; cursor: pointer; color: var(--accent); -webkit-tap-highlight-color: transparent; }
.hero svg { width: 100%; height: 100%; overflow: visible; }
.hero .waves path { transform-box: fill-box; transform-origin: center; }
.hero .w1 { opacity: .5; } .hero .w2 { opacity: .22; }
.hero.ring .w1, .hero.ring .w2 { animation: wave 1.1s var(--ease-out) 4 both; }
.hero.ring .w2 { animation-delay: .2s; }
.hero .tine { transform-box: fill-box; transform-origin: bottom center; }
.hero.ring .tine.l { animation: tine-l .08s linear 30; }
.hero.ring .tine.r { animation: tine-r .08s linear 30; }
@keyframes wave { from { opacity: .9; transform: scale(.85); } to { opacity: 0; transform: scale(1.35); } }
@keyframes tine-l { 50% { transform: rotate(-.8deg); } }
@keyframes tine-r { 50% { transform: rotate(.8deg); } }
@media (prefers-reduced-motion: reduce) { .hero.ring *, .mark.ring *, .mark.ring::after, .boot img { animation: none !important; } }
.login .field { text-align: center; }
.field { width: 100%; height: 50px; border: 1px solid var(--line); background: var(--paper); border-radius: 12px; padding: 0 14px; outline: none; margin-bottom: 10px; }
.field:focus { border-color: var(--accent); }
.btn { width: 100%; height: 50px; border: 0; border-radius: 12px; background: var(--btn); color: var(--btn-ink); font-weight: 500; cursor: pointer; }
.btn.ghost { background: none; color: var(--ink); border: 1px solid var(--line); }
.err { color: var(--danger); font-size: var(--fs-sm); min-height: 1.4em; margin: 2px 0 8px; }

/* Меню и окна */
.sheet-bg { position: fixed; inset: 0; background: rgba(20, 14, 8, .35); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--paper); width: 100%; max-width: 440px; border-radius: 18px 18px 0 0; padding: 10px 10px max(14px, env(safe-area-inset-bottom)); max-height: 85dvh; overflow: auto; }
@media (min-width: 600px) { .sheet-bg { align-items: center; } .sheet { border-radius: 18px; } }
.sheet h3 { font-family: var(--serif); margin: 10px 12px 12px; font-weight: 600; }
.sheet form { padding: 0 12px 6px; }
a.row { color: inherit; text-decoration: none; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; border: 0; background: none; text-align: left; padding: 0 12px; border-radius: 10px; cursor: pointer; }
.row:hover { background: var(--accent-bg); }
.row svg { width: 20px; height: 20px; color: var(--soft); flex: none; }
.row.danger, .row.danger svg { color: var(--danger); }
.row small { margin-left: auto; color: var(--soft); }
.sheet .ver { color: var(--soft); font-size: .75rem; padding: 8px 12px 0; }

.toast { position: fixed; left: 50%; bottom: max(86px, calc(env(safe-area-inset-bottom) + 76px)); transform: translateX(-50%); background: var(--ink); color: var(--bg);
  border-radius: 12px; padding: 10px 10px 10px 16px; display: flex; gap: 12px; align-items: center; z-index: 30; max-width: calc(100% - 32px); font-size: var(--fs-sm); }
.toast button { background: none; border: 0; color: var(--accent-bg); font-weight: 600; padding: 6px 8px; cursor: pointer; }
.toast[hidden] { display: none; }
