* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --bg: #eef8fb;
  --bg-soft: #f8fdff;
  --surface: #ffffff;
  --surface-tint: #f4fbfd;
  --text: #102033;
  --muted: #66758a;
  --line: #d9edf3;
  --line-strong: #bfe1ea;
  --primary: #078ca3;
  --primary-strong: #05768c;
  --primary-soft: #e0f7fb;
  --success: #20b26b;
  --warning: #b26b00;
  --danger: #d9435f;
  --shadow: 0 16px 36px rgba(31, 82, 104, 0.12);
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans Thai", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(238, 248, 251, 0.96)),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(7, 140, 163, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(7, 140, 163, 0.055) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 70%);
}

.page {
  position: relative;
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mark {
  width: 38px;
  height: 38px;
  border: 1px solid #9edbe6;
  border-radius: 8px;
  background:
    linear-gradient(135deg, #078ca3 0%, #28b483 62%, #f7c948 100%);
  box-shadow: 0 10px 24px rgba(7, 140, 163, 0.18);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  color: #0c2338;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.16;
  letter-spacing: 0;
}

h2 {
  color: #102033;
  font-size: 20px;
  line-height: 1.35;
  margin-bottom: 10px;
}

h3 {
  color: #142a40;
  font-size: 15px;
  line-height: 1.55;
}

.muted {
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #bfe4eb;
  border-radius: 999px;
  padding: 7px 12px;
  background: #ffffff;
  color: #0d7187;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(27, 94, 117, 0.08);
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.two {
  grid-template-columns: minmax(280px, 0.95fr) minmax(0, 1.45fr);
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.hero-main {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.panel.light {
  background: #ffffff;
  color: var(--text);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(280px, 0.82fr);
  gap: 16px;
  align-items: stretch;
}

.hero-main {
  min-height: 188px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(180deg, #ffffff 0%, #f4fbfd 100%);
}

.hero h2 {
  max-width: 860px;
  margin: 8px 0 10px;
  color: #092236;
  font-size: clamp(24px, 3.4vw, 36px);
  line-height: 1.14;
}

.actionbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.button,
button {
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  min-height: 42px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 10px 18px rgba(7, 140, 163, 0.22);
  transition: transform 0.14s ease, filter 0.14s ease, box-shadow 0.14s ease;
}

.button:hover,
button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 14px 24px rgba(7, 140, 163, 0.26);
}

.button.secondary,
button.secondary {
  border: 1px solid #bfe4eb;
  color: #0d7187;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(27, 94, 117, 0.08);
}

.button.warn,
button.warn {
  color: #5c3900;
  background: #ffd66e;
  box-shadow: 0 10px 18px rgba(178, 107, 0, 0.16);
}

.button.danger,
button.danger {
  color: #ffffff;
  background: var(--danger);
}

.button.small,
button.small {
  min-height: 38px;
  padding: 8px 11px;
  font-size: 13px;
}

.button[disabled],
button[disabled] {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
}

.input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 11px 12px;
  font-family: inherit;
  font-size: 14px;
}

.qrbox {
  display: grid;
  gap: 12px;
  place-items: center;
  text-align: center;
}

.qrwrap {
  width: min(100%, 330px);
  aspect-ratio: 1;
  border: 1px solid #d7e9ef;
  border-radius: 8px;
  background: #ffffff;
  display: grid;
  place-items: center;
  padding: 12px;
  box-shadow: 0 12px 28px rgba(31, 82, 104, 0.1);
}

#qrCanvas {
  width: 100% !important;
  height: 100% !important;
}

.linkbox {
  width: 100%;
  word-break: break-all;
  border: 1px solid #bfe4eb;
  border-radius: 8px;
  background: var(--primary-soft);
  color: #096f84;
  padding: 10px;
  font-size: 13px;
}

.stat {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(31, 82, 104, 0.08);
}

.stat strong {
  display: block;
  color: #0c2338;
  font-size: 30px;
  line-height: 1.1;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.tablewrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid #e4f0f4;
  color: #25364a;
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #0b6f84;
  background: #e9f8fb;
  font-weight: 900;
  white-space: nowrap;
}

tbody tr:nth-child(even) {
  background: #f8fcfd;
}

td.num {
  color: #102033;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.code {
  display: inline-flex;
  min-width: 42px;
  justify-content: center;
  border: 1px solid #bde3eb;
  border-radius: 999px;
  padding: 3px 8px;
  color: #087f96;
  background: #edfafd;
  font-weight: 900;
}

.notice {
  border-left: 4px solid var(--success);
  border-radius: 8px;
  padding: 12px 14px;
  background: #e9fbf2;
  color: #14633f;
}

.notice.warn {
  border-left-color: #f0b429;
  background: #fff8e5;
  color: #684500;
}

.setup-list {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.setup-list div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fcfd;
  padding: 12px;
}

.weight-panel {
  display: grid;
  gap: 16px;
}

.weight-section {
  border: 1px solid #d7eaf0;
  border-radius: 8px;
  background: #f8fcfd;
  padding: 14px;
}

.weight-section + .weight-section {
  margin-top: 2px;
}

.weight-total {
  margin-bottom: 12px;
  border: 1px solid #bfe4eb;
  border-radius: 8px;
  background: #eefafd;
  color: #087f96;
  padding: 9px 11px;
  font-size: 13px;
  font-weight: 900;
}

.weight-total.warn {
  border-color: #f2c46f;
  background: #fff8e5;
  color: #704700;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #dceef3;
}

.section-title h3 {
  color: #087f96;
  font-size: 17px;
}

.section-title p {
  max-width: 560px;
  text-align: right;
  font-size: 13px;
}

.vote-shell {
  max-width: 980px;
  margin: 0 auto;
}

.aspect-card,
.factor-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  display: grid;
  gap: 12px;
}

.aspect-card {
  padding: 14px;
}

.factor-row {
  padding: 15px;
}

.range-line {
  display: grid;
  grid-template-columns: 104px minmax(150px, 1fr) 74px;
  gap: 12px;
  align-items: center;
}

.range-line label {
  color: #27445f;
  font-weight: 900;
}

.range-line output {
  border: 1px solid #bfe4eb;
  border-radius: 8px;
  background: #eefafd;
  color: #0a7188;
  padding: 8px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
}

input[type="range"] {
  width: 100%;
  height: 40px;
  background: transparent;
  accent-color: var(--primary);
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 13px;
  border: 1px solid #b7dce5;
  border-radius: 999px;
  background: linear-gradient(90deg, #d7eef4, #7bcada, #078ca3);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  margin-top: -10px;
  border: 4px solid var(--primary);
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(7, 140, 163, 0.25);
}

input[type="range"]::-moz-range-track {
  height: 13px;
  border: 1px solid #b7dce5;
  border-radius: 999px;
  background: linear-gradient(90deg, #d7eef4, #7bcada, #078ca3);
}

input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border: 4px solid var(--primary);
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(7, 140, 163, 0.25);
}

.sticky-submit {
  position: sticky;
  bottom: 14px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  border: 1px solid #bfe4eb;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 36px rgba(31, 82, 104, 0.16);
  padding: 12px;
}

.final-submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 22px;
  border: 1px solid #9fd8e3;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(31, 82, 104, 0.14);
  padding: 18px;
}

.final-submit strong {
  display: block;
  color: #0c2338;
  font-size: 16px;
  margin-bottom: 4px;
}

.final-submit button {
  min-width: 180px;
}

.footer {
  padding: 28px 0 10px;
  color: #6d7f91;
  font-size: 13px;
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid #bfe4eb;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 18px 50px rgba(31, 82, 104, 0.18);
  padding: 12px 14px;
  font-weight: 850;
}

.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .page {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero,
  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .hero-main {
    min-height: auto;
  }

  .hero h2 {
    font-size: 25px;
  }

  .range-line {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .sticky-submit,
  .final-submit {
    align-items: stretch;
    flex-direction: column;
  }

  .section-title {
    flex-direction: column;
  }

  .section-title p {
    max-width: none;
    text-align: left;
  }

  .actionbar .button,
  .actionbar button {
    flex: 1 1 160px;
  }

  .tablewrap {
    margin-right: -6px;
    margin-left: -6px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }
}

/* AI Cyber theme layer */
:root {
  --bg: #eaf9fb;
  --bg-soft: #f7feff;
  --surface: rgba(255, 255, 255, 0.93);
  --surface-tint: #effcff;
  --text: #0d2135;
  --muted: #5f7289;
  --line: rgba(104, 207, 225, 0.38);
  --line-strong: rgba(15, 155, 183, 0.42);
  --primary: #058aa3;
  --primary-strong: #045c74;
  --primary-soft: #ddfbff;
  --success: #16a76b;
  --warning: #a76200;
  --danger: #d73562;
  --cyber-cyan: #22d3ee;
  --cyber-mint: #34d399;
  --cyber-lime: #a3e635;
  --cyber-gold: #f7c948;
  --cyber-violet: #6d5dfc;
  --cyber-pink: #cc4fdf;
  --shadow: 0 22px 54px rgba(11, 89, 116, 0.14);
  --shadow-strong: 0 28px 70px rgba(5, 80, 112, 0.2);
}

html {
  background:
    radial-gradient(circle at 18% -8%, rgba(52, 211, 153, 0.16), transparent 34%),
    radial-gradient(circle at 82% 2%, rgba(247, 201, 72, 0.12), transparent 28%),
    var(--bg);
}

body {
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(234, 249, 251, 0.96)),
    linear-gradient(115deg, rgba(34, 211, 238, 0.13), transparent 38%, rgba(163, 230, 53, 0.11) 68%, transparent),
    repeating-linear-gradient(90deg, rgba(5, 138, 163, 0.032) 0 1px, transparent 1px 72px),
    var(--bg);
}

body::before {
  z-index: 0;
  opacity: 0.9;
  background-image:
    linear-gradient(rgba(5, 138, 163, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(5, 138, 163, 0.07) 1px, transparent 1px),
    linear-gradient(135deg, transparent 0 47%, rgba(109, 93, 252, 0.045) 48% 52%, transparent 53%);
  background-size: 30px 30px, 30px 30px, 180px 180px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.64), transparent 78%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0 49%, rgba(34, 211, 238, 0.08) 50%, transparent 51%),
    repeating-linear-gradient(180deg, rgba(4, 92, 116, 0.035) 0 1px, transparent 1px 10px);
  opacity: 0.52;
  mix-blend-mode: multiply;
}

.page {
  z-index: 1;
}

.topbar {
  position: relative;
  margin-bottom: 8px;
  padding: 16px 0 24px;
}

.topbar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 8px;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.76), rgba(163, 230, 53, 0.62), transparent);
}

