/* Palette and components follow the landing page so the site feels like one product */
:root {
    --bg: #0b1110;
    --bg-2: #0f1514;
    --panel: #141c1a;
    --panel-2: #1a2220;
    --field: #111917;
    --line: rgba(255, 255, 255, 0.07);
    --line-2: rgba(var(--accent-rgb), 0.25);
    --text: #e8efed;
    --muted: #8fa39f;
    --dim: #758d89;
    --green: #42b883;
    --green-2: #36a385;
    --green-glow: rgba(var(--accent-rgb), 0.35);
    --accent-rgb: 66, 184, 131;
    --accent-hi: #4fd49a;
    --grad: linear-gradient(120deg, #7ef0bd 0%, #42b883 45%, #3b9ede 100%);
    --blue: #3b9ede;
    --gold: #e6c200;
    --red: #ff5c6c;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.main-container {
    display: flex;
    min-height: 100vh;
}

/* Left art panel */
.left-panel {
    flex: 1.25;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 36px 56px 56px;
    background: #0d1413 url('../../../images/landing-islands.jpg') center 30% / cover no-repeat;
    background-image: image-set(url('../../../images/landing-islands.webp') type('image/webp'), url('../../../images/landing-islands.jpg') type('image/jpeg'));
    background-size: cover;
    background-position: center 30%;
}

.left-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(11, 17, 16, 0.55) 0%, rgba(11, 17, 16, 0.05) 35%, rgba(11, 17, 16, 0.55) 65%, rgba(11, 17, 16, 0.95) 100%),
        linear-gradient(90deg, transparent 60%, rgba(11, 17, 16, 0.9) 100%);
}

.left-panel > * { position: relative; z-index: 1; }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    align-self: flex-start;
}

.brand img {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--line-2);
    background: rgba(11, 17, 16, 0.6);
}

.brand b { color: var(--green); }

.art-overlay { max-width: 560px; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--green);
    border: 1px solid var(--line-2);
    background: rgba(11, 17, 16, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.6); }
    70% { box-shadow: 0 0 0 10px rgba(var(--accent-rgb), 0); }
    100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0); }
}

.art-overlay h1 {
    font-size: clamp(2.2rem, 4vw, 3.4rem);
    line-height: 1.08;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 20px 0 14px;
    text-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.grad {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.art-overlay p {
    color: #b9c9c5;
    font-size: 1.02rem;
    line-height: 1.6;
    max-width: 460px;
}

.hud-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 26px;
}

.hud-chip {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 9px 14px;
    border-radius: 12px;
    font-size: 0.82rem;
    color: var(--text);
    background: rgba(15, 21, 20, 0.7);
    border: 1px solid var(--line);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.hud-chip i { color: var(--c, var(--green)); }

/* Right form panel */
.right-panel {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 22px;
    padding: 48px 28px;
    background:
        radial-gradient(600px 420px at 80% 0%, rgba(var(--accent-rgb), 0.14), transparent 60%),
        radial-gradient(500px 400px at 0% 100%, rgba(59, 158, 222, 0.08), transparent 60%),
        var(--bg);
    overflow: hidden;
}

.right-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(var(--line) 1px, transparent 1px),
        linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse at 50% 30%, #000 10%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 10%, transparent 70%);
    opacity: 0.45;
}

.login-content {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 38px 34px 30px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(26, 34, 32, 0.85), rgba(20, 28, 26, 0.85));
    border: 1px solid var(--line);
    box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: rise 0.6s ease both;
}

.login-content::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 30px;
    right: 30px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--green), transparent);
}

@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

.game-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 18px;
    background: rgba(var(--accent-rgb), 0.08);
    border: 1px solid var(--line-2);
    box-shadow: 0 0 30px -6px var(--green-glow);
}

.logo-img {
    width: 40px;
    height: auto;
}

.login-content h2 {
    text-align: center;
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 6px;
}

.subtitle {
    text-align: center;
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 26px;
}

.warning {
    display: none;
    font-size: 0.86rem;
    color: var(--red);
    background: rgba(255, 92, 108, 0.1);
    border: 1px solid rgba(255, 92, 108, 0.25);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 20px;
    text-align: left;
}

/* Error box the teacher and admin scripts write into #errorBox */
.alert-box {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 0.86rem;
    color: var(--red);
    background: rgba(255, 92, 108, 0.1);
    border: 1px solid rgba(255, 92, 108, 0.25);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 20px;
}

.alert-box i { margin-top: 3px; }

.alert-box.ok { color: #42b883; background: rgba(66, 184, 131, 0.1); border-color: rgba(66, 184, 131, 0.3); }

.field-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--muted);
    margin: 0 0 7px 4px;
    letter-spacing: 0.02em;
}

.input-group {
    position: relative;
    margin-bottom: 18px;
}

