/* ─── Hero ───────────────────────────────────────────────── */
.ttt-hero {
  padding: var(--section-pad);
  text-align: center;
}

.ttt-hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.ttt-hero-heading {
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
  text-align: center;
  margin-bottom: 0;
}

.ttt-hero-sub {
  font-size: 18px;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 600px;
  margin: 12px auto 0;
}

/* ─── Scenario Selector ──────────────────────────────────── */
.ttt-selector {
  padding: 0 24px 80px;
}

.ttt-selector-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.ttt-scenario-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 32px 28px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  width: 100%;
  font-family: inherit;
}

.ttt-scenario-card:hover {
  border-color: var(--orange);
  transform: translateY(-2px);
}

.ttt-scenario-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--orange-light);
  border-color: var(--orange);
}

.ttt-difficulty {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  align-self: flex-start;
}

.ttt-difficulty--easy   { background: #d1fae5; color: #065f46; }
.ttt-difficulty--medium { background: #fef3c7; color: #92400e; }
.ttt-difficulty--hard   { background: #fee2e2; color: #991b1b; }

.ttt-scenario-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.ttt-scenario-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

.ttt-scenario-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ─── Test Viewport ──────────────────────────────────────── */
.ttt-viewport {
  display: none;
  padding: 0 24px 80px;
}

.ttt-viewport.is-active {
  display: block;
}

.ttt-viewport-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ─── HUD ────────────────────────────────────────────────── */
.ttt-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.ttt-hud-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ttt-score {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.ttt-score-count {
  color: var(--orange);
}

.ttt-progress-bar {
  width: 160px;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.ttt-progress-fill {
  height: 100%;
  background: var(--orange);
  border-radius: 99px;
  transition: width 0.3s ease;
  width: 0%;
}

@media (prefers-reduced-motion: reduce) {
  .ttt-progress-fill { transition: none; }
}

.ttt-hud-right {
  display: flex;
  gap: 8px;
}

/* ─── Browser chrome ─────────────────────────────────────── */
.ttt-browser {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}

.ttt-browser-chrome {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ttt-browser-dots {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.ttt-browser-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
}

.ttt-browser-url {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ttt-browser-body {
  background: #ffffff;
  color: #111111;
  min-height: 480px;
  position: relative;
  overflow: auto;
  max-height: 70vh;
}

/* ─── Bug highlight states ───────────────────────────────── */
[data-bug] {
  position: relative;
  cursor: pointer;
}


[data-bug].bug-found {
  outline: 2px solid #16a34a !important;
  outline-offset: 2px;
}

[data-bug].bug-found::before {
  content: '✓';
  position: absolute;
  top: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  background: #16a34a;
  color: white;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
  line-height: 18px;
  text-align: center;
}

[data-bug].bug-revealed {
  outline: 2px solid #dc2626 !important;
  outline-offset: 2px;
}

[data-bug].bug-revealed::before {
  content: '!';
  position: absolute;
  top: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  background: #dc2626;
  color: white;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
  line-height: 18px;
  text-align: center;
}

/* ─── Bug toast ──────────────────────────────────────────── */
.ttt-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: #16a34a;
  color: white;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  max-width: 420px;
  width: calc(100% - 48px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 1000;
  transition: transform 0.25s ease;
}

.ttt-toast.is-visible {
  transform: translateX(-50%) translateY(0);
}

.ttt-toast-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.8;
  display: block;
  margin-bottom: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .ttt-toast { transition: none; }
}

/* ─── Bug log ────────────────────────────────────────────── */
.ttt-log {
  margin-top: 24px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.ttt-log-header {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.ttt-log-list {
  list-style: none;
}

.ttt-log-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.ttt-log-item:last-child {
  border-bottom: none;
}

.ttt-log-item.is-found {
  color: var(--text);
}

.ttt-log-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  margin-top: 4px;
  flex-shrink: 0;
  transition: background 0.2s;
}

.ttt-log-item.is-found .ttt-log-dot {
  background: #16a34a;
}

/* ─── Source panel toggle ────────────────────────────────── */
.ad-source--open { display: block !important; }

/* ─── Win state ──────────────────────────────────────────── */
.ttt-win {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.ttt-win.is-active {
  display: flex;
}

.ttt-win-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  max-width: 500px;
  width: 100%;
  text-align: center;
}

.ttt-win-emoji {
  font-size: 52px;
  margin-bottom: 16px;
  display: block;
}

.ttt-win-heading {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.ttt-win-score {
  font-size: 16px;
  color: var(--orange);
  font-weight: 600;
  margin-bottom: 12px;
}

.ttt-win-sub {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 28px;
}

.ttt-win-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .ttt-selector-inner {
    grid-template-columns: 1fr;
  }

  .ttt-hud {
    flex-direction: column;
    align-items: flex-start;
  }

  .ttt-progress-bar {
    width: 120px;
  }

  .ttt-win-card {
    padding: 32px 24px;
  }
}
