:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f5f8fb;
  --border: #e1e7ef;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #1765bd;
  --primary-hover: #14539a;
  --primary-soft: #e8f2ff;
  --accent: #0f9f8f;
  --success: #047857;
  --text-soft: #8190a5;
  --tor: #7c3aed;
  --tor-soft: #f3edff;
  --warning: #a8742a;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px rgba(15, 23, 42, .07);
  --radius: 18px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1018;
  --surface: #121925;
  --surface-2: #182131;
  --border: #233046;
  --text: #e8eef8;
  --muted: #8d9bb0;
  --primary: #4f9df8;
  --primary-hover: #7ab8ff;
  --primary-soft: #132a44;
  --accent: #27d3bd;
  --success: #34d399;
  --text-soft: #77869a;
  --tor: #a78bfa;
  --tor-soft: #221b38;
  --warning: #c9a15a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 40px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(600px 300px at 50% -80px, color-mix(in srgb, var(--primary) 14%, transparent), transparent),
    var(--bg);
}
button { font: inherit; border: 0; cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.page {
  display: flex;
  flex-direction: column;
  width: min(730px, calc(100% - 28px));
  position: relative;
  min-height: 100vh;
  margin: 0 auto;
  padding: 56px 0;
}

.card-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .05);
}
html[data-theme="dark"] .card-topbar { box-shadow: 0 10px 28px rgba(0, 0, 0, .25); }
.brand { display: inline-flex; align-items: center; gap: .85rem; color: var(--text); text-decoration: none; }
.doc-logo {
  position: relative;
  display: inline-flex;
  width: 3rem;
  height: 3rem;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 1.05rem;
  background:
    radial-gradient(circle at 22% 18%, color-mix(in srgb, #fff 82%, var(--primary) 18%), transparent 0 16%),
    radial-gradient(circle at 76% 82%, color-mix(in srgb, var(--success) 48%, transparent), transparent 0 28%),
    linear-gradient(145deg, var(--primary), var(--accent) 62%, color-mix(in srgb, var(--success) 58%, var(--accent)));
  box-shadow:
    0 16px 36px color-mix(in srgb, var(--primary) 26%, transparent),
    0 0 0 5px color-mix(in srgb, var(--primary-soft) 72%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, .35);
  transform: rotate(-3deg);
}

.doc-logo::before {
  content: "";
  position: absolute;
  inset: -.22rem;
  border: 1px solid color-mix(in srgb, var(--accent) 46%, transparent);
  border-radius: 1.25rem;
  opacity: .58;
  transform: rotate(10deg);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 14%, transparent);
}

.doc-logo::after {
  content: "";
  position: absolute;
  right: .36rem;
  top: .38rem;
  width: .42rem;
  height: .42rem;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--warning) 65%, #fff);
  box-shadow:
    0 0 0 .28rem color-mix(in srgb, var(--warning) 18%, transparent),
    0 0 18px color-mix(in srgb, var(--warning) 32%, transparent);
}

.doc-logo-monogram {
  position: relative;
  z-index: 5;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 950;
  letter-spacing: -.09em;
  text-shadow:
    0 2px 10px rgba(15, 23, 42, .34),
    0 0 18px rgba(255, 255, 255, .18);
}

.doc-logo-cart {
  position: absolute;
  left: .23rem;
  bottom: .24rem;
  z-index: 2;
  width: .95rem;
  height: .78rem;
  border-radius: .38rem;
  background: color-mix(in srgb, var(--surface) 86%, var(--accent) 14%);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--accent) 36%, transparent),
    0 8px 16px rgba(15, 23, 42, .14);
  opacity: .92;
}

.doc-logo-cart::before {
  content: "";
  position: absolute;
  left: .27rem;
  top: -.18rem;
  width: .38rem;
  height: .3rem;
  border: 2px solid color-mix(in srgb, var(--accent) 72%, #fff);
  border-bottom: 0;
  border-radius: .4rem .4rem 0 0;
}

.doc-logo-cart::after {
  content: "";
  position: absolute;
  left: .22rem;
  bottom: .16rem;
  width: .11rem;
  height: .11rem;
  border-radius: 9999px;
  background: var(--accent);
  box-shadow: .36rem 0 0 var(--accent);
}

.doc-logo-dollar {
  position: absolute;
  right: .18rem;
  top: .22rem;
  z-index: 2;
  display: flex;
  width: .9rem;
  height: .9rem;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--surface) 86%, var(--accent) 14%);
  color: var(--accent);
  font-size: .58rem;
  font-weight: 950;
  line-height: 1;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--accent) 36%, transparent),
    0 8px 16px rgba(15, 23, 42, .12);
}

