/* ===== Scrollbar ausblenden ===== */
::-webkit-scrollbar {
    width: 0;
    height: 0;
    background: transparent;
}

html {
    scrollbar-width: none;
}

body {
    overflow-x: hidden;
    overflow-y: auto;
}

/* ===== Variablen ===== */
:root {
    --bg: #111;
    --text: rgba(255, 255, 255, 0.92);
    --accent: #2997ff;
    --secondary: rgba(255, 255, 255, 0.6);
    --terminal-bg: rgba(25, 25, 25, 0.85);
    --glass: rgba(50, 50, 50, 0.5);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-shadow: 0 4px 6px rgba(0, 0, 0, 0.1),
                    0 8px 24px rgba(0, 0, 0, 0.2),
                    0 16px 40px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease-out;
}

/* ===== Light Theme ===== */
[data-theme="light"] {
    --bg: #f5f5f7;
    --text: rgba(0, 0, 0, 0.92);
    --accent: #0071e3;
    --secondary: rgba(0, 0, 0, 0.7);
    --terminal-bg: rgba(245, 245, 247, 0.85);
    --glass: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.12);
    --glass-shadow: 0 4px 6px rgba(0, 0, 0, 0.05),
                    0 8px 24px rgba(0, 0, 0, 0.1),
                    0 16px 40px rgba(0, 0, 0, 0.08);
}

/* ===== Allgemein ===== */
* {
    text-rendering: optimizeLegibility;
}

/* ===== Hintergrund-Gradient ===== */
body::before {
    content: "";
    position: fixed;
    top: -10px;
    left: -10px;
    width: calc(100% + 20px);
    height: calc(100% + 20px);
    background:
        radial-gradient(circle at 20% 30%, rgba(13, 75, 94, 0.25) 5%, transparent 20%) repeat,
        radial-gradient(circle at 80% 70%, rgba(59, 169, 156, 0.25) 5%, transparent 20%) repeat,
        radial-gradient(circle at 40% 80%, rgba(107, 123, 141, 0.2) 5%, transparent 25%) repeat,
        radial-gradient(circle at 60% 20%, rgba(27, 105, 120, 0.2) 5%, transparent 25%) repeat;
    background-size: 200% 200%;
    animation: gradientMove 40s ease infinite;
    z-index: -2;
    opacity: 0.6;
    transition: opacity 2s ease-in-out;
}

[data-theme="light"] body::before {
    background:
        radial-gradient(circle at 20% 30%, rgba(13, 75, 94, 0.3) 5%, transparent 20%) repeat,
        radial-gradient(circle at 80% 70%, rgba(59, 169, 156, 0.3) 5%, transparent 20%) repeat,
        radial-gradient(circle at 40% 80%, rgba(107, 123, 141, 0.25) 5%, transparent 25%) repeat,
        radial-gradient(circle at 60% 20%, rgba(27, 105, 120, 0.25) 5%, transparent 25%) repeat;
    opacity: 0.7;
}

[data-theme="light"] .contact-image {
    filter: invert(1) brightness(0.85);
}

@keyframes gradientMove {
    0% {
        background-position: 0% 0%;
        opacity: 0.5;
    }
    50% {
        background-position: 100% 100%;
        opacity: 0.7;
    }
    100% {
        background-position: 0% 0%;
        opacity: 0.5;
    }
}

@media (prefers-reduced-motion: reduce) {
    body::before {
        animation: none;
    }
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    color: var(--text);
    font-family: 'SF Mono', -apple-system, BlinkMacSystemFont, sans-serif;
    position: relative;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* ===== Tilt Wrapper ===== */
#tiltWrapper {
    display: flex;
    justify-content: center;
    width: 100%;
    perspective: 600px;
    padding: 16px 0;
}

.terminal-container {
    width: 80%;
    max-width: 700px;
    height: auto;
    transform-style: preserve-3d;
    transition: transform 0.08s ease-out;
    display: flex;
    flex-direction: column;
    position: relative;
    box-sizing: border-box;
    will-change: transform;
}

