/* GoVibeTool V5 — Labs & Play Stylesheet */
:root {
  --v5-lab-brand: #6252f3;
  --v5-lab-accent: #0284c7;
  --v5-play-brand: #ec4899;
  --v5-play-accent: #8b5cf6;
  --v5-node-start: #10b981;
  --v5-node-action: #6366f1;
  --v5-node-condition: #f59e0b;
  --v5-node-end: #ef4444;
}

/* Pillar Badges & Navigation Highlights */
.nav-pillar-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 3px 9px;
  border-radius: 999px;
  margin-left: 6px;
}
.nav-pillar-badge.labs { background: #e0f2fe; color: #0369a1; }
.nav-pillar-badge.play { background: #fce7f3; color: #be185d; }
.navlinks a.active {
  color: var(--brand);
  position: relative;
}
.navlinks a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -8px;
  height: 2.5px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  border-radius: 2px;
}

/* Breadcrumbs */
.breadcrumb-trail {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin: 18px 0 10px;
  flex-wrap: wrap;
}
.breadcrumb-trail a {
  color: var(--muted);
  text-decoration: none;
  transition: color .18s;
}
.breadcrumb-trail a:hover { color: var(--brand); }
.breadcrumb-trail span { color: var(--line); }
.breadcrumb-trail strong { color: var(--ink); font-weight: 650; }

/* Subpage Hero */
.v5-hero {
  padding: 56px 0 42px;
  background: radial-gradient(circle at 85% 15%, rgba(141,92,246,.18), transparent 35%),
              radial-gradient(circle at 12% 25%, rgba(2,132,199,.12), transparent 30%),
              linear-gradient(145deg, #fcfbff 0%, #f4f2ff 60%, #f8f8fc 100%);
  border-bottom: 1px solid var(--line);
}
.v5-hero.play-hero {
  background: radial-gradient(circle at 85% 15%, rgba(236,72,153,.18), transparent 35%),
              radial-gradient(circle at 12% 25%, rgba(139,92,246,.12), transparent 30%),
              linear-gradient(145deg, #fffafd 0%, #fdf2f8 60%, #f8f8fc 100%);
}
.v5-hero h1 {
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: -.05em;
  margin: 12px 0 16px;
}
.v5-hero p {
  font-size: 18px;
  color: var(--muted);
  max-width: 720px;
  margin: 0 0 24px;
}

/* Feature Grid */
.v5-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin: 36px 0;
}
@media (max-width: 800px) {
  .v5-grid { grid-template-columns: 1fr; }
}

.v5-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
  display: flex;
  flex-direction: column;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
  position: relative;
  overflow: hidden;
}
.v5-card:hover {
  transform: translateY(-4px);
  border-color: #c9c5f7;
  box-shadow: 0 18px 40px rgba(41,35,92,.08);
}
.v5-card h3 {
  font-size: 24px;
  margin: 12px 0 8px;
  letter-spacing: -.03em;
}
.v5-card p {
  color: var(--muted);
  margin: 0 0 20px;
  flex-grow: 1;
}
.v5-card .v5-card-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.v5-badge {
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}
.v5-badge.featured { background: var(--soft); color: var(--brand); }
.v5-badge.live { background: #dcfce7; color: #15803d; }

/* Visual Workflow Lab Styles */
.workflow-app {
  display: grid;
  grid-template-columns: 270px 1fr 300px;
  gap: 16px;
  height: calc(100vh - 120px);
  min-height: 650px;
  margin-top: 18px;
}
@media (max-width: 1150px) {
  .workflow-app {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.panel-container {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,.02);
}
.panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafafc;
}
.panel-header h2, .panel-header h3 {
  font-size: 14px;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink);
  font-weight: 800;
}
.panel-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

/* Canvas Area */
.canvas-container {
  position: relative;
  background: #f8f9fe;
  background-image: radial-gradient(var(--line) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.canvas-toolbar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,.04);
  flex-wrap: wrap;
  gap: 8px;
}
.canvas-viewport {
  position: relative;
  min-width: 1200px;
  min-height: 800px;
  flex: 1;
}
.workflow-svg-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Workflow Nodes */
.wf-node {
  position: absolute;
  width: 210px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(20,20,40,.06);
  cursor: grab;
  z-index: 2;
  transition: box-shadow .15s, border-color .15s, transform .1s;
  user-select: none;
}
.wf-node:active { cursor: grabbing; }
.wf-node.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--soft), 0 10px 30px rgba(98,82,243,.18);
}
.wf-node.executing {
  border-color: #10b981;
  box-shadow: 0 0 0 4px rgba(16,185,129,.25);
  animation: pulse-node 1.5s infinite;
}
@keyframes pulse-node {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}
.wf-node-header {
  padding: 10px 14px;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 750;
  color: #fff;
}
.wf-node-header.start { background: var(--v5-node-start); }
.wf-node-header.action { background: var(--v5-node-action); }
.wf-node-header.condition { background: var(--v5-node-condition); }
.wf-node-header.end { background: var(--v5-node-end); }

.wf-node-content {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--ink);
}
.wf-node-content small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

