:root {
  --bg: #F5F6F8;
  --card: #FFFFFF;
  --ink: #111827;
  --mut: #6B7280;
  --line: #E5E7EB;
  --brand: #22C55E;
  --brand-dark: #16A34A;
  --brand-light: #DCFCE7;
  --brand-tint: #ECFDF5;
  --dark: #0F1115;
  --dark-card: #171920;
  --dark-border: rgba(255, 255, 255, 0.08);
  --acc: #22C55E;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

.wrap {
  max-width: 540px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 16px;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-img {
  height: 38px;
  width: auto;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

.hdr-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Language Switcher */
.lang-switch {
  display: inline-flex;
  background: #E5E7EB;
  padding: 3px;
  border-radius: 20px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}

.lang-btn {
  border: 0;
  background: transparent;
  color: var(--mut);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.18s ease;
  min-height: 32px;
}

.lang-btn.active {
  background: #FFFFFF;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #FFFFFF;
  border: 1px solid var(--line);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  color: var(--mut);
  margin-bottom: 14px;
}

.badge-dot {
  width: 7px;
  height: 7px;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

/* Hero Title */
h1 {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.08;
  color: var(--ink);
}

h1 em {
  font-style: normal;
  color: #6B7280;
}

.lead {
  font-size: 15px;
  color: var(--mut);
  margin-top: 8px;
  line-height: 1.45;
}

/* Base Card */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 6px 16px rgba(0,0,0,0.02);
  border: 1px solid rgba(0,0,0,0.04);
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

label {
  font-size: 13px;
  font-weight: 700;
  color: var(--mut);
  letter-spacing: 0.01em;
}

.btn-clear {
  border: 0;
  background: transparent;
  color: #9CA3AF;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: color 0.15s;
}

.btn-clear:hover {
  color: var(--ink);
}

/* Input */
.inp {
  display: flex;
  align-items: center;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  padding: 4px 16px;
  transition: all 0.18s ease;
  background: #FFFFFF;
}

.inp:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.inp b {
  font-size: 40px;
  font-weight: 800;
  color: #9CA3AF;
  user-select: none;
  line-height: 1;
}

.inp input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--ink);
  padding: 6px 8px;
  min-height: 54px;
}

.inp input::placeholder {
  color: #D1D5DB;
}

/* Price Range Slider */
.range-wrap {
  margin-top: 14px;
  padding: 0 2px;
}

.range-wrap input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  accent-color: var(--brand);
  width: 100%;
  height: 8px;
  border-radius: 8px;
  outline: none;
  background: #E5E7EB;
  cursor: pointer;
  margin: 6px 0;
  display: block;
}

/* Webkit (Chrome, Edge, Safari) thumb */
.range-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 3px solid var(--brand);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.04);
  cursor: grab;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.range-wrap input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.08);
}

.range-wrap input[type="range"]::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.15);
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.22);
}

/* Firefox thumb */
.range-wrap input[type="range"]::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 3px solid var(--brand);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.04);
  cursor: grab;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.range-wrap input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.08);
}

.range-wrap input[type="range"]::-moz-range-thumb:active {
  cursor: grabbing;
  transform: scale(1.15);
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.22);
}

.range-wrap input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 8px;
  background: transparent;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  color: #9CA3AF;
  margin-top: 2px;
  user-select: none;
}

/* Quick Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chips button {
  border: 1px solid var(--line);
  background: #FFFFFF;
  border-radius: 20px;
  padding: 8px 15px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 40px;
}

.chips button:hover {
  border-color: var(--brand);
  background: #F0FDF4;
  color: #15803D;
}

.chips button:active {
  transform: scale(0.96);
}

.grp {
  margin-top: 14px;
  font-size: 13px;
  color: var(--mut);
  line-height: 1.4;
}

.grp b {
  color: var(--ink);
}

/* Results Container */
.res {
  display: none;
}

