:root {
    /* Paleta — terminal táctico */
    --void: #050a12;
    --panel: #0a1420;
    --panel-raised: #0f1d2c;
    --hairline: #1c3344;

    --cyan: #4ce8ff;
    --cyan-dim: #1d5566;
    --cyan-glow: rgba(76, 232, 255, 0.35);

    --amber: #ffb13d;
    --amber-glow: rgba(255, 177, 61, 0.35);

    --text-bright: #eaf6fb;
    --text-main: #c4dbe4;
    --text-muted: #5d7d8c;

    --score-red: #ff4f5e;
    --score-orange: #ff9f3d;
    --score-yellow: #ffd23f;
    --score-green: #3de08a;
    --score-blue: #4ce8ff;
    --score-gold: #ffb13d;

    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Rajdhani', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--void);
    background-image:
        radial-gradient(ellipse 900px 500px at 50% -10%, rgba(76, 232, 255, 0.10), transparent),
        linear-gradient(180deg, var(--void) 0%, #060d16 100%);
    color: var(--text-main);
    line-height: 1.45;
    padding: 0 0 60px 0;
    -webkit-tap-highlight-color: transparent;
    font-size: 18px;
    position: relative;
    min-height: 100vh;
}

/* Capa sutil de scanlines sobre toda la página */
.scanlines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
    background: repeating-linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.018) 0px,
        rgba(255, 255, 255, 0.018) 1px,
        transparent 1px,
        transparent 3px
    );
    mix-blend-mode: overlay;
}

/* Marcas de esquina tipo HUD, reutilizables en cualquier panel con position:relative */
.hud-corner {
    position: absolute;
    width: 22px;
    height: 22px;
    border: 2px solid var(--cyan);
    opacity: 0.7;
    pointer-events: none;
}
.hud-corner-tl { top: 10px; left: 10px; border-right: none; border-bottom: none; }
.hud-corner-tr { top: 10px; right: 10px; border-left: none; border-bottom: none; }
.hud-corner-bl { bottom: 10px; left: 10px; border-right: none; border-top: none; }
.hud-corner-br { bottom: 10px; right: 10px; border-left: none; border-top: none; }

/* ---------------- HEADER ---------------- */

.main-header {
    position: relative;
    background:
        linear-gradient(180deg, var(--panel-raised) 0%, var(--panel) 100%);
    color: var(--text-bright);
    text-align: center;
    padding: clamp(28px, 6vw, 44px) 20px 30px;
    border-bottom: 1px solid var(--cyan-dim);
    box-shadow: 0 0 60px rgba(76, 232, 255, 0.08) inset;
}

.logo-container {
    margin-bottom: 14px;
    display: flex;
    justify-content: center;
}

.logo-hex {
    width: 78px;
    height: 88px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(160deg, var(--cyan-dim), var(--panel));
    border: 2px solid var(--cyan);
    color: var(--cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: 1px;
    box-shadow: 0 0 24px var(--cyan-glow);
}

.eyebrow {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--amber);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.teacher-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 7vw, 2.8rem);
    font-weight: 900;
    letter-spacing: 3px;
    margin-bottom: 22px;
    color: var(--text-bright);
    text-shadow: 0 0 18px var(--cyan-glow);
}

.comm-channel {
    max-width: 420px;
    margin: 0 auto;
    padding-top: 18px;
    border-top: 1px dashed var(--hairline);
}

.comm-label {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.spotify-embed-container {
    margin-bottom: 14px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--hairline);
}

.spotify-link {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, var(--cyan-dim), var(--panel-raised));
    color: var(--cyan);
    text-decoration: none;
    padding: 12px 20px;
    border: 1px solid var(--cyan);
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    max-width: 100%;
}

.spotify-link:active {
    transform: scale(0.96);
}

.spotify-link:hover {
    box-shadow: 0 0 18px var(--cyan-glow);
}

.spotify-icon {
    margin-right: 10px;
    flex-shrink: 0;
}

/* ---------------- LAYOUT GENERAL ---------------- */

.container {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 18px;
}