/* Ports */
.wf-port {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--brand);
  position: absolute;
  cursor: crosshair;
  z-index: 5;
  transition: transform .15s;
}
.wf-port:hover { transform: scale(1.3); }
.wf-port.in { left: -7px; top: calc(50% - 7px); }
.wf-port.out { right: -7px; top: calc(50% - 7px); }
.wf-port.out-true { right: -7px; top: 32px; border-color: #10b981; }
.wf-port.out-false { right: -7px; bottom: 16px; border-color: #ef4444; }

/* API Playground Styles */
.api-app {
  display: grid;
  grid-template-columns: 280px 1fr 1fr;
  gap: 16px;
  height: calc(100vh - 120px);
  min-height: 650px;
  margin-top: 18px;
}
@media (max-width: 1100px) {
  .api-app {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.req-url-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.method-select {
  font-weight: 800;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--surface);
  color: var(--brand);
  cursor: pointer;
  width: 110px;
}
.url-input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13px;
}

.code-editor {
  width: 100%;
  height: 240px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  background: #18192f;
  color: #f1f1ff;
  border-radius: 12px;
  padding: 14px;
  border: 1px solid #2f314d;
  resize: vertical;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 12px;
}
.status-badge.s2xx { background: #dcfce7; color: #15803d; }
.status-badge.s4xx { background: #fef9c3; color: #854d0e; }
.status-badge.s5xx { background: #fee2e2; color: #b91c1c; }

/* Daily Quiz & Play Styles */
.play-container {
  max-width: 760px;
  margin: 32px auto 60px;
}
.quiz-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: 0 16px 45px rgba(20,20,50,.05);
}
@media (max-width: 600px) {
  .quiz-card { padding: 22px; }
}

.quiz-progress-bar {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin: 18px 0 28px;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width .3s ease;
}

.quiz-option {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 15px 18px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all .15s ease;
  font-size: 15px;
  font-weight: 550;
  gap: 14px;
}
.quiz-option:hover:not(:disabled):not([aria-disabled="true"]) {
  border-color: var(--brand);
  background: var(--soft);
  transform: translateX(4px);
}
.quiz-option.correct {
  border-color: #10b981 !important;
  background: #ecfdf5 !important;
  color: #065f46 !important;
}
.quiz-option.incorrect {
  border-color: #ef4444 !important;
  background: #fef2f2 !important;
  color: #991b1b !important;
}
.quiz-option-letter {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}
.quiz-option.correct .quiz-option-letter {
  background: #10b981;
  color: #fff;
}
.quiz-option.incorrect .quiz-option-letter {
  background: #ef4444;
  color: #fff;
}

.explanation-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 22px 0 16px;
  animation: fadeIn .25s ease-in-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Streak & Stat Counter Grid */
.stat-counter-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 24px 0;
}
@media (max-width: 600px) {
  .stat-counter-grid { grid-template-columns: repeat(2, 1fr); }
}
.stat-counter-box {
  background: var(--surface-2);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
}
.stat-counter-box strong {
  display: block;
  font-size: 26px;
  letter-spacing: -.03em;
  color: var(--ink);
}
.stat-counter-box small {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 750;
  letter-spacing: .06em;
}

/* Word & Logic Puzzle Styles */
.puzzle-board {
  display: grid;
  gap: 20px;
  margin-top: 24px;
}
.cipher-slots {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 24px 0;
  flex-wrap: wrap;
}
.cipher-slot {
  width: 54px;
  height: 64px;
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 850;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .15s;
}
.cipher-slot.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--soft);
}
.cipher-slot.confirmed {
  background: #dcfce7;
  border-color: #16a34a;
  color: #15803d;
}

.clue-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0;
}
.clue-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
  transition: opacity .2s;
}
.clue-item.resolved {
  opacity: .5;
  text-decoration: line-through;
  background: #fafafc;
}
.clue-checkbox {
  margin-top: 3px;
  cursor: pointer;
}

/* Keyboard Input Helper */
.letter-keyboard {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  max-width: 580px;
  margin: 20px auto;
}
.key-btn {
  width: 44px;
  height: 48px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 16px;
  font-weight: 750;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  display: grid;
  place-items: center;
}
.key-btn:hover {
  background: var(--soft);
  border-color: var(--brand);
}
.key-btn.eliminated {
  background: #e2e8f0;
  color: #94a3b8;
  cursor: not-allowed;
  opacity: .5;
}
.key-btn.action-key {
  width: auto;
  padding: 0 14px;
  font-size: 12px;
}

/* Keep the 1200px workflow canvas scrollable within its panel on narrow screens.
   Grid children otherwise retain intrinsic min-width and overflow the page. */
.workflow-app,
.workflow-app > .panel-container {
  min-width: 0;
  max-width: 100%;
}
.workflow-app > .canvas-container {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

/* Mobile Workflow Lab containment: prevent canvas descendants from widening
   the document while retaining horizontal panning inside the canvas panel. */
@media (max-width: 600px) {
  main#main:has(.workflow-app) {
    overflow-x: clip;
  }
  .workflow-app {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    min-width: 0;
  }
  .workflow-app > .panel-container {
    width: 100%;
    min-width: 0;
  }
  .workflow-app .canvas-container {
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }
}

/* Workflow Lab v2 */
:root { --v5-node-loop: #0ea5e9; }
.wf-node-header.loop { background: var(--v5-node-loop); }
.wf-node { touch-action: none; }
.wf-node:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
.wf-node.bp { box-shadow: 0 0 0 3px #ef4444, 0 6px 18px rgba(239,68,68,.2); }
.wf-node.bp::after { content: '●'; position: absolute; left: -8px; top: -10px; color: #ef4444; font-size: 16px; }
.wf-node.visited:not(.executing) { border-color: #a7f3d0; }
.wf-guide-list { margin: 8px 0 12px; padding-left: 0; list-style: none; display: grid; gap: 6px; font-size: 14px; }
.wf-guide-list li.done { color: #065f46; }
.wf-guide-list li span[aria-hidden] { display: inline-block; width: 20px; font-weight: 800; }
@media (max-width: 900px) { .workflow-app { grid-template-columns: 1fr !important; height: auto !important; } .canvas-container { min-height: 460px; } }
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
@media (max-width: 700px) { .wf-heading { flex-direction: column; align-items: stretch; } .wf-heading .actions { justify-content: flex-start; } }
