:root {
    --primary-color: #00FFFF;
    --secondary-color: #FFD504;
    --bg-dark: #050505;
    --hud-bg: rgba(0, 20, 20, 0.85);
    --hud-border: rgba(0, 255, 255, 0.3);
    --text-main: #e0faff;
    --text-muted: #8caeb3;
    --font-heading: 'Teko', sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

@font-face {
    font-family: Teko;
    src: url("Teko/Teko-VariableFont_wght.ttf");
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    /* Cybergrid background */
    background-image:
        linear-gradient(rgba(0, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.05) 1px, transparent 1px),
        radial-gradient(circle at 50% 50%, rgba(0, 20, 20, 0) 0%, rgba(0, 0, 0, 0.8) 100%);
    background-size: 40px 40px, 40px 40px, 100% 100%;
    color: var(--text-main);
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Layout */
.app {
    display: grid;
    grid-template-columns: 1fr 400px;
    width: 100%;
    max-width: 1600px;
    height: 95vh;
    gap: 15px;
    padding: 15px;
}

/* Common HUD Panel Styles */
.hud-panel {
    background: var(--hud-bg);
    border: 1px solid var(--hud-border);
    position: relative;
    /* Removed clip-path that was cutting content too aggressively */
    border-radius: 0;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.1);
}

/* Add an inner border effect instead of modifying the box shape */
/* Cut corner effect for bottom right */
.hud-panel {
    clip-path: polygon(0 0,
            100% 0,
            100% calc(100% - 30px),
            calc(100% - 30px) 100%,
            0 100%);
}

/* Corner Accents */
.hud-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    --c: var(--primary-color);
    background:
        /* Top Left */
        linear-gradient(to right, var(--c) 2px, transparent 2px) top left,
        linear-gradient(to bottom, var(--c) 2px, transparent 2px) top left,

        /* Top Right */
        linear-gradient(to left, var(--c) 2px, transparent 2px) top right,
        linear-gradient(to bottom, var(--c) 2px, transparent 2px) top right,

        /* Bottom Left */
        linear-gradient(to right, var(--c) 2px, transparent 2px) bottom left,
        linear-gradient(to top, var(--c) 2px, transparent 2px) bottom left,

        /* Bottom Right (Cut Line) - Calculated for 30px cut */
        linear-gradient(135deg, transparent 46px, var(--c) 46px, var(--c) 49px, transparent 49px) bottom right;

    background-size: 15px 15px, 15px 15px,
        15px 15px, 15px 15px,
        15px 15px, 15px 15px,
        50px 50px;
    background-repeat: no-repeat;
    background-origin: border-box;
    pointer-events: none;
    z-index: 10;
}

/* Decoration for the cut corner - removed */
.hud-panel::after {
    display: none;
}

/* 3D Viewer Section */
.viewer-section {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Scanline effect */
.viewer-section::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

.brand-bg-text {
    position: absolute;
    font-family: var(--font-heading);
    font-size: 10rem;
    color: rgba(0, 255, 255, 0.03);
    right: -20px;
    bottom: 0;
    line-height: 0.8;
    pointer-events: none;
    white-space: nowrap;
    z-index: 1;
    text-align: right;
}

.brand-title {
    position: absolute;
    top: 20px;
    left: 30px;
    font-family: var(--font-heading);
    font-size: 3rem;
    color: var(--primary-color);
    letter-spacing: 4px;
    text-shadow: 0 0 10px var(--primary-color);
    margin: 0;
    z-index: 20;
    border-left: 5px solid var(--secondary-color);
    padding-left: 15px;
    line-height: 0.9;
}

#parent {
    width: 100%;
    max-width: 800px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 10;
}

#parent canvas {
    outline: none;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(0, 255, 255, 0.2));
}

#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--primary-color);
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid var(--primary-color);
    padding: 10px 30px;
    display: none;
    z-index: 100;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Sidebar Section */
.controls-section {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    overflow-y: auto;
}

.controls-section::-webkit-scrollbar {
    width: 4px;
}

.controls-section::-webkit-scrollbar-thumb {
    background: var(--primary-color);
}

.controls-section::-webkit-scrollbar-track {
    background: rgba(0, 255, 255, 0.1);
}

.section-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--hud-border);
    padding-bottom: 2px;
    margin-bottom: 5px;
    letter-spacing: 2px;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
}

.section-title::after {
    content: '///';
    color: var(--secondary-color);
    font-size: 1rem;
    align-self: center;
}

.text-content {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-muted);
    font-family: 'Courier New', Courier, monospace;
    /* Monospace fits HUD better */
}

.text-content a {
    color: var(--secondary-color);
    text-decoration: none;
    background: rgba(255, 213, 4, 0.1);
    padding: 0 4px;
    transition: 0.2s;
}

.text-content a:hover {
    background: var(--secondary-color);
    color: #000;
    box-shadow: 0 0 10px var(--secondary-color);
}

.steps-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 10px;
}

.steps-list li {
    display: flex;
    gap: 15px;
    color: var(--text-muted);
    font-size: 0.85rem;
    align-items: center;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    padding-left: 10px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);
    padding: 8px 10px;
}

.step-number {
    color: var(--bg-dark);
    background: var(--secondary-color);
    font-weight: bold;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    min-width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
}

.highlight {
    color: var(--primary-color);
    font-weight: 600;
}

/* Controls */
.action-area {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px dashed var(--hud-border);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.button {
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    font-family: var(--font-heading);
    font-size: 1.4rem;
    padding: 0 10px;
    height: 55px;
    /* Fixed height */
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    text-align: center;
    position: relative;
    overflow: hidden;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);

    /* Flex alignment for text */
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
    /* Prevent wrapping */
}

.button span {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.button:hover::before {
    left: 100%;
}

.button:hover {
    background: var(--primary-color);
    color: var(--bg-dark);
    box-shadow: 0 0 20px var(--primary-color);
    text-shadow: none;
}

.button-secondary {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    background: rgba(255, 213, 4, 0.05);
}

.button-secondary:hover {
    background: var(--secondary-color);
    color: var(--bg-dark);
    box-shadow: 0 0 20px var(--secondary-color);
}

#textureUpload {
    display: none;
}

/* Responsive */
@media (max-width: 1024px) {
    .app {
        grid-template-columns: 1fr;
        height: auto;
        padding: 0;
        max-width: 100%;
        display: flex;
        flex-direction: column;
    }

    body {
        align-items: flex-start;
        height: auto;
        overflow-y: auto;
    }

    .viewer-section {
        height: 50vh;
        min-height: 400px;
        clip-path: none;
        border: none;
        border-bottom: 2px solid var(--primary-color);
    }

    .viewer-section::after {
        display: none;
        /* Performance on mobile */
    }

    .controls-section {
        margin: 0;
        border: none;
        width: 100%;
        clip-path: none;
    }
}