:root {
  --bg: #071326;
  --bg-2: #0b1c36;
  --panel: rgba(23, 43, 79, 0.92);
  --panel-2: rgba(17, 34, 67, 0.95);
  --line: rgba(255, 255, 255, 0.08);
  --text: #f5f8ff;
  --muted: #b9c7e6;
  --accent: #56a8ff;
  --accent-2: #2d7eea;
  --success: #1fc77a;
  --warning: #f3b23c;
  --danger: #ef5b6b;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.32);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(71, 132, 255, 0.15), transparent 30%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #07111f 0%, #0a1630 100%);
  border-right: 1px solid var(--line);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.sidebar-brand h1 {
  margin: 0;
  font-size: 3rem;
  line-height: 1;
  letter-spacing: -1px;
}

.sidebar-brand p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 600;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-nav a {
  padding: 16px 18px;
  border-radius: 14px;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  transition: 0.2s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.95), rgba(75, 165, 255, 0.8));
  box-shadow: 0 10px 26px rgba(40, 110, 220, 0.28);
}

.sidebar-footer {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.main-content {
  padding: 34px 34px 48px;
}

.topbar {
  margin-bottom: 22px;
}

.topbar h2 {
  margin: 0 0 6px;
  font-size: 3.2rem;
  line-height: 1.05;
  letter-spacing: -1px;
}

.topbar p {
  margin: 0;
  color: var(--text);
  font-size: 1.55rem;
  font-weight: 700;
}

.panel {
  background: linear-gradient(180deg, rgba(23, 49, 92, 0.98), rgba(17, 37, 72, 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 24px;
}

.panel h3 {
  margin: 0 0 12px;
  font-size: 2rem;
  line-height: 1.1;
}

.panel p {
  margin: 0;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 600;
}

.hero-panel p {
  margin-bottom: 18px;
}

.scan-form {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 14px;
  align-items: center;
  margin-top: 18px;
}

.scan-form input {
  width: 100%;
  height: 58px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.96);
  color: #12223f;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 0 18px;
  outline: none;
}

.scan-form input::placeholder {
  color: #687997;
  font-weight: 600;
}

.scan-form input:focus {
  border-color: rgba(86, 168, 255, 0.9);
  box-shadow: 0 0 0 3px rgba(86, 168, 255, 0.18);
}

.scan-form button,
.secondary-btn,
.recent-scan-actions button {
  height: 58px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #68b4ff, #2c86ea);
  color: white;
  font-size: 1.08rem;
  font-weight: 800;
  cursor: pointer;
  padding: 0 20px;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 10px 22px rgba(30, 118, 236, 0.28);
}

.scan-form button:hover,
.secondary-btn:hover,
.recent-scan-actions button:hover {
  transform: translateY(-1px);
}

.scan-form button:active,
.secondary-btn:active,
.recent-scan-actions button:active {
  transform: translateY(0);
}

.secondary-btn {
  height: 48px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
}

.helper-text {
  margin-top: 14px !important;
  color: var(--muted) !important;
  font-size: 1.02rem !important;
  font-weight: 700 !important;
}

.error-panel {
  border-color: rgba(239, 91, 107, 0.28);
  background: linear-gradient(180deg, rgba(89, 24, 38, 0.92), rgba(61, 18, 30, 0.95));
}

.error-panel h3 {
  color: #ffd6db;
  margin-bottom: 8px;
}

.error-panel p {
  color: #ffe8ec;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.panel-header p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 1.02rem;
}

.recent-scans {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.recent-scan-item {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 170px;
}

.recent-scan-site {
  font-size: 1.12rem;
  font-weight: 800;
  word-break: break-word;
}

.recent-scan-meta {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
}

.recent-scan-actions {
  margin-top: auto;
}

.recent-scan-actions button {
  height: 42px;
  padding: 0 16px;
  font-size: 0.95rem;
}

.empty-history {
  padding: 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
}

.metrics-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.metric-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  text-align: center;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

.metric-card h4 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--text);
}

.metric-value {
  font-size: 3.4rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -1px;
}

.metric-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  padding: 8px 16px;
  margin: 0 auto;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 1.05rem;
}

.detail-row:last-child {
  border-bottom: 0;
}

.detail-row span {
  color: var(--text);
  font-weight: 700;
}

.detail-row strong {
  color: white;
  font-weight: 900;
  text-align: right;
  word-break: break-word;
}

.tag-list,
.recommendation-list {
  margin: 14px 0 0;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-list li,
.recommendation-list li {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  padding: 10px 14px;
  font-size: 0.96rem;
  font-weight: 800;
  color: white;
}

.recommendation-list {
  flex-direction: column;
}

.recommendation-list li {
  border-radius: 14px;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.05);
}

.good {
  background: rgba(31, 199, 122, 0.18) !important;
  color: #b9ffd8 !important;
  border: 1px solid rgba(31, 199, 122, 0.32) !important;
}

.warn {
  background: rgba(243, 178, 60, 0.18) !important;
  color: #ffe5a3 !important;
  border: 1px solid rgba(243, 178, 60, 0.32) !important;
}

.bad {
  background: rgba(239, 91, 107, 0.18) !important;
  color: #ffd0d6 !important;
  border: 1px solid rgba(239, 91, 107, 0.32) !important;
}

#about p {
  line-height: 1.55;
}

@media (max-width: 1200px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .results-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .main-content {
    padding: 22px;
  }

  .topbar h2 {
    font-size: 2.4rem;
  }

  .topbar p {
    font-size: 1.15rem;
  }

  .scan-form {
    grid-template-columns: 1fr;
  }

  .scan-form button {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .panel {
    padding: 20px;
  }

  .panel h3 {
    font-size: 1.55rem;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 160px;
  }

  .metric-value {
    font-size: 2.6rem;
  }

  .panel-header {
    flex-direction: column;
  }

  .detail-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .detail-row strong {
    text-align: left;
  }
}