:root {
    --bg: #0A0A0F;
    --paper: #13141F;
    --grid: #1A1B25;
    --ink: #E2E2E7;
    --ink-dim: #666677;
    --purple: #8957e5;
    --purple-dim: rgba(137, 87, 229, 0.15);
}

body {
    background-color: var(--bg);
    font-family: 'IBM Plex Mono', monospace;
    color: var(--ink);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: 
        repeating-linear-gradient(0deg,
            transparent 0px,
            transparent 2px,
            rgba(137, 87, 229, 0.03) 2px,
            rgba(137, 87, 229, 0.03) 4px);
}

.manual {
    background: var(--paper);
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    border: 1px solid var(--purple-dim);
    position: relative;
    overflow: hidden;
}

/* Binary border */
.manual::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 10px solid transparent;
    border-image: repeating-linear-gradient(
        45deg,
        var(--purple-dim) 0,
        var(--purple-dim) 10px,
        transparent 10px,
        transparent 20px
    ) 1;
    pointer-events: none;
}

.header {
    text-align: center;
    margin-bottom: 8px;
    padding: 8px;
    border: 1px solid var(--purple-dim);
    background: var(--grid);
    position: relative;
}

.header::before,
.header::after {
    content: '10101010';
    position: absolute;
    font-size: 12px;
    color: var(--purple);
    opacity: 0.5;
}

.header::before {
    top: 10px;
    left: 10px;
}

.header::after {
    bottom: 10px;
    right: 10px;
}

h1 {
    font-size: 2.5rem;
    color: var(--purple);
    margin: 0;
    text-shadow: 0 0 10px rgba(137, 87, 229, 0.3);
}

h2 {
    color: var(--ink-dim);
    font-size: 1rem;
    margin: 10px 0;
}

.section {
    margin: 10px 0;
}

h3 {
    color: var(--purple);
    border-bottom: 1px solid var(--purple-dim);
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

h3::before {
    content: '>';
    color: var(--purple);
}

.spec-box {
    background: var(--grid);
    border: 1px solid var(--purple-dim);
    padding: 8px;
    margin: 6px 0;
}

.diagram-section {
    margin: 3rem 0;
}

.diagram {
    background: var(--grid);
    padding: 4rem;
    margin: 0;
    border: 1px solid var(--purple-dim);
}

pre {
    color: var(--purple);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    line-height: 1.2;
    margin: 0;
    text-align: center;
}

.diagram-label {
    color: var(--ink-dim);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 1rem;
    text-align: center;
}

.diagram-description {
    color: var(--ink-dim);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 1rem 0;
    max-width: 600px;
    padding: 1rem;
    border-left: 2px solid var(--purple-dim);
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(var(--purple-dim) 1px, transparent 1px),
        linear-gradient(90deg, var(--purple-dim) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.05;
    pointer-events: none;
}

.scanline {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 50%,
        rgba(137, 87, 229, 0.03) 50%
    );
    background-size: 100% 4px;
    pointer-events: none;
    animation: scan 10s linear infinite;
}

@keyframes scan {
    from { transform: translateY(0); }
    to { transform: translateY(4px); }
}

/* Update diagram styles */
.machine-diagram {
    background: var(--grid);
    padding: 4rem;
    margin: 2rem 0;
    font-family: 'IBM Plex Mono', monospace;
    color: var(--purple);
    white-space: pre;
    line-height: 1.2;
    font-size: 14px;
    position: relative;
    border-left: 1px solid var(--purple-dim);
    border-right: 1px solid var(--purple-dim);
    /* Make horizontal lines much longer */
    border-top: 1px solid var(--purple-dim);
    border-bottom: 1px solid var(--purple-dim);
}

.component {
    border: 2px solid var(--purple);
    padding: 1rem 2rem;
    text-align: center;
    position: relative;
    min-width: 200px;
}

.component::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 10px;
    height: 10px;
    border-left: 2px solid var(--purple);
    border-top: 2px solid var(--purple);
}

.component::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--purple);
    border-bottom: 2px solid var(--purple);
}

.arrow {
    width: 2px;
    height: 30px;
    background: var(--purple);
    position: relative;
}

.arrow::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: -4px;
    width: 10px;
    height: 10px;
    border: 2px solid var(--purple);
    border-bottom: none;
    border-right: none;
    transform: rotate(225deg);
}

.reactor {
    border: 2px solid var(--purple);
    padding: 2rem;
    position: relative;
}

.reactor::before {
    content: '∿∿∿∿';
    color: var(--purple);
    font-size: 1.5rem;
    letter-spacing: 5px;
}

.valve {
    width: 40px;
    height: 40px;
    border: 2px solid var(--purple);
    border-radius: 50%;
    position: relative;
    margin: 1rem;
}

.valve::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid var(--purple);
    border-radius: 50%;
}

