/* Fonts are loaded via <link> in each HTML head for better performance (preconnect + display=swap) */
:root {
    --cyan: #00e1af;
    --purple: #7a53dd;
    --bg-dark: #0a0a12;
    --bg-card: #13131f;
    --text-primary: #ffffff;
    --text-secondary: #a8a8b8;
    --border-subtle: rgba(122, 83, 221, 0.15);
    --glow-cyan: rgba(0, 225, 175, 0.4);
    --glow-purple: rgba(122, 83, 221, 0.4);
    --font-display: 'Jost', sans-serif; /* Large titles, headings (900 italic) */
    --font-body: 'Barlow Semi Condensed', sans-serif; /* Body / small text */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 20% 30%,
            var(--glow-purple),
            transparent 25%),
        radial-gradient(circle at 80% 20%, var(--glow-cyan), transparent 30%),
        radial-gradient(circle at 50% 80%,
            var(--glow-purple),
            transparent 35%);
    opacity: 0.15;
    z-index: 0;
    animation: pulse 20s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(1.1) rotate(5deg);
    }
}

.container {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 16px 28px;
}

@media (max-width: 1399px) {
    .container {
        max-width: 1200px;
    }
}

.hero {
    text-align: center;
    margin-bottom: 32px;
    animation: fadeInDown 0.8s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo-wrapper {
    display: inline-block;
    margin-bottom: 12px;
    position: relative;
}

.logo-wrapper::after {
    content: "";
    position: absolute;
    inset: -20px;
    background: linear-gradient(-45deg, var(--cyan), var(--purple));
    filter: blur(40px);
    opacity: 0.3;
    z-index: -1;
    animation: logoGlow 3s ease-in-out infinite;
}

@keyframes logoGlow {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 0.5;
    }
}

.logo-wrapper img {
    height: 80px;
    width: auto;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.5));
}

