:root {
  color-scheme: dark;
  --bg: #071018;
  --panel: rgba(10, 22, 31, .82);
  --panel-solid: #0c1a24;
  --line: rgba(123, 224, 255, .2);
  --line-strong: rgba(29, 233, 255, .55);
  --text: #dffcff;
  --muted: #89b5c2;
  --cyan: #1de9ff;
  --cyan-soft: rgba(29, 233, 255, .16);
  --amber: #ffbf4d;
  --danger: #ff5c86;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  overscroll-behavior: none;
  background: radial-gradient(circle at top, #10202d, #071018 60%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body {
  overflow-x: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.noscript {
  padding: 12px 16px;
  background: #5b1630;
  color: #fff;
  text-align: center;
}

.start-screen {
  position: relative;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  align-items: center;
  gap: 34px;
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 28px 0 72px;
}

.start-hero {
  min-width: 0;
}

.start-hero h1 {
  font-size: clamp(2.8rem, 12vw, 7.4rem);
  color: var(--text);
  text-shadow: 0 0 28px rgba(29, 233, 255, .2);
}

.brand-subtitle {
  margin: 0 0 10px;
  color: rgba(223, 252, 255, .86);
  font-size: clamp(1rem, 3.4vw, 1.42rem);
  font-weight: 850;
}

.start-hero .lead {
  max-width: 720px;
  color: var(--muted);
  font-size: clamp(1rem, 3vw, 1.25rem);
  line-height: 1.8;
}

.start-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.mode-help {
  max-width: 560px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(29, 233, 255, .24);
  border-radius: 8px;
  background: rgba(7, 16, 24, .46);
}

.mode-help span {
  display: block;
  color: var(--cyan);
  font-weight: 900;
}

.mode-help p {
  margin: 5px 0 0;
  color: rgba(223, 252, 255, .72);
  line-height: 1.7;
}

.start-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}

.start-note {
  max-width: 360px;
  margin: 0;
  color: rgba(223, 252, 255, .62);
  font-size: .92rem;
  line-height: 1.7;
}

.quick-summary {
  max-width: 620px;
  margin: 18px 0 0;
  padding: 14px 16px;
  border-left: 3px solid var(--cyan);
  background: rgba(29, 233, 255, .08);
  color: rgba(223, 252, 255, .88);
  font-size: clamp(1rem, 2.8vw, 1.22rem);
  font-weight: 850;
  line-height: 1.8;
}

.fullscreen-recommend {
  display: none;
  max-width: 620px;
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 191, 77, .38);
  border-radius: 8px;
  background: rgba(255, 191, 77, .1);
  color: #fff1c8;
  font-weight: 850;
  line-height: 1.65;
}

#startBtn {
  min-height: 56px;
  padding: 0 22px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(29, 233, 255, .32), rgba(29, 233, 255, .08));
  color: var(--text);
  font-weight: 950;
  box-shadow: 0 0 38px rgba(29, 233, 255, .14);
}

.start-actions a {
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
}

.start-ad {
  align-self: center;
}

.start-ad .ad-box {
  min-height: 260px;
}

.more-link {
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  color: rgba(223, 252, 255, .68);
  font-size: .9rem;
  font-weight: 800;
  text-decoration: none;
}

.more-link::after {
  content: "";
  display: block;
  width: 9px;
  height: 9px;
  margin: 6px auto 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: .72;
}

#app {
  width: 100%;
  height: 100dvh;
  min-height: 560px;
  position: relative;
  overflow: hidden;
}

.topbar {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 12px max(14px, env(safe-area-inset-left));
  border-bottom: 0;
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}

.brand {
  min-width: 0;
}

.series-label {
  margin: 0 0 4px;
  color: rgba(223, 252, 255, .44);
  font-size: .72rem;
  font-weight: 900;
}

.test-title {
  margin: 0 0 2px;
  color: rgba(223, 252, 255, .34);
  font-size: clamp(1.25rem, 4vw, 2.3rem);
  font-weight: 900;
  line-height: 1.05;
  text-shadow: 0 0 14px rgba(29, 233, 255, .14);
}

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

h1 {
  margin-bottom: 4px;
  font-size: clamp(1.65rem, 7vw, 3.8rem);
  line-height: 1;
  color: rgba(223, 252, 255, .55);
  text-shadow: 0 0 18px rgba(29, 233, 255, .18);
}

.lead {
  margin-bottom: 0;
  color: rgba(223, 252, 255, .42);
  font-size: clamp(.82rem, 2.6vw, 1rem);
}