.input-group > i {
    position: absolute;
    left: 17px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--dim);
    transition: color 0.2s;
    pointer-events: none;
}

.input-group input {
    width: 100%;
    padding: 14px 16px 14px 46px;
    background: var(--field);
    border: 1px solid #26302e;
    border-radius: 14px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.input-group input:read-only { color: var(--muted); }

.input-group:focus-within input {
    border-color: var(--green);
    background: #0f1715;
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.12);
}

.input-group:focus-within > i { color: var(--green); }

.input-group input::placeholder { color: var(--dim); }

.input-group.has-toggle input { padding-right: 48px; }

.toggle-password {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: none;
    color: var(--dim);
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.toggle-password:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }

.actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--muted);
    margin: 4px 0 24px;
}

.remember-me {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.remember-me input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid #36423f;
    border-radius: 5px;
    margin-right: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.2s;
}

.remember-me input:focus-visible ~ .checkmark { outline: 2px solid var(--green); outline-offset: 2px; }

.remember-me input:checked ~ .checkmark {
    background-color: var(--green);
    border-color: var(--green);
}

.remember-me input:checked ~ .checkmark::after {
    content: '\f00c';
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: #07120e;
    font-size: 10px;
}

.forgot-pass {
    color: var(--muted);
    transition: color 0.2s;
}

.forgot-pass:hover { color: var(--green); }

.btn-login {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent-hi), var(--green) 45%, var(--green-2));
    color: #07120e;
    font-family: inherit;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 12px 30px -12px var(--green-glow);
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    margin-bottom: 20px;
}

.btn-login i { transition: transform 0.2s; }

.btn-login:hover { transform: translateY(-2px); box-shadow: 0 18px 40px -14px var(--green-glow); }

.btn-login:hover i { transform: translateX(3px); }

.btn-login:disabled { opacity: 0.7; cursor: wait; transform: none; }

.btn-login:focus-visible, .toggle-password:focus-visible, a:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

.signup-link {
    text-align: center;
    font-size: 0.87rem;
    color: var(--muted);
}

.signup-link a {
    color: var(--green);
    font-weight: 600;
}

.signup-link a:hover { text-decoration: underline; }

/* Links to the other portals sit under the card */
.portal-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    font-size: 0.8rem;
    color: var(--dim);
}

.portal-switch a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.portal-switch a.student:hover { color: #42b883; border-color: rgba(66, 184, 131, 0.4); background: rgba(66, 184, 131, 0.06); }

.portal-switch a.teacher:hover { color: #3b9ede; border-color: rgba(59, 158, 222, 0.4); background: rgba(59, 158, 222, 0.06); }

.portal-switch a.admin:hover { color: #e6c200; border-color: rgba(230, 194, 0, 0.4); background: rgba(230, 194, 0, 0.06); }

.back-home {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--dim);
    transition: color 0.2s;
}

.back-home:hover { color: var(--green); }

/* Portal accents follow the landing page: students green, teachers blue, admins gold */
body.theme-teacher {
    --green: #3b9ede;
    --green-2: #2b7fc0;
    --accent-rgb: 59, 158, 222;
    --accent-hi: #7cc4f5;
    --line-2: rgba(59, 158, 222, 0.3);
    --green-glow: rgba(59, 158, 222, 0.35);
    --grad: linear-gradient(120deg, #a8dcff 0%, #3b9ede 55%, #42b883 100%);
}

body.theme-admin {
    --green: #e6c200;
    --green-2: #c9a200;
    --accent-rgb: 230, 194, 0;
    --accent-hi: #ffe45c;
    --line-2: rgba(230, 194, 0, 0.3);
    --green-glow: rgba(230, 194, 0, 0.3);
    --grad: linear-gradient(120deg, #fff08a 0%, #e6c200 50%, #ff9f43 100%);
}

@media (max-width: 900px) {
    .main-container { flex-direction: column; }

    .left-panel {
        flex: none;
        min-height: 300px;
        padding: 24px 22px 30px;
        gap: 40px;
        background-image: url('../../../images/landing-islands-720.webp');
    }

    .left-panel::before {
        background: linear-gradient(180deg, rgba(11, 17, 16, 0.6) 0%, rgba(11, 17, 16, 0.2) 40%, var(--bg) 100%);
    }

    .art-overlay h1 { font-size: 2rem; margin: 14px 0 8px; }

    .art-overlay p { font-size: 0.92rem; }

    .hud-row { display: none; }

    .right-panel { padding: 8px 16px 40px; background: var(--bg); }

    .right-panel::before { display: none; }
}

/* Phones get a smaller copy of the art, the panel is only as wide as the screen */
@media (max-width: 480px) {
    .left-panel { background-image: url('../../../images/landing-islands-560.webp'); }
}

@media (max-width: 420px) {
    .login-content { padding: 30px 20px 24px; border-radius: 18px; }

    .actions { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