.brand {
  min-width: 0;
}

.mark {
  position: relative;
  overflow: hidden;
  width: 46px;
  height: 46px;
  border-color: rgba(255, 255, 255, 0.78);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.62), transparent 42%),
    conic-gradient(from 220deg, var(--cyber-cyan), var(--cyber-mint), var(--cyber-gold), var(--cyber-violet), var(--cyber-cyan));
  box-shadow:
    0 14px 34px rgba(34, 211, 238, 0.28),
    inset 0 0 0 1px rgba(255, 255, 255, 0.52);
}

.mark::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 6px;
  background:
    linear-gradient(90deg, transparent 44%, rgba(255, 255, 255, 0.72) 45% 55%, transparent 56%),
    linear-gradient(0deg, transparent 44%, rgba(255, 255, 255, 0.72) 45% 55%, transparent 56%);
}

.mark::after {
  content: "AI";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #063245;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0;
}

h1 {
  color: #071f34;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

h2 {
  color: #092238;
}

h3 {
  color: #122a42;
}

.muted {
  color: var(--muted);
}

.pill {
  position: relative;
  border-color: rgba(34, 211, 238, 0.46);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(234, 251, 255, 0.86));
  color: #066f86;
  box-shadow:
    0 10px 28px rgba(34, 211, 238, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--cyber-mint);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.16), 0 0 18px rgba(52, 211, 153, 0.68);
}