.guidance-text {
    text-align: center;
    font-family: var(--font-body);
    font-size: clamp(1.1rem, 4vw, 1.3rem);
    font-weight: 700;
    color: var(--cyan);
    margin-bottom: 18px;
    background-color: var(--panel);
    border: 1px solid var(--cyan-dim);
    padding: 14px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

/* ---------------- PANEL DE CONTROLES ---------------- */

.controls-section {
    position: relative;
    background-color: var(--panel);
    padding: 30px 24px;
    border: 1px solid var(--hairline);
    border-radius: 4px;
    margin-bottom: 22px;
    text-align: center;
}

.select-label {
    display: block;
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.group-dropdown {
    width: 100%;
    max-width: 220px;
    padding: 14px;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--cyan);
    border: 2px solid var(--cyan);
    border-radius: 4px;
    background-color: var(--panel-raised);
    text-align: center;
    text-align-last: center;
    appearance: none;
    -webkit-appearance: none;
}

.group-dropdown:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--cyan-glow);
}

.subject-indicator {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.subject-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--text-muted);
}

.subject-indicator span#subject-name {
    font-family: var(--font-display);
    color: var(--amber);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 0 0 14px var(--amber-glow);
}

/* ---------------- LISTA DE ALUMNOS ---------------- */

.list-label {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-left: 4px;
}

.students-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.student-card {
    position: relative;
    background-color: var(--panel);
    padding: 20px 18px;
    border: 1px solid var(--hairline);
    border-left: 4px solid var(--cyan-dim);
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.15s ease, border-left-color 0.15s ease, transform 0.1s ease;
}

.student-card:active {
    transform: scale(0.99);
    background-color: var(--panel-raised);
}

.student-card:hover {
    border-left-color: var(--cyan);
    background-color: var(--panel-raised);
}

.student-info-left {
    flex: 1;
    padding-right: 12px;
}

.student-name {
    font-family: var(--font-body);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-bright);
    letter-spacing: 0.3px;
}

.student-card-chevron {
    font-family: var(--font-display);
    color: var(--cyan-dim);
    font-size: 1.4rem;
}

.empty-state {
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
    padding: 20px;
}

/* ---------------- MODAL ---------------- */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(2, 6, 11, 0.88);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.modal-content {
    position: relative;
    background-color: var(--panel);
    width: 100%;
    max-width: 460px;
    border: 1px solid var(--cyan-dim);
    border-radius: 4px;
    padding: 36px 26px 30px;
    text-align: center;
    box-shadow: 0 0 50px rgba(76, 232, 255, 0.12), 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.modal-content.flash {
    animation: content-flash 0.5s ease-out;
}

@keyframes content-flash {
    0% { box-shadow: 0 0 110px var(--cyan-glow), 0 0 60px var(--amber-glow) inset; }
    100% { box-shadow: 0 0 50px rgba(76, 232, 255, 0.12), 0 10px 30px rgba(0, 0, 0, 0.5); }
}

.close-button {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 2.2rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    z-index: 10;
}

.close-button:hover {
    color: var(--cyan);
}

.modal-eyebrow {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.modal-student-name {
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 6vw, 1.6rem);
    font-weight: 800;
    color: var(--text-bright);
    margin-bottom: 22px;
    padding: 0 16px;
    letter-spacing: 0.5px;
}

.modal-lock-state {
    padding: 14px 0 6px;
}

.lock-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 22px;
}

.lock-ring {
    position: absolute;
    top: -5px;
    left: -5px;
    width: 130px;
    height: 130px;
    transform: rotate(-90deg);
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.lock-ring-track {
    fill: none;
    stroke: var(--hairline);
    stroke-width: 4;
}

.lock-ring-progress {
    fill: none;
    stroke: var(--amber);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 364;
    stroke-dashoffset: 364;
    filter: drop-shadow(0 0 8px var(--amber-glow));
    transition: stroke-dashoffset 0.25s ease-out;
}

.lock-ring-progress.charging {
    animation: ring-fill 4s linear forwards;
}

@keyframes ring-fill {
    from { stroke-dashoffset: 364; }
    to   { stroke-dashoffset: 0; }
}

.lock-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(160deg, var(--panel-raised), var(--panel));
    border: 2px solid var(--cyan);
    color: var(--cyan);
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    cursor: pointer;
    box-shadow: 0 0 20px var(--cyan-glow);
    position: relative;
    z-index: 2;
}

