/* cinemalink — единые стили по дизайн-концепции */

:root {
  --bg: #101014;
  --bg-top: #1d1a22;
  --surface: #17151c;
  --line: #24242c;
  --text: #f2f0ea;
  --muted: #9a97a0;
  --dim: #6e6a76;
  --faint: #4d4a55;
  --accent: #e8b04b;
  --accent-hover: #f0c06a;
  --accent-ink: #14120c;
  --ok: #8fca8f;
  --err: #e07a6a;
}

* { box-sizing: border-box; }

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

body {
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, var(--bg-top), var(--bg) 65%) fixed;
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Golos Text', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  align-items: center;
}

a { color: #c8c5cf; }
a:hover { color: var(--accent); }

/* ── Логотип ─────────────────────────────── */

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-badge {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.logo-word {
  font-family: 'Unbounded', sans-serif;
  font-weight: 600;
  font-size: 18px;
  color: var(--text);
}

.logo-word span { color: var(--accent); }

/* ── Каркас страницы ─────────────────────── */

.page {
  width: 100%;
  max-width: 720px;
  padding: 28px 20px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.page-header {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  margin-bottom: 56px;
}

/* ── Герой: форма сокращения ─────────────── */

.hero {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero h1 {
  font-family: 'Unbounded', sans-serif;
  font-weight: 600;
  font-size: 34px;
  line-height: 1.25;
  margin: 0 0 14px;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero .sub {
  color: var(--muted);
  font-size: 16px;
  max-width: 460px;
  margin: 0 0 36px;
}

.shorten-form {
  width: 100%;
  display: flex;
  gap: 10px;
}

.shorten-form input {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  color: var(--text);
  font-family: 'Golos Text', sans-serif;
  font-size: 16px;
  outline: none;
  transition: border-color .15s;
}

.shorten-form input::placeholder { color: var(--dim); }

.shorten-form input:focus { border-color: var(--accent); }

.shorten-form button {
  flex: none;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 12px;
  padding: 16px 26px;
  font-family: 'Golos Text', sans-serif;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: background .15s;
}

.shorten-form button:hover { background: var(--accent-hover); }

.shorten-form button:disabled {
  opacity: .6;
  cursor: default;
}

.form-error {
  color: var(--err);
  font-size: 14px;
  margin-top: 12px;
  min-height: 20px;
}

/* ── Результат ───────────────────────────── */

.result {
  width: 100%;
  margin-top: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  display: none;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.result.visible { display: flex; }

.result-label {
  color: var(--dim);
  font-size: 13px;
}

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

.result-link {
  flex: 1;
  min-width: 200px;
  font-family: monospace;
  font-size: 18px;
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}

.result-link:hover { color: var(--accent-hover); }

.copy-btn {
  flex: none;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 10px;
  padding: 10px 18px;
  font-family: 'Golos Text', sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.copy-btn:hover,
.copy-btn.copied {
  background: var(--accent);
  color: var(--accent-ink);
}

.result-target {
  color: var(--dim);
  font-size: 13px;
  word-break: break-all;
}

/* ── Мои ссылки ──────────────────────────── */

.recent {
  width: 100%;
  margin-top: 48px;
  display: none;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.recent.visible { display: flex; }

.recent h2 {
  font-family: 'Unbounded', sans-serif;
  font-weight: 400;
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 4px;
}

.recent-item {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.recent-item a {
  font-family: monospace;
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
  flex: none;
}

.recent-item a:hover { color: var(--accent-hover); }

.recent-item .target {
  color: var(--dim);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

/* ── Как это работает ────────────────────── */

.steps {
  width: 100%;
  margin-top: 56px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  text-align: left;
}

.step .icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(232, 176, 75, .12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.step h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 6px;
}

.step p {
  color: var(--dim);
  font-size: 13px;
  margin: 0;
}

/* ── Страница перехода ───────────────────── */

.go-page {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px 20px;
}

/* Основной блок — по центру экрана, дисклеймер прижат к низу */
.go-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.ring-wrap {
  position: relative;
  width: 190px;
  height: 190px;
}

.ring-wrap svg { transform: rotate(-90deg); display: block; }

.ring-track { stroke: var(--line); }

.ring-bar {
  stroke: var(--accent);
  transition: stroke-dashoffset 1s linear;
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.ring-count {
  font-family: 'Oswald', sans-serif;
  font-size: 64px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}

.ring-label {
  color: var(--dim);
  font-size: 13px;
}

.go-dest {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.go-status {
  color: var(--muted);
  font-size: 15px;
}

.go-target {
  color: var(--accent);
  font-family: monospace;
  font-size: 16px;
  word-break: break-all;
  max-width: 560px;
}

.go-btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 15px;
  padding: 14px 32px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}

.go-btn:hover {
  background: var(--accent-hover);
  color: var(--accent-ink);
}

.go-note {
  color: var(--faint);
  font-size: 12px;
  text-align: center;
  max-width: 480px;
  margin-top: 28px;
}

.go-note .ok { margin-right: 4px; }

.go-note .ok { color: var(--ok); }

/* Ссылка не найдена */
.go-missing-icon {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}

.go-missing h1 {
  font-family: 'Unbounded', sans-serif;
  font-weight: 600;
  font-size: 24px;
  margin: 0;
  text-align: center;
}

/* ── Страница правил ─────────────────────── */

.legal {
  width: 100%;
  text-align: left;
}

.legal h1 {
  font-family: 'Unbounded', sans-serif;
  font-weight: 600;
  font-size: 24px;
  line-height: 1.3;
  margin: 0 0 18px;
}

.legal h2 {
  font-family: 'Unbounded', sans-serif;
  font-weight: 400;
  font-size: 16px;
  color: var(--accent);
  margin: 32px 0 10px;
}

.legal p,
.legal li {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 10px;
}

.legal ul {
  margin: 0 0 10px;
  padding-left: 22px;
}

.legal li { margin-bottom: 6px; }

.legal .legal-intro {
  color: var(--text);
}

/* ── Админка ─────────────────────────────── */

.page-wide { max-width: 900px; }

.admin-header {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 36px;
}

.admin-badge {
  font-family: 'Golos Text', sans-serif;
  font-size: 12px;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  margin-left: 4px;
}

.admin-logout {
  color: var(--dim);
  font-size: 14px;
  text-decoration: none;
}

.admin {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: left;
}

/* Вход */
.admin-login {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 300px;
  max-width: 100%;
  text-align: center;
}

.admin-login h1 {
  font-family: 'Unbounded', sans-serif;
  font-weight: 600;
  font-size: 20px;
  margin: 0 0 6px;
}

.admin-login input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text);
  font-family: 'Golos Text', sans-serif;
  font-size: 16px;
  outline: none;
}

.admin-login input:focus { border-color: var(--accent); }

.admin-login button {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-family: 'Golos Text', sans-serif;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

.admin-login button:hover { background: var(--accent-hover); }

/* Плитки со счётчиками */
.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
}

.tile-value {
  font-family: 'Oswald', sans-serif;
  font-size: 34px;
  font-weight: 600;
  line-height: 1.1;
}

.tile-label {
  color: var(--dim);
  font-size: 13px;
  margin-top: 2px;
}

/* График */
.chart-card,
.links-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}

.chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.chart-card h2,
.links-card h2 {
  font-family: 'Unbounded', sans-serif;
  font-weight: 400;
  font-size: 15px;
  color: var(--muted);
  margin: 0;
}

.links-card h2 { margin-bottom: 12px; }

.chart-legend {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
}

.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }

.sw {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.sw-created { background: #b8842c; }
.sw-clicks { background: #6293d6; }

.chart-wrap { position: relative; }

.chart { width: 100%; height: auto; display: block; }

.grid-line { stroke: var(--line); stroke-width: 1; }
.grid-dashed { stroke-dasharray: 3 4; }

.axis-text {
  fill: var(--dim);
  font-family: 'Golos Text', sans-serif;
  font-size: 10px;
}

.bar-created { fill: #b8842c; }
.bar-clicks { fill: #6293d6; }

.hit-area { fill: transparent; }

.day-group:hover .bar-created { fill: #cf9838; }
.day-group:hover .bar-clicks { fill: #74a5e6; }

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: #211f27;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
  white-space: nowrap;
  z-index: 2;
}

.chart-tooltip strong { color: var(--text); font-weight: 600; }
.chart-tooltip span { display: inline-flex; align-items: center; gap: 6px; }

.chart-data { margin-top: 10px; }

.chart-data summary {
  color: var(--dim);
  font-size: 13px;
  cursor: pointer;
}

/* Массовое сокращение */
.bulk-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}

.bulk-card h2 {
  font-family: 'Unbounded', sans-serif;
  font-weight: 400;
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 8px;
}

.bulk-hint {
  color: var(--dim);
  font-size: 13px;
  margin: 0 0 14px;
}

.mono-hint { font-family: monospace; color: var(--muted); }

.bulk-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bulk-form input[type="file"] {
  color: var(--dim);
  font-size: 13px;
  font-family: 'Golos Text', sans-serif;
}

.bulk-form input[type="file"]::file-selector-button {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 10px;
  padding: 9px 16px;
  font-family: 'Golos Text', sans-serif;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  margin-right: 12px;
  transition: background .15s, color .15s;
}

.bulk-form input[type="file"]::file-selector-button:hover {
  background: var(--accent);
  color: var(--accent-ink);
}

.bulk-form textarea {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  font-family: monospace;
  font-size: 13px;
  resize: vertical;
  outline: none;
}

.bulk-form textarea:focus { border-color: var(--accent); }
.bulk-form textarea::placeholder { color: var(--faint); }

.bulk-form button {
  align-self: flex-start;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  font-family: 'Golos Text', sans-serif;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.bulk-form button:hover { background: var(--accent-hover); }

.bulk-msg { margin-top: 12px; }

.bulk-summary {
  margin-top: 16px;
  padding: 12px 14px;
  background: rgba(232, 176, 75, .08);
  border: 1px solid rgba(232, 176, 75, .25);
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

.bulk-download { margin-left: auto; text-decoration: none; }

.bulk-results { margin-top: 12px; }

/* Таблицы */
.admin table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin th {
  text-align: left;
  color: var(--dim);
  font-weight: 500;
  font-size: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.admin td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.admin tr:last-child td { border-bottom: none; }

.admin .num { text-align: right; }

.admin .mono {
  font-family: monospace;
  color: var(--accent);
  text-decoration: none;
}

.admin .mono:hover { color: var(--accent-hover); }

.admin .dim { color: var(--dim); white-space: nowrap; }

.target-cell {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-scroll { overflow-x: auto; }

.empty-note { color: var(--dim); font-size: 14px; margin: 0; }

@media (max-width: 720px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
}

/* ── Подвал ──────────────────────────────── */

.page-footer {
  width: 100%;
  max-width: 720px;
  padding: 24px 20px 32px;
  color: var(--faint);
  font-size: 13px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-disclaimer {
  color: var(--faint);
  font-size: 12px;
  max-width: 560px;
  margin: 0 auto;
}

.footer-nav a { color: var(--dim); }
.footer-nav a:hover { color: var(--accent); }

/* ── Доступность и адаптив ───────────────── */

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

@media (prefers-reduced-motion: reduce) {
  .ring-bar { transition: none; }
}

@media (max-width: 560px) {
  .hero h1 { font-size: 25px; }
  .shorten-form { flex-direction: column; }
  .shorten-form button { padding: 15px 22px; }
  .steps { grid-template-columns: 1fr; }
  .page-header { margin-bottom: 40px; }
  .ring-wrap { width: 160px; height: 160px; }
  .ring-wrap svg { width: 160px; height: 160px; }
  .ring-count { font-size: 52px; }
}
