@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
@import url('https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@2.44.0/tabler-icons.min.css');

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    image-rendering: pixelated;
}

html {
    font-size: 16px;
    transition: font-size 0.2s ease;
}

body {
    background: #0e1628;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
    font-family: 'Press Start 2P', monospace;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    top: 0; left: 0;
    width: 2px; height: 2px;
    background: transparent;
    box-shadow:
        12vw 8vh #fff, 22vw 32vh #fffdf0, 44vw 13vh #f7d070,
        74vw 22vh #fff, 84vw 10vh #fffdf0, 91vw 38vh #fcae1e,
        6vw 58vh #fff, 19vw 78vh #fffdf0, 39vw 68vh #fff,
        61vw 84vh #f7d070, 71vw 58vh #fff, 86vw 74vh #fffdf0,
        32vw 46vh #fff, 67vw 16vh #fff, 11vw 20vh #fcae1e,
        54vw 53vh #fffdf0, 79vw 90vh #fff, 47vw 28vh #fff,
        3vw 40vh #f7d070, 93vw 55vh #fffdf0;
    z-index: 0;
    animation: tw1 4s infinite steps(2);
    pointer-events: none;
}

body::after {
    content: "";
    position: fixed;
    top: 0; left: 0;
    width: 3px; height: 3px;
    background: transparent;
    box-shadow:
        9vw 43vh #fcae1e, 29vw 18vh #fff, 64vw 36vh #fffdf0,
        81vw 48vh #f7d070, 17vw 88vh #fff, 49vw 76vh #fff,
        37vw 6vh #fffdf0, 73vw 70vh #fcae1e, 94vw 78vh #fff,
        58vw 42vh #fff, 26vw 62vh #f7d070, 42vw 90vh #fffdf0;
    z-index: 0;
    animation: tw2 3s infinite steps(2);
    pointer-events: none;
}

@keyframes tw1 { 0%, 100% { opacity: .3 } 50% { opacity: .9 } }
@keyframes tw2 { 0%, 100% { opacity: .8 } 50% { opacity: .15 } }

.nameplate-contact a {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.nameplate-contact a:hover {
    color: var(--border-accent);
}

p a {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

p a:hover {
    color: var(--border-accent);
}

#welcome-popup {
    position: fixed;
    inset: 0;
    background: rgba(10, 16, 36, 0.96);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease;
}

#welcome-popup.hidden {
    display: none;
}

.welcome-box {
    background: #7a5c1e;
    border: 0.3125rem solid #e8b830;
    outline: 0.25rem solid #0e1628;
    box-shadow: 0 0 0 0.5rem #7a5c1e, 0 0 0 0.625rem #e8b830, 0.75rem 0.75rem 0 rgba(0,0,0,.55);
    max-width: 26.25rem;
    width: 90%;
    padding: 1.75rem 1.5rem 1.5rem;
    position: relative;
}

.welcome-box::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        170deg,
        transparent 0px, rgba(255,220,80,.04) 2px,
        transparent 4px, rgba(0,0,0,.04) 7px, transparent 9px
    );
}

.welcome-title {
    font-size: 0.6875rem;
    color: #f9e4b7;
    letter-spacing: 0.125rem;
    text-shadow: 0.125rem 0.125rem 0 #5a3a00;
    margin-bottom: 0.875rem;
    padding-bottom: 0.625rem;
    border-bottom: 0.125rem dashed #e8b830;
    text-align: center;
}

.welcome-desc {
    font-family: monospace;
    font-size: 0.8125rem;
    font-weight: normal;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.8;
    color: #f2ddb0;
    margin-bottom: 1.25rem;
}

.welcome-desc a {
    color: #e8b830;
    text-decoration: none;
}

.welcome-desc a:hover {
    text-decoration: underline;
}

#popup-loading-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.875rem;
    min-height: 4.375rem;
    justify-content: center;
}

