:root {
  color-scheme: light;
  --ink: #101217;
  --muted: #687080;
  --line: #dfe4ea;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: #ffffff;
  --surface: #f5f7fb;
  --cyan: #00a9c8;
  --green: #2fb875;
  --yellow: #efb84f;
  --coral: #f16d59;
  --red: #d83a52;
  --indigo: #4558ff;
  --shadow: 0 24px 70px rgba(26, 34, 49, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(245, 247, 251, 0.92)),
    radial-gradient(circle at 88% 8%, rgba(0, 169, 200, 0.16), transparent 32%),
    radial-gradient(circle at 12% 28%, rgba(239, 184, 79, 0.18), transparent 26%),
    #f5f7fb;
  letter-spacing: 0;
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  border-bottom: 1px solid rgba(16, 18, 23, 0.08);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(16, 18, 23, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(0, 169, 200, 0.96), rgba(47, 184, 117, 0.88)),
    #00a9c8;
  box-shadow: 0 10px 22px rgba(0, 169, 200, 0.24);
}

.topnav {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(16, 18, 23, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.topnav a {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.topnav a:hover {
  color: var(--ink);
  background: rgba(16, 18, 23, 0.06);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(380px, 1.1fr);
  gap: 42px;
  align-items: center;
  min-height: calc(100vh - 76px);
  padding: 50px 0 28px;
}

.hero-copy {
  max-width: 600px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--cyan);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 20px;
  font-size: clamp(4.4rem, 7vw, 7.8rem);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
  letter-spacing: 0;
}

.vote-panel h2,
.dashboard h2,
.history-section h2 {
  font-size: clamp(1.65rem, 3vw, 2.65rem);
  line-height: 1.04;
}

h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.lede {
  max-width: 560px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.6;
}

.visual-panel {
  position: relative;
  min-height: 470px;
  overflow: hidden;
  border: 1px solid rgba(16, 18, 23, 0.08);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.52)),
    repeating-linear-gradient(
      90deg,
      rgba(16, 18, 23, 0.04) 0 1px,
      transparent 1px 92px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(16, 18, 23, 0.04) 0 1px,
      transparent 1px 92px
    );
  box-shadow: var(--shadow);
}

