:root {
    --accent: #ff0000;
    --accent-soft: rgba(255, 0, 0, 0.15);
    --bg-color: #080808;
    --bg-image: none;
    --bg-gradient: none;
    --card-bg: rgba(14, 14, 14, 0.55);
    --text: #ffffff;
    --muted: rgba(255, 255, 255, 0.55);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

html, body {
    min-height: 100vh;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html::-webkit-scrollbar, body::-webkit-scrollbar {
    display: none;
}

body {
    background: var(--bg-color);
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: center;
    align-items: safe center;
    position: relative;
    overflow-x: hidden;
    padding: 40px 20px;
    -webkit-tap-highlight-color: transparent;
}

a, button, .volume-control, .badge-toggle, .preset-swatch, .bar, input, select, textarea {
    touch-action: manipulation;
}

#bg-layer {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-color: var(--bg-color);
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
    transition: background 0.4s ease;
}

#bg-layer.has-gradient {
    background-image: var(--bg-gradient);
    background-size: cover;
    background-position: center;
}

#entry-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(18px) brightness(0.5);
    -webkit-backdrop-filter: blur(18px) brightness(0.5);
    background: rgba(8, 8, 8, 0.5);
    cursor: pointer !important;
    transition: opacity 0.7s ease, visibility 0.7s ease;
}

#entry-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.entry-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    user-select: none;
    text-align: center;
}

.entry-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--accent);
    animation: spin 1.4s linear infinite;
    box-shadow: 0 0 24px var(--accent-soft);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.entry-label {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 0 0 20px var(--accent), 0 0 40px var(--accent-soft);
    animation: pulse-glow 2s ease-in-out infinite;
}

.entry-sub {
    font-size: 12px;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
}

@keyframes pulse-glow {
    0%, 100% { text-shadow: 0 0 20px var(--accent), 0 0 40px var(--accent-soft); }
    50% { text-shadow: 0 0 35px var(--accent), 0 0 70px var(--accent-soft); }
}

.volume-control {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.2s ease;
}

.volume-control:hover {
    color: #fff;
}

.volume-slider {
    width: 0;
    opacity: 0;
    transition: width 0.3s ease, opacity 0.3s ease;
    accent-color: #fff;
    cursor: pointer;
}

.volume-control:hover .volume-slider, .volume-slider.active {
    width: 80px;
    opacity: 1;
}

.card {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    max-width: 44rem;
    width: 100%;
    padding: 26px;
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 24px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    will-change: transform;
    transition: transform 700ms cubic-bezier(0.03, 0.98, 0.52, 0.99);
    transform: perspective(1000px) rotateX(0deg) rotateY(0deg) scale3d(1, 1, 1);
}

.avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.15);
    background: #1a1a2e;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 40px;
    font-weight: 700;
    margin: 0 auto 15px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 0 20px var(--accent);
}

.avatar:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 10px 30px var(--accent-soft);
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.avatar .avatar-fallback {
    font-size: 40px;
    font-weight: 700;
    color: var(--accent);
}

.name {
    font-size: 34px;
    font-weight: 600;
    text-shadow: 0 0 16px var(--accent);
    word-break: break-word;
    text-align: center;
}

.handle {
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    margin-top: -8px;
    letter-spacing: 0.02em;
}

.badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}

.badge {
    width: 24px;
    height: 24px;
    color: #fff;
    filter: drop-shadow(0 0 2.5px var(--accent));
    transition: transform 0.3s ease;
    position: relative;
    cursor: default;
}

.badge:hover {
    transform: scale(1.3) translateY(-3px);
}

.badge-tooltip {
    position: fixed;
    background: rgba(20, 20, 20, 0.95);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    z-index: 99999;
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.badge-tooltip.visible {
    opacity: 1;
}

.joined {
    font-size: 13px;
    color: var(--muted);
}

.socials {
    display: flex;
    gap: 12px;
    margin-top: 5px;
}

.social {
    color: #fff;
    filter: drop-shadow(1px 0 7px var(--accent));
    transition: transform 0.3s ease;
    text-decoration: none;
    display: inline-flex;
}

.social:hover {
    transform: scale(1.2) translateY(-5px);
}

.social svg {
    width: 24px;
    height: 24px;
}

.stats {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: var(--muted);
}

.discord {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    width: 100%;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 12px 14px;
}

.discord-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    position: relative;
    flex-shrink: 0;
    overflow: visible;
}

.discord-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 10px var(--accent);
}

.status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #080808;
}

.status-online { background: #23a55a; }
.status-idle { background: #f0b232; }
.status-dnd { background: #f23f43; }
.status-offline { background: #80848e; }

.discord-info {
    flex: 1;
    min-width: 0;
}

.discord-name {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin: 0;
    text-shadow: 0 0 8px var(--accent);
}

.discord-status {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 2px;
    min-height: 18px;
}

.disconnect-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.75);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.disconnect-btn:hover {
    color: #fff;
    border-color: var(--accent);
}

.player {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 15px;
    width: 100%;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 12px 14px;
}

.cover {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    background: linear-gradient(135deg, #1a1a2e, #333);
    transition: opacity 0.3s ease;
}

.track {
    flex: 1;
    min-width: 0;
}

.times {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--muted);
}

.bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.fill {
    position: absolute;
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 2px;
}

.btns {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.7);
}

.btns svg {
    width: 20px;
    height: 20px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.btns svg:hover {
    color: #fff;
}

.promo-popup {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-50px);
    z-index: 100000;
    background: rgba(14, 14, 14, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--accent-soft);
    box-shadow: 0 4px 20px var(--accent-soft);
    padding: 12px 24px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    pointer-events: none;
    text-decoration: none;
}

.promo-popup.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.promo-popup:hover {
    border-color: var(--accent);
    box-shadow: 0 6px 30px var(--accent-soft);
    transform: translateX(-50%) translateY(-2px);
}

.promo-text {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-shadow: 0 0 10px var(--accent-soft);
    text-transform: uppercase;
}

.promo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--accent-soft);
    border-radius: 50%;
    color: var(--accent);
    transition: all 0.3s ease;
}

