:root {
  --bg: #f3f6ff;
  --bg-elevated: #ffffff;
  --surface: rgba(255, 255, 255, 0.78);
  --card: rgba(255, 255, 255, 0.86);
  --text: #101625;
  --muted: #5f6d86;
  --brand: #5468ff;
  --brand-2: #6d3bff;
  --ok: #0f9d58;
  --danger: #c83737;
  --line: rgba(125, 141, 173, 0.24);
  --shadow: 0 20px 48px rgba(39, 72, 159, 0.14);
}

:root[data-theme="dark"] {
  --bg: #0b1222;
  --bg-elevated: #101a30;
  --surface: rgba(16, 24, 45, 0.72);
  --card: rgba(19, 30, 54, 0.82);
  --text: #e7ecfa;
  --muted: #9fb0d5;
  --brand: #7ea2ff;
  --brand-2: #9e7bff;
  --ok: #49dca2;
  --danger: #ff8b98;
  --line: rgba(157, 178, 223, 0.28);
  --shadow: 0 24px 58px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 16% 10%, rgba(118, 86, 255, 0.18), transparent 35%),
              radial-gradient(circle at 88% 92%, rgba(84, 104, 255, 0.14), transparent 34%),
              var(--bg);
  position: relative;
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(26px);
  opacity: 0.5;
  pointer-events: none;
}

.bg-orb--1 {
  width: 240px;
  height: 240px;
  top: -40px;
  right: -70px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.bg-orb--2 {
  width: 220px;
  height: 220px;
  bottom: -70px;
  left: -70px;
  background: linear-gradient(135deg, #53d8ff, var(--brand));
}

.container {
  width: min(1040px, 100% - 26px);
  margin-inline: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.2px;
  font-size: clamp(19px, 2.2vw, 24px);
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 8px 10px;
  transition: all 0.2s ease;
}

.nav a:hover {
  color: var(--text);
  border-color: var(--line);
  background: var(--bg-elevated);
}

.theme-toggle {
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle__moon { opacity: 0.45; }
:root[data-theme="dark"] .theme-toggle__moon { opacity: 1; }
:root[data-theme="dark"] .theme-toggle__sun { opacity: 0.45; }

.page {
  padding: 18px 0 34px;
  display: grid;
  gap: 16px;
}

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: clamp(18px, 3.6vw, 34px);
  background: linear-gradient(135deg, rgba(84, 104, 255, 0.16), rgba(109, 59, 255, 0.12)), var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  top: -110px;
  right: -40px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(122, 144, 255, 0.4), transparent 70%);
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 5.2vw, 48px);
  line-height: 1.05;
  max-width: 760px;
}

.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 760px;
  font-size: clamp(15px, 1.9vw, 18px);
}

.hero__actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.card h1, .card h2, .card h3 {
  margin-top: 0;
}

.card--narrow {
  max-width: 460px;
  margin-inline: auto;
}

.actions, .hero__actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  text-decoration: none;
  display: inline-block;
  font-weight: 700;
  padding: 11px 16px;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(84, 104, 255, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(84, 104, 255, 0.34);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}

.form { display: grid; gap: 12px; }

.form label {
  font-size: 14px;
  color: var(--muted);
}

.form input,
.form textarea {
  margin-top: 6px;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 12px;
  outline: 0;
}

.form input:focus,
.form textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(84, 104, 255, 0.2);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.4);
}

:root[data-theme="dark"] .list li {
  background: rgba(9, 16, 33, 0.4);
}

.list a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.tag {
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(84, 104, 255, 0.35);
  border-radius: 999px;
  padding: 4px 8px;
}

.meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: var(--bg-elevated);
}

.metric b {
  display: block;
  font-size: 18px;
}

.error { color: var(--danger); font-weight: 600; }

.result {
  margin-top: 12px;
  white-space: pre-wrap;
  color: var(--ok);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg-elevated);
}

@media (min-width: 760px) {
  .page { padding-top: 24px; }
  .grid { grid-template-columns: 1fr 1fr; }
  .card { padding: 22px; }
}