.diagnostic-mode {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin: 8px 0 0;
  padding: 0 9px;
  border: 1px solid rgba(29, 233, 255, .26);
  border-radius: 8px;
  background: rgba(29, 233, 255, .08);
  color: rgba(29, 233, 255, .74);
  font-size: .72rem;
  font-weight: 950;
  letter-spacing: 0;
  text-shadow: 0 0 14px rgba(29, 233, 255, .22);
}

.topbar-actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  pointer-events: auto;
}

#exitBtn,
#fullscreenBtn,
#saveBtn,
#resetBtn,
.mode-btn {
  min-height: 40px;
  border: 1px solid rgba(223, 252, 255, .18);
  border-radius: 8px;
  background: rgba(7, 16, 24, .22);
  color: rgba(223, 252, 255, .58);
  font-size: .82rem;
  font-weight: 900;
}

#fullscreenBtn,
#exitBtn,
#saveBtn,
.mode-btn {
  padding: 0 12px;
}

#exitBtn {
  border-color: rgba(255, 92, 134, .72);
  background: rgba(255, 92, 134, .28);
  color: rgba(255, 238, 242, .92);
  box-shadow: 0 0 22px rgba(255, 92, 134, .22);
}

#exitBtn:focus-visible,
#exitBtn:hover {
  background: rgba(255, 92, 134, .42);
}

#resetBtn {
  pointer-events: auto;
  align-self: stretch;
  padding: 0 18px;
  border-color: rgba(255, 92, 134, .2);
  background: rgba(7, 16, 24, .18);
  color: rgba(255, 216, 226, .58);
}

.main {
  position: absolute;
  inset: 0;
}

.test-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  background:
    radial-gradient(circle at center, rgba(29, 233, 255, .12), transparent 28%),
    radial-gradient(circle at 12% 20%, rgba(255, 191, 77, .12), transparent 24%),
    radial-gradient(circle at center, #0c1a24, #071018);
}

canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#scanEffect {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, .035) 0,
      rgba(255, 255, 255, .035) 1px,
      transparent 2px,
      transparent 5px
    );
  mix-blend-mode: screen;
  opacity: .34;
}

.test-guide {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(86vw, 520px);
  transform: translate(-50%, -50%);
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(7, 16, 24, .76);
  color: #f0feff;
  line-height: 1.75;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 0 36px rgba(29, 233, 255, .12);
  transition: opacity .2s ease;
}

.test-guide.is-muted {
  opacity: 0;
}

.touch-hints {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.touch-hint,
.target-dot {
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.touch-hint {
  border: 2px solid var(--amber);
  box-shadow: 0 0 0 8px rgba(255, 191, 77, .14), 0 0 28px rgba(255, 191, 77, .35);
}

.target-dot {
  border: 3px solid #fff;
  background: var(--danger);
  box-shadow: 0 0 0 12px rgba(255, 92, 134, .18), 0 0 34px rgba(255, 92, 134, .48);
}

.hit-burst {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(.95);
  padding: 12px 16px;
  border: 1px solid rgba(255, 191, 77, .72);
  border-radius: 8px;
  background: rgba(255, 191, 77, .16);
  color: #fff4d5;
  font-weight: 950;
  letter-spacing: 0;
  box-shadow: 0 0 34px rgba(255, 191, 77, .26);
  pointer-events: none;
  animation: hit-burst .62s ease both;
}

.time-badge {
  position: absolute;
  z-index: 4;
  right: max(14px, env(safe-area-inset-right));
  top: 116px;
  padding: 8px 10px;
  border: 1px solid rgba(29, 233, 255, .4);
  border-radius: 8px;
  background: rgba(7, 16, 24, .34);
  color: rgba(223, 252, 255, .78);
  font-size: .82rem;
  font-weight: 900;
  pointer-events: none;
}

@keyframes hit-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.82);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.06);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -78%) scale(1);
  }
}

.bottom-ui {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 8px;
  padding: 10px max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  border-top: 0;
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}

.score-card,
.analysis-card,
.ad-box,
.info-section article,
.comments-section,
.lab-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.score-card {
  min-width: 0;
  padding: 2px 4px;
  border: 0;
  background: transparent;
}

.score-card span,
.analysis-card span {
  display: block;
  margin-bottom: 2px;
  color: rgba(223, 252, 255, .32);
  font-size: .62rem;
  font-weight: 800;
}

.score-card strong,
.analysis-card strong {
  display: block;
  color: rgba(223, 252, 255, .58);
  font-size: 1.05rem;
  line-height: 1.1;
}

.score-card:first-child strong {
  color: rgba(29, 233, 255, .68);
}

.score-card-strong strong,
.analysis-card-strong strong {
  color: var(--cyan);
  font-size: 1.34rem;
  text-shadow: 0 0 18px rgba(29, 233, 255, .22);
}

