/* APP.RU — визуальная система.
   Монохром, прописные, моноширинные числа, волосяные линии вместо карточек.
   Тему Telegram намеренно не наследуем: стиль одинаковый у всех. */

:root {
  --bone: #f2f0eb;
  --ink: #0a0a0a;
  --muted: #6e6a62;
  --line: rgba(10, 10, 10, 0.16);
  --line-strong: rgba(10, 10, 10, 0.32);

  --bg: var(--bone);
  --fg: var(--ink);
  --inverse-bg: var(--ink);
  --inverse-fg: var(--bone);

  --sans: 'Helvetica Neue', Helvetica, Inter, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;

  --pad: 20px;
  --rhythm: 28px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --fg: #f2f0eb;
    --muted: #8a857c;
    --line: rgba(242, 240, 235, 0.18);
    --line-strong: rgba(242, 240, 235, 0.36);
    --inverse-bg: #f2f0eb;
    --inverse-fg: #0a0a0a;
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

.app {
  max-width: 600px;
  margin: 0 auto;
  padding: 18px var(--pad) calc(64px + env(safe-area-inset-bottom));
}

/* --- Типографика --- */

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
}

h1 {
  font-size: 30px;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

h2 {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}

p {
  margin: 0;
}

.lede {
  font-size: 15px;
  line-height: 1.45;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* --- Каркас --- */

.wordmark {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--fg);
  padding-bottom: 10px;
  margin-bottom: var(--rhythm);
}

.wordmark b {
  font-size: 13px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-weight: 700;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--rhythm);
}

.tight {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rule {
  height: 1px;
  background: var(--line);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--fg);
  margin-bottom: 2px;
}

/* --- Поиск --- */

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 10px;
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  letter-spacing: 0.02em;
  outline: none;
}

.search input::placeholder {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.14em;
}

/* --- Списки --- */

.list {
  display: flex;
  flex-direction: column;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.list-item:active {
  opacity: 0.55;
}

.mark {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--fg);
  font-family: var(--mono);
  font-size: 15px;
  text-transform: uppercase;
}

.mark.lg {
  width: 76px;
  height: 76px;
  font-size: 30px;
}

/* Логотип ложится поверх буквы: если файл не отдался, остаётся буквенная марка. */
.mark {
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.mark img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.item-body {
  flex: 1;
  min-width: 0;
}

.item-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-sub {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.price {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  white-space: nowrap;
}

/* --- Фильтры --- */

.chips {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}

.chip.active {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 5px;
}

/* --- Кнопки --- */

.btn {
  display: block;
  width: 100%;
  border: 1px solid var(--fg);
  border-radius: 0;
  background: var(--inverse-bg);
  color: var(--inverse-fg);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 16px;
  cursor: pointer;
}

.btn:active {
  opacity: 0.7;
}

.btn.secondary {
  background: transparent;
  color: var(--fg);
}

.btn.ghost {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--muted);
}

.btn[disabled] {
  opacity: 0.4;
  cursor: default;
}

.inline-btn {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

/* --- Характеристики --- */

.spec {
  display: flex;
  flex-direction: column;
}

.spec-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.spec-row dt {
  margin: 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  flex: none;
}

.spec-row dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  text-align: right;
  word-break: break-word;
}

.total {
  border-bottom: 0;
  border-top: 1px solid var(--fg);
  padding-top: 14px;
}

.total dt,
.total dd {
  font-size: 13px;
  color: var(--fg);
}

/* --- Статусы --- */

.tag {
  display: inline-block;
  border: 1px solid var(--line-strong);
  padding: 3px 8px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.tag.on {
  border-color: var(--fg);
  color: var(--fg);
}

.tag.off {
  border-style: dashed;
}

/* --- Шаги установки --- */

.step {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.step-num {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--fg);
  font-family: var(--mono);
  font-size: 11px;
}

.step.done .step-num {
  background: var(--inverse-bg);
  color: var(--inverse-fg);
}

.step-body {
  flex: 1;
  min-width: 0;
}

.step-title {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  font-family: var(--mono);
}

.cred {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--fg);
  padding: 12px;
  margin-top: 10px;
}

.cred code {
  flex: 1;
  font-family: var(--mono);
  font-size: 14px;
  word-break: break-all;
}

code {
  font-family: var(--mono);
  font-size: 12px;
}

/* --- Формы --- */

textarea {
  width: 100%;
  min-height: 130px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  padding: 12px;
  resize: vertical;
  outline: none;
}

textarea:focus {
  border-color: var(--fg);
}

/* --- Служебное --- */

.boot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 120px 0;
}

.boot .label {
  animation: pulse 1.4s ease-in-out infinite;
}

.bar {
  width: 56px;
  height: 1px;
  background: var(--fg);
  animation: stretch 1.1s ease-in-out infinite;
  transform-origin: center;
}

@keyframes stretch {
  0%,
  100% {
    transform: scaleX(0.25);
  }
  50% {
    transform: scaleX(1);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

.empty {
  padding: 48px 0;
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  background: var(--inverse-bg);
  color: var(--inverse-fg);
  padding: 12px 18px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  max-width: 84vw;
  text-align: center;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
