:root {
  --surface: #f8f9fa;
  --card: #ffffff;
  --primary: #00677e;
  --primary-hover: #005467;
  --text: #191c1e;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --active: #f1f4f9;
  --ok: #059669;
  --ok-deep: #047857;
  --ok-ink: #022c22;
  --ok-bg: #ecfdf5;
  --ok-border: #d1fae5;
  --ok-soft: #d1fae5;
  --warn: #b45309;
  --warn-ink: #78350f;
  --warn-text: #92400e;
  --warn-bg: #fef3c7;
  --warn-border: #fde68a;
  --teal-700: #0f766e;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--surface);
  color: var(--text);
  font-family: "Plus Jakarta Sans", Roboto, sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: #ccfbf1;
  color: #134e4a;
}

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.col {
  width: 100%;
  max-width: 36rem;
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2rem;
  padding-bottom: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--teal-700);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.brand-mark svg {
  width: 1rem;
  height: 1rem;
}

.brand-name {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--slate-500);
}

.counter {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--slate-400);
}

.main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.hero {
  width: 100%;
  text-align: center;
  margin-bottom: 2rem;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--slate-900);
  line-height: 1.1;
}

.sub {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 400;
  color: var(--slate-500);
}

.tip {
  margin: 0 auto 1.75rem;
  max-width: 28rem;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--slate-400);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 0.875rem 2rem;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}

.btn:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 8px rgba(15, 23, 42, 0.08);
}

.btn:active {
  transform: scale(0.95);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

.card {
  width: 100%;
  background: var(--card);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 1.5rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  padding: 0.5rem;
  overflow: hidden;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0.875rem 1rem;
  border-radius: 0.75rem;
  border-top: 1px solid var(--slate-100);
  transition: background-color 0.2s;
}

.row:first-child {
  border-top: 0;
}

.row.is-active {
  background: var(--active);
}

.row-copy {
  min-width: 0;
}

.row-title {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--slate-700);
  line-height: 1.35;
}

.row-title.is-active-title {
  color: var(--slate-900);
  font-weight: 600;
}

.row-title.is-done-title {
  color: var(--slate-800);
  font-weight: 500;
}

.extra-label {
  display: block;
  margin-bottom: 2px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warn);
}

.row-status {
  width: auto;
  min-width: 1.75rem;
  min-height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-shrink: 0;
}

.row-score {
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.row-score.is-pass {
  color: var(--ok-deep);
}

.row-score.is-great {
  color: var(--ok);
}

.row-score.is-fail {
  color: var(--warn);
}

.dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 999px;
  background: var(--slate-200);
}

.badge {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge svg {
  width: 1rem;
  height: 1rem;
}

.badge-ok {
  background: var(--ok-soft);
  color: var(--ok-deep);
}

.badge-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.stability-peek {
  border: 0;
  padding: 0.35rem;
  margin: -0.35rem;
  cursor: pointer;
  font: inherit;
}

.stability-pop {
  position: fixed;
  z-index: 40;
  min-width: 11.5rem;
  padding: 0.75rem 0.9rem;
  background: var(--card);
  border: 1px solid var(--slate-200);
  border-radius: 0.85rem;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
  color: var(--slate-800);
  font-size: 0.8125rem;
  line-height: 1.2;
}

.stability-pop[hidden] {
  display: none;
}

.stability-pop p {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin: 0;
}

.stability-pop p + p {
  margin-top: 0.5rem;
}

.stability-pop strong {
  margin-left: auto;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.median-symbol {
  display: inline-block;
  min-width: 0.7rem;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  color: var(--slate-700);
}

.spin {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--ok);
}

.banner {
  width: 100%;
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.banner.is-hidden,
.banner[hidden] {
  display: none;
}

.banner.ok {
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
}

.banner.warn,
.banner.bad {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
}

.banner-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.banner-ico {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.banner-ico svg {
  width: 1.25rem;
  height: 1.25rem;
}

.banner.ok .banner-ico {
  background: var(--ok);
}

.banner.warn .banner-ico,
.banner.bad .banner-ico {
  background: var(--warn);
}

.banner h2 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.banner p {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.4;
}

.banner.ok h2 {
  color: var(--ok-ink);
}

.banner.ok p {
  color: var(--ok-deep);
}

.banner.warn h2,
.banner.bad h2 {
  color: var(--warn-ink);
}

.banner.warn p,
.banner.bad p {
  color: var(--warn-text);
}

.banner-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}

.banner-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  white-space: nowrap;
}

.banner.ok .banner-link {
  color: #065f46;
}

.banner.ok .banner-link:hover {
  color: var(--ok-ink);
}

.banner.warn .banner-link,
.banner.bad .banner-link {
  color: var(--warn-ink);
}

.video-card {
  margin-top: 1rem;
  padding: 1rem 1.1rem 1.15rem;
}

.video-card h2 {
  margin: 0.35rem 0.4rem 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--slate-900);
}

.video-lead {
  margin: 0 0.4rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--slate-500);
}

.video-stage {
  position: relative;
  width: calc(100% - 0.4rem);
  margin: 0.85rem auto 0;
  aspect-ratio: 16 / 9;
  border-radius: 0.9rem;
  overflow: hidden;
  background: var(--slate-900);
}

.video-stage iframe,
#yt-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-confirm {
  margin-top: 0.85rem;
}

.video-confirm p {
  margin: 0 0.4rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate-800);
}

.video-confirm[hidden],
.video-result[hidden],
.video-fallback[hidden] {
  display: none;
}

.video-actions {
  display: flex;
  gap: 0.5rem;
}

.video-choice {
  flex: 1;
  border-radius: 999px;
  padding: 0.7rem 0.75rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.video-choice.yes {
  border: 0;
  background: var(--primary);
  color: #fff;
}

.video-choice.yes:hover {
  background: var(--primary-hover);
}

.video-choice.no {
  border: 1px solid var(--slate-200);
  background: #fff;
  color: var(--slate-700);
}

.video-result {
  margin: 0.85rem 0.4rem 0.15rem;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}

.video-result.ok {
  color: var(--ok-deep);
}

.video-result.bad {
  color: var(--warn);
}

.video-fallback {
  margin: 0.75rem 0.4rem 0;
  font-size: 0.8rem;
  color: var(--slate-500);
}

.video-fallback a {
  color: var(--primary);
  font-weight: 600;
}

.tech {
  width: 100%;
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  background: #fff;
  border: 1px solid #e1e3e8;
  color: var(--slate-500);
  font-size: 0.8rem;
}

.tech h2 {
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warn);
}

.tech ul {
  margin: 0;
  padding-left: 1.1rem;
}

.tech li + li {
  margin-top: 0.2rem;
}

.foot {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--slate-400);
}

.foot p {
  margin: 0.35rem 0 0;
  line-height: 1.45;
}

@keyframes m3Spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.m3-spinner {
  animation: m3Spin 0.9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes m3Pop {
  0% {
    transform: scale(0.65);
    opacity: 0;
  }
  70% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.m3-pop {
  animation: m3Pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@media (min-width: 640px) {
  .hero h1 {
    font-size: 3rem;
  }

  .sub {
    font-size: 1.125rem;
  }

  .card {
    padding: 0.75rem;
  }
}

@media (max-width: 520px) {
  .banner {
    align-items: stretch;
    flex-direction: column;
  }

  .banner-actions {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .m3-spinner,
  .m3-pop,
  .btn,
  .banner,
  .row,
  .stability-pop {
    animation: none;
    transition: none;
  }
}