.res.on {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero Result Card (5 months) */
.hero {
  background: linear-gradient(145deg, #12141A 0%, #0A0B0E 100%);
  color: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 24px 22px 22px;
  margin-top: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  top: -60px;
  right: -60px;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.hero-label {
  font-size: 13px;
  font-weight: 700;
  color: #9CA3AF;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.pill {
  display: inline-block;
  background: var(--brand);
  color: #052E16;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 11px;
  border-radius: 12px;
  letter-spacing: -0.01em;
}

.hero .big {
  font-size: 64px;
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1;
  margin-top: 10px;
  color: #FFFFFF;
}

.hero .big i {
  font-style: normal;
  font-size: 22px;
  font-weight: 700;
  color: #9CA3AF;
  margin-left: 4px;
  letter-spacing: 0;
}

.hero .s {
  font-size: 14px;
  color: #9CA3AF;
  margin-top: 10px;
  line-height: 1.4;
}

/* 2-Column Grid */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.box {
  background: #FFFFFF;
  border-radius: 20px;
  padding: 18px 16px;
  border: 1px solid rgba(0,0,0,0.04);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.box .t {
  font-size: 13px;
  font-weight: 700;
  color: var(--mut);
}

.box .v {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-top: 6px;
  color: var(--ink);
}

.box .v i {
  font-style: normal;
  font-size: 14px;
  font-weight: 600;
  color: var(--mut);
  margin-left: 2px;
}

.box .s {
  font-size: 12px;
  color: var(--mut);
  margin-top: 6px;
  line-height: 1.35;
}

/* Headings */
h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tag-ready {
  font-size: 12px;
  font-weight: 700;
  color: #047857;
  background: var(--brand-light);
  padding: 4px 9px;
  border-radius: 10px;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 14px;
}

th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--mut);
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.02em;
}

td {
  padding: 11px 8px;
  border-bottom: 1px solid #F3F4F6;
  color: var(--ink);
}

td:last-child, th:last-child {
  text-align: right;
}

td:nth-child(2), th:nth-child(2) {
  text-align: right;
}

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

/* Highlight active tier */
tr.on td {
  background: var(--brand-light) !important;
  font-weight: 800;
  color: #065F46;
}

tr.on td:first-child {
  border-radius: 10px 0 0 10px;
}

tr.on td:last-child {
  border-radius: 0 10px 10px 0;
}

.cmp td {
  padding: 10px 8px;
}

.cmp td:first-child {
  color: var(--mut);
  font-weight: 600;
}

/* Ready text block */
pre {
  white-space: pre-wrap;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink);
  background: #F9FAFB;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-top: 8px;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  padding: 15px 20px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s ease;
  min-height: 50px;
}

.btn:active {
  transform: scale(0.98);
}

.btn-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.btn-copy {
  background: var(--ink);
  color: #FFFFFF;
}

.btn-copy.ok {
  background: #16A34A;
  color: #FFFFFF;
}

.btn-tg {
  background: #229ED9;
  color: #FFFFFF;
}

.btn-tg:hover {
  background: #1E8EBE;
}

/* Contacts quick bar */
.contacts-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #F9FAFB;
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  transition: background 0.15s;
  min-height: 44px;
}

.contact-item:hover {
  background: #F3F4F6;
  border-color: #D1D5DB;
}

.c-icon {
  font-size: 16px;
}

.c-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Formula note */
.formula {
  font-size: 13px;
  color: var(--mut);
  line-height: 1.55;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.formula p {
  margin-bottom: 6px;
}

.formula code {
  display: block;
  white-space: normal;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  background: #F3F4F6;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--ink);
  margin: 6px 0 8px;
  font-weight: 600;
}

/* Footer */
footer {
  margin-top: 30px;
  text-align: center;
  color: var(--mut);
  font-size: 13px;
  line-height: 1.6;
}

.foot-brand {
  margin-bottom: 8px;
}

.foot-logo {
  height: 24px;
  width: auto;
  opacity: 0.85;
}

.foot-slogan {
  font-size: 12px;
  color: #9CA3AF;
  margin-top: 4px;
}

.foot-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
}

.foot-links a {
  color: var(--ink);
  text-decoration: none;
}

.foot-links a:hover {
  color: var(--brand-dark);
}

/* Responsive tweaks */
@media (max-width: 400px) {
  .wrap {
    padding: 12px 12px 32px;
  }
  .inp input {
    font-size: 38px;
  }
  .hero .big {
    font-size: 52px;
  }
  .box .v {
    font-size: 26px;
  }
  .contacts-bar {
    grid-template-columns: 1fr;
  }
}
