:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #dbe3ef;
  --success: #16a34a;
  --danger: #dc2626;
  --soft: #f8fafc;
  --key: #eef2ff;
  --key-active: #2563eb;
  --key-border: #c7d2fe;
  --topbar: #0f172a;
}

body.dark {
  --bg: #0f172a;
  --card: #111827;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --border: #374151;
  --soft: #1f2937;
  --key: #1e293b;
  --key-border: #475569;
  --topbar: #020617;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; }

.topbar {
  background: var(--topbar);
  color: white;
  padding: 14px 24px;
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 26px;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
}

.nav,
.auth-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.nav a,
.nav button,
.auth-nav a,
.auth-nav button {
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: #dbeafe;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.nav a:hover,
.nav button:hover,
.auth-nav a:hover,
.auth-nav button:hover {
  color: #fff;
}

.auth-register {
  background: var(--primary) !important;
  color: white !important;
  padding: 8px 12px !important;
  border-radius: 999px !important;
}

.hello { color: #dbeafe; font-weight: 700; }

.page {
  max-width: 1200px;
  margin: 28px auto;
  padding: 0 18px;
}

.title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

h1 { margin: 0; font-size: 30px; }

.badge {
  background: #dbeafe;
  color: #1e40af;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

body.dark .badge { background: #1e3a8a; color: #dbeafe; }

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

.card,
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  padding: 20px;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.field label,
.auth-card label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

select,
button,
textarea,
input {
  font: inherit;
}

select,
.auth-card input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--card);
  color: var(--text);
}

.stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
}

.stat strong { display: block; font-size: 24px; margin-bottom: 4px; }
.stat span {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.timer strong { color: var(--primary); }

.progress {
  height: 10px;
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 18px;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--primary);
}

.typing-text {
  min-height: 155px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  line-height: 1.9;
  font-size: 21px;
  background: var(--soft);
  margin-bottom: 16px;
  user-select: none;
}

.typing-text span { padding: 2px 1px; border-radius: 4px; }
.typing-text .correct { color: var(--success); background: rgba(22, 163, 74, .12); }
.typing-text .wrong { color: var(--danger); background: rgba(220, 38, 38, .15); }
.typing-text .current { background: #bfdbfe; color: #1e3a8a; }

textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  font-size: 20px;
  line-height: 1.6;
  outline: none;
  background: var(--card);
  color: var(--text);
}

textarea:focus,
.auth-card input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

textarea:disabled { opacity: .7; cursor: not-allowed; }

.actions {
  display: flex;
  gap: 12px;
  margin-top: 14px;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: white;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-light {
  background: var(--soft);
  color: var(--text);
  border: 1px solid var(--border);
}

.status {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.result {
  display: none;
  margin-top: 18px;
  border-radius: 14px;
  padding: 16px;
  background: rgba(37, 99, 235, .08);
  border: 1px solid rgba(37, 99, 235, .22);
}

.result.active { display: block; }

.result-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.result-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}

.result-item strong { display: block; font-size: 22px; }
.result-item span { font-size: 12px; color: var(--muted); }

.bottom-panel { display: grid; gap: 18px; }
.side-title { margin: 0 0 14px; font-size: 18px; }

.keyboard {
  display: grid;
  gap: 8px;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
}

.key-row { display: flex; gap: 6px; justify-content: center; }

.key {
  min-width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--key-border);
  background: var(--key);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  transition: .12s ease;
}

.key.active {
  background: var(--key-active);
  color: white;
  transform: translateY(-2px);
}

.key.wide { min-width: 62px; }
.key.space { min-width: 160px; }

.tip {
  max-width: 920px;
  margin: 18px auto 0;
  padding: 14px;
  border-radius: 12px;
  background: rgba(245, 158, 11, .12);
  border: 1px solid rgba(245, 158, 11, .35);
  font-size: 14px;
  line-height: 1.5;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.small-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  max-height: 210px;
  overflow: auto;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  gap: 10px;
}

.list-item b { color: var(--danger); }

.empty {
  color: var(--muted);
  font-size: 14px;
  background: var(--soft);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-top: 10px;
}

.auth-page {
  max-width: 480px;
  margin: 44px auto;
  padding: 0 18px;
}

.auth-card h1 { margin-bottom: 8px; }
.auth-card p { color: var(--muted); margin-top: 0; }
.auth-card form { display: grid; gap: 12px; }

.auth-switch {
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

.auth-switch a { color: var(--primary); font-weight: 700; }

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  margin: 16px 0;
  font-size: 14px;
}

.alert.error {
  background: rgba(220, 38, 38, .12);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, .25);
}

.site-footer {
  margin-top: 36px;
  background: #0f172a;
  color: #dbeafe;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 38px 18px 30px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.35fr;
  gap: 48px;
}

.footer-col h3 { margin: 0 0 18px; color: white; font-size: 22px; }

.footer-col a {
  display: block;
  color: #a9bfdd;
  text-decoration: none;
  font-size: 16px;
  margin-bottom: 10px;
}

.footer-col a:hover { color: white; }

.footer-about p {
  margin: 0 0 18px;
  color: #a9bfdd;
  line-height: 1.55;
}

.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: #94a3b8;
  font-size: 14px;
}

