:root {
  --bg: #14161a;
  --panel: #1c1f26;
  --panel-2: #232833;
  --line: #2e343f;
  --fg: #e6e8ee;
  --dim: #8b93a3;
  --accent: #6c8cff;
  --ok: #4fb477;
  --warn: #d9a441;
  --err: #e2585a;
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

header.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(20, 22, 26, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.brand {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.brand:hover { text-decoration: none; }

header.top nav {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  flex-wrap: wrap;
}

header.top nav a { color: var(--dim); }
header.top nav a.on { color: var(--fg); font-weight: 600; }

main {
  max-width: 820px;
  margin: 0 auto;
  padding: 16px 16px 64px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 14px;
}

.card.narrow { max-width: 420px; margin: 48px auto; }

h1 { font-size: 20px; margin: 0 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 10px; color: var(--dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }

textarea, input[type="password"], input[type="text"] {
  width: 100%;
  background: var(--panel-2);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font: inherit;
  resize: vertical;
}
textarea:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

label { display: block; margin-bottom: 12px; font-size: 14px; color: var(--dim); }
label input { margin-top: 6px; }

button, .btn {
  display: inline-block;
  background: var(--accent);
  color: #0e1116;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }

button.ghost, .btn.ghost {
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--line);
  font-weight: 500;
}
button.ghost:hover, .btn.ghost:hover { color: var(--fg); border-color: var(--dim); }

form.inline { display: inline; }

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.row.spread { justify-content: space-between; align-items: flex-start; }

.dim { color: var(--dim); }
.tiny { font-size: 12px; margin-top: 4px; }
.ok { color: var(--ok); }
.ask { color: var(--warn); }
.error { color: var(--err); }
.hint { color: var(--dim); font-size: 14px; }

blockquote {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-left: 3px solid var(--line);
  color: var(--dim);
  background: var(--panel-2);
  border-radius: 0 8px 8px 0;
  white-space: pre-wrap;
  word-break: break-word;
}

ul.feed { list-style: none; margin: 0; padding: 0; }
ul.feed li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  word-break: break-word;
}
ul.feed li:last-child { border-bottom: 0; }

ul.warn { color: var(--warn); font-size: 13px; padding-left: 18px; }

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

.chip {
  display: block;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--fg);
  min-width: 120px;
}
.chip:hover { border-color: var(--accent); text-decoration: none; }

.totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.totals .t {
  background: var(--panel-2);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.totals .t strong { display: block; font-size: 18px; }

.inbox-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.inbox-item:last-child { border-bottom: 0; }

@media (max-width: 480px) {
  main { padding: 12px 12px 64px; }
  .card { padding: 14px; }
  h1 { font-size: 18px; }
}

/* ---------- медиа-галерея ---------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.gallery figure {
  margin: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.gallery img,
.gallery video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 260px;
  object-fit: cover;
  background: #0d0f13;
}
.gallery audio { width: 100%; }
.gallery figcaption { padding: 6px 8px; word-break: break-all; }

/* ---------- кнопка записи ---------- */

#rec[data-state="recording"] {
  background: var(--err);
  color: #fff;
  border-color: var(--err);
}

#rec-status { min-width: 60px; }

@media (max-width: 480px) {
  .gallery { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* ---------- холст проекта ---------- */

.card.hero {
  background: linear-gradient(160deg, #232a3a 0%, var(--panel) 60%);
  border-color: #38415a;
}
.pitch {
  font-size: 19px;
  line-height: 1.45;
  font-weight: 600;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}
ul.keys {
  margin: 0 0 12px;
  padding-left: 18px;
  color: var(--dim);
  font-size: 14px;
}
ul.keys li { margin: 4px 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  align-items: start;
}
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid .card { margin: 0; }

.lede {
  color: var(--dim);
  font-size: 14px;
  margin: 0 0 10px;
  font-style: italic;
}

ul.points, ol.steps {
  margin: 0;
  padding-left: 18px;
}
ul.points li, ol.steps li {
  margin: 6px 0;
  word-break: break-word;
}

ul.decisions { list-style: none; margin: 0; padding: 0; }
ul.decisions li {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
ul.decisions li:last-child { border-bottom: 0; }
.mark { color: var(--ok); font-weight: 700; }

ul.questions { list-style: none; margin: 0; padding: 0; }
ul.questions li {
  display: flex;
  gap: 10px;
  padding: 7px 0;
  align-items: flex-start;
}
.box {
  flex: 0 0 14px;
  height: 14px;
  margin-top: 4px;
  border: 1px solid var(--dim);
  border-radius: 4px;
}

.card.empty { border-style: dashed; }

details.card summary {
  cursor: pointer;
  color: var(--dim);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
details.card[open] summary { margin-bottom: 12px; }
details.card h2 { margin-top: 16px; }

@media (max-width: 480px) {
  .pitch { font-size: 17px; }
  .grid { grid-template-columns: 1fr; }
}