/* ===== Terminal ===== */
.terminal {
    width: 100%;
    border-radius: 24px;
    border: 2px solid var(--glass-border);
    position: relative;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    background: var(--terminal-bg);
    padding: 1.2rem;
    transform-style: preserve-3d;
    box-shadow: var(--glass-shadow);
    overflow: hidden;
}

.terminal::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 24px;
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.08) 0%,
            transparent 50%,
            rgba(255, 255, 255, 0.04) 100%);
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}

/* ===== Header ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    position: relative;
    z-index: 3;
}

.title {
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    font-weight: 600;
    margin: 0;
    background: linear-gradient(90deg, var(--accent), #ff2d55);
    background-clip: text;
    color: transparent;
    letter-spacing: -0.5px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    cursor: pointer;
    text-decoration: none;
}

.header-buttons {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.settings-toggle,
.theme-toggle {
    background: var(--glass);
    border: 2px solid var(--glass-border);
    border-radius: 50%;
    width: 2.2rem;
    height: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    color: var(--text);
    padding: 0;
    outline: none;
    box-shadow: var(--glass-shadow);
}

.settings-toggle:hover,
.settings-toggle.active,
.theme-toggle:hover,
.theme-toggle.active {
    background: var(--accent);
    color: white;
    transform: scale(1.08);
}

.theme-toggle i,
.settings-toggle i {
    pointer-events: none;
}

.theme-toggle i {
    color: inherit;
}

/* ===== Prompt ===== */
.prompt {
    display: flex;
    align-items: center;
    margin: 0.6rem 0;
    position: relative;
    z-index: 100;
}

.prompt-text {
    color: var(--accent);
    margin-right: 0.4rem;
    font-size: clamp(0.9rem, 3.5vw, 1.1rem);
    cursor: pointer;
}

.prompt-input-wrapper {
    position: relative;
    flex: 1;
    z-index: 100;
}

.prompt-input {
    background: transparent;
    border: none;
    color: var(--text);
    font-family: inherit;
    font-size: clamp(0.9rem, 3.5vw, 1.1rem);
    outline: none;
    width: 100%;
    caret-color: var(--accent);
}

.placeholder-hint {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--secondary);
    font-size: clamp(0.9rem, 3.5vw, 1.1rem);
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.placeholder-hint .clickable-question {
    pointer-events: auto;
    cursor: pointer;
    color: inherit;
    text-decoration: none;
}

.prompt-input:not(:placeholder-shown)~.placeholder-hint {
    display: none;
}

.clear-terminal-btn {
    background: transparent;
    border: none;
    color: var(--secondary);
    cursor: pointer;
    font-size: 1rem;
    margin-left: 0.4rem;
    padding: 0;
    display: none;
    transition: color 0.2s;
}

.clear-terminal-btn.visible {
    display: inline-block;
}

.clear-terminal-btn:hover {
    color: var(--accent);
}

/* ===== Autocomplete ===== */
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    width: max-content;
    min-width: 100%;
    background: var(--terminal-bg);
    border: 2px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.2rem 0;
    margin-top: 4px;
    display: none;
    z-index: 999999;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.autocomplete-list.active {
    display: block;
}

.autocomplete-item {
    padding: 0.5rem 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--secondary);
    transition: background 0.15s;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: rgba(41, 151, 255, 0.2);
    color: var(--text);
}

/* ===== Terminal Output ===== */
.terminal-output {
    display: none;
    max-height: 180px;
    overflow-y: auto;
    margin-top: 0.4rem;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 0.4rem;
    font-size: 0.8rem;
    color: var(--secondary);
    position: relative;
    z-index: 20;
}

.terminal-output.active {
    display: block;
}

.terminal-output .output-line {
    margin: 0.15rem 0;
    word-break: break-all;
}