@media (max-width: 1050px) {
  .topbar-inner,
  .topbar-left {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; }
}

@media (max-width: 620px) {
  .title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar,
  .stats,
  .result-grid {
    grid-template-columns: 1fr 1fr;
  }

  h1 { font-size: 24px; }
  .typing-text { font-size: 18px; }
  textarea { font-size: 18px; }

  .key { min-width: 26px; height: 30px; font-size: 11px; }
  .key.space { min-width: 110px; }

  .actions { flex-direction: column; }
  .footer-inner { grid-template-columns: 1fr; }
}


.alert.success {
  background: rgba(22, 163, 74, .12);
  color: var(--success);
  border: 1px solid rgba(22, 163, 74, .25);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.admin-table th,
.admin-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
}

.admin-table th {
  color: var(--muted);
  background: var(--soft);
}

.admin-table small {
  color: var(--muted);
}

.danger-link {
  color: var(--danger);
  font-weight: 700;
  text-decoration: none;
}


/* Admin sol menü */
.admin-body {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background: var(--bg);
}

.admin-sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  background: var(--topbar);
  color: #dbeafe;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.admin-logo {
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  text-decoration: none;
}

.admin-menu {
  display: grid;
  gap: 8px;
}

.admin-menu a {
  display: block;
  color: #cbd5e1;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
}

.admin-menu a:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

.admin-user {
  margin-top: auto;
  color: #94a3b8;
  font-size: 14px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .1);
}

.admin-user strong {
  color: #fff;
}

.admin-main {
  min-width: 0;
}

.admin-content {
  max-width: 1200px;
  margin: 28px auto;
  padding: 0 18px;
}

.seo-page-select {
  max-width: 360px;
  margin-bottom: 22px;
}

.seo-page-select label,
.seo-form label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 700;
}

.seo-form {
  display: grid;
  gap: 14px;
}

.seo-form input,
.seo-form textarea,
.seo-page-select select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--card);
  color: var(--text);
  font: inherit;
}

.seo-form textarea {
  min-height: auto;
  resize: vertical;
  font-size: 15px;
}

.seo-form small {
  color: var(--muted);
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.check-row {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}

.check-row label {
  margin: 0;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--text);
}

.check-row input {
  width: auto;
}

.seo-form hr {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--border);
}

@media (max-width: 900px) {
  .admin-body {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: relative;
    min-height: auto;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}


.seo-content p,
.auth-seo-text p {
  color: var(--muted);
  line-height: 1.7;
}

.auth-seo-text {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.auth-seo-text h2,
.seo-content h2 {
  margin-top: 0;
}

.admin-table input[type="text"],
.admin-table input[type="url"] {
  width: 100%;
  min-width: 220px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--card);
  color: var(--text);
  font: inherit;
}


.audit-ok {
  color: var(--success);
  font-weight: 800;
}

.audit-bad {
  color: var(--danger);
  font-weight: 800;
}

.audit-warn {
  color: #f59e0b;
  font-weight: 800;
}

.admin-sidebar {
  overflow-y: auto;
}

.admin-menu a {
  line-height: 1.25;
}
