/* Shiro VPN Mini App — стиль ассетов бота: рисовая бумага, тушь,
   красное солнце, пиксельные картинки и «печатные» тени. */

:root {
  --paper: #f1e9d8;
  --paper-deep: #e7dcc5;
  --card: #faf5ea;
  --ink: #221f20;
  --ink-soft: #5d5852;
  --ink-faint: #8f877b;
  --line: rgba(34, 31, 32, 0.16);
  --red: #c42028;
  --red-deep: #96161d;
  --red-tint: rgba(196, 32, 40, 0.1);
  --gold: #b8862f;
  --green: #3c7a4a;
  --amber: #c08a1e;
  --shadow: #221f20;
  --radius: 14px;
  --font-serif: "Noto Serif", Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #161514;
  --paper-deep: #1e1c1a;
  --card: #23201d;
  --ink: #f1e9d8;
  --ink-soft: #b9b0a2;
  --ink-faint: #857d71;
  --line: rgba(241, 233, 216, 0.14);
  --red: #e0453c;
  --red-deep: #b8302a;
  --red-tint: rgba(224, 69, 60, 0.14);
  --gold: #d6a74e;
  --green: #6fb07c;
  --amber: #e0ac45;
  --shadow: #000;
  color-scheme: dark;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background-color: var(--paper);
  /* Зерно бумаги: редкие крапины, как на картинках бота. */
  background-image: radial-gradient(
      rgba(120, 100, 70, 0.1) 1px,
      transparent 1.4px
    ),
    radial-gradient(rgba(120, 100, 70, 0.07) 1px, transparent 1.4px);
  background-size: 23px 23px, 37px 37px;
  background-position: 0 0, 11px 17px;
  color: var(--ink);
  font: 16px/1.45 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px calc(28px + env(safe-area-inset-bottom));
}

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

h1,
h2,
h3 {
  font-family: var(--font-serif);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.2;
}

h2 {
  font-size: 20px;
  line-height: 1.25;
}

h3 {
  font-size: 17px;
}

p {
  margin: 0;
}

.muted {
  color: var(--ink-soft);
}

.faint {
  color: var(--ink-faint);
  font-size: 13px;
}

.stack > * + * {
  margin-top: 14px;
}

.stack-sm > * + * {
  margin-top: 8px;
}

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

.spacer {
  flex: 1;
}

/* --- экран и шапка -------------------------------------------------------- */

.screen {
  animation: enter 0.22s ease-out;
}

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

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 19px;
}

.brand .sun {
  width: 22px;
  height: 22px;
}

.seal {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: var(--red);
  color: #faf5ea;
  font-family: var(--font-serif);
  font-size: 17px;
  border-radius: 4px;
  transform: rotate(-4deg);
}

.sun {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--red);
  flex: none;
}

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

@keyframes pulse {
  50% {
    transform: scale(0.88);
    opacity: 0.75;
  }
}

.splash {
  min-height: 70vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
}

/* --- картинка экрана ------------------------------------------------------ */

.hero {
  position: relative;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 4px 4px 0 var(--shadow);
  background: var(--paper-deep);
  aspect-ratio: 16 / 10;
}

.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 45%;
  display: block;
  image-rendering: pixelated;
}

.hero--square {
  aspect-ratio: 1 / 1;
  max-width: 300px;
  margin-inline: auto;
}

:root[data-theme="dark"] .hero {
  border-color: #3a3631;
}

/* --- карточки ------------------------------------------------------------- */

.card {
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 3px 3px 0 var(--shadow);
}

:root[data-theme="dark"] .card {
  border-color: #3a3631;
}

.card--flat {
  box-shadow: none;
  border-color: var(--line);
}

.card--accent {
  border-color: var(--red);
  box-shadow: 3px 3px 0 var(--red-deep);
}

.label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}

.big {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--ink-faint);
}

.dot--ok {
  background: var(--green);
}

.dot--warn {
  background: var(--amber);
}

/* Пиксельная шкала срока: 12 «кирпичиков». */
.meter {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 3px;
  margin-top: 10px;
}

.meter i {
  height: 8px;
  background: var(--line);
  border-radius: 1px;
}

.meter i.on {
  background: var(--red);
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}

.kv:last-child {
  border-bottom: 0;
}

.kv b {
  text-align: right;
  white-space: nowrap;
}

.features .row > span:first-child {
  flex: none;
  width: 26px;
  text-align: center;
}

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

.btn {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font: 600 16px/1.2 var(--font-sans);
  box-shadow: 3px 3px 0 var(--shadow);
  cursor: pointer;
  transition: transform 0.06s, box-shadow 0.06s;
  text-decoration: none;
}

.btn:active {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--shadow);
}

.btn[disabled] {
  opacity: 0.55;
  pointer-events: none;
}