h1 {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 900;
    font-size: clamp(36px, 5vw, 48px);
    background: linear-gradient(-45deg, var(--cyan), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.5;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 16px;
    background: rgba(122, 83, 221, 0.1);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-badge::before {
    content: "";
    width: 8px;
    height: 8px;
    background: var(--cyan);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--cyan);
    animation: blink 2s ease-in-out infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.grid {
    display: grid;
    gap: 16px;
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

/* Consistent column counts to avoid uneven column widths */
@media (min-width: 1200px) {
    .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 800px) and (max-width: 1199px) {
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 799px) {
    .grid { grid-template-columns: 1fr; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 16px;
    position: relative;
    overflow: visible;
    min-width: 0; /* allow content to shrink inside grid columns */
    transition: all 0.18s ease;
}

.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(-45deg, var(--cyan), var(--purple));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover {
    border-color: rgba(122, 83, 221, 0.4);
    box-shadow: 0 20px 60px rgba(122, 83, 221, 0.2);
}

.card:hover::before {
    opacity: 1;
}

.card.full { grid-column: 1 / -1; }

.card h2 {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 900;
    font-size: 22px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card h2::before {
    content: "";
    width: 4px;
    height: 24px;
    background: linear-gradient(-45deg, var(--cyan), var(--purple));
    border-radius: 2px;
}

.card-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.4;
}

.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(122, 83, 221, 0.1);
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(-45deg, var(--cyan), var(--purple));
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(122, 83, 221, 0.4);
    transition: transform 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(-45deg, var(--cyan), var(--purple));
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(122, 83, 221, 0.4);
}

.volume-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
    align-items: start;
}

.volume-control {
    display: flex;
    flex-direction: column;
}

.volume-label {
    display: block;
    text-align: center;
    margin-top: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--cyan);
    min-height: 20px;
}

.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

button {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(-45deg, var(--cyan), var(--purple));
    color: white;
    box-shadow: 0 4px 20px rgba(122, 83, 221, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(122, 83, 221, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(122, 83, 221, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
    background: rgba(122, 83, 221, 0.2);
    border-color: var(--purple);
}

.url-section {
    margin-top: 24px;
}

.url-section h3 {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 900;
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.url-section h3::before {
    content: "→";
    color: var(--cyan);
    font-size: 20px;
}

.url-item {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
    align-items: center;
}

.url-link {
    flex: 1;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--cyan);
    text-decoration: none;
    font-size: 12px;
    font-family: "Courier New", monospace;
    word-break: break-all;
    transition: all 0.3s ease;
}

.url-link:hover {
    border-color: var(--cyan);
    background: rgba(0, 225, 175, 0.05);
}

.btn-copy {
    padding: 10px 16px;
    background: rgba(0, 225, 175, 0.1);
    border: 1px solid rgba(0, 225, 175, 0.3);
    border-radius: 10px;
    color: var(--cyan);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-copy:hover {
    background: rgba(0, 225, 175, 0.2);
    transform: translateY(-2px);
}

.info-box {
    background: rgba(122, 83, 221, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
}

.info-box code {
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--cyan);
    font-size: 13px;
}

.info-box p {
    margin-bottom: 10px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.info-box p:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .volume-grid {
        grid-template-columns: 1fr;
    }

    .btn-group {
        flex-direction: column;
    }

    .url-item {
        flex-direction: column;
    }

    .btn-copy {
        width: 100%;
    }
}

/* Compact chat popouts */
.chat-popouts { display: flex; gap: 10px; align-items: center; }
.chat-btn { width: 44px; height: 44px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.25); border: 1px solid var(--border-subtle); cursor: pointer; transition: all 160ms ease; padding: 6px; }
.chat-btn img { width: 22px; height: 22px; display: block; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4)); }
.chat-btn:hover { transform: translateY(-2px); border-color: rgba(122,83,221,0.35); }
.chat-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.chat-all { font-size: 13px; color: var(--text-secondary); font-weight:700; }

@media (min-width: 769px) and (max-width: 1399px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Sound Library Styles (concise, non-redundant) */
.sound-library-grid {
    display: grid;
    grid-template-columns: 1fr; /* stack library + assignments vertically */
    gap: 12px;
    margin-bottom: 12px;
    align-items: start;
}

.sound-panel,
.sound-editor,
.assignment-sequence {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px;
}

.sound-panel { border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 12px; }

.panel-title {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 900;
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.panel-title::before {
    content: "";
    width: 3px;
    height: 18px;
    background: linear-gradient(-45deg, var(--cyan), var(--purple));
    border-radius: 2px;
}

.subsection-title {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 900;
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sound-select {
    width: 100%;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300e1af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}
.sound-select:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(122, 83, 221, 0.1);
}
.sound-select option { background: var(--bg-card); color: var(--text-primary); padding: 8px; }

.sound-editor { background: rgba(122, 83, 221, 0.03); }

/* FromSoft variant groups and chips */
.variant-group { margin-bottom: 14px; }
.variant-group-title { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; }
.variant-group-row { display: block; }
.variant-group-title { display:flex; justify-content:space-between; align-items:center; gap:8px; cursor:pointer; }
.variant-group-title .chev { font-size: 12px; color: var(--text-secondary); display:inline-block; width:14px; height:14px; text-align:center; }

/* Collapsible panels (Sound Library / Assignments) */
.panel-title { display:flex; align-items:center; justify-content:space-between; gap:8px; cursor:pointer; }
.panel-title .chev { display:inline-block; width:16px; height:16px; font-size:14px; color: var(--text-secondary); }
.collapsible-content { display: none; }
.panel-title[aria-expanded="true"] + .collapsible-content { display: block; }
.variant-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,0.02); }
.variant-label { font-size: 13px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Toggle switch */
.variant-toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.variant-toggle input { opacity: 0; width: 0; height: 0; }
.variant-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.06); transition: .2s; border-radius: 999px; }
.variant-slider:before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background-color: white; border-radius: 50%; transition: .2s; box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
.variant-toggle input:checked + .variant-slider { background-color: rgba(0,200,120,0.18); box-shadow: 0 6px 14px rgba(0,200,120,0.06); }
.variant-toggle input:checked + .variant-slider:before { transform: translateX(20px); background-color: var(--text-primary); }

/* Remove internal scroll and compact spacing */
#fromsoft-variants-list { overflow: visible; }
#fromsoft-variants-list .variant-group { margin-bottom: 8px; }

.assignment-sequence {
    min-height: 140px;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: auto;
}

.sequence-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(122, 83, 221, 0.06);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    transition: all 0.2s ease;
    animation: slideIn 0.3s ease-out;
}
.sequence-item:hover { background: rgba(122, 83, 221, 0.12); border-color: var(--purple); }
.sequence-item-icon { font-size: 18px; opacity: 0.7; }
.sequence-item-content { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sequence-item-label { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.sequence-item-value { font-size: 12px; color: var(--text-secondary); font-family: "Courier New", monospace; }
.sequence-item-remove {
    padding: 6px 10px; background: rgba(255, 0, 0, 0.06); border: 1px solid rgba(255, 0, 0, 0.12); border-radius: 6px; color: #ff6b6b; font-size: 12px; cursor: pointer; transition: all 0.2s ease;
}
.sequence-item-remove:hover { background: rgba(255, 0, 0, 0.12); border-color: rgba(255, 0, 0, 0.2); }

/* Assignment-specific button and control sizing to avoid inconsistent stretching */
.assignment-sequence button,
.assignment-sequence .btn-primary,
.assignment-sequence .btn-secondary {
    flex: 0 0 auto; /* don't stretch */
    padding: 8px 12px;
    font-size: 13px;
    height: 36px;
    border-radius: 8px;
}

.assignment-sequence .sound-select {
    padding: 8px 10px;
    font-size: 13px;
    height: 36px;
}

.assignment-sequence .sequence-item {
    gap: 10px;
    padding: 8px 10px;
}

/* Hide the global 'Probar Secuencia' button if present — per-phase buttons replace it */
#test-assignment { display: none !important; }

.divider {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-subtle), transparent);
    margin: 20px 0;
}

@media (max-width: 1200px) { .sound-library-grid { grid-template-columns: 1fr; } }

@keyframes slideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
