:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-alt: #eef6f3;
  --text: #172033;
  --muted: #5d6878;
  --border: #d9e0e8;
  --teal: #0f766e;
  --blue: #2563eb;
  --amber: #b45309;
  --red: #c2410c;
  --shadow: 0 16px 40px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), transparent 32rem),
    linear-gradient(315deg, rgba(37, 99, 235, 0.08), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.home-mode {
  background:
    linear-gradient(90deg, rgba(5, 10, 18, 0.78), rgba(5, 10, 18, 0.34) 45%, rgba(5, 10, 18, 0.7)),
    url("assets/home-wallpaper-web.jpg") center 38% / cover fixed no-repeat;
}

button,
[role="button"] {
  font: inherit;
}

button {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  min-height: 2.5rem;
  padding: 0 1rem;
}

button:hover {
  border-color: #aeb9c6;
}

button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 3px;
}

.primary {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

.topbar,
.workspace,
.category-view {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem 0 1.25rem;
}

.home-mode .topbar {
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.5);
}

.home-mode .eyebrow {
  color: #b8fff7;
}

.topbar h1,
.panel h2 {
  margin: 0;
  line-height: 1.08;
}

.topbar h1 {
  font-size: clamp(2rem, 4vw, 4rem);
  font-weight: 780;
}

.panel h2 {
  font-size: 1.35rem;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem;
}

.is-hidden {
  display: none !important;
}

.category-view {
  width: 100%;
  min-height: calc(100vh - 9rem);
  display: grid;
  place-items: center;
  padding-bottom: 2rem;
}

.category-card {
  display: grid;
  place-items: center;
  gap: 0.8rem;
  width: min(38rem, 100%);
  min-height: 18rem;
  border: 1px solid rgba(15, 118, 110, 0.36);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.2)),
    rgba(8, 14, 24, 0.44);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.32);
  color: #fff;
  backdrop-filter: blur(8px);
  padding: 2rem;
  text-align: center;
}

.category-card:hover {
  border-color: var(--teal);
}

.category-card strong {
  font-size: 5.5rem;
  line-height: 1;
}

.category-label,
.category-meta {
  color: rgba(255, 255, 255, 0.82);
  font-weight: 760;
}

.category-signature {
  display: inline-block;
  color: transparent;
  background: linear-gradient(90deg, #fff7d6, #ffffff, #f7c948, #fff7d6);
  background-size: 240% 100%;
  background-clip: text;
  font-size: 2rem;
  font-weight: 850;
  text-shadow: 0 0 18px rgba(255, 214, 102, 0.48);
  animation: signatureFloat 3.6s ease-in-out infinite, signatureShine 2.8s linear infinite;
}

@keyframes signatureFloat {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-0.45rem);
  }
}

@keyframes signatureShine {
  0% {
    background-position: 0% 50%;
    opacity: 0.76;
  }

  50% {
    background-position: 100% 50%;
    opacity: 1;
  }

  100% {
    background-position: 0% 50%;
    opacity: 0.76;
  }
}

.workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  padding-bottom: 2rem;
}

.ad-slot {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 6.5rem;
  border: 1px dashed rgba(93, 104, 120, 0.48);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 1rem;
  text-align: center;
}

.ad-slot-wide {
  grid-column: 1 / -1;
}

.ad-label {
  position: absolute;
  top: 0.5rem;
  left: 0.75rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.ad-placeholder {
  margin: 0;
  color: var(--muted);
  font-weight: 720;
}

.adsbygoogle {
  display: block;
  width: 100%;
  min-height: 5rem;
}

.ad-slot.is-live .ad-placeholder {
  display: none;
}

.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.panel-head,
.sample-count,
.metric-list,
.metric-list div {
  display: flex;
  align-items: center;
}

.panel-head {
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.sample-count {
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.sample-count span:first-child {
  color: var(--text);
  font-size: 1.4rem;
  font-weight: 800;
}

.target {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 14rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.42)),
    var(--surface-alt);
  user-select: none;
  overflow: hidden;
}

.mouse-target {
  padding: 1rem;
}

.target::before {
  content: "";
  position: absolute;
  inset: 1rem;
  border: 1px dashed rgba(15, 118, 110, 0.42);
  border-radius: 8px;
  pointer-events: none;
}

.target.is-hot {
  border-color: var(--teal);
  background:
    radial-gradient(circle at 50% 50%, rgba(15, 118, 110, 0.18), transparent 45%),
    var(--surface-alt);
}

.key-target:focus {
  border-color: var(--blue);
}

.target-value,
.target-label,
.target-hint {
  position: relative;
  z-index: 1;
}

.target-value {
  font-size: clamp(2.5rem, 8vw, 5.6rem);
  font-weight: 820;
  line-height: 1;
}

.target-label {
  align-self: start;
  color: var(--muted);
  font-weight: 700;
}

.target-hint {
  align-self: start;
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.stat {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  background: var(--surface);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.stat strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.1rem;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

canvas {
  display: block;
  width: 100%;
  height: 180px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfd;
}

.table-wrap {
  margin-top: 1rem;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 29rem;
  font-size: 0.86rem;
}

caption {
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-weight: 700;
  text-align: left;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 0.5rem;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
}

.metrics {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(12rem, 18rem) 1fr;
  gap: 1rem;
}

.reaction-panel {
  grid-column: 1 / -1;
}

.reaction-layout {
  display: grid;
  grid-template-columns: minmax(18rem, 1fr) minmax(18rem, 0.9fr);
  gap: 1rem;
}

.reaction-window {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.85rem;
  min-height: 18rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  background: #edf2f7;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  user-select: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.reaction-window strong {
  font-size: clamp(3rem, 9vw, 6.5rem);
  line-height: 1;
}

.reaction-window span {
  color: inherit;
  font-weight: 750;
}

.reaction-window.is-waiting {
  background: #f3f4f6;
  border-color: #aeb9c6;
}

.reaction-window.is-ready {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

.reaction-window.is-result {
  background: #eef6f3;
  border-color: rgba(15, 118, 110, 0.45);
}

.reaction-window.is-false-start {
  background: #fff7ed;
  border-color: rgba(194, 65, 12, 0.45);
  color: var(--red);
}

.reaction-side {
  min-width: 0;
}

.reaction-side > button {
  width: 100%;
}

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

.metric-list {
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
}

.metric-list div {
  min-height: 4rem;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  background: var(--surface);
}

.metric-list dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.metric-list dd {
  margin: 0;
  font-weight: 720;
}

@media (max-width: 920px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .reaction-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions,
  .actions button {
    width: 100%;
  }

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

  .target {
    min-height: 12rem;
  }

  .category-card strong {
    font-size: 3.4rem;
  }

  .category-signature {
    font-size: 1.35rem;
  }
}
