:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #637083;
  --soft: #8d98a8;
  --line: #d8e0ea;
  --page: #edf2f8;
  --panel: #ffffff;
  --panel-alt: #f7f9fc;
  --brand: #f97316;
  --brand-deep: #ea580c;
  --teal: #14b8a6;
  --blue: #2563eb;
  --danger: #dc2626;
  --shadow: 0 24px 70px rgba(24, 33, 47, 0.12);
  --shadow-soft: 0 10px 30px rgba(24, 33, 47, 0.08);
  --button-font: "Segoe UI Variable", "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f4f7fb;
  --muted: #a8b3c4;
  --soft: #7f8da3;
  --line: #2b3647;
  --page: #080d14;
  --panel: #111827;
  --panel-alt: #0c1320;
  --brand: #fb923c;
  --brand-deep: #fdba74;
  --teal: #2dd4bf;
  --blue: #60a5fa;
  --danger: #f87171;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(249, 115, 22, 0.18), transparent 24%),
    radial-gradient(circle at top right, rgba(20, 184, 166, 0.16), transparent 26%),
    linear-gradient(180deg, #eef4fb 0%, #edf2f8 100%);
  color: var(--ink);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at top left, rgba(251, 146, 60, 0.2), transparent 25%),
    radial-gradient(circle at top right, rgba(45, 212, 191, 0.12), transparent 28%),
    linear-gradient(180deg, #070b12 0%, #0b111c 100%);
}

button,
input,
select {
  font: inherit;
}

input,
textarea,
.question-title {
  -webkit-user-select: text;
  user-select: text;
}

button {
  border: 0;
  cursor: pointer;
  font-family: var(--button-font);
  letter-spacing: 0;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

button:active {
  transform: translateY(1px) scale(0.99);
}

button:disabled {
  cursor: default;
  opacity: 0.5;
}

.app {
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.86)),
    var(--page);
  box-shadow: var(--shadow);
}

:root[data-theme="dark"] .app {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.94), rgba(10, 16, 27, 0.96));
}

.screen {
  min-height: 100vh;
  padding: 18px 16px 98px;
  animation: screenIn 260ms ease both;
}

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

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.brand-copy {
  display: grid;
  gap: 8px;
}

