/* CIBI — Can I Break It? — intrusion console v7 */
:root {
  color-scheme: dark;
  --void: #05070a;
  --bg: #07090c;
  --panel: #0c0f13;
  --panel-2: #0f1318;
  --line: rgba(180, 200, 195, 0.10);
  --line-strong: rgba(10, 255, 159, 0.30);
  --text: #e9f2ee;
  --muted: #7c8a86;
  --muted2: #545f5c;

  --signal: #0aff9f;
  --signal-dim: rgba(10, 255, 159, 0.14);
  --amber: #ffb02e;
  --alert: #ff3b3b;
  --alert-dim: rgba(255, 59, 59, 0.14);

  --mono: "JetBrains Mono", "Share Tech Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --display: "Share Tech Mono", "JetBrains Mono", ui-monospace, monospace;

  --shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}

*, *::before, *::after { box-sizing: border-box; }

html { min-height: 100%; scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: var(--mono);
  background: var(--void);
  overflow-x: hidden;
  position: relative;
}

a { color: inherit; }
button, textarea, select { font: inherit; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- atmosphere ---------- */

.noise {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(10, 255, 159, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(10, 255, 159, 0.025) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 0%, transparent 72%);
}

.scan {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.012) 0px,
    rgba(255, 255, 255, 0.012) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.5;
}

/* ---------- layout shell ---------- */

.shell {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 90px;
}

/* ---------- header ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 30px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 38px;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--signal);
  background: var(--panel);
  border: 1px solid var(--line-strong);
}

.brand-mark-corner {
  position: absolute;
  width: 6px;
  height: 6px;
  border: 1px solid var(--signal);
}
.brand-mark-corner.tl { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.brand-mark-corner.tr { top: -1px; right: -1px; border-width: 1px 1px 0 0; }
.brand-mark-corner.bl { bottom: -1px; left: -1px; border-width: 0 0 1px 1px; }
.brand-mark-corner.br { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

.brand-text {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-q { color: var(--signal); }

.nav-links {
  display: flex;
  gap: 26px;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.15s ease;
}

.nav-links a:hover { color: var(--signal); }

.header-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.dot-armed {
  background: var(--signal);
  box-shadow: 0 0 10px rgba(10, 255, 159, 0.8);
  animation: blink 2.2s ease-in-out infinite;
}

@keyframes blink {
  0%, 60%, 100% { opacity: 1; }
  80% { opacity: 0.35; }
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(28px, 5vw, 60px);
  align-items: center;
  padding-bottom: 8px;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--signal);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(42px, 6vw, 72px);
  line-height: 1.04;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.lead {
  max-width: 560px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.lead.small { font-size: 14px; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 34px;
}

.btn {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 22px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  transition: transform 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
  color: #04140d;
  background: var(--signal);
  border-color: var(--signal);
  box-shadow: 0 0 30px rgba(10, 255, 159, 0.22);
}

.btn-primary:hover { box-shadow: 0 0 40px rgba(10, 255, 159, 0.36); }

.btn-bracket { opacity: 0.5; }

.btn-ghost {
  background: var(--panel);
  color: var(--muted);
}

.btn-ghost:hover { color: var(--text); border-color: var(--line-strong); }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meta-label {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--muted2);
}

.meta-val {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.meta-locked { color: var(--alert); }

/* ---------- hero visual: intrusion log panel ---------- */

.hero-visual {
  display: grid;
  place-items: center;
}

.panel-frame {
  position: relative;
  width: min(100%, 440px);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--bg));
  box-shadow: var(--shadow);
}

.panel-frame-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid var(--signal);
  opacity: 0.7;
}
.panel-frame-corner.tl { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.panel-frame-corner.tr { top: -1px; right: -1px; border-width: 1px 1px 0 0; }
.panel-frame-corner.bl { bottom: -1px; left: -1px; border-width: 0 0 1px 1px; }
.panel-frame-corner.br { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

.panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.panel-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--signal);
}

.panel-live i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 8px rgba(10, 255, 159, 0.8);
  animation: blink 1.8s ease-in-out infinite;
}

.panel-body {
  height: 340px;
  overflow: hidden;
  padding: 6px 0;
  font-size: 12px;
  line-height: 1.5;
}

.log-row {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  gap: 10px;
  align-items: baseline;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transform: translateY(6px);
  animation: rowIn 0.4s ease forwards;
}

@keyframes rowIn {
  to { opacity: 1; transform: translateY(0); }
}

.log-time { color: var(--muted2); font-size: 10.5px; }

.log-text {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-status {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: right;
}

.log-status.blocked { color: var(--alert); }
.log-status.passed { color: var(--signal); }
.log-status.partial { color: var(--amber); }

.panel-bottom {
  display: flex;
  justify-content: space-between;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted2);
}

/* ---------- vector strip ---------- */

.strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 70px;
  border: 1px solid var(--line);
  background: var(--line);
}

.strip-card {
  padding: 26px 24px;
  background: var(--bg);
}

.strip-tag {
  color: var(--signal);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  font-weight: 700;
}

.strip-card h2 {
  margin: 16px 0 10px;
  font-family: var(--display);
  font-size: 19px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  font-weight: 400;
}

.strip-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}

/* ---------- footer panel ---------- */

