/* PassBox — дизайн-система
   Тема: «сургучная печать». Секрет — это запечатанное письмо: его можно
   вскрыть только один раз (или ограниченное число раз), после чего печать
   считается сломанной. Акцент один — цвет сургуча; всё остальное сдержанно. */

:root {
  --bg: #f7f5f1;
  --bg-elevated: #ffffff;
  --text: #1c1b19;
  --text-muted: #6b6358;
  --border: #e3ddd2;
  --border-strong: #cdc4b4;
  --accent: #a33b2b;
  --accent-text: #ffffff;
  --accent-soft: #f3e2dc;
  --danger: #a33b2b;
  --success: #3f6b4a;
  --shadow: 0 1px 2px rgba(28, 27, 25, 0.04), 0 8px 24px rgba(28, 27, 25, 0.06);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-sans: -apple-system, "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15140f;
    --bg-elevated: #1e1c16;
    --text: #ede9e1;
    --text-muted: #9a9286;
    --border: #34302675;
    --border-strong: #4a4436;
    --accent: #d6694f;
    --accent-text: #1c1006;
    --accent-soft: #3a2018;
    --danger: #e07a5f;
    --success: #6ea37c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.4);
  }
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrap {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 12px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand__mark {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.brand__name {
  font-size: 15px;
  color: var(--text-muted);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 0 64px;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
}

@media (max-width: 480px) {
  .card { padding: 24px 20px; }
}

h1 {
  font-size: 22px;
  font-weight: 650;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.lede {
  color: var(--text-muted);
  font-size: 14.5px;
  margin: 0 0 28px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field {
  margin-bottom: 24px;
}

.secret-input-row {
  display: flex;
  gap: 8px;
}

textarea, input[type="text"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  padding: 12px 14px;
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  min-height: 88px;
}

textarea:focus, input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.icon-btn {
  flex-shrink: 0;
  width: 44px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 480px) {
  .row-2 { grid-template-columns: 1fr; gap: 16px; }
}

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

.range-field__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.range-field__value {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
}

input[type="range"] {
  width: 100%;
  appearance: none;
  height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  outline: none;
  margin: 0;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid var(--bg-elevated);
  box-shadow: 0 0 0 1px var(--accent);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid var(--bg-elevated);
  box-shadow: 0 0 0 1px var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 15px;
  font-weight: 650;
  padding: 13px 20px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
}

.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.99); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn--ghost:hover {
  filter: none;
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.5;
}

.hint strong { color: var(--text); }

/* --- Результат: ссылка + QR --- */

.result {
  text-align: center;
}

.result__seal {
  margin: 0 auto 18px;
  width: 64px;
  height: 64px;
}

.link-box {
  display: flex;
  gap: 8px;
  margin: 20px 0;
}

.link-box input {
  text-align: left;
  font-size: 13px;
  color: var(--text-muted);
}

.qr-wrap {
  display: flex;
  justify-content: center;
  margin: 24px 0;
}

.qr-wrap canvas, .qr-wrap img {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  padding: 12px;
}

.meta-pills {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.pill {
  font-size: 12.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
}

/* --- Просмотр секрета получателем --- */

.reveal-card {
  text-align: center;
}

.reveal-card .seal {
  width: 88px;
  height: 88px;
  margin: 0 auto 20px;
}

.secret-output {
  font-family: var(--font-mono);
  font-size: 18px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 20px 0;
  word-break: break-all;
  user-select: all;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status {
  font-size: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  text-align: left;
}

.status--error {
  background: var(--accent-soft);
  color: var(--danger);
}

.status--success {
  background: rgba(63, 107, 74, 0.12);
  color: var(--success);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--text);
  color: var(--bg);
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(-6px);
}

footer {
  text-align: center;
  padding: 20px 0 32px;
  font-size: 12.5px;
  color: var(--text-muted);
}

footer a {
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  * { transition: none !important; }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
