:root {
    --bg: #000;
    --fg: #fff;
    --accent: #ff6666;
    --muted: #999;
    --border: #222;
    --link: #ff6666;
    --link-hover: #ff8888;
    --input-bg: transparent;
    --input-fg: #fff;
    --divider-pad: 10px;
    --divider-gap: 16px;
    --fade-dy: 6px;
    --moe-counter-height: clamp(44px, 12vw, 88px);
}

.light-theme {
    --bg: #fafafa;
    --fg: #121212;
    --accent: #d12f2f;
    --muted: #555;
    --border: #ddd;
    --link: #c42525;
    --link-hover: #e04c4c;
    --input-bg: transparent;
    --input-fg: #121212;
}

* {
    box-sizing: border-box;
}

html,
body {
    background-color: var(--bg);
    color: var(--fg);
    font-family: "Fira Code", monospace;
    margin: 0;
    padding: 0;
    text-align: left;
    min-height: 100%;
    overflow-x: hidden;
}

body {
    padding: 16px;
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

.terminal-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 16px;
    background-color: var(--bg);
    text-align: left;
    overflow-x: hidden;
    animation: fadeIn 0.85s ease-out;
    animation-delay: 0.02s;
    animation-fill-mode: both;
}

.terminal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--fg);
    padding-bottom: var(--divider-pad);
    margin-bottom: var(--divider-gap);
    animation: fadeIn 0.85s ease-out;
    animation-delay: 0.05s;
    animation-fill-mode: both;
    position: relative;
    z-index: 1;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeIn 0.9s ease-out;
    animation-delay: 0.12s;
    animation-fill-mode: both;
}

.terminal-title {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--fg);
    letter-spacing: 0.3px;
    animation: fadeIn 0.9s ease-out;
    animation-delay: 0.08s;
    animation-fill-mode: both;
}

.theme-toggle-link,
.terminal-toggle-link {
    color: var(--fg);
    text-decoration: underline;
    cursor: pointer;
}

.terminal-toggle-link {
    display: none;
}

.divider {
    display: none !important;
    border: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
}

.terminal-content {
    animation: fadeIn 0.9s ease-out;
    animation-delay: 0.18s;
    animation-fill-mode: both;
    overflow-x: hidden;
}

.content-container {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
    align-items: flex-start;
    overflow-x: hidden;
    animation: fadeIn 0.85s ease-out;
    animation-delay: 0.22s;
    animation-fill-mode: both;
}

.ascii-art-container {
    flex: 1;
    min-width: 300px;
    text-align: left;
    padding-right: 6px;
    animation: fadeIn 0.9s ease-out;
    animation-delay: 0.26s;
    animation-fill-mode: both;
    overflow: hidden;
}

.system-info-container {
    flex: 1;
    min-width: 300px;
    text-align: left;
    padding-left: 6px;
    overflow: hidden;
    animation: fadeIn 0.9s ease-out;
    animation-delay: 0.32s;
    animation-fill-mode: both;
}

.ascii-art {
    color: var(--fg);
    margin: 0;
    white-space: pre;
    text-align: left;
    display: block;
    font-size: 0.75em;
    line-height: 1.2;
    animation: fadeIn 0.9s ease-out;
    animation-delay: 0.28s;
    animation-fill-mode: both;
    max-width: 100%;
    overflow: hidden;
}

.system-info {
    margin: 0;
    text-align: left;
    max-width: 100%;
    overflow: hidden;
}

.system-info p {
    margin: 6px 0;
    word-break: break-word;
    overflow-wrap: anywhere;
    animation: fadeIn 0.4s ease-out;
    animation-fill-mode: both;
}

.system-info p:nth-child(1) {
    animation-delay: 0.1s;
}

.system-info p:nth-child(2) {
    animation-delay: 0.15s;
}

.system-info p:nth-child(3) {
    animation-delay: 0.2s;
}

.system-info p:nth-child(4) {
    animation-delay: 0.25s;
}

.system-info p:nth-child(5) {
    animation-delay: 0.3s;
}

.system-info p:nth-child(6) {
    animation-delay: 0.35s;
}

.system-info p:nth-child(7) {
    animation-delay: 0.4s;
}

.system-info p:nth-child(8) {
    animation-delay: 0.45s;
}

.system-info p:nth-child(9) {
    animation-delay: 0.5s;
}

.system-info p:nth-child(10) {
    animation-delay: 0.55s;
}

.system-info p:nth-child(11) {
    animation-delay: 0.6s;
}

