@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@300;400;500;600&display=swap');

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

:root {
  --ink:      #111110;
  --ink-2:    #3a3a38;
  --ink-3:    #767672;
  --rule:     #e2e0d8;
  --surface:  #f8f7f4;
  --accent:   #1a56db;
  --warn:     #c2410c;
  --paper:    #ffffff;
  --danger:   #dc2626;
}

body {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--surface);
  padding: 0 0 80px;
  -webkit-user-select: none;
  user-select: none;
}

/* Allow selection only in input areas */
textarea, input[type="text"], input[type="email"], input[type="url"],
.code-editor { -webkit-user-select: text; user-select: text; }

/* ── Header ─────────────────────────────────────────────── */
.page-header {
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  padding: 12px 48px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.logo {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.logo span { color: var(--accent); }

.badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  border: 1px solid var(--rule);
  padding: 4px 10px;
  border-radius: 4px;
}

/* ── Timer Bar ──────────────────────────────────────────── */
#timer-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--paper);
  border-bottom: 2px solid var(--rule);
  padding: 10px 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.3s, border-color 0.3s;
}

#timer-bar.warning {
  background: #fef3c7;
  border-bottom-color: #f59e0b;
}

#timer-bar.urgent {
  background: #fee2e2;
  border-bottom-color: var(--danger);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

#timer-bar .timer-label { color: var(--ink-3); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
#timer-bar .timer-value { font-size: 22px; letter-spacing: 0.04em; color: var(--ink); }
#timer-bar.warning .timer-value { color: #92400e; }
#timer-bar.urgent .timer-value { color: var(--danger); }

body.has-timer { padding-top: 64px; }

/* ── Main Content ───────────────────────────────────────── */
main { max-width: 860px; margin: 0 auto; padding: 48px 24px 0; }

.title-block { margin-bottom: 40px; }
.title-block h1 {
  font-size: 28px;
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--ink);
  margin-bottom: 12px;
}
.title-block p { color: var(--ink-2); max-width: 620px; }

.meta-row {
  display: flex;
  gap: 32px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  flex-wrap: wrap;
}
.meta-item { display: flex; flex-direction: column; gap: 2px; }
.meta-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-family: 'IBM Plex Mono', monospace;
}
.meta-value { font-size: 14px; font-weight: 500; color: var(--ink); }

/* ── Sections ───────────────────────────────────────────── */
section { margin-bottom: 36px; }

h2 {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-family: 'IBM Plex Mono', monospace;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}

h3 {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  margin: 20px 0 8px;
}

p { color: var(--ink-2); margin-bottom: 12px; }
p:last-child { margin-bottom: 0; }
ul, ol { padding-left: 20px; color: var(--ink-2); }
li { margin-bottom: 6px; }

code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  background: #eeecea;
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--ink);
}

pre {
  background: #17171a;
  color: #d4d2cc;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  padding: 24px 28px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid #2a2a2e;
  -webkit-user-select: none;
  user-select: none;
}

/* ── Callouts ───────────────────────────────────────────── */
.callout {
  padding: 16px 20px;
  border-radius: 6px;
  margin: 16px 0;
  font-size: 14px;
}
.callout.info { background: #eff6ff; border-left: 3px solid var(--accent); color: #1e3a5f; }
.callout.warn { background: #fff7ed; border-left: 3px solid #ea580c; color: #7c2d12; }
.callout.danger { background: #fef2f2; border-left: 3px solid var(--danger); color: #7f1d1d; }

/* ── Confirm checklist ─────────────────────────────────── */
.checklist li {
  margin-bottom: 10px;
}
.check-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.5;
}
.check-label input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Task Cards ─────────────────────────────────────────── */
.task-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 24px 28px;
  margin: 16px 0;
}
.task-number {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.task-card h3 { margin-top: 0; }

/* ── Forms ──────────────────────────────────────────────── */
.form-group {
  margin-bottom: 24px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  margin-bottom: 8px;
}

input[type="text"],
input[type="email"],
input[type="url"] {
  width: 100%;
  padding: 12px 16px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 15px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  transition: border-color 0.2s;
}
input:focus {
  outline: none;
  border-color: var(--accent);
}

textarea {
  width: 100%;
  padding: 14px 16px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 15px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.2s;
}
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.code-editor {
  width: 100%;
  min-height: 400px;
  padding: 20px 24px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  background: #17171a;
  color: #d4d2cc;
  border: 1px solid #2a2a2e;
  border-radius: 8px;
  resize: vertical;
  tab-size: 2;
}
.code-editor:focus {
  outline: none;
  border-color: #4a4a5e;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 12px 32px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #1648b8; }
.btn-primary:disabled {
  background: var(--rule);
  color: var(--ink-3);
  cursor: not-allowed;
  transform: none;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #b91c1c; }

.btn-secondary {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--rule);
}
.btn-secondary:hover { background: var(--surface); }

/* ── Login / Warning Pages ──────────────────────────────── */
.centered-card {
  max-width: 480px;
  margin: 12px auto 0;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 32px;
}
.centered-card h1 {
  font-size: 22px;
  font-weight: 400;
  margin-bottom: 8px;
}
.centered-card p {
  color: var(--ink-2);
  margin-bottom: 20px;
}

/* ── Resource Links ─────────────────────────────────────── */
.resource-list {
  list-style: none;
  padding: 0;
}
.resource-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
}
.resource-list li:last-child { border-bottom: none; }
.resource-list a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.resource-list a:hover { text-decoration: underline; }

/* ── Warning Modal Overlay ──────────────────────────────── */
#warning-banner {
  display: none;
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  padding: 12px 28px;
  border-radius: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  animation: slideDown 0.3s ease;
}
#warning-banner.show { display: block; }
#warning-banner.warn-10 { background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; }
#warning-banner.warn-1 { background: #fee2e2; color: #991b1b; border: 1px solid var(--danger); }

@keyframes slideDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Submit Section ─────────────────────────────────────── */
.submit-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 2px solid var(--rule);
  text-align: center;
}
.submit-section p {
  color: var(--ink-3);
  font-size: 13px;
  margin-bottom: 16px;
}