.btn--primary {
  background: var(--red);
  border-color: var(--red-deep);
  color: #fff;
  box-shadow: 3px 3px 0 var(--red-deep);
}

:root[data-theme="dark"] .btn {
  border-color: #3a3631;
}

:root[data-theme="dark"] .btn--primary {
  border-color: var(--red-deep);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--ink-soft);
  min-height: 44px;
}

.btn--ghost:active {
  transform: none;
  background: var(--red-tint);
}

.btn--sm {
  min-height: 40px;
  width: auto;
  padding: 8px 14px;
  font-size: 14px;
}

.btn.loading {
  pointer-events: none;
  color: transparent;
  position: relative;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  border-color: var(--ink) transparent var(--ink) transparent;
  animation: spin 0.8s linear infinite;
}

.btn--primary.loading::after {
  border-color: #fff transparent #fff transparent;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Плитки действий на главной. */
.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tile {
  appearance: none;
  text-align: left;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  padding: 14px;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  box-shadow: 3px 3px 0 var(--shadow);
  font: inherit;
  cursor: pointer;
  transition: transform 0.06s, box-shadow 0.06s;
}

:root[data-theme="dark"] .tile {
  border-color: #3a3631;
}

.tile:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.tile .icon {
  font-size: 22px;
  line-height: 1;
}

.tile b {
  font-size: 15px;
}

.tile small {
  color: var(--ink-faint);
  font-size: 12.5px;
  line-height: 1.3;
}

/* --- тарифы --------------------------------------------------------------- */

.plan {
  appearance: none;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
  transition: transform 0.06s, box-shadow 0.06s;
}

.plan:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.plan h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan .price {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 22px;
  white-space: nowrap;
}

.plan .meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-soft);
}

.chip--red {
  background: var(--red-tint);
  border-color: transparent;
  color: var(--red);
  font-weight: 600;
}

/* --- пополнение ----------------------------------------------------------- */

.amounts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.amount {
  appearance: none;
  min-height: 46px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font: 600 15px/1 var(--font-sans);
  cursor: pointer;
}

:root[data-theme="dark"] .amount {
  border-color: #3a3631;
}

.amount.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.field {
  display: flex;
  align-items: center;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--card);
  padding: 0 14px;
}

:root[data-theme="dark"] .field {
  border-color: #3a3631;
}

.field:focus-within {
  border-color: var(--red);
}

.field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: 700 22px/1 var(--font-serif);
  padding: 14px 0;
}

.field span {
  font: 700 20px/1 var(--font-serif);
  color: var(--ink-faint);
}

.hint {
  font-size: 13px;
  color: var(--ink-faint);
}

.hint.error {
  color: var(--red);
}

/* --- инструкция ----------------------------------------------------------- */

.qr {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 4px 4px 0 var(--shadow);
  max-width: 280px;
  margin-inline: auto;
}

.qr img {
  display: block;
  width: 100%;
  image-rendering: pixelated;
}

.steps {
  counter-reset: step;
  list-style: none;
  margin: 0;
  padding: 0;
}

.steps.card {
  padding: 18px 16px;
}

.steps .warn {
  margin-top: 6px;
}

.steps li {
  position: relative;
  padding: 0 0 18px 46px;
}

.steps li:last-child {
  padding-bottom: 0;
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font: 700 15px/1 var(--font-serif);
}

.steps li::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 34px;
  bottom: 4px;
  width: 2px;
  background: var(--line);
}

.steps li:last-child::after {
  display: none;
}

.steps b {
  display: block;
  margin-bottom: 4px;
}

.warn {
  border-left: 4px solid var(--red);
  background: var(--red-tint);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}

pre.config {
  margin: 0;
  max-height: 180px;
  overflow: auto;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--ink-soft);
}

/* --- список ссылок -------------------------------------------------------- */

.list {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}

.list button {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: 500 15px/1.3 var(--font-sans);
  text-align: left;
  cursor: pointer;
}

.list button:last-child {
  border-bottom: 0;
}

.list button:active {
  background: var(--red-tint);
}

.list .chev {
  margin-left: auto;
  color: var(--ink-faint);
}

/* --- нижний лист и тост --------------------------------------------------- */

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 16, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
  animation: fade 0.18s ease-out;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.sheet {
  width: 100%;
  max-width: 520px;
  background: var(--paper);
  border-top: 2px solid var(--ink);
  border-radius: 20px 20px 0 0;
  padding: 22px 16px calc(20px + env(safe-area-inset-bottom));
  animation: rise 0.22s ease-out;
}

@keyframes rise {
  from {
    transform: translateY(40px);
  }
}

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  background: var(--ink);
  color: var(--paper);
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 30;
  box-shadow: 3px 3px 0 var(--red);
  animation: rise 0.2s ease-out;
}

.center {
  text-align: center;
}

.mt-lg {
  margin-top: 22px;
}