.system-info p:nth-child(12) {
    animation-delay: 0.65s;
}

.system-info .service-link {
    color: var(--fg);
    text-decoration: underline;
    margin-right: 10px;
}

.system-info .service-link:hover {
    color: var(--link);
    text-decoration: underline;
}

.highlight {
    color: var(--accent);
    font-weight: bold;
}

.command-terminal {
    margin-top: var(--divider-gap);
    border-top: 1px solid var(--fg);
    padding-top: var(--divider-pad);
    animation: fadeIn 0.9s ease-out;
    animation-delay: 0.95s;
    animation-fill-mode: both;
    overflow-x: hidden;
}

#output {
    margin-top: 8px;
    white-space: pre-wrap;
    color: var(--fg);
    word-break: break-word;
    overflow-x: hidden;
}

.command-container {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
    margin: 2px 0;
    position: relative;
    width: 100%;
    max-width: 100%;
}

.user-prompt {
    color: var(--accent);
    font-weight: bold;
    margin-right: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.prompt-line {
    color: var(--accent);
    font-weight: bold;
    margin-top: 5px;
    display: inline-block;
}

.command-input {
    background-color: var(--input-bg);
    color: var(--input-fg);
    border: none;
    padding: 0;
    font-family: "Fira Code", monospace;
    flex: 1 1 140px;
    min-width: 1ch;
    max-width: 100%;
    outline: none;
    caret-color: var(--accent);
}

.command-input:focus {
    outline: none;
}

.command-input-with-placeholder::placeholder {
    color: var(--muted);
    font-style: italic;
    opacity: 0.9;
}

.command-input-disabled {
    opacity: 0.6;
}

.submitted-command {
    color: var(--input-fg);
    white-space: pre-wrap;
    word-break: break-word;
    display: inline-flex;
    align-items: baseline;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
}

.command-input,
.submitted-command {
    font-weight: 400;
    font-size: 1em;
    line-height: 1.2;
    letter-spacing: 0;
    font-kerning: normal;
    font-variant-ligatures: common-ligatures contextual;
    font-feature-settings:
        "liga" 1,
        "calt" 1;
    font-family: "Fira Code", monospace;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.command-output {
    margin: 0;
}

.command-result p {
    margin: 0;
    line-height: 1.4;
}

.command-output + .command-output {
    margin-top: 6px;
}

.completion-output {
    opacity: 0.9;
}

.print-line {
    animation: lineIn 0.12s ease-out;
}

.image-container {
    animation: fadeIn 0.5s ease-out;
    animation-delay: 0.7s;
    animation-fill-mode: both;
    width: 252px;
    height: 80px;
    overflow: hidden;
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
    filter: brightness(1.5) grayscale(100%);
    display: block;
}

.mobile-services {
    display: none;
}

.mobile-services .mobile-services-title {
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 4px;
    animation: fadeIn 0.6s ease-out;
    animation-delay: 0.42s;
    animation-fill-mode: both;
    text-align: center;
}

.mobile-services .services-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 0 0 10px;
    padding: 0;
    animation: fadeIn 0.6s ease-out;
    animation-delay: 0.44s;
    animation-fill-mode: both;
}

.mobile-services .services-row:nth-child(2) {
    animation-delay: 0.5s;
}

.mobile-services .services-row:nth-child(3) {
    animation-delay: 0.56s;
}

.mobile-services .services-row:nth-child(4) {
    animation-delay: 0.62s;
}

.mobile-services .services-row:nth-child(5) {
    animation-delay: 0.68s;
}

.mobile-services .services-row:nth-child(6) {
    animation-delay: 0.74s;
}

.mobile-services .services-row:nth-child(7) {
    animation-delay: 0.8s;
}

.mobile-services .services-row:nth-child(8) {
    animation-delay: 0.86s;
}

.mobile-services .service-link {
    color: var(--fg);
    text-decoration: underline;
    padding: 2px 6px;
    line-height: 1.3;
    display: inline-block;
    white-space: normal;
    overflow-wrap: anywhere;
    border-radius: 4px;
}

.mobile-services .service-link:hover,
.mobile-services .service-link:focus-visible,
.mobile-services .service-link:active {
    color: var(--link);
}

.mobile-services a {
    -webkit-tap-highlight-color: var(--link);
}

.moe-counter {
    display: none;
    width: 100%;
    max-width: 100%;
}

.moe-counter img,
.moe-counter canvas,
.moe-counter svg {
    height: var(--moe-counter-height);
    width: auto;
    max-width: 100%;
    display: block;
    filter: brightness(1.5) grayscale(100%);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(var(--fade-dy));
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes lineIn {
    from {
        opacity: 0;
        transform: translateY(2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .terminal-toggle-link {
        display: inline;
    }

    .terminal-header {
        border-bottom: 1px solid var(--fg);
        margin-bottom: var(--divider-gap);
        padding-bottom: var(--divider-pad);
    }

    .system-info-container,
    .command-terminal {
        display: none !important;
    }

    .command-container {
        flex-wrap: wrap;
        gap: 8px;
    }

    .command-input,
    .submitted-command {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
    }

    html.mobile-terminal-mode .command-terminal {
        display: block !important;
        max-width: 100%;
        overflow-x: auto;
        padding-bottom: var(--divider-pad);
        animation: fadeIn 0.6s ease-out;
        animation-delay: 0.44s;
        animation-fill-mode: both;
    }

    html.mobile-terminal-mode #output {
        font-size: 0.95rem;
        white-space: pre-wrap;
    }

    html.mobile-terminal-mode .command-container {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    html.mobile-terminal-mode .command-input,
    html.mobile-terminal-mode .submitted-command {
        font-size: 0.95rem;
        word-break: break-word;
    }

    html.mobile-terminal-mode .command-input {
        min-width: 0;
        width: auto;
        max-width: 100%;
        flex: 1 1 auto;
    }

    html.mobile-terminal-mode .command-input::placeholder {
        font-size: 0.85rem;
    }

    html.mobile-terminal-mode .mobile-services {
        display: none !important;
    }

    .content-container {
        flex-direction: column;
        gap: 12px;
    }

    .ascii-art-container,
    .system-info-container {
        min-width: 100%;
    }

    .ascii-art-container {
        text-align: center;
        padding: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .ascii-art {
        text-align: center;
        display: inline-block;
        margin: 0 auto;
        font-size: 0.55em;
    }

    .moe-counter {
        display: flex;
        align-items: center;

        justify-content: center;
        margin-top: 10px;
        animation: fadeIn 0.6s ease-out;
        animation-delay: 0.12s;
        animation-fill-mode: both;
    }

    body {
        padding: 16px;
    }

    .terminal-container {
        padding: 16px;
    }

    .mobile-services {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        border-top: 1px solid var(--fg);
        padding-top: var(--divider-pad);
        margin-top: var(--divider-gap);
        animation: fadeIn 0.88s ease-out;
        animation-delay: 0.38s;
        animation-fill-mode: both;
    }

    .mobile-services .mobile-services-title {
        font-size: 1.25rem;
    }

    .mobile-services .services-row {
        margin-bottom: 14px;
    }

    .mobile-services .service-link {
        font-size: 1.2rem;
    }
}

@media (max-width: 768px) {
    html.force-desktop .mobile-services {
        display: none !important;
    }

    html.force-desktop .terminal-header {
        border-bottom: 1px solid var(--fg);
    }

    html.force-desktop .system-info-container,
    html.force-desktop .command-terminal {
        display: block !important;
    }

    html.force-desktop .content-container {
        flex-direction: row;
        gap: 16px;
    }

    html.force-desktop .ascii-art-container {
        text-align: left;
        padding-right: 6px;
        display: block;
    }

    html.force-desktop .ascii-art {
        text-align: left;
        display: block;
        font-size: 0.75em;
    }

    html.force-desktop .moe-counter {
        display: none !important;
    }

    html.force-desktop body {
        padding: 16px;
    }

    html.force-desktop .terminal-container {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .ascii-art {
        font-size: 0.45em;
    }

    .command-container {
        gap: 6px;
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .command-input,
    .submitted-command {
        font-size: 0.85rem;
    }

    .command-input {
        width: 100%;
    }

    .user-prompt {
        font-size: 0.85rem;
    }

    .command-input::placeholder {
        font-size: 0.7rem;
    }
}

html,
body,
.terminal-container,
.terminal-content,
.content-container,
.ascii-art-container,
.system-info-container,
.ascii-art,
.system-info,
.command-terminal,
#output {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
.terminal-container::-webkit-scrollbar,
.terminal-content::-webkit-scrollbar,
.content-container::-webkit-scrollbar,
.ascii-art-container::-webkit-scrollbar,
.system-info-container::-webkit-scrollbar,
.ascii-art::-webkit-scrollbar,
.system-info::-webkit-scrollbar,
.command-terminal::-webkit-scrollbar,
#output::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}
