/* I2C.html */
html.page-i2c {
    color-scheme: light dark;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at top, #f4f8ff, #d9e6ff 45%, #eef3ff 75%, #ffffff);
    min-height: 100vh;
}

html.page-i2c body {
    margin: 0;
    display: flex;
    justify-content: center;
    padding: clamp(2rem, 5vw, 4rem);
    background: rgba(255, 255, 255, 0.6);
}

html.page-i2c main {
    max-width: 1100px;
    width: 100%;
    background: rgba(255, 255, 255, 0.88);
    border-radius: 24px;
    backdrop-filter: blur(12px);
    box-shadow: 0 26px 60px rgba(15, 23, 42, 0.14);
    padding: clamp(2.5rem, 6vw, 3.25rem);
    display: grid;
    gap: clamp(2rem, 4vw, 3rem);
}

html.page-i2c header {
    display: grid;
    gap: 0.75rem;
    text-align: center;
}

html.page-i2c h1 {
    margin: 0;
    font-size: clamp(2.1rem, 5vw, 3.2rem);
    color: #1d4ed8;
    letter-spacing: -0.01em;
}

html.page-i2c header p {
    margin: 0 auto;
    max-width: 760px;
    color: #334155;
    font-size: clamp(1rem, 2.3vw, 1.2rem);
    line-height: 1.65;
}

html.page-i2c .wave-section {
    display: grid;
    gap: 1.5rem;
}

html.page-i2c .wave-panel {
    background: linear-gradient(160deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.9));
    border-radius: 20px;
    padding: clamp(1.5rem, 3vw, 2.25rem);
    color: rgba(226, 232, 240, 0.95);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    display: grid;
    gap: 1rem;
}

html.page-i2c .legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    font-size: 0.95rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

html.page-i2c .legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

html.page-i2c .legend-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
}

html.page-i2c .legend-dot.scl {
    background: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.3);
}

html.page-i2c .legend-dot.sda {
    background: #fbbf24;
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.3);
}

html.page-i2c canvas#waveform {
    width: 100%;
    height: 240px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.6), rgba(15, 23, 42, 0.45));
}

html.page-i2c .controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

html.page-i2c .controls button {
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(248, 250, 252, 0.12);
    color: #e2e8f0;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    padding: 0.6rem 1.1rem;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

html.page-i2c .controls button:hover,
html.page-i2c .controls button:focus-visible {
    border-color: rgba(96, 165, 250, 0.7);
    background: rgba(96, 165, 250, 0.14);
    outline: none;
    transform: translateY(-1px);
}

html.page-i2c .controls button.active {
    background: rgba(96, 165, 250, 0.24);
    border-color: rgba(96, 165, 250, 0.8);
    color: #fff;
}

html.page-i2c .stage-details {
    display: grid;
    gap: 1.5rem;
    background: rgba(255, 255, 255, 0.72);
    border-radius: 20px;
    padding: clamp(1.5rem, 3vw, 2.25rem);
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

html.page-i2c .stage-text {
    display: grid;
    gap: 0.75rem;
}

html.page-i2c .stage-text h2 {
    margin: 0;
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    color: #1e3a8a;
}

html.page-i2c .stage-text p {
    margin: 0;
    color: #1f2937;
    line-height: 1.7;
    font-size: 1.05rem;
}

html.page-i2c .stage-text ul {
    margin: 0;
    padding-left: 1.1rem;
    color: #334155;
    line-height: 1.6;
}

html.page-i2c .bit-display {
    display: grid;
    gap: 0.85rem;
}

html.page-i2c .bit-display h3 {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: 0.05em;
    color: #1d4ed8;
    text-transform: uppercase;
}

html.page-i2c .bit-sequence {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(52px, 1fr));
    gap: 0.55rem;
}

html.page-i2c .bit {
    display: grid;
    gap: 0.2rem;
    background: rgba(96, 165, 250, 0.14);
    border-radius: 12px;
    padding: 0.6rem 0.4rem;
    text-align: center;
    border: 1px solid rgba(96, 165, 250, 0.22);
}

html.page-i2c .bit strong {
    font-size: 1.2rem;
    color: #0f172a;
}

html.page-i2c .bit span {
    font-size: 0.85rem;
    color: #1d4ed8;
    letter-spacing: 0.03em;
}

html.page-i2c .bit-note {
    margin: 0;
    font-size: 0.95rem;
    color: #475569;
}

html.page-i2c .notes {
    display: grid;
    gap: 0.75rem;
    font-size: 0.95rem;
    color: #475569;
    line-height: 1.6;
}

html.page-i2c .notes strong {
    color: #1e40af;
}

@media (max-width: 720px) {
    html.page-i2c canvas#waveform {
        height: 200px;
    }

}

@media (prefers-reduced-motion: reduce) {
    html.page-i2c *,
    html.page-i2c *::before,
    html.page-i2c *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

}


/* UART.html */
html.page-uart {
    color-scheme: light dark;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at top, #f4f7ff, #d6dcff 40%, #f0f2ff 70%, #fff);
    min-height: 100vh;
}

html.page-uart body {
    margin: 0;
    padding: 2rem;
    display: flex;
    justify-content: center;
    background: rgba(255, 255, 255, 0.6);
}

html.page-uart main {
    max-width: 1100px;
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
    padding: 2.5rem;
    display: grid;
    gap: 2rem;
}

html.page-uart h1 {
    margin-top: 0;
    font-size: clamp(2rem, 4vw, 2.8rem);
    text-align: center;
    color: #2e3a59;
}

html.page-uart p.description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #374160;
    text-align: justify;
}