.valves {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.diagram-content {
    width: fit-content;
    margin: 0 auto;
}

.installation-steps {
    counter-reset: step;
    margin: 2rem 0;
}

.step {
    position: relative;
    padding: 1.5rem;
    margin: 1.5rem 0;
    background: var(--grid);
    border: 1px solid var(--purple-dim);
}

.step::before {
    counter-increment: step;
    content: "STEP " counter(step);
    position: absolute;
    top: -12px;
    left: 20px;
    background: var(--paper);
    padding: 0 10px;
    color: var(--purple);
    font-size: 0.8rem;
    letter-spacing: 2px;
}

.step-content {
    margin-top: 0.5rem;
}

.step-title {
    color: var(--purple);
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.substeps {
    margin-left: 1.5rem;
    padding-left: 1rem;
    border-left: 1px solid var(--purple-dim);
}

.substep {
    margin: 0.8rem 0;
    color: var(--ink-dim);
}

.substep::before {
    content: "•";
    color: var(--purple);
    margin-right: 0.5rem;
}

.warning-box {
    background: rgba(137, 87, 229, 0.05);
    border-left: 3px solid var(--purple);
    padding: 1rem;
    margin: 1rem 0;
    font-size: 0.9rem;
    color: var(--ink-dim);
}

/* Installation Guide Styles */
.install-guide {
    background: var(--grid);
    border: 1px solid var(--purple-dim);
    padding: 2rem;
    margin: 2rem 0;
    position: relative;
}

/* Step Container */
.install-step {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--paper);
    border: 1px solid var(--purple-dim);
    position: relative;
}

/* Step Number */
.install-step::before {
    content: attr(data-step);
    position: absolute;
    top: -12px;
    left: 20px;
    background: var(--paper);
    color: var(--purple);
    padding: 0 10px;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

/* Step Title */
.step-title {
    color: var(--purple);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--purple-dim);
}

/* Step Description */
.step-description {
    color: var(--ink);
    line-height: 1.6;
    margin: 1rem 0;
}

/* Important Notes Box */
.note-box {
    background: var(--grid);
    border-left: 3px solid var(--purple);
    padding: 1rem;
    margin: 1rem 0;
    color: var(--ink-dim);
}

/* Code or Address Display */
.code-display {
    background: var(--bg);
    border: 1px solid var(--purple-dim);
    padding: 1rem;
    font-family: 'IBM Plex Mono', monospace;
    color: var(--purple);
    margin: 1rem 0;
    word-break: break-all;
}

/* --- Responsive Mobile Styles --- */
@media (max-width: 700px) {
  body {
    padding: 5vw;
    font-size: 0.95rem;
  }
  .manual {
    padding: 4vw 2vw;
    max-width: 100vw;
    border-width: 2px;
  }
  .header {
    padding: 6px 1vw;
    margin-bottom: 10px;
  }
  h1 {
    font-size: 1.5rem;
  }
  h2 {
    font-size: 0.9rem;
  }
  .section {
    margin: 10px 0;
  }
  .diagram,
  .machine-diagram {
    padding: 1.2rem 0.5rem;
    font-size: 12px;
    overflow-x: auto;
    max-width: 100vw;
    box-sizing: border-box;
  }
  pre {
    font-size: 12px;
    text-align: left;
    white-space: pre;
    overflow-x: auto;
  }
  .diagram-label,
  .diagram-description {
    font-size: 0.8rem;
    padding: 0.5rem;
    max-width: 100vw;
  }
  .install-guide {
    padding: 1rem 0.5rem;
    margin: 1rem 0;
  }
  .install-step {
    padding: 1rem 0.5rem;
    margin: 1rem 0;
  }
  .spec-box {
    padding: 0.5rem 0.3rem;
    margin: 0.5rem 0;
  }
  .code-display {
    font-size: 12px;
    padding: 0.7rem 0.3rem;
    overflow-x: auto;
  }
}

/* Always allow horizontal scroll for diagrams and code on small screens */
.diagram,
.machine-diagram,
pre,
.code-display {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.copy-button {
    background: var(--paper);
    color: var(--purple);
    border: 1px solid var(--purple-dim);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1rem;
    padding: 0.5em 1.2em;
    border-radius: 6px;
    cursor: pointer;
    transition: 
        background 0.2s,
        color 0.2s,
        border-color 0.2s,
        box-shadow 0.2s;
    box-shadow: 0 2px 8px 0 rgba(137, 87, 229, 0.07);
    outline: none;
    margin: 0.5em 0;
    position: relative;
    z-index: 1;
}

.copy-button:hover,
.copy-button:focus {
    background: var(--purple);
    color: var(--paper);
    border-color: var(--purple);
    box-shadow: 0 4px 16px 0 rgba(137, 87, 229, 0.15);
}

.copy-button:active {
    background: var(--purple-dim);
    color: var(--purple);
    border-color: var(--purple);
}