.panel,
.hero-main,
.stat,
.aspect-card,
.factor-row,
.tablewrap,
.qrwrap {
  border-color: rgba(31, 181, 205, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 253, 255, 0.9));
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.panel,
.hero-main,
.stat,
.aspect-card,
.factor-row {
  position: relative;
  overflow: hidden;
}

.panel::before,
.hero-main::before,
.stat::before,
.aspect-card::before,
.factor-row::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cyber-cyan), var(--cyber-mint), var(--cyber-gold));
  opacity: 0.92;
}

.hero-main {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(239, 252, 255, 0.9)),
    linear-gradient(135deg, rgba(34, 211, 238, 0.18), transparent 40%, rgba(247, 201, 72, 0.12)),
    repeating-linear-gradient(90deg, rgba(5, 138, 163, 0.06) 0 1px, transparent 1px 44px);
}

.hero-main::after {
  content: "";
  position: absolute;
  top: 22px;
  right: 18px;
  width: 86px;
  height: 86px;
  border-top: 2px solid rgba(34, 211, 238, 0.45);
  border-right: 2px solid rgba(163, 230, 53, 0.48);
  border-radius: 8px;
  opacity: 0.7;
}

.hero h2 {
  color: #061d31;
  text-shadow: 0 8px 28px rgba(34, 211, 238, 0.18);
}