html.page-uart .controls {
    display: grid;
    gap: 1.5rem;
    background: rgba(16, 30, 58, 0.92);
    color: #eef2ff;
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

html.page-uart .controls form {
    display: grid;
    gap: 1.25rem;
}

html.page-uart .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

html.page-uart label {
    display: grid;
    gap: 0.35rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-size: 0.8rem;
}

html.page-uart input[type="text"],
html.page-uart input[type="number"],
html.page-uart select {
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: inherit;
    font-size: 1rem;
    letter-spacing: 0.05em;
    font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    transition: background 0.3s ease, transform 0.2s ease;
}

html.page-uart input:focus,
html.page-uart select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

html.page-uart button {
    border: none;
    background: linear-gradient(135deg, #2d7aff, #4ea1ff);
    color: white;
    padding: 0.85rem 1.8rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

html.page-uart button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(45, 122, 255, 0.35);
}

html.page-uart button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

html.page-uart .visualizer {
    display: grid;
    gap: 2rem;
}

html.page-uart section {
    background: rgba(255, 255, 255, 0.82);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: inset 0 0 0 1px rgba(46, 58, 89, 0.08);
}

html.page-uart section h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.4rem;
    color: #2e3a59;
}

html.page-uart .bit-track {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

html.page-uart .bits {
    display: grid;
    grid-auto-flow: column;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

html.page-uart .bit-box {
    min-width: 90px;
    background: linear-gradient(135deg, rgba(45, 122, 255, 0.12), rgba(46, 58, 89, 0.08));
    border-radius: 12px;
    padding: 0.75rem;
    display: grid;
    gap: 0.35rem;
    justify-items: center;
    transition: transform 0.2s ease, box-shadow 0.3s ease, background 0.3s ease;
}

html.page-uart .bit-box .bit-label {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #4a5784;
}

html.page-uart .bit-box .bit-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2a4a;
}

html.page-uart .bit-box.active {
    transform: translateY(-6px);
    box-shadow: 0 16px 30px rgba(45, 122, 255, 0.35);
    background: linear-gradient(135deg, rgba(45, 122, 255, 0.28), rgba(46, 58, 89, 0.18));
}

html.page-uart .bit-box.sent {
    opacity: 0.6;
}

html.page-uart .wave-grid {
    display: grid;
    gap: 1.5rem;
}

html.page-uart .wave-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    align-items: center;
    gap: 1rem;
}

html.page-uart .wave-label {
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #4a5784;
}

html.page-uart svg.waveform {
    width: 100%;
    height: 120px;
}

html.page-uart svg.waveform rect.bit-highlight {
    fill: rgba(77, 139, 255, 0.22);
    stroke: rgba(45, 122, 255, 0.55);
    stroke-width: 1.5;
    rx: 6;
    opacity: 0;
    transition: opacity 0.3s ease;
}

html.page-uart svg.waveform path.trace {
    fill: none;
    stroke: #1f2a4a;
    stroke-width: 4;
    stroke-linejoin: round;
}

html.page-uart svg.waveform line.sample-line {
    stroke: #ff6f3c;
    stroke-width: 2;
    stroke-dasharray: 6 8;
    opacity: 0.65;
    transition: opacity 0.3s ease;
}

html.page-uart svg.waveform line.sample-line.active {
    opacity: 1;
    stroke-width: 3;
}

html.page-uart svg.waveform text.sample-label {
    fill: #ff6f3c;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

html.page-uart .status {
    display: grid;
    gap: 1rem;
}

html.page-uart .status-text {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.6;
    color: #2e3a59;
}

html.page-uart .button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

@media (max-width: 720px) {
    html.page-uart body {
        padding: 1rem;
    }

    html.page-uart main {
        padding: 1.5rem;
    }

    html.page-uart .wave-row {
        grid-template-columns: 1fr;
    }

    html.page-uart .wave-label {
        justify-self: start;
    }

}


/* WS2812b.html */
html.page-ws2812b {
    color-scheme: light dark;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at top, #f4f9ff, #dbe8ff 45%, #eef3ff 70%, #fff);
    min-height: 100vh;
}

html.page-ws2812b body {
    margin: 0;
    padding: 2rem;
    display: flex;
    justify-content: center;
    background: rgba(255, 255, 255, 0.6);
}

html.page-ws2812b main {
    max-width: 1100px;
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
    padding: 2.5rem;
    display: grid;
    gap: 2rem;
}

html.page-ws2812b h1 {
    margin-top: 0;
    font-size: clamp(2rem, 4vw, 2.8rem);
    text-align: center;
    color: #2b3a63;
}

html.page-ws2812b p.description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #374160;
    text-align: justify;
}

html.page-ws2812b .controls {
    display: grid;
    gap: 1.5rem;
    background: rgba(21, 30, 64, 0.95);
    color: #eef2ff;
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

html.page-ws2812b .controls form {
    display: grid;
    gap: 1.25rem;
}

html.page-ws2812b .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

html.page-ws2812b label {
    display: grid;
    gap: 0.35rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-size: 0.8rem;
}

html.page-ws2812b input[type="text"] {
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: inherit;
    font-size: 1rem;
    letter-spacing: 0.03em;
    font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    transition: background 0.3s ease, transform 0.2s ease;
}

html.page-ws2812b input[type="text"]:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

html.page-ws2812b button {
    border: none;
    background: linear-gradient(135deg, #305bff, #4aa8ff);
    color: white;
    padding: 0.85rem 1.8rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

html.page-ws2812b button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(48, 91, 255, 0.35);
}

html.page-ws2812b button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

html.page-ws2812b .visualizer {
    display: grid;
    gap: 2rem;
}

html.page-ws2812b .waveforms {
    background: rgba(21, 30, 64, 0.95);
    color: #f9fbff;
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    display: grid;
    gap: 1.5rem;
}

html.page-ws2812b .waveform-row {
    display: grid;
    gap: 0.6rem;
}

html.page-ws2812b .waveform-row h2 {
    margin: 0;
    font-size: 1rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(238, 242, 255, 0.8);
}

html.page-ws2812b svg.waveform {
    width: 100%;
    height: 90px;
    border-radius: 12px;
    background: rgba(10, 18, 36, 0.65);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: visible;
}

html.page-ws2812b path.trace {
    fill: none;
    stroke: #63a4ff;
    stroke-width: 3;
    stroke-linejoin: round;
}

html.page-ws2812b rect.bit-highlight {
    fill: rgba(255, 255, 255, 0.14);
    rx: 6;
    ry: 6;
    opacity: 0;
    transition: opacity 0.3s ease;
}

html.page-ws2812b .bit-trackers {
    display: grid;
    gap: 1.25rem;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: inset 0 0 0 1px rgba(16, 30, 58, 0.06);
}

html.page-ws2812b .register {
    display: grid;
    gap: 0.75rem;
}

html.page-ws2812b .register h3,
html.page-ws2812b .led-summary h3 {
    margin: 0;
    font-size: 1rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #344057;
}

html.page-ws2812b .bit-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 0.75rem;
}

html.page-ws2812b .bit-box {
    background: linear-gradient(145deg, #f5f7ff, #e5e9ff);
    color: #293553;
    border-radius: 10px;
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
    display: grid;
    justify-items: center;
    gap: 0.35rem;
}

html.page-ws2812b .bit-box span.bit-label {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #4c5774;
}

html.page-ws2812b .bit-box span.bit-value {
    font-size: 1.3rem;
}

html.page-ws2812b .bit-box.active {
    transform: translateY(-6px);
    box-shadow: 0 18px 30px rgba(48, 91, 255, 0.25);
    background: linear-gradient(145deg, #305bff, #4aa8ff);
    color: #fff;
}

html.page-ws2812b .bit-box.active span.bit-label {
    color: rgba(255, 255, 255, 0.85);
}

html.page-ws2812b .bit-box.sent {
    opacity: 0.65;
}

html.page-ws2812b .led-summary {
    display: grid;
    gap: 0.75rem;
}

html.page-ws2812b .led-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

html.page-ws2812b .led-card {
    background: linear-gradient(145deg, #fefefe, #eef2ff);
    border-radius: 12px;
    padding: 1rem;
    display: grid;
    gap: 0.5rem;
    box-shadow: inset 0 0 0 1px rgba(27, 44, 92, 0.08);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

html.page-ws2812b .led-card.active {
    transform: translateY(-4px);
    box-shadow: 0 16px 28px rgba(48, 91, 255, 0.2);
}

html.page-ws2812b .led-index {
    font-weight: 700;
    color: #2b3a63;
    letter-spacing: 0.06em;
}

html.page-ws2812b .led-swatch {
    display: block;
    height: 36px;
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
    transition: background 0.4s ease;
}

html.page-ws2812b .led-components {
    font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.85rem;
    color: #4c5774;
    display: grid;
    gap: 0.2rem;
}

html.page-ws2812b .led-components .component-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-variant-numeric: tabular-nums;
}

html.page-ws2812b .led-components .component-line .current {
    font-weight: 600;
    color: #2b3a63;
}

html.page-ws2812b .led-components .component-line.complete .current {
    color: #305bff;
}

html.page-ws2812b .status-board {
    background: rgba(21, 30, 64, 0.95);
    color: #f9fbff;
    border-radius: 16px;
    padding: 1.5rem;
    display: grid;
    gap: 0.75rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

html.page-ws2812b .status-board h3 {
    margin: 0;
    font-size: 1rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(238, 242, 255, 0.75);
}

html.page-ws2812b .status-board p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
}

html.page-ws2812b .legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.9rem;
    color: rgba(238, 242, 255, 0.75);
}

html.page-ws2812b .legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

html.page-ws2812b .legend i {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 4px;
}

html.page-ws2812b .legend i.data {
    background: #63a4ff;
}

html.page-ws2812b .legend i.reset {
    background: #7a8bff;
}

@media (max-width: 768px) {
    html.page-ws2812b body {
        padding: 1.5rem;
    }

    html.page-ws2812b main {
        padding: 1.75rem;
    }

    html.page-ws2812b svg.waveform {
        height: 80px;
    }

    html.page-ws2812b .bit-strip {
        grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
    }

}


/* bubble.html */
html.page-bubble {
    color-scheme: light dark;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at top, #f4f7ff, #d6dcff 40%, #f0f2ff 70%, #fff);
    min-height: 100vh;
}

html.page-bubble body {
    margin: 0;
    padding: 2rem;
    display: flex;
    justify-content: center;
    background: rgba(255, 255, 255, 0.6);
}

html.page-bubble main {
    max-width: 1000px;
    width: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
    padding: 2.5rem;
    display: grid;
    gap: 2rem;
}

html.page-bubble h1 {
    margin-top: 0;
    font-size: clamp(2rem, 4vw, 2.8rem);
    text-align: center;
    color: #2e3a59;
}

html.page-bubble p.description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #374160;
    text-align: justify;
}

html.page-bubble .visualizer {
    display: grid;
    gap: 2rem;
}

html.page-bubble .workspace {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(320px, 1.3fr);
    gap: 2rem;
}

html.page-bubble .pseudocode {
    background: #101e3a;
    color: #eef2ff;
    border-radius: 14px;
    padding: 1.2rem 1.5rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

html.page-bubble .pseudocode h2,
html.page-bubble .animation h2 {
    margin-top: 0;
    font-size: 1.2rem;
    letter-spacing: 0.04em;
}

html.page-bubble ol.code-lines {
    list-style: none;
    counter-reset: line;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.35rem;
    font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.95rem;
}

html.page-bubble ol.code-lines li {
    position: relative;
    padding-left: 3.2rem;
    line-height: 1.6;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 0.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

html.page-bubble ol.code-lines li::before {
    counter-increment: line;
    content: counter(line);
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.55);
}

html.page-bubble ol.code-lines li.active {
    background: linear-gradient(135deg, #2d7aff, #4ea1ff);
    color: #fff;
    transform: translateX(4px) scale(1.01);
    box-shadow: 0 10px 30px rgba(45, 122, 255, 0.35);
}

html.page-bubble .animation {
    background: rgba(16, 30, 58, 0.9);
    color: #f9fbff;
    border-radius: 14px;
    padding: 1.5rem;
    display: grid;
    gap: 1.5rem;
}

html.page-bubble .array-container {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    justify-content: center;
    min-height: 220px;
}

html.page-bubble .bar {
    width: 40px;
    background: linear-gradient(180deg, #6fa7ff, #1c47ff);
    border-radius: 10px 10px 4px 4px;
    position: relative;
    transition: transform 0.45s ease, background 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    padding-bottom: 0.5rem;
}

html.page-bubble .bar.comparing {
    background: linear-gradient(180deg, #ffb347, #ff8303);
    box-shadow: 0 14px 30px rgba(255, 131, 3, 0.35);
}

html.page-bubble .bar.swapping {
    background: linear-gradient(180deg, #ff5a7a, #c62b50);
    box-shadow: 0 14px 30px rgba(198, 43, 80, 0.45);
}

html.page-bubble .bar.sorted {
    background: linear-gradient(180deg, #32d399, #0f9d58);
    box-shadow: 0 14px 30px rgba(15, 157, 88, 0.4);
}

html.page-bubble .status {
    font-size: 1rem;
    min-height: 3rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 1rem;
    line-height: 1.5;
}

html.page-bubble .controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

html.page-bubble .controls button {
    flex: 1 1 120px;
    padding: 0.85rem 1.2rem;
    border-radius: 12px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    background: linear-gradient(135deg, #5161ff, #7f9bff);
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

html.page-bubble .controls button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(81, 97, 255, 0.35);
}

html.page-bubble .controls button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    box-shadow: none;
}

html.page-bubble .legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: rgba(249, 251, 255, 0.9);
}

html.page-bubble .legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

html.page-bubble .legend em {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

html.page-bubble .legend em.compare {
    background: linear-gradient(180deg, #ffb347, #ff8303);
}

html.page-bubble .legend em.swap {
    background: linear-gradient(180deg, #ff5a7a, #c62b50);
}

html.page-bubble .legend em.sorted {
    background: linear-gradient(180deg, #32d399, #0f9d58);
}

html.page-bubble footer {
    text-align: center;
    font-size: 0.9rem;
    color: #445072;
}

@media (max-width: 900px) {
    html.page-bubble body {
        padding: 1rem;
    }

    html.page-bubble main {
        padding: 1.5rem;
    }

    html.page-bubble .workspace {
        grid-template-columns: 1fr;
    }

    html.page-bubble .array-container {
        min-height: 180px;
    }

    html.page-bubble .bar {
        width: clamp(26px, 7vw, 40px);
    }

}


/* gzip.html */
html.page-gzip {
    color-scheme: light dark;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at top, #f4f7ff, #d6dcff 40%, #f0f2ff 70%, #fff);
    min-height: 100vh;
}

html.page-gzip body {
    margin: 0;
    padding: 2rem;
    display: flex;
    justify-content: center;
    background: rgba(255, 255, 255, 0.6);
}

html.page-gzip main {
    max-width: 1100px;
    width: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
    padding: 2.5rem;
    display: grid;
    gap: 2rem;
}

html.page-gzip nav.return-link {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

html.page-gzip nav.return-link a {
    text-decoration: none;
    color: #1d4ed8;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

html.page-gzip nav.return-link a:hover,
html.page-gzip nav.return-link a:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(59, 130, 246, 0.25);
    outline: none;
}

html.page-gzip h1 {
    margin-top: 0;
    font-size: clamp(2rem, 4vw, 2.8rem);
    text-align: center;
    color: #2e3a59;
}

html.page-gzip p.description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #374160;
    text-align: justify;
}

html.page-gzip .visualizer {
    display: grid;
    gap: 2rem;
}

html.page-gzip .workspace {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(360px, 1.4fr);
    gap: 2rem;
}

html.page-gzip .pseudocode {
    background: #101e3a;
    color: #eef2ff;
    border-radius: 14px;
    padding: 1.2rem 1.5rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

html.page-gzip .pseudocode h2,
html.page-gzip .animation h2 {
    margin-top: 0;
    font-size: 1.2rem;
    letter-spacing: 0.04em;
}

html.page-gzip ol.code-lines {
    list-style: none;
    counter-reset: line;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.35rem;
    font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.95rem;
}

html.page-gzip ol.code-lines li {
    position: relative;
    padding-left: 3.2rem;
    line-height: 1.6;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 0.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

html.page-gzip ol.code-lines li::before {
    counter-increment: line;
    content: counter(line);
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.55);
}

html.page-gzip ol.code-lines li.active {
    background: linear-gradient(135deg, #2d7aff, #4ea1ff);
    color: #fff;
    transform: translateX(4px) scale(1.01);
    box-shadow: 0 10px 30px rgba(45, 122, 255, 0.35);
}

html.page-gzip .animation {
    background: rgba(16, 30, 58, 0.9);
    color: #f9fbff;
    border-radius: 14px;
    padding: 1.5rem;
    display: grid;
    gap: 1.5rem;
}

html.page-gzip .data-stream,
html.page-gzip .token-stream,
html.page-gzip .bitstream,
html.page-gzip .status {
    background: rgba(11, 20, 42, 0.85);
    border-radius: 12px;
    padding: 1rem 1.2rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

html.page-gzip .stream-title {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(209, 218, 255, 0.8);
}

html.page-gzip .symbols {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

html.page-gzip .symbol {
    min-width: 36px;
    height: 44px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    padding: 0 0.4rem;
    font-weight: 600;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.08);
    color: #f1f4ff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

html.page-gzip .symbol.processed {
    background: linear-gradient(135deg, rgba(56, 255, 169, 0.2), rgba(56, 255, 169, 0.5));
}

html.page-gzip .symbol.current {
    transform: translateY(-6px) scale(1.04);
    background: linear-gradient(135deg, rgba(94, 196, 255, 0.7), rgba(82, 140, 255, 0.9));
}

html.page-gzip .symbol.match {
    background: linear-gradient(135deg, rgba(255, 196, 12, 0.4), rgba(255, 154, 14, 0.7));
}

html.page-gzip .symbol.in-window:not(.match)::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    border: 2px solid rgba(114, 162, 255, 0.6);
    box-shadow: 0 0 14px rgba(112, 162, 255, 0.45);
    pointer-events: none;
}

html.page-gzip .window-display {
    margin-top: 0.6rem;
    display: grid;
    gap: 0.65rem;
    color: rgba(226, 234, 255, 0.88);
    font-size: 0.9rem;
    padding: 0.85rem 1rem;
    background: linear-gradient(135deg, rgba(23, 44, 86, 0.72), rgba(16, 32, 70, 0.92));
    border-radius: 12px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

html.page-gzip .window-visual {
    display: grid;
    gap: 0.5rem;
}

html.page-gzip .window-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(205, 220, 255, 0.7);
}

html.page-gzip .window-label .range {
    font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.78rem;
    color: rgba(154, 196, 255, 0.8);
}

html.page-gzip .window-track {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.6rem;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(60, 94, 160, 0.28), rgba(32, 54, 116, 0.65));
    min-height: 52px;
}

html.page-gzip .window-track--empty {
    font-style: italic;
    color: rgba(200, 210, 240, 0.6);
    align-items: center;
    justify-content: center;
}

html.page-gzip .window-symbol {
    min-width: 32px;
    min-height: 36px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    padding: 0 0.4rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    background: rgba(255, 255, 255, 0.08);
    color: #f4f7ff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    position: relative;
}

html.page-gzip .window-symbol.match {
    background: linear-gradient(135deg, #ffcf6a, #ff8f31);
    color: #2e1a02;
    box-shadow: 0 12px 24px rgba(255, 143, 49, 0.45);
}

html.page-gzip .window-pointer {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.85rem;
    color: rgba(255, 219, 164, 0.88);
}

html.page-gzip .window-pointer .pointer-arrow {
    font-size: 1.3rem;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

html.page-gzip .window-pointer .match-text {
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    background: linear-gradient(135deg, #ffcf6a, #ff8f31);
    color: #2e1a02;
    font-weight: 600;
    box-shadow: 0 8px 18px rgba(255, 143, 49, 0.35);
}

html.page-gzip .window-summary {
    font-size: 0.85rem;
    color: rgba(198, 210, 240, 0.75);
}

html.page-gzip .token-stream ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.6rem;
    font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

html.page-gzip .token {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    display: grid;
    gap: 0.3rem;
}

html.page-gzip .token strong {
    font-size: 0.95rem;
    color: #8fd2ff;
}

html.page-gzip .bitstream pre {
    margin: 0;
    font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    color: rgba(217, 225, 255, 0.92);
    white-space: pre-wrap;
}

html.page-gzip .controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

html.page-gzip .controls button {
    border: none;
    border-radius: 999px;
    padding: 0.75rem 1.6rem;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    background: linear-gradient(135deg, #5f7bff, #4fa3ff);
    color: white;
    box-shadow: 0 10px 25px rgba(79, 163, 255, 0.35);
}

html.page-gzip .controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

html.page-gzip .controls button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 14px 35px rgba(79, 163, 255, 0.45);
}

html.page-gzip .status {
    font-size: 1rem;
    line-height: 1.5;
    color: rgba(232, 238, 255, 0.92);
}

@media (max-width: 900px) {
    html.page-gzip body {
        padding: 1.5rem;
    }

    html.page-gzip .workspace {
        grid-template-columns: 1fr;
    }

}


/* heap.html */
html.page-heap {
    color-scheme: light dark;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at top, #f4f7ff, #d6dcff 40%, #f0f2ff 70%, #fff);
    min-height: 100vh;
}

html.page-heap body {
    margin: 0;
    padding: 2rem;
    display: flex;
    justify-content: center;
    background: rgba(255, 255, 255, 0.6);
}

html.page-heap main {
    max-width: 1100px;
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
    padding: 2.5rem;
    display: grid;
    gap: 2.25rem;
}

html.page-heap h1 {
    margin-top: 0;
    font-size: clamp(2rem, 4vw, 2.8rem);
    text-align: center;
    color: #1f325d;
}

html.page-heap p.description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #2f3a56;
    text-align: justify;
}

html.page-heap .visualizer {
    display: grid;
    gap: 2rem;
}

html.page-heap .workspace {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.4fr);
    gap: 2rem;
}

html.page-heap .pseudocode {
    background: #0f2143;
    color: #eef2ff;
    border-radius: 14px;
    padding: 1.3rem 1.5rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

html.page-heap .pseudocode h2,
html.page-heap .animation h2 {
    margin-top: 0;
    font-size: 1.2rem;
    letter-spacing: 0.04em;
}

html.page-heap ol.code-lines {
    list-style: none;
    counter-reset: line;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.35rem;
    font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.95rem;
}

html.page-heap ol.code-lines li {
    position: relative;
    padding-left: 3.2rem;
    line-height: 1.6;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 0.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

html.page-heap ol.code-lines li::before {
    counter-increment: line;
    content: counter(line);
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.55);
}

html.page-heap ol.code-lines li.active {
    background: linear-gradient(135deg, #2d7aff, #4ea1ff);
    color: #fff;
    transform: translateX(4px) scale(1.01);
    box-shadow: 0 10px 30px rgba(45, 122, 255, 0.35);
}

html.page-heap .animation {
    background: rgba(16, 30, 58, 0.92);
    color: #f9fbff;
    border-radius: 14px;
    padding: 1.5rem;
    display: grid;
    gap: 1.5rem;
}

html.page-heap .array-container {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    justify-content: center;
    min-height: 240px;
}

html.page-heap .bar {
    width: 40px;
    background: linear-gradient(180deg, #6fa7ff, #1c47ff);
    border-radius: 10px 10px 4px 4px;
    position: relative;
    transition: transform 0.45s ease, background 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    padding-bottom: 0.5rem;
}

html.page-heap .bar.comparing {
    background: linear-gradient(180deg, #ffb347, #ff8303);
    box-shadow: 0 14px 30px rgba(255, 131, 3, 0.35);
}

html.page-heap .bar.swapping {
    background: linear-gradient(180deg, #ff5a7a, #c62b50);
    box-shadow: 0 14px 30px rgba(198, 43, 80, 0.45);
}

html.page-heap .bar.sorted {
    background: linear-gradient(180deg, #32d399, #0f9d58);
    box-shadow: 0 14px 30px rgba(15, 157, 88, 0.4);
}

html.page-heap .status {
    font-size: 1rem;
    min-height: 3rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 1rem;
    line-height: 1.5;
}

html.page-heap .controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

html.page-heap .controls button {
    flex: 1 1 120px;
    padding: 0.85rem 1.2rem;
    border-radius: 12px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    background: linear-gradient(135deg, #5161ff, #7f9bff);
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

html.page-heap .controls button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(81, 97, 255, 0.35);
}

html.page-heap .controls button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    box-shadow: none;
}

html.page-heap .legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: rgba(249, 251, 255, 0.9);
}

html.page-heap .legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

html.page-heap .legend em {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

html.page-heap .legend em.compare {
    background: linear-gradient(180deg, #ffb347, #ff8303);
}

html.page-heap .legend em.swap {
    background: linear-gradient(180deg, #ff5a7a, #c62b50);
}

html.page-heap .legend em.sorted {
    background: linear-gradient(180deg, #32d399, #0f9d58);
}

html.page-heap footer {
    text-align: center;
    font-size: 0.9rem;
    color: #445072;
}

@media (max-width: 900px) {
    html.page-heap body {
        padding: 1rem;
    }

    html.page-heap main {
        padding: 1.5rem;
    }

    html.page-heap .workspace {
        grid-template-columns: 1fr;
    }

    html.page-heap .array-container {
        min-height: 190px;
    }

    html.page-heap .bar {
        width: clamp(26px, 7vw, 40px);
    }

}


/* huffman.html */
html.page-huffman {
    color-scheme: light dark;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at top, #f4f7ff, #d6dcff 40%, #f0f2ff 70%, #fff);
    min-height: 100vh;
}

html.page-huffman body {
    margin: 0;
    padding: 2rem;
    display: flex;
    justify-content: center;
    background: rgba(255, 255, 255, 0.6);
}

html.page-huffman main {
    max-width: 1100px;
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.16);
    padding: clamp(2rem, 5vw, 3rem);
    display: grid;
    gap: 2.5rem;
}

html.page-huffman header {
    display: grid;
    gap: 0.7rem;
    text-align: center;
}

html.page-huffman h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.8rem);
    color: #1f2a44;
}

html.page-huffman p.description {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.6;
    color: #374160;
}

html.page-huffman nav.return-link {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

html.page-huffman nav.return-link a {
    text-decoration: none;
    color: #1d4ed8;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

html.page-huffman nav.return-link a:hover,
html.page-huffman nav.return-link a:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(59, 130, 246, 0.25);
    outline: none;
}

html.page-huffman .visualizer {
    display: grid;
    gap: 2rem;
}

html.page-huffman .workspace {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(360px, 1.5fr);
    gap: 2rem;
}

html.page-huffman .pseudocode {
    background: #101e3a;
    color: #eef2ff;
    border-radius: 16px;
    padding: 1.4rem 1.6rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

html.page-huffman .pseudocode h2,
html.page-huffman .animation h2 {
    margin-top: 0;
    font-size: 1.25rem;
    letter-spacing: 0.04em;
}

html.page-huffman ol.code-lines {
    list-style: none;
    counter-reset: line;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.35rem;
    font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.95rem;
}

html.page-huffman ol.code-lines li {
    position: relative;
    padding-left: 3.2rem;
    line-height: 1.6;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 0.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

html.page-huffman ol.code-lines li::before {
    counter-increment: line;
    content: counter(line);
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.55);
}

html.page-huffman ol.code-lines li.active {
    background: linear-gradient(135deg, #2d7aff, #4ea1ff);
    color: #fff;
    transform: translateX(4px) scale(1.01);
    box-shadow: 0 10px 30px rgba(45, 122, 255, 0.35);
}

html.page-huffman .animation {
    background: rgba(16, 30, 58, 0.92);
    color: #f9fbff;
    border-radius: 16px;
    padding: 1.6rem;
    display: grid;
    gap: 1.5rem;
}

html.page-huffman .controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

html.page-huffman .controls button {
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: inherit;
    font: inherit;
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

html.page-huffman .controls button:hover:not(:disabled),
html.page-huffman .controls button:focus-visible:not(:disabled) {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 12px 28px rgba(45, 122, 255, 0.25);
    outline: none;
}

html.page-huffman .controls button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

html.page-huffman .status-box {
    background: rgba(10, 20, 38, 0.8);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

html.page-huffman .panels {
    display: grid;
    gap: 1.4rem;
}

html.page-huffman .panel {
    background: rgba(10, 20, 38, 0.65);
    border-radius: 14px;
    padding: 1.1rem 1.3rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

html.page-huffman .panel h3 {
    margin: 0 0 0.7rem 0;
    font-size: 1.05rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #9dbfff;
}

html.page-huffman .frequency-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.6rem;
    font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.95rem;
}

html.page-huffman .frequency-list span {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.18);
}

html.page-huffman .queue {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

html.page-huffman .queue-node {
    min-width: 120px;
    padding: 0.6rem 0.8rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.3);
    display: grid;
    gap: 0.25rem;
    font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    transition: transform 0.25s ease, background 0.25s ease;
}

html.page-huffman .queue-node.highlight {
    background: linear-gradient(135deg, #f97316, #fb923c);
    color: #fff;
    transform: translateY(-4px) scale(1.02);
}

html.page-huffman .queue-node.new-node {
    background: linear-gradient(135deg, #22c55e, #4ade80);
    color: #07260f;
}

html.page-huffman .tree-display {
    display: grid;
    gap: 1rem;
}

html.page-huffman .tree-forest {
    display: grid;
    gap: 1rem;
}

html.page-huffman .tree-node {
    display: grid;
    justify-items: center;
    gap: 0.6rem;
}

html.page-huffman .node-bubble {
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.28);
}

html.page-huffman .children {
    display: grid;
    gap: 0.9rem;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    justify-items: center;
}

html.page-huffman .code-list {
    display: grid;
    gap: 0.4rem;
    font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

html.page-huffman .code-list span {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.45rem 0.6rem;
    border-radius: 9px;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

@media (max-width: 960px) {
    html.page-huffman .workspace {
        grid-template-columns: 1fr;
    }

}

@media (prefers-reduced-motion: reduce) {
    html.page-huffman *,
    html.page-huffman *::before,
    html.page-huffman *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

}


/* index.html */
html.page-index {
    color-scheme: light dark;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    background: radial-gradient(circle at top, #f4f7ff, #d6dcff 40%, #f0f2ff 70%, #fff);
}

html.page-index body {
    margin: 0;
    display: flex;
    justify-content: center;
    padding: clamp(2rem, 6vw, 4rem);
    background: rgba(255, 255, 255, 0.55);
}

html.page-index main {
    max-width: 1100px;
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 22px;
    backdrop-filter: blur(10px);
    box-shadow: 0 24px 60px rgba(30, 41, 59, 0.15);
    padding: clamp(2rem, 5vw, 3rem);
    display: grid;
    gap: 2.5rem;
}

html.page-index header {
    text-align: center;
    display: grid;
    gap: 0.75rem;
}

html.page-index h1 {
    margin: 0;
    font-size: clamp(2.2rem, 5vw, 3.2rem);
    color: #1e293b;
}

html.page-index p {
    margin: 0;
    color: #475569;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
}

html.page-index .grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

html.page-index a {
    text-decoration: none;
    color: inherit;
}

html.page-index .card {
    padding: 1.75rem;
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(244, 247, 255, 0.8));
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.12);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

html.page-index .card:hover,
html.page-index .card:focus-visible {
    transform: translateY(-6px);
    box-shadow: 0 25px 45px rgba(15, 23, 42, 0.18);
    border-color: rgba(59, 130, 246, 0.4);
    outline: none;
}

html.page-index .card h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.4rem;
    color: #1d4ed8;
}

html.page-index .card p {
    color: #475569;
    font-size: 0.95rem;
}

html.page-index footer {
    font-size: 0.85rem;
    color: #64748b;
    text-align: center;
}

@media (prefers-reduced-motion: reduce) {
    html.page-index *,
    html.page-index *::before,
    html.page-index *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

}


/* insertion.html */
html.page-insertion {
    color-scheme: light dark;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at top, #f4f7ff, #d6dcff 40%, #f0f2ff 70%, #fff);
    min-height: 100vh;
}

html.page-insertion body {
    margin: 0;
    padding: 2rem;
    display: flex;
    justify-content: center;
    background: rgba(255, 255, 255, 0.6);
}

html.page-insertion main {
    max-width: 1000px;
    width: 100%;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(8px);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
    padding: 2.5rem;
    display: grid;
    gap: 2rem;
}

html.page-insertion h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.8rem);
    text-align: center;
    color: #26355c;
}

html.page-insertion p.description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #374160;
    text-align: justify;
}

html.page-insertion .visualizer {
    display: grid;
    gap: 2rem;
}

html.page-insertion .workspace {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(320px, 1.3fr);
    gap: 2rem;
}

html.page-insertion .pseudocode {
    background: #0f1d39;
    color: #eef2ff;
    border-radius: 14px;
    padding: 1.2rem 1.5rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

html.page-insertion .pseudocode h2,
html.page-insertion .animation h2 {
    margin-top: 0;
    font-size: 1.2rem;
    letter-spacing: 0.04em;
}

html.page-insertion ol.code-lines {
    list-style: none;
    counter-reset: line;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.35rem;
    font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.95rem;
}

html.page-insertion ol.code-lines li {
    position: relative;
    padding-left: 3.2rem;
    line-height: 1.6;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 0.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

html.page-insertion ol.code-lines li::before {
    counter-increment: line;
    content: counter(line);
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.55);
}

html.page-insertion ol.code-lines li.active {
    background: linear-gradient(135deg, #ff7f50, #ffb347);
    color: #fff;
    transform: translateX(4px) scale(1.01);
    box-shadow: 0 10px 30px rgba(255, 145, 72, 0.35);
}

html.page-insertion .animation {
    background: rgba(15, 29, 57, 0.92);
    color: #f9fbff;
    border-radius: 14px;
    padding: 1.5rem;
    display: grid;
    gap: 1.5rem;
}

html.page-insertion .array-container {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    justify-content: center;
    min-height: 220px;
}

html.page-insertion .bar {
    flex: 1;
    min-width: 40px;
    background: linear-gradient(180deg, #5c7dff, #2f54eb);
    border-radius: 8px 8px 4px 4px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    color: white;
    font-weight: 600;
    padding-bottom: 0.5rem;
    transition: transform 0.3s ease, background 0.3s ease;
}

html.page-insertion .bar.comparing {
    background: linear-gradient(180deg, #ff9f7f, #ff6f61);
}

html.page-insertion .bar.swapping {
    background: linear-gradient(180deg, #20bf6b, #0fbf66);
    transform: translateY(-6px);
}

html.page-insertion .bar.sorted {
    background: linear-gradient(180deg, #6dd5fa, #2980b9);
}

html.page-insertion .status {
    min-height: 60px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 1rem;
    line-height: 1.5;
    font-weight: 500;
    color: #dbe6ff;
}

html.page-insertion .controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

html.page-insertion .controls button {
    border: none;
    border-radius: 999px;
    padding: 0.65rem 1.6rem;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.85);
    color: #13203b;
    box-shadow: 0 10px 25px rgba(18, 32, 59, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

html.page-insertion .controls button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(18, 32, 59, 0.24);
}

html.page-insertion .controls button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

html.page-insertion footer {
    font-size: 0.9rem;
    color: #3e4b6d;
    text-align: center;
}

@media (max-width: 780px) {
    html.page-insertion body {
        padding: 1.5rem;
    }

    html.page-insertion .workspace {
        grid-template-columns: 1fr;
    }

    html.page-insertion .array-container {
        min-height: 180px;
    }

    html.page-insertion .bar {
        min-width: 32px;
    }

}


/* merge.html */
html.page-merge {
    color-scheme: light dark;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at top, #f4f7ff, #d6dcff 40%, #f0f2ff 70%, #fff);
    min-height: 100vh;
}

html.page-merge body {
    margin: 0;
    padding: 2rem;
    display: flex;
    justify-content: center;
    background: rgba(255, 255, 255, 0.65);
}

html.page-merge main {
    max-width: 1100px;
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 22px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.14);
    padding: clamp(2rem, 3vw, 3rem);
    display: grid;
    gap: 2.25rem;
}

html.page-merge h1 {
    margin-top: 0;
    font-size: clamp(2rem, 4vw, 3rem);
    text-align: center;
    color: #243056;
}

html.page-merge p.description {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #384469;
    text-align: justify;
}

html.page-merge .visualizer {
    display: grid;
    gap: 2.25rem;
}

html.page-merge .workspace {
    display: grid;
    grid-template-columns: minmax(250px, 0.95fr) minmax(360px, 1.35fr);
    gap: 2rem;
}

html.page-merge .pseudocode,
html.page-merge .animation {
    border-radius: 16px;
    padding: 1.6rem;
}

html.page-merge .pseudocode {
    background: #091736;
    color: #eef3ff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

html.page-merge .animation {
    background: rgba(13, 26, 54, 0.9);
    color: #f4f7ff;
    display: grid;
    gap: 1.4rem;
}

html.page-merge .pseudocode h2,
html.page-merge .animation h2 {
    margin-top: 0;
    font-size: 1.25rem;
    letter-spacing: 0.04em;
}

html.page-merge ol.code-lines {
    list-style: none;
    counter-reset: line;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.4rem;
    font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.95rem;
}

html.page-merge ol.code-lines li {
    position: relative;
    padding: 0.55rem 0.9rem 0.55rem 3.4rem;
    line-height: 1.5;
    border-radius: 0.6rem;
    background: rgba(255, 255, 255, 0.04);
    transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

html.page-merge ol.code-lines li::before {
    counter-increment: line;
    content: counter(line);
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.55);
}

html.page-merge ol.code-lines li.active {
    background: linear-gradient(135deg, #6b5bff, #46a2ff);
    color: #fff;
    transform: translateX(6px) scale(1.01);
    box-shadow: 0 12px 35px rgba(70, 162, 255, 0.35);
}

html.page-merge .array-lanes {
    display: grid;
    gap: 1.4rem;
}

html.page-merge .stream-container {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
    flex-wrap: wrap;
}

html.page-merge .stream {
    flex: 1 1 240px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 1rem 1.2rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    display: grid;
    gap: 0.8rem;
}

html.page-merge .stream-legend {
    flex: 1 1 100%;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 1rem 1.2rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.85);
}

html.page-merge .legend-title {
    margin: 0 0 0.6rem;
    font-size: 0.95rem;
    letter-spacing: 0.03em;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
}

html.page-merge .legend-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

html.page-merge .legend-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    line-height: 1.4;
}

html.page-merge .legend-swatch {
    width: 26px;
    height: 18px;
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

html.page-merge .variables {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 1rem 1.2rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

html.page-merge .variables h3 {
    margin: 0 0 0.8rem;
    font-size: 1.05rem;
    letter-spacing: 0.03em;
    color: rgba(255, 255, 255, 0.9);
}

html.page-merge .variable-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.7rem;
}

html.page-merge .variable {
    display: grid;
    gap: 0.25rem;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    background: linear-gradient(160deg, rgba(124, 178, 255, 0.18), rgba(255, 152, 230, 0.2));
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

html.page-merge .variable .label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.65);
}

html.page-merge .variable .value {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
}

html.page-merge .stream h3 {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.9);
}

html.page-merge .stream-status {
    margin: 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

html.page-merge .stream-bars {
    display: flex;
    gap: 0.45rem;
    align-items: flex-end;
    min-height: 80px;
    justify-content: center;
}

html.page-merge .stream-bar {
    width: 28px;
    height: 70px;
    border-radius: 10px 10px 4px 4px;
    background: linear-gradient(160deg, #ffe2fd, #ff9ce8);
    color: #18233a;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 10px 16px rgba(0, 0, 0, 0.18);
    transition: transform 0.3s ease, filter 0.3s ease, background 0.3s ease;
}

html.page-merge .stream[data-side="right"] .stream-bar {
    background: linear-gradient(160deg, #ffeccc, #ffb75e);
}

html.page-merge .stream-bar.consumed {
    filter: grayscale(0.35) brightness(0.85);
    opacity: 0.65;
}

html.page-merge .stream-bar.active {
    transform: translateY(-6px) scale(1.05);
    box-shadow: 0 12px 22px rgba(255, 255, 255, 0.18);
}

html.page-merge .stream-bar.new {
    opacity: 0;
    animation-duration: 0.6s;
    animation-timing-function: cubic-bezier(0.2, 0.8, 0.25, 1);
    animation-fill-mode: forwards;
}

html.page-merge .stream[data-side="left"] .stream-bar.new {
    animation-name: slideFromInputLeft;
}

html.page-merge .stream[data-side="right"] .stream-bar.new {
    animation-name: slideFromInputRight;
}

@keyframes slideFromInputLeft {
    0% {
        transform: translate(42px, -24px) scale(0.8);
        opacity: 0;
        filter: brightness(1.15);
    }
    70% {
        opacity: 1;
    }
    100% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
}

@keyframes slideFromInputRight {
    0% {
        transform: translate(-42px, -24px) scale(0.8);
        opacity: 0;
        filter: brightness(1.1);
    }
    70% {
        opacity: 1;
    }
    100% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
}

html.page-merge .array-container {
    display: flex;
    gap: 0.55rem;
    justify-content: center;
    align-items: flex-end;
    min-height: 220px;
}

html.page-merge .array-bar {
    width: 40px;
    border-radius: 12px 12px 4px 4px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: #12203c;
    padding-bottom: 0.35rem;
    background: linear-gradient(160deg, #cfe4ff, #7dc4ff);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.18);
    transition: transform 0.35s ease, filter 0.35s ease, background 0.35s ease;
}

html.page-merge .array-bar.split-left {
    background: linear-gradient(160deg, #ffd1f9, #ff89d8);
}

html.page-merge .array-bar.split-right {
    background: linear-gradient(160deg, #ffe5b4, #ffb347);
}

html.page-merge .array-bar.focus {
    background: linear-gradient(160deg, #ffe27d, #ff6f61);
    color: #2e1c17;
    transform: translateY(-6px) scale(1.04);
    box-shadow: 0 18px 32px rgba(255, 111, 97, 0.35);
}

html.page-merge .array-bar.merge-target {
    background: linear-gradient(160deg, #b5f5d1, #52d68a);
    transform: translateY(-6px) scale(1.05);
}

html.page-merge .array-bar.result {
    background: linear-gradient(160deg, #94b0ff, #2f6bff);
    color: #fff;
    transform: translateY(-10px) scale(1.08);
}

html.page-merge .controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

html.page-merge .controls button {
    border: none;
    border-radius: 999px;
    padding: 0.65rem 1.3rem;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    background: linear-gradient(135deg, #5560ff, #64b4ff);
    color: #fff;
    box-shadow: 0 12px 24px rgba(68, 139, 255, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

html.page-merge .controls button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

html.page-merge .controls button:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 28px rgba(68, 139, 255, 0.4);
    filter: brightness(1.05);
}

html.page-merge .status {
    background: rgba(9, 23, 54, 0.8);
    border-radius: 14px;
    padding: 1rem 1.2rem;
    min-height: 70px;
    font-size: 0.95rem;
    line-height: 1.5;
}

@media (max-width: 900px) {
    html.page-merge .workspace {
        grid-template-columns: 1fr;
    }

    html.page-merge .array-bar {
        width: clamp(24px, 10vw, 36px);
    }

}


/* quick.html */
html.page-quick {
    color-scheme: light dark;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at top, #f8f4ff, #dcd1ff 45%, #f2e9ff 75%, #fff);
    min-height: 100vh;
}

html.page-quick body {
    margin: 0;
    padding: 2rem;
    display: flex;
    justify-content: center;
    background: rgba(255, 255, 255, 0.6);
}

html.page-quick main {
    max-width: 1100px;
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(80, 44, 110, 0.15);
    padding: 2.8rem;
    display: grid;
    gap: 2.2rem;
}

html.page-quick h1 {
    margin-top: 0;
    font-size: clamp(2rem, 4vw, 3rem);
    text-align: center;
    color: #2f2158;
}

html.page-quick p.description {
    font-size: 1.08rem;
    line-height: 1.7;
    color: #3d2f65;
    text-align: justify;
}

html.page-quick .visualizer {
    display: grid;
    gap: 2.2rem;
}

html.page-quick .workspace {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(360px, 1.3fr);
    gap: 2.2rem;
}

html.page-quick .pseudocode {
    background: #140f2d;
    color: #efe8ff;
    border-radius: 16px;
    padding: 1.4rem 1.6rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

html.page-quick .pseudocode h2,
html.page-quick .animation h2 {
    margin-top: 0;
    font-size: 1.2rem;
    letter-spacing: 0.04em;
}

html.page-quick ol.code-lines {
    list-style: none;
    counter-reset: line;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.4rem;
    font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.96rem;
}

html.page-quick ol.code-lines li {
    position: relative;
    padding-left: 3.2rem;
    line-height: 1.6;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 0.6rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

html.page-quick ol.code-lines li::before {
    counter-increment: line;
    content: counter(line);
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
}

html.page-quick ol.code-lines li.active {
    background: linear-gradient(135deg, #6f3bff, #9c6bff);
    color: #fff;
    transform: translateX(4px) scale(1.01);
    box-shadow: 0 16px 36px rgba(111, 59, 255, 0.32);
}

html.page-quick .animation {
    background: rgba(20, 15, 45, 0.92);
    color: #f9f6ff;
    border-radius: 16px;
    padding: 1.6rem;
    display: grid;
    gap: 1.7rem;
}

html.page-quick .array-container {
    display: flex;
    gap: 0.6rem;
    align-items: flex-end;
    justify-content: center;
    min-height: 240px;
}

html.page-quick .bar {
    width: 38px;
    background: linear-gradient(180deg, #8e79ff, #4732ff);
    border-radius: 12px 12px 6px 6px;
    position: relative;
    transition: transform 0.45s ease, background 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    padding-bottom: 0.55rem;
}

html.page-quick .bar.comparing {
    background: linear-gradient(180deg, #ffbd59, #ff8d1a);
    box-shadow: 0 16px 34px rgba(255, 141, 26, 0.4);
}

html.page-quick .bar.swapping {
    background: linear-gradient(180deg, #ff5f7d, #d22c54);
    box-shadow: 0 16px 36px rgba(210, 44, 84, 0.45);
}

html.page-quick .bar.pivot {
    background: linear-gradient(180deg, #33d4c2, #0f9b8b);
    box-shadow: 0 16px 38px rgba(15, 155, 139, 0.45);
}

html.page-quick .bar.active-range {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.18);
}

html.page-quick .bar.sorted {
    background: linear-gradient(180deg, #35d68b, #108b4d);
    box-shadow: 0 16px 34px rgba(16, 139, 77, 0.45);
}

html.page-quick .status {
    font-size: 1rem;
    min-height: 3rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
    line-height: 1.5;
}

html.page-quick .controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

html.page-quick .controls button {
    flex: 1 1 130px;
    padding: 0.9rem 1.2rem;
    border-radius: 12px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    background: linear-gradient(135deg, #7c45ff, #af82ff);
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

html.page-quick .controls button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(124, 69, 255, 0.35);
}

html.page-quick .controls button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    box-shadow: none;
}

html.page-quick .legend {
    display: flex;
    gap: 1.1rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: rgba(249, 246, 255, 0.9);
}

html.page-quick .legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

html.page-quick .legend em {
    display: inline-block;
    width: 15px;
    height: 15px;
    border-radius: 4px;
}

html.page-quick .legend em.compare {
    background: linear-gradient(180deg, #ffbd59, #ff8d1a);
}

html.page-quick .legend em.swap {
    background: linear-gradient(180deg, #ff5f7d, #d22c54);
}

html.page-quick .legend em.pivot {
    background: linear-gradient(180deg, #33d4c2, #0f9b8b);
}

html.page-quick .legend em.partition {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.35));
    border: 1px solid rgba(255, 255, 255, 0.4);
}

html.page-quick .legend em.sorted {
    background: linear-gradient(180deg, #35d68b, #108b4d);
}

html.page-quick footer {
    text-align: center;
    font-size: 0.92rem;
    color: #4b3a6b;
}

@media (max-width: 900px) {
    html.page-quick body {
        padding: 1rem;
    }

    html.page-quick main {
        padding: 1.7rem;
    }

    html.page-quick .workspace {
        grid-template-columns: 1fr;
    }

    html.page-quick .array-container {
        min-height: 200px;
    }

    html.page-quick .bar {
        width: clamp(26px, 7vw, 38px);
    }

}


/* spi.html */
html.page-spi {
    color-scheme: light dark;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at top, #f4f7ff, #d6dcff 40%, #f0f2ff 70%, #fff);
    min-height: 100vh;
}

html.page-spi body {
    margin: 0;
    padding: 2rem;
    display: flex;
    justify-content: center;
    background: rgba(255, 255, 255, 0.6);
}

html.page-spi main {
    max-width: 1100px;
    width: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
    padding: 2.5rem;
    display: grid;
    gap: 2rem;
}

html.page-spi h1 {
    margin-top: 0;
    font-size: clamp(2rem, 4vw, 2.8rem);
    text-align: center;
    color: #2e3a59;
}

html.page-spi p.description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #374160;
    text-align: justify;
}

html.page-spi .controls {
    display: grid;
    gap: 1.5rem;
    background: rgba(16, 30, 58, 0.92);
    color: #eef2ff;
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

html.page-spi .controls form {
    display: grid;
    gap: 1.25rem;
}

html.page-spi .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

html.page-spi label {
    display: grid;
    gap: 0.35rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-size: 0.8rem;
}

html.page-spi input[type="text"] {
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: inherit;
    font-size: 1rem;
    letter-spacing: 0.08em;
    font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    transition: background 0.3s ease, transform 0.2s ease;
}

html.page-spi input[type="text"]:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

html.page-spi button {
    border: none;
    background: linear-gradient(135deg, #2d7aff, #4ea1ff);
    color: white;
    padding: 0.85rem 1.8rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

html.page-spi button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(45, 122, 255, 0.35);
}

html.page-spi button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

html.page-spi .visualizer {
    display: grid;
    gap: 2rem;
}

html.page-spi .waveforms {
    background: rgba(16, 30, 58, 0.92);
    color: #f9fbff;
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    display: grid;
    gap: 1.5rem;
}

html.page-spi .waveform-row {
    display: grid;
    gap: 0.6rem;
}

html.page-spi .waveform-row h2 {
    margin: 0;
    font-size: 1rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(238, 242, 255, 0.8);
}

html.page-spi svg.waveform {
    width: 100%;
    height: 80px;
    border-radius: 12px;
    background: rgba(8, 16, 32, 0.65);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: visible;
}

html.page-spi path.trace {
    fill: none;
    stroke: #63a4ff;
    stroke-width: 3;
    stroke-linejoin: round;
}

html.page-spi .waveform-row:nth-child(2) path.trace {
    stroke: #6dd5a5;
}

html.page-spi .waveform-row:nth-child(3) path.trace {
    stroke: #f8b26a;
}

html.page-spi .waveform-row:nth-child(4) path.trace {
    stroke: #f67280;
}

html.page-spi rect.bit-highlight {
    fill: rgba(255, 255, 255, 0.14);
    rx: 6;
    ry: 6;
    opacity: 0;
    transition: opacity 0.3s ease;
}

html.page-spi .bit-trackers {
    display: grid;
    gap: 1.25rem;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: inset 0 0 0 1px rgba(16, 30, 58, 0.06);
}

html.page-spi .register {
    display: grid;
    gap: 0.75rem;
}

html.page-spi .register h3 {
    margin: 0;
    font-size: 1rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #344057;
}

html.page-spi .bit-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 0.5rem;
}

html.page-spi .bit-box {
    background: linear-gradient(145deg, #f5f7ff, #e5e9ff);
    color: #293553;
    border-radius: 10px;
    padding: 0.65rem 0.35rem;
    text-align: center;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.06em;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

html.page-spi .bit-box.active {
    transform: translateY(-6px);
    box-shadow: 0 18px 30px rgba(45, 122, 255, 0.25);
    background: linear-gradient(145deg, #2d7aff, #4ea1ff);
    color: #fff;
}

html.page-spi .bit-box.sent {
    opacity: 0.65;
}

html.page-spi .status-board {
    background: rgba(16, 30, 58, 0.92);
    color: #f9fbff;
    border-radius: 16px;
    padding: 1.5rem;
    display: grid;
    gap: 0.75rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

html.page-spi .status-board h3 {
    margin: 0;
    font-size: 1rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(238, 242, 255, 0.75);
}

html.page-spi .status-board p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
}

html.page-spi .legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.9rem;
    color: rgba(238, 242, 255, 0.75);
}

html.page-spi .legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

html.page-spi .legend i {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 4px;
}

html.page-spi .legend i.clock {
    background: #63a4ff;
}

html.page-spi .legend i.mosi {
    background: #6dd5a5;
}

html.page-spi .legend i.miso {
    background: #f8b26a;
}

html.page-spi .legend i.cs {
    background: #f67280;
}

@media (max-width: 768px) {
    html.page-spi body {
        padding: 1.5rem;
    }

    html.page-spi main {
        padding: 1.75rem;
    }

    html.page-spi svg.waveform {
        height: 70px;
    }

    html.page-spi .bit-strip {
        grid-template-columns: repeat(auto-fit, minmax(32px, 1fr));
    }

}