.eyebrow {
  width: max-content;
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(249, 115, 22, 0.12);
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 8px;
  background: white;
  padding: 4px;
  box-shadow: var(--shadow-soft);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  box-shadow: var(--shadow-soft);
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-strip {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 32px;
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(24, 33, 47, 0.92);
  color: white;
  font-size: 12px;
  font-weight: 900;
}

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

h1 {
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 21px;
  line-height: 1.1;
}

h3 {
  font-size: 15px;
  line-height: 1.2;
}

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

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

.hero,
.panel,
.question,
.result-row,
.stats {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.hero,
.panel,
.question,
.result-row,
.month-group {
  animation: slideIn 260ms ease both;
}

.hero {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  padding: 18px;
  background:
    linear-gradient(140deg, rgba(249, 115, 22, 0.11), transparent 34%),
    linear-gradient(225deg, rgba(37, 99, 235, 0.08), transparent 38%),
    var(--panel);
  box-shadow: var(--shadow-soft);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.72);
  pointer-events: none;
}

:root[data-theme="dark"] .hero {
  background:
    linear-gradient(140deg, rgba(251, 146, 60, 0.15), transparent 34%),
    linear-gradient(225deg, rgba(45, 212, 191, 0.1), transparent 38%),
    var(--panel);
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hero-text {
  display: grid;
  gap: 8px;
}

.hero-text p {
  max-width: 32ch;
  line-height: 1.4;
}

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

.stats {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  min-height: 68px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
  text-align: center;
}

:root[data-theme="dark"] .stats {
  background: rgba(255, 255, 255, 0.04);
}

.stats strong {
  font-size: 21px;
  line-height: 1;
}

.stats span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
}

.panel {
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 12px;
}

.section-head:first-of-type {
  margin-top: 0;
}

.stack {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.field-help {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  background: white;
  color: var(--ink);
  outline: none;
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select {
  background: #0b1220;
}

input:focus,
select:focus {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.search-field {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.search-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

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

.mini-field {
  display: grid;
  gap: 6px;
}

.mini-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.weight-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.weight-options label {
  position: relative;
}

.weight-options input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.weight-options span {
  display: grid;
  place-items: center;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
}

:root[data-theme="dark"] .weight-options span {
  background: #0b1220;
}

.weight-options input:checked + span {
  border-color: rgba(249, 115, 22, 0.55);
  background: rgba(249, 115, 22, 0.13);
  color: var(--brand-deep);
}

.button {
  min-height: 48px;
  border-radius: 8px;
  padding: 0 14px;
  background: linear-gradient(180deg, #202b3b, #111827);
  color: white;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  box-shadow: 0 12px 24px rgba(17, 24, 39, 0.18);
}

.button.secondary {
  background: linear-gradient(180deg, var(--panel), var(--panel-alt));
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.button.ghost {
  min-height: 40px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  border: 1px solid rgba(216, 224, 234, 0.9);
}

.button-row {
  display: grid;
  gap: 10px;
}

.install-card {
  margin-top: 14px;
}

.install-steps {
  display: grid;
  gap: 8px;
}

.install-steps span {
  min-height: 38px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--panel-alt);
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wrap {
  flex-wrap: wrap;
}

.tabs {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(100%, 460px);
  margin: 0 auto;
  padding: 7px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 -18px 45px rgba(24, 33, 47, 0.08);
  backdrop-filter: blur(16px);
}

:root[data-theme="dark"] .tabs {
  background: rgba(8, 13, 20, 0.95);
}

.tab {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  min-height: 56px;
  border-radius: 8px;
  background: transparent;
  color: var(--soft);
  font-size: 11px;
  font-weight: 900;
}

.tab span {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 999px;
  background: rgba(141, 152, 168, 0.14);
  line-height: 1;
}

.tab svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab.active {
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.18), rgba(249, 115, 22, 0.1));
  color: var(--brand-deep);
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.12);
}

.tab.active span {
  background: rgba(249, 115, 22, 0.2);
}

.question {
  display: grid;
  gap: 12px;
  padding: 15px;
  box-shadow: var(--shadow-soft);
}

.question-head {
  display: grid;
  gap: 8px;
}

.question-title {
  font-size: 19px;
  font-weight: 900;
  line-height: 1.22;
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  max-height: 4.2em;
}

.question-title.expanded {
  display: block;
  max-height: none;
  -webkit-line-clamp: unset;
}

.text-toggle {
  width: fit-content;
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(148, 163, 184, 0.14);
  color: var(--brand-deep);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.text-toggle:active {
  transform: translateY(1px);
}

.question-subline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.question-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef3f8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pill.hot {
  background: rgba(249, 115, 22, 0.12);
  color: var(--brand-deep);
}

.pill.cool {
  background: rgba(20, 184, 166, 0.12);
  color: #0f766e;
}

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

.person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
  font-weight: 850;
}

:root[data-theme="dark"] .person {
  background: #0b1220;
}

:root[data-theme="dark"] .person.selected {
  background:
    linear-gradient(180deg, rgba(45, 212, 191, 0.18), rgba(45, 212, 191, 0.1)),
    #0b1220;
}

.person::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #d7dee8;
  flex: 0 0 auto;
}

.person.selected {
  border-color: rgba(20, 184, 166, 0.46);
  background:
    linear-gradient(180deg, rgba(20, 184, 166, 0.16), rgba(20, 184, 166, 0.1)),
    white;
}

.person.selected::after {
  background: var(--teal);
}

.result-row {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--panel-alt);
}

.ranking-row {
  border-color: rgba(249, 115, 22, 0.22);
}

.month-group {
  display: grid;
  gap: 10px;
}

.month-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: white;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

:root[data-theme="dark"] .month-button {
  background: var(--panel);
}

:root[data-theme="dark"] .button {
  background: linear-gradient(180deg, #f4f7fb, #dbe5f2);
  color: #0b1220;
}

:root[data-theme="dark"] .button.secondary {
  background: linear-gradient(180deg, #151f2e, #0c1320);
  color: var(--ink);
}

:root[data-theme="dark"] .pill {
  background: rgba(255, 255, 255, 0.07);
}

:root[data-theme="dark"] .logo {
  background: rgba(255, 255, 255, 0.9);
}

.month-button span {
  font-weight: 900;
}

.month-button strong {
  display: grid;
  place-items: center;
  min-width: 30px;
  min-height: 30px;
  border-radius: 999px;
  background: rgba(249, 115, 22, 0.12);
  color: var(--brand-deep);
}

.month-content {
  display: grid;
  gap: 12px;
}

.archive-ranking {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(249, 115, 22, 0.22);
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(140deg, rgba(249, 115, 22, 0.12), transparent 44%),
    var(--panel-alt);
}

.bar {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: #e5ebf2;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #fb923c);
}

.empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 108px;
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
}

.notice {
  border-left: 4px solid var(--teal);
  padding: 11px 12px;
  border-radius: 8px;
  background: rgba(20, 184, 166, 0.12);
  color: #0f766e;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 700;
}

.danger-text {
  border-left-color: var(--danger);
  background: rgba(220, 38, 38, 0.1);
  color: #991b1b;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes screenIn {
  from {
    opacity: 0.92;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 360px) {
  .stats-grid,
  .people-grid,
  .duration-grid,
  .weight-options {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 28px;
  }
}