.footer-panel {
  margin-top: 1px;
  padding: 36px;
  border: 1px solid var(--line);
  border-top: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  background: linear-gradient(180deg, rgba(10, 255, 159, 0.03), transparent);
}

.footer-copy h2 {
  margin: 0;
  max-width: 640px;
  font-family: var(--display);
  font-size: clamp(20px, 2.6vw, 28px);
  line-height: 1.35;
  font-weight: 400;
  text-transform: uppercase;
}

.site-footer {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted2);
}

.dim { color: var(--muted2); }

/* ---------- chat launcher ---------- */

.chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  width: 58px;
  height: 58px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--signal);
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: 0 18px 50px rgba(0,0,0,0.55), 0 0 0 1px rgba(10,255,159,0.05);
}

.launcher-corner {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 1px solid var(--signal);
  opacity: 0.8;
}
.launcher-corner.tl { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.launcher-corner.tr { top: -1px; right: -1px; border-width: 1px 1px 0 0; }
.launcher-corner.bl { bottom: -1px; left: -1px; border-width: 0 0 1px 1px; }
.launcher-corner.br { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

.chat-launcher .pulse {
  position: absolute;
  right: 7px;
  top: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--alert);
  box-shadow: 0 0 10px rgba(255, 59, 59, 0.8);
}

.chat-launcher .pulse.is-unlocked {
  background: var(--signal);
  box-shadow: 0 0 10px rgba(10, 255, 159, 0.8);
}

/* ---------- chat widget ---------- */

.chat-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  width: min(370px, calc(100vw - 28px));
  height: min(480px, calc(100vh - 28px));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(9, 12, 16, 0.98), rgba(5, 7, 10, 0.99));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px) scale(0.985);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.chat-widget.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.frame-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 1px solid var(--signal);
  z-index: 2;
  pointer-events: none;
}
.frame-corner.tl { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.frame-corner.tr { top: -1px; right: -1px; border-width: 1px 1px 0 0; }
.frame-corner.bl { bottom: -1px; left: -1px; border-width: 0 0 1px 1px; }
.frame-corner.br { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

.chat-widget.locked .frame-corner { border-color: var(--alert); }

.chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.chat-eyebrow {
  display: block;
  margin: 0 0 4px;
  color: var(--signal);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 9.5px;
  font-weight: 700;
}

.chat-header h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lock-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--alert-dim);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--alert);
  background: var(--alert-dim);
  white-space: nowrap;
}

.lock-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--alert);
}

.chat-widget.unlocked .lock-pill {
  color: var(--signal);
  border-color: var(--signal-dim);
  background: var(--signal-dim);
}

.chat-widget.unlocked .lock-dot { background: var(--signal); }

.chat-actions button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.chat-actions button:hover { border-color: var(--line-strong); }

.chat-subbar {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.012);
}

#testPromptSelect {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  padding: 0 8px;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  outline: none;
}

#testPromptSelect:focus {
  border-color: var(--line-strong);
}

#testPromptSelect option {
  color: #0a0c0f;
  background: #ffffff;
}

.messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  overflow-y: auto;
}

.msg { display: flex; align-items: flex-end; gap: 9px; }
.msg.user { justify-content: flex-end; }

.avatar {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--signal-dim);
  color: var(--signal);
  background: rgba(10, 255, 159, 0.06);
  font-size: 10px;
  font-weight: 700;
}

.bubble {
  max-width: 82%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  line-height: 1.5;
  font-size: 13.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.user .bubble {
  border-color: var(--signal-dim);
  background: rgba(10, 255, 159, 0.05);
}

.msg.bot.is-error .bubble {
  border-color: var(--alert-dim);
  background: var(--alert-dim);
  color: #ffd4d4;
}

.composer {
  display: grid;
  grid-template-columns: 18px 1fr 72px;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
}

.composer-caret {
  color: var(--signal);
  font-weight: 700;
  text-align: center;
}

.composer textarea {
  min-height: 40px;
  max-height: 110px;
  resize: none;
  padding: 11px 4px;
  border: none;
  border-bottom: 1px solid var(--line-strong);
  outline: none;
  color: var(--text);
  background: transparent;
  font-size: 13.5px;
}

.composer textarea::placeholder { color: var(--muted2); }

.composer textarea:focus {
  border-color: var(--signal);
}

.composer button {
  height: 40px;
  border: 1px solid var(--signal);
  color: #04140d;
  background: var(--signal);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.composer button:disabled {
  opacity: 0.5;
  cursor: progress;
}

/* ---------- responsive ---------- */

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

  .panel-body { height: 260px; }

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

@media (max-width: 680px) {
  .shell {
    width: min(100%, calc(100% - 20px));
    padding-top: 18px;
  }

  .nav-links { display: none; }
  .header-status span:last-child { display: none; }

  h1 { font-size: clamp(34px, 11vw, 50px); }

  .hero-meta { gap: 18px 24px; }

  .footer-panel {
    flex-direction: column;
    align-items: flex-start;
    padding: 26px;
  }

  .site-footer { flex-direction: column; gap: 6px; }

  .chat-widget {
    right: 10px;
    bottom: 10px;
    width: min(370px, calc(100vw - 20px));
    height: min(480px, calc(100vh - 20px));
  }

  .chat-launcher { right: 14px; bottom: 14px; }
}