.button,
button {
  border: 1px solid rgba(255, 255, 255, 0.62);
  background:
    linear-gradient(135deg, #047f99 0%, #10a7a6 48%, #20b26b 100%);
  box-shadow:
    0 14px 30px rgba(5, 138, 163, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.button:hover,
button:hover {
  box-shadow:
    0 18px 38px rgba(5, 138, 163, 0.3),
    0 0 0 4px rgba(34, 211, 238, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.button.secondary,
button.secondary {
  border-color: rgba(34, 211, 238, 0.42);
  color: #066f86;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(232, 251, 255, 0.88));
  box-shadow: 0 10px 24px rgba(4, 92, 116, 0.11);
}

.button.warn,
button.warn {
  color: #563600;
  background: linear-gradient(135deg, #ffe8a3, #f7c948);
}

.button.danger,
button.danger {
  background: linear-gradient(135deg, #d73562, #cc4fdf);
}

.input,
textarea {
  border-color: rgba(5, 138, 163, 0.34);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.input:focus,
textarea:focus,
input[type="range"]:focus-visible {
  outline: 3px solid rgba(34, 211, 238, 0.22);
  outline-offset: 2px;
}

.qrwrap {
  background:
    linear-gradient(180deg, #ffffff, #f4fdff);
  box-shadow:
    0 22px 50px rgba(4, 92, 116, 0.14),
    0 0 0 8px rgba(34, 211, 238, 0.06);
}

.linkbox,
.weight-total,
.range-line output {
  border-color: rgba(34, 211, 238, 0.42);
  background:
    linear-gradient(180deg, rgba(239, 252, 255, 0.98), rgba(221, 251, 255, 0.86));
  color: #056f85;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.stat strong {
  color: #071f34;
}

.stat span {
  color: #4c667e;
}

.tablewrap {
  box-shadow: var(--shadow);
}

table,
tbody tr:nth-child(even) {
  background: transparent;
}

th {
  color: #045c74;
  background:
    linear-gradient(180deg, rgba(220, 251, 255, 0.98), rgba(236, 255, 249, 0.96));
}

td {
  border-bottom-color: rgba(5, 138, 163, 0.12);
}

tbody tr:hover {
  background: rgba(34, 211, 238, 0.055);
}

.code {
  border-color: rgba(34, 211, 238, 0.46);
  color: #046c84;
  background:
    linear-gradient(180deg, #ffffff, #ddfbff);
  box-shadow: 0 6px 14px rgba(34, 211, 238, 0.12);
}

.notice {
  border-left-color: var(--cyber-mint);
  background: linear-gradient(180deg, #ecfff7, #f7fffb);
}

.notice.warn {
  border-left-color: var(--cyber-gold);
  background: linear-gradient(180deg, #fff8df, #fffdf5);
}

.weight-section {
  border-color: rgba(34, 211, 238, 0.34);
  border-left: 5px solid var(--cyber-cyan);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(239, 252, 255, 0.82));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.62);
}

.weight-section:nth-of-type(2) {
  border-left-color: var(--cyber-lime);
}

.weight-total.warn {
  border-color: rgba(247, 201, 72, 0.72);
  background: linear-gradient(180deg, #fff7d8, #fffdf2);
  color: #6b4300;
}

.section-title {
  border-bottom-color: rgba(34, 211, 238, 0.2);
}

.section-title h3 {
  color: #045c74;
}

.aspect-card,
.factor-row {
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.aspect-card:hover,
.factor-row:hover {
  border-color: rgba(34, 211, 238, 0.58);
  box-shadow: var(--shadow-strong);
  transform: translateY(-1px);
}

.range-line {
  grid-template-columns: 112px minmax(170px, 1fr) 82px;
}

.range-line label {
  color: #183c57;
}

input[type="range"] {
  height: 48px;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 16px;
  border-color: rgba(255, 255, 255, 0.78);
  background:
    linear-gradient(90deg, rgba(52, 211, 153, 0.98) 0%, rgba(34, 211, 238, 0.98) 48%, rgba(109, 93, 252, 0.88) 74%, rgba(247, 201, 72, 0.98) 100%);
  box-shadow:
    inset 0 2px 4px rgba(6, 38, 56, 0.16),
    0 0 0 6px rgba(34, 211, 238, 0.08);
}

input[type="range"]::-webkit-slider-thumb {
  width: 34px;
  height: 34px;
  margin-top: -10px;
  border: 5px solid #ffffff;
  background:
    radial-gradient(circle, #ffffff 0 30%, var(--cyber-cyan) 31% 56%, #047f99 57%);
  box-shadow:
    0 8px 22px rgba(4, 92, 116, 0.28),
    0 0 0 4px rgba(255, 255, 255, 0.68);
}

input[type="range"]::-moz-range-track {
  height: 16px;
  border-color: rgba(255, 255, 255, 0.78);
  background:
    linear-gradient(90deg, rgba(52, 211, 153, 0.98) 0%, rgba(34, 211, 238, 0.98) 48%, rgba(109, 93, 252, 0.88) 74%, rgba(247, 201, 72, 0.98) 100%);
  box-shadow:
    inset 0 2px 4px rgba(6, 38, 56, 0.16),
    0 0 0 6px rgba(34, 211, 238, 0.08);
}

input[type="range"]::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border: 5px solid #ffffff;
  background:
    radial-gradient(circle, #ffffff 0 30%, var(--cyber-cyan) 31% 56%, #047f99 57%);
  box-shadow:
    0 8px 22px rgba(4, 92, 116, 0.28),
    0 0 0 4px rgba(255, 255, 255, 0.68);
}

.sticky-submit,
.final-submit {
  border-color: rgba(34, 211, 238, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(236, 255, 249, 0.92));
  box-shadow:
    0 20px 54px rgba(4, 92, 116, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.final-submit strong {
  color: #071f34;
}

.toast {
  border-color: rgba(34, 211, 238, 0.46);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(235, 252, 255, 0.96));
  box-shadow:
    0 22px 60px rgba(4, 92, 116, 0.2),
    0 0 0 6px rgba(34, 211, 238, 0.08);
}

.footer {
  color: #60758a;
}

@media (prefers-reduced-motion: no-preference) {
  .mark {
    animation: aiMarkShift 8s ease-in-out infinite;
  }

  @keyframes aiMarkShift {
    0%,
    100% {
      filter: hue-rotate(0deg) saturate(1);
    }

    50% {
      filter: hue-rotate(18deg) saturate(1.08);
    }
  }
}

@media (max-width: 860px) {
  .topbar::after {
    bottom: 4px;
  }

  .mark {
    width: 42px;
    height: 42px;
  }

  .hero-main::after {
    width: 58px;
    height: 58px;
    opacity: 0.44;
  }

  .range-line {
    grid-template-columns: 1fr;
  }

  .range-line output {
    width: 100%;
  }

  .final-submit button,
  .sticky-submit button {
    width: 100%;
  }
}

/* Layout fix for vote weight cards */
.grid > * {
  min-width: 0;
}

.weight-section .grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.weight-section .aspect-card {
  min-height: 124px;
}

.aspect-card h3,
.factor-row h3 {
  min-width: 0;
  overflow-wrap: anywhere;
}

.weight-section .range-line {
  grid-template-columns: 76px minmax(0, 1fr) 82px;
  gap: 10px;
}

.range-line input[type="range"] {
  min-width: 0;
}

.range-line output {
  width: 100%;
  min-width: 0;
  max-width: 82px;
  justify-self: end;
}

@media (max-width: 920px) {
  .weight-section .range-line {
    grid-template-columns: 1fr 82px;
  }

  .weight-section .range-line label {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .weight-section .grid.two {
    grid-template-columns: 1fr;
  }
}