.lab-panel,
.ad-row,
.info-section,
.comments-section {
  width: min(1120px, calc(100% - 24px));
  margin: 14px auto 0;
}

.lab-panel {
  padding: 12px;
}

.mode-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.mode-btn.active {
  background: rgba(29, 233, 255, .26);
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.analysis-card {
  padding: 12px;
}

.analysis-card-strong {
  border-color: rgba(29, 233, 255, .38);
  background: rgba(29, 233, 255, .08);
}

.progress-track {
  height: 9px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(137, 181, 194, .16);
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--amber));
  transition: width .15s ease;
}

.log-list {
  display: grid;
  gap: 6px;
  max-height: 120px;
  margin: 10px 0 0;
  padding-left: 20px;
  overflow: auto;
  color: var(--muted);
  font-size: .86rem;
}

.ad-box {
  min-height: 180px;
  padding: 10px;
}

.ad-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: .68rem;
  text-align: center;
}

body.is-testing {
  overflow: hidden;
}

body.is-testing .topbar {
  opacity: .62;
}

body.is-testing .topbar h1 {
  font-size: clamp(1.15rem, 4vw, 2.15rem);
  color: rgba(223, 252, 255, .34);
  text-shadow: 0 0 14px rgba(29, 233, 255, .14);
}

body.is-testing .topbar .test-title {
  color: rgba(223, 252, 255, .34);
}

body.is-testing .topbar .series-label,
body.is-testing .topbar .lead {
  color: rgba(223, 252, 255, .26);
}

body.is-testing .topbar .diagnostic-mode {
  border-color: rgba(29, 233, 255, .24);
  color: rgba(29, 233, 255, .62);
}

body.is-testing .bottom-ui {
  opacity: .68;
}

body.is-testing .start-screen,
body.is-testing .lab-panel,
body.is-testing .ad-row,
body.is-testing .info-section,
body.is-testing .comments-section {
  display: none;
}

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

.info-section article,
.comments-section {
  padding: 16px;
}

.result-card {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 16, 24, .62);
}

.result-card span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 900;
}

.result-card strong {
  display: block;
  color: var(--cyan);
  font-size: 1.08rem;
}

.result-card p {
  margin: 6px 0 0;
  color: rgba(223, 252, 255, .72);
  line-height: 1.75;
}

.comments-section #app-comments,
.comments-section .app-comments,
.comments-section .app-comment-form-section,
.comments-section .app-comment-form,
.comments-section .app-comment-item,
.comments-section .app-comment-reply,
.comments-section .app-comments-empty {
  border-color: var(--line);
  background: transparent;
  color: var(--text);
}

.comments-section .app-comments {
  padding: 0;
}

.comments-section .app-comments h2,
.comments-section .app-comment-form-section h3,
.comments-section .app-comment-author,
.comments-section .app-comment-body,
.comments-section label {
  color: var(--text);
}

.comments-section .app-comment-meta,
.comments-section .app-comments-empty,
.comments-section .app-comment-note {
  color: var(--muted);
}

.comments-section input,
.comments-section textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 16, 24, .84);
  color: var(--text);
}

.comments-section input::placeholder,
.comments-section textarea::placeholder {
  color: rgba(223, 252, 255, .38);
}

.comments-section button,
.comments-section .app-comment-submit {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(29, 233, 255, .16);
  color: var(--text);
  font-weight: 800;
}

.info-section h2 {
  margin-bottom: 10px;
  font-size: 1.08rem;
}

.info-section p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.85;
}

.tool-links {
  display: grid;
  gap: 8px;
}

.tool-links a {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 16, 24, .74);
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
}

@media (max-width: 760px) {
  .fullscreen-recommend {
    display: block;
  }

  .start-screen {
    grid-template-columns: 1fr;
    align-content: start;
    padding-top: max(18px, env(safe-area-inset-top));
  }

  .start-ad .ad-box {
    min-height: 220px;
  }

  #app {
    min-height: 100dvh;
  }

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

  .topbar-actions {
    flex-direction: column;
  }

  #fullscreenBtn,
  #exitBtn,
  #saveBtn {
    width: 44px;
    min-height: 36px;
    overflow: hidden;
    padding: 0;
    font-size: 0;
  }

  #fullscreenBtn::before {
    content: "⛶";
    font-size: 1.15rem;
  }

  #exitBtn::before {
    content: "←";
    font-size: 1.15rem;
  }

  #saveBtn::before {
    content: "↓";
    font-size: 1.15rem;
  }

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

  #resetBtn {
    grid-column: 1 / -1;
  }

  .analysis-grid,
  .info-section {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .score-card {
    padding: 7px 8px;
  }

  .score-card strong {
    font-size: 1.06rem;
  }
}