.loader-dots {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.loader-dots span {
    width: 0.5rem;
    height: 0.5rem;
    background: #e8b830;
    border: 0.125rem solid #5a3a00;
    display: block;
    animation: dot-blink 1.2s infinite steps(1);
}

.loader-dots span:nth-child(2) { animation-delay: .4s; }
.loader-dots span:nth-child(3) { animation-delay: .8s; }

@keyframes dot-blink {
    0%, 100% { background: #e8b830; box-shadow: 0 0 0.25rem #e8b830; }
    50%       { background: #5a3a00; box-shadow: none; }
}

.loader-status {
    font-size: 0.5rem;
    color: #c8a050;
    letter-spacing: 0.125rem;
    text-align: center;
}

.start-btn {
    background: #1a2e0a;
    border: 0.1875rem solid #6abe30;
    outline: 0.125rem solid #0e1628;
    color: #a8e060;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.625rem;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    box-shadow: 0.25rem 0.25rem 0 #2a5000;
    letter-spacing: 0.125rem;
    transition: none;
    animation: pulse-green 1.6s infinite steps(2);
}

.start-btn:hover { background: #2a4a10; border-color: #a8e060; }
.start-btn:active { transform: translate(2px, 2px); box-shadow: 0.125rem 0.125rem 0 #2a5000; }

@keyframes pulse-green {
    0%, 100% { box-shadow: 0.25rem 0.25rem 0 #2a5000; }
    50%       { box-shadow: 0.25rem 0.25rem 0 #4abe20, 0 0 0.5rem #4abe2044; }
}

.radio-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 28.75rem;
}

.radio-body {
    width: 100%;
    background: #7a5c1e;
    border: 0.3125rem solid #e8b830;
    outline: 0.25rem solid #0e1628;
    box-shadow: 0 0 0 0.5rem #7a5c1e, 0 0 0 0.625rem #e8b830, 0.75rem 0.75rem 0 rgba(0,0,0,.55);
    position: relative;
}

.radio-body::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: repeating-linear-gradient(
        170deg,
        transparent 0px, rgba(255,220,80,.05) 2px,
        transparent 4px, rgba(0,0,0,.04) 7px, transparent 9px
    );
}

.radio-inner {
    position: relative;
    z-index: 1;
    padding: 0.875rem 0.875rem 0.75rem;
}

.radio-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.625rem;
}

.brand-badge {
    background: #f9e4b7;
    border: 0.1875rem solid #e8b830;
    padding: 0.25rem 0.625rem;
    box-shadow: 0.125rem 0.125rem 0 #5a3a00;
}

.brand-badge span {
    font-size: 0.5rem;
    color: #7a5c1e;
    letter-spacing: 0.125rem;
}

.mini-screen {
    background: #1a2e0a;
    border: 0.1875rem solid #e8b830;
    padding: 0.25rem 0.5rem;
    min-width: 6.875rem;
    text-align: right;
    box-shadow: inset 0.125rem 0.125rem 0 rgba(0,0,0,.5), 0.125rem 0.125rem 0 #5a3a00;
}

.mini-screen-text {
    font-size: 0.5rem;
    color: #a8e060;
    text-shadow: 0 0 0.3125rem #5ad010;
    letter-spacing: 0.0625rem;
}

.radio-mid {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.speaker-grille {
    flex: 1;
    border: 0.25rem solid #e8b830;
    height: 5.5rem;
    overflow: hidden;
    box-shadow: inset 0 0 0 0.125rem #c8960a, 0.125rem 0.125rem 0 #5a3a00;
    position: relative;
}

.grille-cloth {
    width: 100%;
    height: 100%;
    background-color: #c8960a;
    background-image:
        repeating-linear-gradient(0deg,   rgba(0,0,0,.22) 0px, rgba(0,0,0,.22) 1px, transparent 1px, transparent 5px),
        repeating-linear-gradient(90deg,  rgba(0,0,0,.22) 0px, rgba(0,0,0,.22) 1px, transparent 1px, transparent 5px);
    background-size: 5px 5px;
    position: relative;
    transform-origin: center center;
}

.speaker-cone {
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 3.25rem; height: 3.25rem;
    border: 0.1875rem solid rgba(90,58,0,.6);
    pointer-events: none;
}

.speaker-cone::after {
    content: '';
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 1.125rem; height: 1.125rem;
    border: 0.1875rem solid rgba(90,58,0,.5);
}

.speaker-cone::before {
    content: '';
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 0.5rem; height: 0.5rem;
    background: rgba(90,58,0,.4);
}

.dial-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3125rem;
}

.dial-outer {
    width: 4.125rem; height: 4.125rem;
    background: #f9e4b7;
    border: 0.25rem solid #e8b830;
    box-shadow: 0.25rem 0.25rem 0 #5a3a00, inset -0.125rem -0.125rem 0 rgba(0,0,0,.15), inset 0.125rem 0.125rem 0 rgba(255,255,255,.25);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: ns-resize;
    user-select: none;
}

.dial-outer::before {
    content: '';
    position: absolute;
    width: 100%; height: 100%;
    background: conic-gradient(
        transparent 0deg 20deg, #e8b830 20deg 22deg,
        transparent 22deg 52deg, #e8b830 52deg 54deg,
        transparent 54deg 84deg, #e8b830 84deg 86deg,
        transparent 86deg 116deg, #e8b830 116deg 118deg,
        transparent 118deg 148deg, #e8b830 148deg 150deg,
        transparent 150deg 360deg
    );
    opacity: .4;
    pointer-events: none;
}

.dial-inner {
    width: 2.5rem; height: 2.5rem;
    background: #e8b830;
    border: 0.1875rem solid #7a5c1e;
    box-shadow: inset 0.125rem 0.125rem 0 rgba(255,255,255,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.dial-dot {
    width: 0.3125rem; height: 0.3125rem;
    background: #5a3a00;
    position: absolute;
    top: 0.1875rem; left: 50%;
    transform: translateX(-50%);
    transform-origin: 50% calc(100% + 17px);
}

.dial-label {
    font-size: 0.375rem;
    color: #f9e4b7;
    letter-spacing: 0.0625rem;
}

.dial-val {
    font-size: 0.4375rem;
    color: #e8b830;
    text-shadow: 0 0 0.25rem #e8b830;
    margin-top: -0.125rem;
}

.nameplate {
    background: #5a3a00;
    border: 0.1875rem solid #e8b830;
    outline: 0.125rem solid #7a5c1e;
    box-shadow: inset 0.125rem 0.125rem 0 rgba(0,0,0,.3), inset -0.0625rem -0.0625rem 0 rgba(255,200,0,.1), 0.125rem 0.125rem 0 #3a2000;
    padding: 0.4375rem 0.75rem;
    margin-bottom: 0.625rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.nameplate-name {
    font-size: 0.5rem;
    color: #f9e4b7;
    text-shadow: 0.0625rem 0.0625rem 0 #3a2000;
    letter-spacing: 0.125rem;
    white-space: nowrap;
}

.nameplate-role {
    font-size: 0.3125rem;
    color: #e8b830;
    letter-spacing: 0.0625rem;
    white-space: nowrap;
    opacity: .85;
}

.nameplate-divider {
    width: 0.125rem;
    height: 1.5rem;
    background: #e8b830;
    opacity: .4;
    flex-shrink: 0;
}

.nameplate-contact {
    font-size: 0.3125rem;
    color: #c8a050;
    letter-spacing: 0.0625rem;
    line-height: 1.8;
    text-align: right;
    text-transform: none;
    font-family: monospace;
    font-weight: bold;
}

.faders-section {
    background: #f2ddb0;
    border: 0.1875rem solid #e8b830;
    box-shadow: inset 0.125rem 0.125rem 0 rgba(255,255,255,.35), inset -0.125rem -0.125rem 0 rgba(0,0,0,.1), 0.125rem 0.125rem 0 #5a3a00;
    padding: 0.625rem 0.5rem 0.5rem;
    margin-bottom: 0.625rem;
}

.faders-title {
    font-size: 0.375rem;
    color: #7a5c1e;
    letter-spacing: 0.125rem;
    text-align: center;
    margin-bottom: 0.5rem;
    border-bottom: 0.125rem dashed #e8b830;
    padding-bottom: 0.3125rem;
}

.faders-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.375rem;
}

.fader-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.fader-name {
    font-size: 0.3125rem;
    color: #7a5c1e;
    text-align: center;
    line-height: 1.5;
}

.fader-track {
    width: 1.75rem;
    height: 5.75rem;
    background: #c8960a;
    border: 0.1875rem solid #e8b830;
    box-shadow: inset 0.125rem 0.125rem 0 rgba(0,0,0,.25);
    position: relative;
}

.fader-track::before {
    content: '';
    position: absolute;
    right: 0.125rem; top: 0;
    width: 0.1875rem; height: 100%;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px, transparent 7px,
        #5a3a00 7px, #5a3a00 8px
    );
}

.fader-fill {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%;
    pointer-events: none;
    transition: height .08s;
    height: 0%;
}

#fill-rain { background: repeating-linear-gradient(to top, #88ccee 0px, #88ccee 4px, #55aacc 4px, #55aacc 5px); }
#fill-music { background: repeating-linear-gradient(to top, #ee88aa 0px, #ee88aa 4px, #cc5577 4px, #cc5577 5px); }
#fill-birds { background: repeating-linear-gradient(to top, #88cc55 0px, #88cc55 4px, #559933 4px, #559933 5px); }
#fill-river { background: repeating-linear-gradient(to top, #aa88dd 0px, #aa88dd 4px, #7755bb 4px, #7755bb 5px); }
#fill-meditation { background: repeating-linear-gradient(to top, #eeaa44 0px, #eeaa44 4px, #cc7722 4px, #cc7722 5px); }

.fader-thumb {
    position: absolute;
    left: 50%;
    transform: translateX(-50%) translateY(50%);
    width: 2.125rem; height: 0.8125rem;
    border: 0.1875rem solid;
    box-shadow: 0.125rem 0.125rem 0 #5a3a00;
    pointer-events: none;
    z-index: 3;
    bottom: 0%;
}

#thumb-rain { background: #88ccee; border-color: #55aacc; }
#thumb-music { background: #ee88aa; border-color: #cc5577; }
#thumb-birds { background: #88cc55; border-color: #559933; }
#thumb-river { background: #aa88dd; border-color: #7755bb; }
#thumb-meditation { background: #eeaa44; border-color: #cc7722; }

.fader-thumb::after {
    content: '';
    position: absolute;
    top: 0.125rem; left: 50%;
    transform: translateX(-50%);
    width: 55%; height: 0.125rem;
    background: rgba(0,0,0,.3);
    box-shadow: 0 3px 0 rgba(0,0,0,.3);
}

.fader-input {
    -webkit-appearance: slider-vertical;
    writing-mode: vertical-lr;
    direction: rtl;
    appearance: slider-vertical;
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    background: transparent;
    cursor: pointer;
    opacity: 0;
    z-index: 4;
    margin: 0;
}

.fader-val {
    font-size: 0.375rem;
    color: #7a5c1e;
    min-width: 1.25rem;
    text-align: center;
}

.presets-section {
    margin-bottom: 0.625rem;
}

.presets-label {
    font-size: 0.375rem;
    color: #f9e4b7;
    letter-spacing: 0.125rem;
    text-align: center;
    margin-bottom: 0.375rem;
}

.presets-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.375rem;
}

.preset-btn {
    background: #1a2e0a;
    border: 0.1875rem solid #6abe30;
    color: #a8e060;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.375rem;
    padding: 0.5rem 0.125rem 0.375rem;
    cursor: pointer;
    box-shadow: 0.1875rem 0.1875rem 0 #2a5000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1875rem;
    outline: 0.125rem solid #0e1628;
}

.preset-btn::before {
    content: attr(data-icon);
    font-size: 0.875rem;
    line-height: 1;
}

.preset-btn .p-label {
    font-size: 0.3125rem;
    letter-spacing: 0.0625rem;
    color: #6abe30;
}

.preset-btn:hover   { background: #2a4a10; border-color: #a8e060; }
.preset-btn:active { transform: translate(2px, 2px); box-shadow: 0.0625rem 0.0625rem 0 #2a5000; }

.preset-btn.preset-saving {
    background: #332200;
    border-color: #fcae1e;
    color: #fcae1e;
    animation: blink-s .4s infinite steps(1);
}

.preset-btn.preset-success {
    background: #1a3a08;
    border-color: #a8e060;
    color: #fff;
}

@keyframes blink-s {
    0%, 100% { opacity: 1 }
    50%       { opacity: .3 }
}

.bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.125rem;
}

.icon-btn {
    width: 2.125rem; height: 2.125rem;
    border: 0.1875rem solid;
    box-shadow: 0.125rem 0.125rem 0 #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: inherit;
    font-family: inherit;
}

.icon-btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0; }

.btn-power    { background: #cc3333; border-color: #ff6666; color: #fff; box-shadow: 0.125rem 0.125rem 0 #7a0000; }
.btn-power:hover { background: #ee4444; }

.btn-linkedin { background: #1a3a5c; border-color: #4a90d0; color: #7ec8f8; box-shadow: 0.125rem 0.125rem 0 #0a1a2c; }
.btn-linkedin:hover { background: #254e7a; }

.btn-github   { background: #1e1e2e; border-color: #9090c0; color: #c0c0e0; box-shadow: 0.125rem 0.125rem 0 #080818; }
.btn-github:hover { background: #2a2a3e; }

#info-popup {
    position: fixed;
    inset: 0;
    background: rgba(10,16,36,.85);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s steps(3);
}

#info-popup.open {
    opacity: 1;
    pointer-events: all;
}

.popup-box {
    background: #7a5c1e;
    border: 0.3125rem solid #e8b830;
    outline: 0.25rem solid #0e1628;
    box-shadow: 0 0 0 0.375rem #7a5c1e, 0.625rem 0.625rem 0 rgba(0,0,0,.5);
    max-width: 26.25rem;
    width: 90%;
    padding: 1.25rem;
    position: relative;
}

.popup-box h2 {
    font-size: 0.625rem;
    color: #f9e4b7;
    letter-spacing: 0.125rem;
    margin-bottom: 0.75rem;
    border-bottom: 0.125rem dashed #e8b830;
    padding-bottom: 0.5rem;
    text-shadow: 0.125rem 0.125rem 0 #5a3a00;
}

.popup-box p {
    font-family: monospace;
    font-size: 0.75rem;
    font-weight: normal;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.7;
    color: #f2ddb0;
}

.popup-close {
    position: absolute;
    top: 0.5rem; right: 0.625rem;
    background: #cc3333;
    border: 0.1875rem solid #ff6666;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.4375rem;
    padding: 0.25rem 0.4375rem;
    cursor: pointer;
    box-shadow: 0.125rem 0.125rem 0 #7a0000;
}

.popup-close:active { transform: translate(2px, 2px); box-shadow: 0 0 0; }

.toast-notification {
    position: fixed;
    top: 0.875rem;
    left: 50%;
    transform: translateX(-50%) translateY(-3.75rem);
    background: #1a2e0a;
    border: 0.25rem solid #6abe30;
    box-shadow: 0.25rem 0.25rem 0 #2a5000;
    padding: 0.625rem 1.25rem;
    font-size: 0.5rem;
    color: #a8e060;
    z-index: 9999;
    opacity: 0;
    transition: transform .2s steps(3), opacity .2s steps(3);
    pointer-events: none;
    white-space: nowrap;
    font-family: 'Press Start 2P', monospace;
}

.toast-notification.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (min-width: 1024px) {
    html {
        font-size: 22px;
    }
}