* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  background:
    radial-gradient(circle, #d4d4d8 1px, transparent 1px) 0 0 / 24px 24px,
    url('bg-p.png') bottom center / 100% auto no-repeat fixed,
    #fafafa;
  color: #18181b;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Nav ---- */
.nav {
  padding: 24px 0;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-logo {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #18181b;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: -0.5px;
}

.nav-name {
  font-weight: 700;
  font-size: 17px;
  color: #18181b;
  letter-spacing: -0.02em;
}

/* ---- Hero ---- */
.hero {
  padding: 60px 0 40px;
}

.hero-row {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 36px;
}

.hero-title {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.15;
  color: #09090b;
  margin-bottom: 16px;
}

/* ---- Ticker ---- */
.ticker {
  overflow: hidden;
  white-space: nowrap;
  padding: 18px 0;
  position: relative;
  width: 200%;
  margin-left: -50%;
}
.ticker::before, .ticker::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 60px;
  z-index: 1;
  pointer-events: none;
}
.ticker::before { left: 0; background: linear-gradient(to right, #fafafa, transparent); }
.ticker::after  { right: 0; background: linear-gradient(to left, #fafafa, transparent); }
.ticker-track {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  animation: ticker-scroll 28s linear infinite;
}
.ticker-item {
  display: inline-block;
  font-size: 17px;
  font-weight: 500;
  color: #3f3f46;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #d4d4d8;
  border-radius: 999px;
  padding: 10px 22px;
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.ticker-dot {
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #d4d4d8;
  align-self: center;
  flex-shrink: 0;
}
@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.hero-sub {
  font-size: 18px;
  color: #71717a;
  line-height: 1.6;
  max-width: 540px;
}

/* ---- Butler sprite ---- */
.butler-hero {
  height: 110px;
  min-width: 60px;
  image-rendering: pixelated;
  background-repeat: no-repeat;
  background-position: 0 0;
  transition: width 0.3s, min-width 0.3s;
}

.butler-hero.b-cook {
  width: 106px; min-width: 106px;
  background-image: url('sprites/cook2.png');
  background-size: 636px 110px;
  animation: b-cook 0.8s steps(6) infinite;
}
@keyframes b-cook { to { background-position: -636px 0; } }

.butler-hero.b-sweep {
  width: 90px; min-width: 90px;
  background-image: url('sprites/sweep2.png');
  background-size: 540px 110px;
  animation: b-sweep 0.7s steps(6) infinite;
}
@keyframes b-sweep { to { background-position: -540px 0; } }

.butler-hero.b-shake {
  width: 60px; min-width: 60px;
  background-image: url('sprites/shake2.png');
  background-size: 360px 110px;
  animation: b-shake 0.6s steps(6) infinite;
}
@keyframes b-shake { to { background-position: -360px 0; } }

.butler-hero.b-cloche {
  width: 132px; min-width: 132px;
  background-image: url('sprites/cloche2.png');
  background-size: 528px 110px;
  animation: b-cloche 0.8s steps(4) infinite;
}
@keyframes b-cloche { to { background-position: -528px 0; } }

.butler-hero.b-knead {
  width: 92px; min-width: 92px;
  background-image: url('sprites/knead2.png');
  background-size: 552px 110px;
  animation: b-knead 0.8s steps(6) infinite;
}
@keyframes b-knead { to { background-position: -552px 0; } }

.butler-hero.b-iron {
  width: 92px; min-width: 92px;
  background-image: url('sprites/iron2.png');
  background-size: 368px 110px;
  animation: b-iron 0.7s steps(4) infinite;
}
@keyframes b-iron { to { background-position: -368px 0; } }

/* Legacy idle (used on run page etc.) */
.butler-idle {
  width: 58px;
  height: 110px;
  min-width: 58px;
  background: url('sprites/idle.png') 0 0 no-repeat;
  background-size: 174px 110px;
  animation: butler-idle 0.8s steps(3) infinite;
  image-rendering: pixelated;
}

@keyframes butler-idle {
  to { background-position: -174px 0; }
}

@keyframes butler-idle-sm {
  to { background-position: -132px 0; }
}

/* ---- Create box ---- */
.create-box {
  background: #fff;
  border: 1.5px solid #e4e4e7;
  border-radius: 20px;
  padding: 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.create-box:focus-within {
  border-color: #a1a1aa;
  box-shadow: 0 0 0 4px rgba(0,0,0,0.03), 0 12px 48px rgba(0,0,0,0.08);
}

.create-box textarea {
  width: 100%;
  padding: 22px 22px 14px;
  font-size: 17px;
  line-height: 1.6;
  border: none;
  border-radius: 16px 16px 0 0;
  outline: none;
  background: transparent;
  color: #18181b;
  resize: none;
  font-family: inherit;
  min-height: 120px;
}

.create-box textarea::placeholder { color: #a1a1aa; }

.create-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 6px 6px 10px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.create-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  background: #18181b;
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}

.create-btn:hover { background: #27272a; }
.create-btn:active { transform: scale(0.98); }
.create-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.spinner-sm {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ---- Mic button ---- */
.mic-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px solid #e4e4e7;
  background: #fff;
  color: #71717a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.mic-btn:hover {
  border-color: #a1a1aa;
  color: #18181b;
  background: #fafafa;
}

.mic-btn.recording {
  background: #fef2f2;
  border-color: #ef4444;
  color: #ef4444;
  animation: pulse-mic 1.5s ease-in-out infinite;
}

@keyframes pulse-mic {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.3); }
  50% { box-shadow: 0 0 0 10px rgba(239,68,68,0); }
}

/* ---- Memory button ---- */
.memory-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px solid #e4e4e7;
  background: #fff;
  color: #71717a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  overflow: hidden;
}

.memory-btn img {
  border-radius: 50%;
  object-fit: cover;
}

.memory-btn:hover {
  border-color: #a1a1aa;
  color: #18181b;
  background: #fafafa;
}

.memory-btn.active {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #2563eb;
}

/* ---- Memory panel ---- */
.memory-panel {
  display: none;
  margin-top: 12px;
  opacity: 0;
  transform: translateY(-6px);
}

.memory-panel.show {
  display: block;
  opacity: 1;
  transform: translateY(0);
  animation: mem-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes mem-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.memory-panel-inner {
  background: #fff;
  border: 1.5px solid #e4e4e7;
  border-radius: 16px;
  padding: 20px;
}

.memory-header {
  margin-bottom: 14px;
}

.memory-label {
  font-size: 14px;
  font-weight: 700;
  color: #18181b;
}

.memory-sub {
  display: block;
  font-size: 13px;
  color: #a1a1aa;
  margin-top: 2px;
}

.memory-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.memory-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.memory-key, .memory-val {
  flex: 1;
  padding: 9px 12px;
  font-size: 14px;
  border: 1.5px solid #e4e4e7;
  border-radius: 10px;
  outline: none;
  background: #fafafa;
  color: #18181b;
  font-family: inherit;
  transition: border-color 0.15s;
}

.memory-key { max-width: 160px; }

.memory-key:focus, .memory-val:focus {
  border-color: #a1a1aa;
  background: #fff;
}

.memory-key::placeholder, .memory-val::placeholder {
  color: #a1a1aa;
}

.memory-remove {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: none;
  color: #a1a1aa;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.memory-remove:hover {
  background: #fef2f2;
  color: #ef4444;
}

.memory-add {
  margin-top: 10px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #71717a;
  background: none;
  border: 1.5px dashed #e4e4e7;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.memory-add:hover {
  border-color: #a1a1aa;
  color: #18181b;
  background: #fafafa;
}

/* ---- Result ---- */
.result {
  display: none;
  margin-top: 20px;
  opacity: 0;
  transform: translateY(10px);
}

.result.show {
  opacity: 1;
  transform: translateY(0);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-inner {
  background: #fff;
  border: 1.5px solid #d1fae5;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 4px 24px rgba(22,163,74,0.06);
}

.result-title {
  font-size: 15px;
  font-weight: 700;
  color: #15803d;
  margin-bottom: 16px;
}

.result-body {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.result-link-col {
  flex: 1;
  min-width: 0;
}

.result-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f0fdf4;
  border: 1px solid #d1fae5;
  border-radius: 12px;
  padding: 12px 14px;
}

.link {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #15803d;
  word-break: break-all;
  font-family: 'SF Mono', Monaco, Menlo, monospace;
}

.copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #d1fae5;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: inherit;
  background: #fff;
  color: #15803d;
}

.copy-btn:hover { background: #f0fdf4; }
.copy-btn.copied { background: #dcfce7; border-color: #86efac; }

.share-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  background: #15803d;
  color: #fff;
  border: 1px solid #15803d;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}

.share-btn:hover { background: #16a34a; border-color: #16a34a; }
.share-btn:active { transform: scale(0.98); }

/* ---- Live tracker ---- */
.tracker {
  display: none;
  margin-top: 20px;
  opacity: 0;
  transform: translateY(10px);
}

.tracker.show {
  opacity: 1;
  transform: translateY(0);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.tracker-inner {
  background: #fff;
  border: 1.5px solid #e4e4e7;
  border-radius: 20px;
  padding: 24px;
}

.tracker-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.tracker-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #a1a1aa;
  flex-shrink: 0;
}

.tracker-dot.running {
  background: #22c55e;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.tracker-dot.paused {
  background: #f59e0b;
  animation: pulse-dot-amber 1.5s ease-in-out infinite;
}

.tracker-dot.complete { background: #16a34a; }
.tracker-dot.error { background: #ef4444; }

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}

@keyframes pulse-dot-amber {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(245,158,11,0); }
}

.tracker-status {
  font-size: 15px;
  font-weight: 600;
  color: #18181b;
}

.tracker-log {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tracker-entry {
  font-size: 13px;
  color: #52525b;
  padding: 6px 10px;
  background: #fafafa;
  border-radius: 8px;
  line-height: 1.4;
}

.tracker-step {
  font-weight: 700;
  color: #18181b;
  margin-right: 4px;
}

/* ---- Example pills ---- */
.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
  align-items: center;
}

.examples-label {
  font-size: 13px;
  color: #a1a1aa;
  font-weight: 500;
}

.pill {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  background: #fff;
  color: #52525b;
  border: 1px solid #e4e4e7;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  line-height: 1.4;
}

.pill:hover {
  color: #18181b;
  border-color: #a1a1aa;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* ---- How it works ---- */
.how {
  padding: 56px 0;
  /* Break out of .page container so the video can be wider */
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  padding-left: 24px;
  padding-right: 24px;
}

.how-header {
  font-size: 13px;
  font-weight: 600;
  color: #18181b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 28px;
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
}

.how-video {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  display: block;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.06);
}

/* ---- Footer ---- */
.footer {
  padding: 28px 0;
  text-align: center;
}

.footer p { color: #a1a1aa; font-size: 12px; }

/* ---- Run page ---- */
.run-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  text-align: center;
}

.run-header { margin-bottom: 40px; }
.run-logo { font-size: 2em; font-weight: 700; letter-spacing: -0.03em; }

.run-status {
  background: #fff;
  border: 1px solid #e4e4e7;
  border-radius: 20px;
  padding: 48px 40px;
  text-align: center;
  max-width: 480px;
  width: 100%;
}

.run-status h2 { font-size: 20px; font-weight: 600; }

.spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid #e4e4e7;
  border-top-color: #18181b;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.task-text {
  color: #71717a;
  font-size: 14px;
  margin-top: 12px;
}

.install-prompt {
  margin-top: 24px;
  color: #71717a;
  font-size: 14px;
  line-height: 1.7;
}

.install-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}
.install-link:hover { text-decoration: underline; }

/* ---- Mobile gate ---- */
.mobile-gate {
  display: none;
}

@media (max-width: 768px), (pointer: coarse) {
  .page, .run-container { display: none !important; }

  .mobile-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 32px 24px;
    text-align: center;
  }

  .mobile-gate .gate-butler {
    width: 132px;
    height: 110px;
    background: url('sprites/cloche2.png') 0 0 no-repeat;
    background-size: 528px 110px;
    animation: b-cloche 0.8s steps(4) infinite;
    image-rendering: pixelated;
    margin-bottom: 32px;
  }

  .mobile-gate .gate-title {
    font-size: 22px;
    font-weight: 800;
    color: #18181b;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
  }

  .mobile-gate .gate-msg {
    font-size: 16px;
    color: #52525b;
    line-height: 1.6;
    max-width: 320px;
  }
}