.visual-panel canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.visual-readout {
  position: absolute;
  right: 24px;
  bottom: 24px;
  display: grid;
  gap: 6px;
  min-width: 180px;
  padding: 18px;
  border: 1px solid rgba(16, 18, 23, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 18px 48px rgba(26, 34, 49, 0.1);
}

.visual-readout span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.visual-readout strong {
  font-size: 2.3rem;
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: stretch;
  padding: 26px 0 18px;
}

.vote-panel,
.today-panel,
.dashboard,
.history-section {
  border: 1px solid rgba(16, 18, 23, 0.08);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(26, 34, 49, 0.08);
}

.vote-panel {
  padding: 28px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.rating-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(88px, 1fr));
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.rating-option {
  position: relative;
  min-width: 0;
}

.rating-option input {
  position: absolute;
  opacity: 0;
}

.rating-option span {
  display: grid;
  min-height: 118px;
  align-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid rgba(16, 18, 23, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  font-size: clamp(0.8rem, 1vw, 0.95rem);
  font-weight: 800;
  line-height: 1.12;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.rating-option span::before {
  content: "";
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--rating-color);
}

.rating-option input:checked + span,
.rating-option:focus-within span {
  border-color: color-mix(in srgb, var(--rating-color) 72%, #101217);
  background: color-mix(in srgb, var(--rating-color) 14%, #ffffff);
  box-shadow: 0 16px 36px color-mix(in srgb, var(--rating-color) 22%, transparent);
  transform: translateY(-3px);
}

.rating-option:hover span {
  transform: translateY(-2px);
}

.form-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-top: 20px;
}

.detected-country,
.compare-field {
  display: grid;
  gap: 8px;
  min-width: min(100%, 260px);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detected-country strong {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  padding: 0 14px;
  border: 1px solid rgba(16, 18, 23, 0.12);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 0.95rem;
  text-transform: none;
}

select {
  width: 100%;
  min-height: 48px;
  padding: 0 42px 0 14px;
  border: 1px solid rgba(16, 18, 23, 0.12);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(0, 169, 200, 0.16);
}

.primary-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 20px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #101217;
  font-weight: 800;
  box-shadow: 0 16px 34px rgba(16, 18, 23, 0.22);
}

.primary-button:hover {
  background: #242936;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.54;
}

.button-icon {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  color: #101217;
  background: #fff;
  font-weight: 900;
  line-height: 1;
}

.form-note {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.today-panel {
  display: grid;
  align-content: space-between;
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(16, 18, 23, 0.96), rgba(16, 18, 23, 0.88)),
    #101217;
  color: #fff;
}

.today-panel .eyebrow {
  color: #82e6d3;
}

.today-score {
  margin: 16px 0;
  font-size: clamp(2.4rem, 4vw, 4.2rem);
  font-weight: 900;
  line-height: 0.95;
}

.today-panel p:last-child {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.5;
}

.dashboard,
.history-section {
  margin: 20px 0;
  padding: 28px;
}

.dashboard-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  display: grid;
  gap: 10px;
  min-height: 116px;
  padding: 18px;
  border: 1px solid rgba(16, 18, 23, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.metric span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.metric strong {
  align-self: end;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.94;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.data-grid.lower {
  margin-top: 18px;
}

.chart-panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid rgba(16, 18, 23, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
  margin-bottom: 16px;
}

.panel-head span {
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 800;
  text-align: right;
}

.bar-list,
.country-list,
.latest-list,
.history-list {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.72fr) minmax(120px, 1fr) 48px;
  gap: 12px;
  align-items: center;
}

.bar-label {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  font-weight: 800;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(16, 18, 23, 0.08);
}

.bar-fill {
  width: var(--bar-width);
  height: 100%;
  border-radius: inherit;
  background: var(--rating-color);
  transition: width 240ms ease;
}

.bar-count {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-align: right;
}

.country-row,
.latest-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(16, 18, 23, 0.08);
}

.country-row:last-child,
.latest-row:last-child {
  border-bottom: 0;
}

.row-title {
  min-width: 0;
  color: var(--ink);
  font-weight: 850;
  overflow-wrap: anywhere;
}

.row-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 650;
}

.pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--ink);
  background: color-mix(in srgb, var(--rating-color) 18%, #ffffff);
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.empty-state {
  min-height: 96px;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px dashed rgba(16, 18, 23, 0.18);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 750;
  text-align: center;
}

.history-section {
  margin-bottom: 72px;
}

.history-list {
  grid-template-columns: 1fr;
  gap: 16px;
}

.history-chart-card,
.history-table {
  border: 1px solid rgba(16, 18, 23, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.history-chart-card {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.history-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.history-stat {
  display: grid;
  gap: 8px;
  min-height: 88px;
  padding: 14px;
  border: 1px solid rgba(16, 18, 23, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.history-stat span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

.history-stat strong {
  align-self: end;
  min-width: 0;
  color: var(--ink);
  font-size: clamp(1.45rem, 3vw, 2.25rem);
  line-height: 1;
  overflow-wrap: anywhere;
}

.history-chart-wrap {
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}

.history-svg {
  display: block;
  width: 100%;
  min-width: 620px;
  height: auto;
}

.history-grid-line {
  stroke: rgba(16, 18, 23, 0.08);
  stroke-width: 1;
}

.history-axis-label,
.history-date-label {
  fill: var(--muted);
  font-weight: 800;
}

.history-axis-label {
  font-size: 10px;
  text-anchor: end;
}

.history-date-label {
  font-size: 12px;
}

.history-date-label-end {
  text-anchor: end;
}

.history-line-shadow,
.history-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-line-shadow {
  stroke: rgba(16, 18, 23, 0.1);
  stroke-width: 11;
}

.history-line {
  stroke: var(--ink);
  stroke-width: 4;
}

.history-point {
  stroke: #fff;
  stroke-width: 4;
  filter: drop-shadow(0 8px 12px rgba(16, 18, 23, 0.16));
}

.history-point-group:focus {
  outline: none;
}

.history-point-group:focus .history-point {
  stroke: var(--ink);
}

.history-chart-caption {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.history-table {
  overflow: hidden;
}

.history-table-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.9fr) minmax(120px, 1fr) minmax(120px, 1fr) 76px;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(16, 18, 23, 0.08);
}

.history-table-row:last-child {
  border-bottom: 0;
}

.history-table-head {
  min-height: 42px;
  color: var(--muted);
  background: rgba(16, 18, 23, 0.035);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.history-mood-cell {
  color: var(--ink);
  font-weight: 850;
}

.history-country-cell,
.history-date-cell {
  min-width: 0;
  color: var(--muted);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.history-score-cell {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--ink);
  background: color-mix(in srgb, var(--rating-color) 18%, #ffffff);
  font-size: 0.82rem;
  font-weight: 850;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 980px) {
  .hero,
  .workspace,
  .data-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .visual-panel {
    min-height: 380px;
  }

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

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

@media (max-width: 720px) {
  .shell {
    width: min(100% - 22px, 1180px);
  }

  .topbar {
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
    padding: 14px 0;
  }

  .topnav {
    width: 100%;
    justify-content: space-between;
  }

  .topnav a {
    flex: 1;
    justify-content: center;
    padding-inline: 8px;
  }

  .hero {
    padding-top: 34px;
  }

  h1 {
    font-size: 3.7rem;
  }

  .visual-panel {
    min-height: 310px;
  }

  .visual-readout {
    right: 14px;
    bottom: 14px;
    min-width: 140px;
    padding: 14px;
  }

  .vote-panel,
  .today-panel,
  .dashboard,
  .history-section {
    padding: 20px;
  }

  .section-heading,
  .dashboard-head,
  .form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .rating-grid {
    grid-template-columns: 1fr;
  }

  .history-summary {
    grid-template-columns: 1fr;
  }

  .rating-option span {
    min-height: 72px;
  }

  .bar-row {
    grid-template-columns: minmax(86px, 0.7fr) minmax(90px, 1fr) 42px;
    gap: 8px;
  }

  .country-row,
  .latest-row,
  .history-table-row {
    grid-template-columns: 1fr;
  }

  .history-table-head {
    display: none;
  }

  .history-score-cell {
    justify-self: start;
    padding: 0 10px;
  }
}