.terminal-output .output-line .clickable-command {
    cursor: pointer;
    color: var(--secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.terminal-output .output-line .clickable-command:hover {
    color: var(--text);
    text-decoration: underline;
}

/* ===== Quote ===== */
.quote-container {
    margin: 0.8rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 50px;
    position: relative;
    z-index: 3;
}

.quote-display {
    color: var(--secondary);
    font-size: clamp(0.8rem, 2.8vw, 0.95rem);
    font-style: italic;
    text-align: center;
    opacity: 0.8;
    transition: opacity 0.3s;
    padding: 0.3rem 0.8rem;
    margin-bottom: 0.3rem;
    max-width: 100%;
    word-wrap: break-word;
}

.quote-controls {
    display: flex;
    gap: 0.4rem;
}

.quote-btn {
    background: var(--glass);
    backdrop-filter: blur(4px);
    border: 2px solid var(--glass-border);
    border-radius: 6px;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.75rem;
    color: var(--text);
    box-shadow: var(--glass-shadow);
}

.quote-btn:hover,
.quote-btn.active {
    transform: translateY(-2px);
    background: rgba(41, 151, 255, 0.2);
}

/* ===== Menu ===== */
.menu {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    margin: 0.8rem 0;
    position: relative;
    z-index: 3;
}

.menu-item {
    cursor: pointer;
    transition: var(--transition);
    padding: 1.2rem 1.2rem;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    background: var(--glass);
    backdrop-filter: blur(4px);
    border: 2px solid var(--glass-border);
    position: relative;
    overflow: hidden;
    box-shadow: var(--glass-shadow);
    transform-style: preserve-3d;
}

.menu-item-content {
    display: flex;
    align-items: center;
    width: 100%;
}

.menu-item-icon {
    margin-right: 0.6rem;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.shortcut {
    margin-left: 0.5rem;
    color: var(--secondary);
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    transition: background 0.2s, color 0.2s;
}

.item-description {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, margin-top 0.3s;
    padding: 0 0.8rem;
    font-size: 0.8rem;
    line-height: 1.3;
    color: var(--secondary);
}

/* ===== Contact Links ===== */
.contact-links {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
    margin: 1.2rem 0;
    position: relative;
    z-index: 3;
}

.contact-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.3rem 0.5rem;
    border-radius: 12px;
    background: var(--glass);
    border: 2px solid var(--glass-border);
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
    cursor: pointer;
    text-align: center;
    position: relative;
    min-height: 130px;
    box-sizing: border-box;
    box-shadow: var(--glass-shadow);
}

.contact-icon {
    font-size: 1.4rem;
    margin-bottom: 0.2rem;
}

.contact-image {
    display: block;
    max-width: 100%;
    height: 2.5rem;
    object-fit: contain;
    margin-bottom: 0.2rem;
}

.contact-description {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, margin-top 0.3s;
    font-size: 0.8rem;
    color: var(--secondary);
    width: 100%;
}

.contact-info {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.3rem;
    font-size: 0.8rem;
}

.copy-btn {
    background: transparent;
    border: none;
    color: var(--secondary);
    cursor: pointer;
    margin-left: 0.2rem;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 0;
    font-size: 0.7rem;
}

.copy-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.65rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 3px;
}

.copy-tooltip.show {
    opacity: 1;
}

.wishlist-link,
.mod-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.2rem;
    color: var(--secondary);
    text-decoration: none;
    transition: color 0.2s;
    font-size: 0.75rem;
    gap: 0.15rem;
}

.mod-link:hover,
.wishlist-link:hover {
    color: var(--accent);
}

.external-icon {
    margin-left: 0.15rem;
    font-size: 0.6rem;
    opacity: 0.6;
}

