:root {
  --bg: #0b0f14;
  --surface: #121820;
  --surface-2: #18202a;
  --border: #26303d;

  --text: #f4f7fa;
  --muted: #8f9baa;

  --blue: #3b82f6;
  --green: #22a06b;
  --orange: #e98a2e;

  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: 100%;
  max-width: 760px;
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: 100px;
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;

  padding:
    calc(18px + env(safe-area-inset-top))
    18px
    16px;

  background: rgba(11, 15, 20, 0.94);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.brand-mark {
  width: 46px;
  height: 46px;

  display: grid;
  place-items: center;

  border-radius: 14px;

  background: var(--blue);
  color: white;

  font-size: 23px;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.4px;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;

  min-height: 50px;
  padding: 0 15px;

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 15px;
}

.search-box span {
  color: var(--muted);
  font-size: 24px;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;

  background: transparent;
  color: var(--text);

  font-size: 16px;
}

.search-box input::placeholder {
  color: #697687;
}

#app-content {
  padding: 22px 18px;
}

.section-label {
  margin: 0 0 13px;
  color: var(--muted);

  font-size: 13px;
  font-weight: 700;

  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.method-grid {
  display: grid;
  gap: 13px;
}

.method-card {
  width: 100%;
  min-height: 112px;

  display: flex;
  align-items: center;
  gap: 16px;

  padding: 20px;

  border: 1px solid var(--border);
  border-radius: var(--radius);

  background: var(--surface);
  color: var(--text);

  text-align: left;
  cursor: pointer;
}

.method-card:active {
  transform: scale(0.985);
}

.method-icon {
  flex: 0 0 auto;

  width: 58px;
  height: 58px;

  display: grid;
  place-items: center;

  border-radius: 16px;

  font-size: 27px;
  font-weight: 700;
}

.method-card.vik .method-icon {
  background: rgba(34,160,107,.15);
  color: #43c58b;
}

.method-card.uzk .method-icon {
  background: rgba(59,130,246,.15);
  color: #66a3ff;
}

.method-card.pvk .method-icon {
  background: rgba(233,138,46,.15);
  color: #ffab59;
}

.method-info {
  flex: 1;
}

.method-info h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.method-info p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.arrow {
  color: #697687;
  font-size: 25px;
}

.quick-title {
  margin-top: 30px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.quick-card {
  min-height: 92px;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;

  border: 1px solid var(--border);
  border-radius: 16px;

  background: var(--surface);
  color: var(--text);

  cursor: pointer;
}

.quick-card span {
  font-size: 25px;
}

.quick-card small {
  color: var(--muted);
}

.page-header {
  display: flex;
  align-items: center;
  gap: 12px;

  margin-bottom: 22px;
}

.back-button {
  width: 44px;
  height: 44px;

  display: grid;
  place-items: center;

  border: 1px solid var(--border);
  border-radius: 13px;

  background: var(--surface);
  color: var(--text);

  font-size: 22px;
  cursor: pointer;
}

.page-header h2 {
  margin: 0;
  font-size: 23px;
}

.page-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.article-list {
  display: grid;
  gap: 11px;
}

.article-card {
  width: 100%;
  padding: 17px;

  border: 1px solid var(--border);
  border-radius: 15px;

  background: var(--surface);
  color: var(--text);

  text-align: left;
  cursor: pointer;
}

.article-card:active {
  transform: scale(.99);
}

.article-category {
  display: block;
  margin-bottom: 7px;

  color: var(--blue);

  font-size: 12px;
  font-weight: 700;

  text-transform: uppercase;
  letter-spacing: .5px;
}

.article-card h3 {
  margin: 0 0 7px;
  font-size: 17px;
}

.article-card p {
  margin: 0;
  color: var(--muted);

  font-size: 14px;
  line-height: 1.45;
}

.article-view {
  padding: 20px;

  border: 1px solid var(--border);
  border-radius: var(--radius);

  background: var(--surface);
}

.article-view .article-category {
  margin-bottom: 10px;
}

.article-view h2 {
  margin: 0 0 18px;
  font-size: 25px;
}

.article-view p {
  margin: 0;
  color: #c4ccd6;

  font-size: 16px;
  line-height: 1.65;
}

.search-status {
  margin-bottom: 15px;
  color: var(--muted);
  font-size: 14px;
}

.empty-state {
  padding: 40px 20px;

  border: 1px dashed var(--border);
  border-radius: var(--radius);

  color: var(--muted);
  text-align: center;
}

.bottom-nav {
  position: fixed;
  z-index: 30;

  left: 50%;
  bottom: 0;
  transform: translateX(-50%);

  width: 100%;
  max-width: 760px;

  display: grid;
  grid-template-columns: repeat(3, 1fr);

  padding:
    8px
    10px
    calc(8px + env(safe-area-inset-bottom));

  background: rgba(15,20,27,.96);
  backdrop-filter: blur(18px);

  border-top: 1px solid var(--border);
}

.nav-button {
  min-height: 56px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  gap: 3px;

  border: 0;
  background: transparent;

  color: var(--muted);
  cursor: pointer;
}

.nav-button span {
  font-size: 22px;
}

.nav-button small {
  font-size: 11px;
}

.nav-button.active {
  color: var(--blue);
}

@media (min-width: 620px) {
  .method-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .method-card {
    flex-direction: column;
    align-items: flex-start;
    min-height: 190px;
  }

  .arrow {
    display: none;
  }
}

/* ===== Structured article v0.2 ===== */

.article-summary {
  margin: 0 0 22px;
  color: #c4ccd6;
  font-size: 16px;
  line-height: 1.6;
}

.article-section {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.article-section h3 {
  margin: 0 0 12px;
  font-size: 17px;
}

.article-section p {
  margin: 0;
  color: #c4ccd6;
  font-size: 15px;
  line-height: 1.65;
}

.article-section ul,
.article-section ol {
  margin: 0;
  padding-left: 23px;
  color: #c4ccd6;
}

.article-section li {
  margin-bottom: 11px;
  padding-left: 3px;
  line-height: 1.55;
}

.article-section li:last-child {
  margin-bottom: 0;
}

.article-warning {
  margin-top: 22px;
  padding: 16px;

  border: 1px solid rgba(233, 138, 46, .35);
  border-radius: 14px;

  background: rgba(233, 138, 46, .08);
}

.article-warning h3 {
  margin: 0 0 9px;
  color: #ffab59;
  font-size: 16px;
}

.article-warning p {
  margin: 0;
  color: #d7dde5;
  font-size: 15px;
  line-height: 1.6;
}

.article-documents {
  margin-top: 22px;
  padding: 16px;

  border: 1px solid rgba(59, 130, 246, .28);
  border-radius: 14px;

  background: rgba(59, 130, 246, .07);
}

.article-documents h3 {
  margin: 0 0 11px;
  color: #7db1ff;
  font-size: 16px;
}

.article-documents ul {
  margin: 0;
  padding-left: 21px;
  color: #c4ccd6;
}

.article-documents li {
  margin-bottom: 8px;
  line-height: 1.5;
}

/* ===== Favorites v0.2 ===== */

.article-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.article-title-row h2 {
  margin: 0;
  flex: 1;
}

.favorite-button {
  flex: 0 0 auto;

  width: 46px;
  height: 46px;

  display: grid;
  place-items: center;

  border: 1px solid var(--border);
  border-radius: 14px;

  background: var(--surface-2);
  color: var(--muted);

  font-size: 27px;
  line-height: 1;

  cursor: pointer;
}

.favorite-button.active {
  color: #f5c451;
  border-color: rgba(245, 196, 81, .35);
  background: rgba(245, 196, 81, .09);
}

.favorite-button:active {
  transform: scale(.94);
}

.favorite-badge {
  min-width: 17px;
  height: 17px;

  display: none;
  place-items: center;

  margin-left: 3px;
  padding: 0 5px;

  border-radius: 9px;

  background: var(--blue);
  color: white;

  font-size: 10px;
  font-weight: 700;
}

.favorite-badge.visible {
  display: inline-grid;
}

.favorite-empty-icon {
  display: block;
  margin-bottom: 12px;
  font-size: 38px;
}

.favorite-hint {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.article-card-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.article-card-content {
  flex: 1;
  min-width: 0;
}

.saved-star {
  flex: 0 0 auto;
  color: #f5c451;
  font-size: 21px;
}

/* Изображения и схемы внутри статей */

.article-image {
  margin: 22px 0;
  padding: 12px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  overflow: hidden;
}

.article-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  object-fit: contain;
}

.article-image figcaption {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 4px 2px;
  line-height: 1.4;
}

.article-image figcaption strong {
  font-size: 15px;
}

.article-image figcaption span {
  font-size: 13px;
  opacity: 0.7;
}

/* Полноэкранный просмотр технических схем */

.zoomable-image {
  cursor: zoom-in;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 50px 16px 30px;
  background: rgba(0, 0, 0, 0.92);
}

.image-viewer img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.image-viewer-close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: white;
  font-size: 38px;
  line-height: 1;
  cursor: pointer;
}

/* Таблицы внутри статей */

.article-table-section {
  overflow: hidden;
}

.article-table-scroll {
  width: 100%;
  overflow-x: auto;
  margin-top: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  -webkit-overflow-scrolling: touch;
}

.article-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.4;
}

.article-table th,
.article-table td {
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.article-table th {
  font-weight: 700;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.04);
}

.article-table tbody tr:last-child td {
  border-bottom: 0;
}

.article-table-note {
  margin: 10px 2px 0;
  font-size: 13px;
  line-height: 1.45;
  opacity: 0.7;
}