.doc-logo-check {
  position: absolute;
  right: .52rem;
  bottom: .52rem;
  z-index: 4;
  width: .58rem;
  height: .34rem;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
  opacity: .94;
}
.brand-text { display: grid; gap: .05rem; }
.brand-text strong { display: inline-flex; align-items: baseline; gap: .02rem; font-size: .98rem; font-weight: 900; letter-spacing: .02em; }
.brand-text small { white-space: nowrap; color: var(--text-soft); font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.word-doc, .word-shop { color: transparent; -webkit-background-clip: text; background-clip: text; }
.word-doc { background-image: linear-gradient(135deg, var(--primary), var(--accent)); }
.word-dash { margin: 0 .06em; color: var(--text-soft); }
.word-shop { background-image: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--success) 74%, var(--accent))); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.language-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}
.language-button {
  min-width: 34px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  transition: background .15s, color .15s;
}
.language-button:hover { color: var(--text); }
html[data-language="ru"] .language-button[data-language="ru"],
html[data-language="en"] .language-button[data-language="en"] { color: #fff; background: var(--primary); box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 22%, transparent); }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface);
  transition: color .15s, border-color .15s;
}
.icon-button:hover { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.icon-button svg { width: 18px; height: 18px; }
.sun-icon { display: none; }
html[data-theme="dark"] .sun-icon { display: block; }
html[data-theme="dark"] .moon-icon { display: none; }

.card {
  margin: auto 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 14px;
}
.card-head h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }

.mirror-list { margin: 0; padding: 0 12px 4px; list-style: none; }
.mirror {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-top: 1px solid var(--border);
}
.mirror:first-child { border-top: 0; }
.mirror-icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}
.mirror-icon svg { width: 18px; height: 18px; stroke-width: 1.8; }
.mirror-copy {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.mirror-address {
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mirror-description { min-width: 0; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
[data-description-language] { display: none; }
html[data-language="en"] [data-description-language="en"],
html[data-language="ru"] [data-description-language="ru"] { display: inline; }
.mirror-actions { display: flex; flex-shrink: 0; align-items: center; gap: 6px; }

.copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 36px;
  height: 36px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  transition: color .15s, border-color .15s, background .15s;
}
.copy-button:hover { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.copy-button svg { width: 16px; height: 16px; }
.copy-button.is-copied {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 40%, var(--border));
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
}

.open-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 12px 0 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 34%, transparent);
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 94%, transparent), color-mix(in srgb, var(--accent) 86%, transparent));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 18%, transparent);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: background .15s, transform .15s;
}
.open-button:hover {
  color: #fff;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary-hover) 94%, transparent), color-mix(in srgb, var(--accent) 90%, transparent));
}
.open-button:active { transform: scale(.97); }
.open-button svg { width: 15px; height: 15px; stroke-width: 2.4; }

.empty {
  margin: 0 20px 14px;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.tor {
  margin: 8px 12px 12px;
  padding: 12px;
  border-radius: 14px;
  background: var(--tor-soft);
}
.tor-label { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 600; }
.tor-badge {
  padding: 2px 7px;
  border-radius: 6px;
  color: #fff;
  background: var(--tor);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
}
html[data-theme="dark"] .tor-badge { color: #120c22; }
.tor-row { display: flex; align-items: center; gap: 8px; }
.tor-address {
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-all;
}
.tor .copy-button { border-color: color-mix(in srgb, var(--tor) 25%, transparent); }
.tor .copy-button:hover { color: var(--tor); border-color: color-mix(in srgb, var(--tor) 50%, transparent); }

.footer { position: absolute; right: 0; bottom: 20px; left: 0; color: var(--muted); font-size: 12px; text-align: center; }

.toast {
  position: fixed;
  z-index: 50;
  bottom: 22px;
  left: 50%;
  padding: 10px 16px;
  border-radius: 999px;
  color: #fff;
  background: #0f172a;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .25);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity .2s, transform .2s;
}
html[data-theme="dark"] .toast { color: #0b1018; background: #e8eef8; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

@media (max-width: 480px) {
  .page { padding: 48px 0; }
  .footer { bottom: 16px; }
  .card-topbar { padding: 12px 16px; }
  .brand { gap: .6rem; }
  .brand-text small { letter-spacing: .03em; }
  .topbar-actions { gap: 6px; }
  .card-head { padding: 16px 16px 10px; }
  .card-head h1 { font-size: 20px; }
  .mirror-list { padding: 0 8px; }
  .mirror { gap: 10px; }
  .mirror-icon { display: none; }
  .open-button span { display: none; }
  .open-button { width: 36px; padding: 0; justify-content: center; }
  .tor { margin-left: 8px; margin-right: 8px; }
}

@media (max-width: 420px) {
  .brand-text small { display: none; }
}

@media (max-width: 350px) {
  .brand-text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