/* ===== Hover-Effekte (Tilt an) ===== */
body.tilt-active .menu-item:hover,
body.tilt-active .menu-item.active,
body.tilt-active .menu-item.show-description,
body.tilt-active .contact-item:hover,
body.tilt-active .contact-item.active,
body.tilt-active .contact-item.show-description {
    transform: translateY(-3px);
    background: rgba(41, 151, 255, 0.15);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

body.tilt-active .menu-item:hover .item-description,
body.tilt-active .menu-item.active .item-description,
body.tilt-active .menu-item.show-description .item-description,
body.tilt-active .contact-item:hover .contact-description,
body.tilt-active .contact-item.active .contact-description,
body.tilt-active .contact-item.show-description .contact-description {
    max-height: 70px;
    margin-top: 0.6rem;
}

body.tilt-active .menu-item:hover .shortcut,
body.tilt-active .menu-item.active .shortcut,
body.tilt-active .menu-item.show-description .shortcut,
body.tilt-active .contact-item:hover .copy-btn,
body.tilt-active .contact-item.active .copy-btn,
body.tilt-active .contact-item.show-description .copy-btn {
    opacity: 1;
}

/* ===== Hover-Effekte (Tilt aus) ===== */
body:not(.tilt-active) .menu-item:hover,
body:not(.tilt-active) .menu-item.active,
body:not(.tilt-active) .menu-item.show-description,
body:not(.tilt-active) .contact-item:hover,
body:not(.tilt-active) .contact-item.active,
body:not(.tilt-active) .contact-item.show-description {
    transform: translateY(-2px);
    background: rgba(41, 151, 255, 0.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body:not(.tilt-active) .menu-item:hover .item-description,
body:not(.tilt-active) .menu-item.active .item-description,
body:not(.tilt-active) .menu-item.show-description .item-description,
body:not(.tilt-active) .contact-item:hover .contact-description,
body:not(.tilt-active) .contact-item.active .contact-description,
body:not(.tilt-active) .contact-item.show-description .contact-description {
    max-height: 70px;
    margin-top: 0.6rem;
}

body:not(.tilt-active) .menu-item:hover .shortcut,
body:not(.tilt-active) .menu-item.active .shortcut,
body:not(.tilt-active) .menu-item.show-description .shortcut {
    background: var(--accent);
    color: white;
    transform: scale(1.04);
}

body:not(.tilt-active) .contact-item:hover .copy-btn,
body:not(.tilt-active) .contact-item.active .copy-btn,
body:not(.tilt-active) .contact-item.show-description .copy-btn {
    opacity: 1;
}

/* ===== Settings Menu ===== */
.settings-menu {
    position: absolute;
    top: 3.5rem;
    right: 0;
    background: var(--terminal-bg);
    border-radius: 12px;
    padding: 0.8rem;
    border: 2px solid var(--glass-border);
    z-index: 1001;
    display: none;
    width: 200px;
    color: var(--text);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.settings-menu.active {
    display: block;
}

.settings-item {
    padding: 0.4rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settings-label {
    font-size: 0.8rem;
    margin-right: 0.4rem;
    color: var(--text);
}

.settings-btn {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.settings-btn:hover,
.settings-btn.active {
    background: rgba(41, 151, 255, 0.2);
}

/* ===== FPS Counter ===== */
.fps-counter {
    position: fixed;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.5);
    color: var(--accent);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
    z-index: 9999;
    pointer-events: none;
    display: none;
    font-weight: 600;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.fps-counter.visible {
    display: block;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .contact-links {
        grid-template-columns: repeat(3, 1fr);
    }
}

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

    .terminal {
        padding: 1rem;
        border-radius: 20px;
    }

    .contact-links {
        grid-template-columns: repeat(2, 1fr);
    }

    .settings-menu {
        top: 3.5rem;
        right: 0;
        width: 180px;
    }

    .terminal-container {
        width: 95%;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .terminal {
        padding: 0.8rem;
        border-radius: 16px;
    }

    .contact-links {
        grid-template-columns: 1fr;
    }

    .terminal-container {
        width: 100%;
        padding: 0 8px;
        box-sizing: border-box;
    }

    #tiltWrapper {
        padding: 8px 0;
    }
}

/* ===== Touch-Geräte: Kein Backdrop-Filter ===== */
@media (pointer: coarse) {
    .terminal {
        backdrop-filter: none;
    }

    .menu-item,
    .contact-item {
        backdrop-filter: none;
    }

    .settings-toggle,
    .theme-toggle {
        backdrop-filter: none;
    }
}