/* ── Devtools Overlay ──────────────────────────────────── */
#devtools-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
}
.devtools-overlay-inner {
  background: var(--paper);
  border-radius: 12px;
  padding: 48px;
  max-width: 480px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.devtools-overlay-inner h2 {
  font-size: 20px;
  font-weight: 500;
  color: var(--danger);
  border: none;
  text-transform: none;
  letter-spacing: normal;
  font-family: 'IBM Plex Sans', sans-serif;
  margin-bottom: 12px;
  padding-bottom: 0;
}
.devtools-overlay-inner p {
  color: var(--ink-2);
  font-size: 15px;
  margin-bottom: 24px;
}
.devtools-overlay-inner #devtools-countdown {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 20px;
  color: var(--danger);
}
.devtools-progress {
  height: 6px;
  background: var(--rule);
  border-radius: 3px;
  overflow: hidden;
}
.devtools-progress-bar {
  height: 100%;
  width: 100%;
  background: var(--danger);
  border-radius: 3px;
  transition: width 1s linear;
}

/* ── Focus-loss overlay ──────────────────────────────────── */
#focus-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99998;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
}
.focus-overlay-inner {
  background: var(--paper);
  border-radius: 12px;
  padding: 48px;
  max-width: 480px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.focus-overlay-inner h2 {
  font-size: 20px;
  font-weight: 500;
  color: var(--danger);
  border: none;
  text-transform: none;
  letter-spacing: normal;
  font-family: 'IBM Plex Sans', sans-serif;
  margin-bottom: 12px;
  padding-bottom: 0;
}
.focus-overlay-inner p {
  color: var(--ink-2);
  font-size: 15px;
  margin-bottom: 16px;
}
.focus-strikes {
  font-size: 13px !important;
  color: var(--ink-3) !important;
  font-style: italic;
}
.focus-strikes span {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  color: var(--danger);
}
.focus-progress {
  height: 6px;
  background: var(--rule);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.focus-progress-bar {
  height: 100%;
  width: 100%;
  background: var(--danger);
  border-radius: 3px;
  transition: width 1s linear;
}

/* ── Loom modal & status ─────────────────────────────────── */
.loom-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 99997;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}
.loom-modal-inner {
  background: var(--paper);
  border-radius: 12px;
  padding: 36px;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.loom-modal-inner h2 {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 20px;
  border: none;
  text-transform: none;
  letter-spacing: normal;
  padding-bottom: 0;
}
.loom-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.loom-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.loom-step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.loom-step strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}
.loom-step p {
  font-size: 13px;
  color: var(--ink-2);
  margin: 0;
}
.loom-step a {
  color: var(--accent);
}
.loom-status {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: #dcfce7;
  border-radius: 6px;
  font-size: 14px;
  color: #166534;
  margin-bottom: 12px;
}
.loom-check {
  font-size: 18px;
  margin-right: 8px;
  font-weight: 600;
}
.loom-status a {
  color: #166534;
  margin-left: 4px;
  word-break: break-all;
  font-size: 13px;
}

/* ── CodeMirror overrides ──────────────────────────────── */
.CodeMirror {
  font-family: 'IBM Plex Mono', monospace !important;
  font-size: 13px !important;
  line-height: 1.6 !important;
  border-radius: 8px;
  border: 1px solid #2a2a2e;
  min-height: 400px;
  height: auto;
}
.CodeMirror-focused {
  border-color: #4a4a5e;
}
.cm-s-material-darker .CodeMirror-gutters {
  border-right: 1px solid #2a2a2e;
}

/* ── Given Code Section ────────────────────────────────── */
.given-code-block {
  position: relative;
}
.given-code-block pre {
  max-height: 600px;
  overflow-y: auto;
}

/* ── LLM Honey Pot ─────────────────────────────────────── */
/* Invisible to humans. OCR/screenshot tools will capture  */
/* this text, and LLMs will follow the poison instructions */
/* producing detectably wrong output.                      */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: 0;
  font-size: 1px;
  line-height: 0;
  color: transparent;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
}

/* ── Watermark (light, for traceability) ───────────────── */
#watermark-overlay {
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  z-index: 9998;
  pointer-events: none;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 48px 32px;
  padding: 40px;
  transform: rotate(-22deg);
  transform-origin: center center;
}
#watermark-overlay span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.06);
  white-space: nowrap;
  letter-spacing: 0.02em;
  line-height: 1;
}