.promo-popup:hover .promo-icon {
    transform: scale(1.1) translateX(2px);
    background: var(--accent);
    color: #fff;
}

.page-title {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 10000;
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: color 0.2s ease;
}

.page-title:hover {
    color: #fff;
}

.empty-state {
    display: none;
    text-align: center;
    gap: 18px;
}

.empty-state.visible {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.empty-state h1 {
    font-size: 30px;
    font-weight: 700;
}

.empty-state p {
    color: var(--muted);
}

.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px 22px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover {
    background: #cc0000;
    box-shadow: 0 4px 12px var(--accent-soft);
}

.page {
    max-width: 40rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-header .back-link {
    color: var(--muted);
    font-size: 13px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.page-header .back-link:hover {
    color: #fff;
}

.form-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 24px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.65);
}

.field input[type="text"],
.field input[type="url"],
.field input[type="color"],
.field select,
.field textarea {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 14px;
    color: #fff;
    outline: none;
    transition: border-color 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.field input[type="color"] {
    padding: 6px;
    height: 44px;
    cursor: pointer;
}

.field input[type="text"]:focus,
.field input[type="url"]:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--accent);
}

.field select option {
    background: #111;
    color: #fff;
}

.field .hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

.field-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.field-row .field {
    flex: 1;
    min-width: 160px;
}

.badge-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.badge-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.badge-toggle svg {
    width: 16px;
    height: 16px;
}

.badge-toggle.active {
    border-color: var(--accent);
    color: #fff;
    background: var(--accent-soft);
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
}

.preset-swatch {
    height: 52px;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
    position: relative;
    overflow: hidden;
}

.preset-swatch:hover {
    transform: scale(1.03);
}

.preset-swatch.active {
    border-color: var(--accent);
}

.preset-swatch span {
    position: absolute;
    left: 8px;
    bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.upload-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.upload-row input[type="file"] {
    display: none;
}

.preview-thumb {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: none;
    background: #111;
}

.gradient-field {
    display: flex;
    gap: 10px;
    align-items: center;
}

.gradient-field input[type="color"] {
    width: 44px;
    flex-shrink: 0;
}

.track-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 12px;
}

.track-row input[type="text"] {
    flex: 1;
    min-width: 120px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
    color: #fff;
    outline: none;
}

@media (min-width: 720px) {
    .track-row input[type="text"].track-cover {
        flex: 0 0 200px;
    }
    .track-row input[type="text"].track-src {
        flex: 1.4;
        min-width: 220px;
    }
    .track-row input[type="text"].track-title {
        flex: 0 0 140px;
        min-width: 140px;
    }
}

.track-row input[type="text"]:focus {
    border-color: var(--accent);
}

.track-remove {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color 0.2s ease;
}

.track-remove:hover {
    color: var(--accent);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 11px 18px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
}

.btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.success-box {
    display: none;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 14px;
    color: #4ade80;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.success-box.visible {
    display: flex;
}

.success-box .btn {
    background: #22c55e;
    text-decoration: none;
}

.success-box .btn:hover {
    background: #16a34a;
}

.success-box .btn.hidden {
    display: none;
}

.error-box {
    display: none;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 13px;
    color: #f87171;
}

.error-box.visible {
    display: block;
}

@media (hover: none), (pointer: coarse) {
    .volume-slider {
        width: 72px;
        opacity: 1;
    }
    .volume-control:hover {
        color: rgba(255, 255, 255, 0.7);
    }
}

@media (max-width: 480px) {
    body {
        padding: 28px 16px;
    }
    .card {
        padding: 20px;
        gap: 13px;
    }
    .avatar {
        width: 88px;
        height: 88px;
        font-size: 34px;
    }
    .name {
        font-size: 30px;
    }
    .entry-ring {
        width: 64px;
        height: 64px;
    }
    .entry-label {
        font-size: 18px;
    }
    .entry-sub {
        font-size: 11px;
    }
    .social svg {
        width: 26px;
        height: 26px;
    }
    .social {
        padding: 6px;
    }
    .stats {
        gap: 14px;
        font-size: 13px;
    }
    .discord, .player {
        padding: 10px 12px;
    }
    .form-card {
        padding: 18px;
    }
    .field-row {
        gap: 10px;
    }
    .field-row .field {
        min-width: 140px;
    }
    .gradient-field {
        flex-wrap: wrap;
    }
    .page-title {
        top: calc(env(safe-area-inset-top, 0px) + 12px);
        right: calc(env(safe-area-inset-right, 0px) + 16px);
    }
    .volume-control {
        top: calc(env(safe-area-inset-top, 0px) + 12px);
        left: 14px;
    }
    .promo-popup {
        top: calc(env(safe-area-inset-top, 0px) + 8px);
        max-width: calc(100vw - 32px);
        padding: 10px 18px;
        gap: 10px;
    }
    .promo-text {
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .field input[type="text"],
    .field input[type="url"],
    .field select,
    .track-row input[type="text"] {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .entry-ring, .entry-label {
        animation: none;
    }
    .card {
        transition: none;
    }
    .avatar:hover {
        transform: none;
    }
    .social:hover, .badge:hover {
        transform: none;
    }
}