.lock-instruction {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 0 16px;
    text-transform: uppercase;
}

.lock-circle.pressing {
    animation: decrypting 4s linear forwards;
    border-color: var(--amber);
    color: var(--amber);
}

@keyframes decrypting {
    0%   { box-shadow: 0 0 20px var(--cyan-glow); transform: translate(0, 0); }
    20%  { transform: translate(1px, -1px); }
    40%  { box-shadow: 0 0 32px var(--amber-glow); transform: translate(-1px, 1px) scale(1.02); }
    60%  { transform: translate(1px, 1px) scale(1.04); }
    80%  { box-shadow: 0 0 50px var(--amber-glow); transform: translate(-2px, -1px) scale(1.07); }
    100% { box-shadow: 0 0 70px var(--amber-glow); transform: translate(0, 0) scale(1.1); }
}

.lock-circle.spectacular-explosion {
    animation: access-granted 0.6s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
    pointer-events: none;
}

@keyframes access-granted {
    0% {
        transform: scale(1.1);
        border-color: var(--amber);
        box-shadow: 0 0 50px var(--amber-glow);
        opacity: 1;
    }
    40% {
        background: var(--cyan-dim);
        border-color: var(--cyan);
        box-shadow: 0 0 70px var(--cyan-glow), 0 0 120px var(--amber-glow);
        opacity: 0.95;
    }
    100% {
        transform: scale(4.2);
        background-color: transparent;
        border-color: transparent;
        box-shadow: none;
        filter: blur(22px);
        opacity: 0;
    }
}

.modal-reveal-state {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-badge-msg {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 10px;
    letter-spacing: 1.5px;
}

.modal-grade-value {
    font-family: var(--font-display);
    font-size: clamp(3.6rem, 18vw, 5rem);
    font-weight: 900;
    line-height: 1;
    margin-bottom: 26px;
}

.modal-grade-value.glitching {
    filter: blur(0.5px);
    opacity: 0.85;
}

.modal-grade-value.settled {
    animation: value-settle 0.5s ease-out;
}

@keyframes value-settle {
    0% { transform: scale(1.3); filter: brightness(1.5); }
    100% { transform: scale(1); filter: brightness(1); }
}

.modal-grade-value.text-gold-style {
    background: linear-gradient(110deg, #b5892c 45%, #ffffff 50%, #b5892c 55%);
    background-size: 300% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0px 0px 14px rgba(255, 177, 61, 0.6));
    animation: gold-flash 5s linear infinite;
    display: inline-block;
}

@keyframes gold-flash {
    0% { background-position: 200% center; }
    100% { background-position: -200% center; }
}

.modal-notes-container {
    border-top: 1px dashed var(--hairline);
    padding-top: 18px;
    margin-top: 8px;
}

.notes-text {
    font-size: 0.92rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
}

.hidden {
    display: none !important;
}

.text-red { color: var(--score-red); }
.text-orange { color: var(--score-orange); }
.text-yellow { color: var(--score-yellow); }
.text-green { color: var(--score-green); }
.text-blue { color: var(--score-blue); }
.text-gold { color: var(--score-gold); }

/* ---------------- RESPONSIVE ---------------- */

@media (max-width: 420px) {
    body { font-size: 16px; }
    .controls-section { padding: 24px 16px; }
    .lock-circle { width: 100px; height: 100px; font-size: 2.4rem; }
    .lock-ring { width: 110px; height: 110px; top: -5px; left: -5px; }
}

@media (min-width: 720px) {
    .container { max-width: 720px; }
    .student-name { font-size: 1.35rem; }
}

@media (prefers-reduced-motion: reduce) {
    .lock-circle.pressing,
    .lock-circle.spectacular-explosion,
    .lock-ring-progress.charging,
    .modal-grade-value.text-gold-style,
    .modal-grade-value.settled,
    .modal-content.flash,
    .modal-reveal-state {
        animation: none !important;
        transition: none !important;
    }
}