:root {
    --bg: #071c2c;
    --bg-soft: #0d2d45;
    --card: rgba(255, 255, 255, 0.08);
    --text: #f4f9ff;
    --muted: #c7d9ec;
    --accent: #ffb703;
    --accent-2: #00c2a8;
    --danger: #ff5d73;
    --success: #21c57b;
    --radius: 18px;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Manrope, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 15% 12%, rgba(255, 183, 3, 0.24) 0%, transparent 36%),
        radial-gradient(circle at 82% 8%, rgba(0, 194, 168, 0.2) 0%, transparent 40%),
        linear-gradient(160deg, var(--bg), #081623 60%, #0a2434 100%);
    min-height: 100vh;
}

.aurora {
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        110deg,
        transparent,
        transparent 26px,
        rgba(255, 255, 255, 0.02) 27px,
        rgba(255, 255, 255, 0.02) 28px
    );
    pointer-events: none;
    opacity: 0.55;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 1rem 1.4rem;
    margin: 1rem auto;
    width: min(1150px, 94vw);
}

.container {
    width: min(1150px, 94vw);
    margin: 1.5rem auto 2rem;
    display: grid;
    gap: 1.2rem;
}

.brand {
    display: flex;
    gap: 0.9rem;
    color: var(--text);
    text-decoration: none;
    align-items: center;
}

.brand-logo {
    display: block;
    width: min(320px, 54vw);
    height: auto;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    background: linear-gradient(140deg, var(--accent), #ff7b00);
    color: #112;
}

.brand small {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
}

.menu {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: center;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    padding: 0;
    flex: 0 0 auto;
}

.menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    margin: 0 auto;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.menu a {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    opacity: 0.9;
}

.menu-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.menu-icon {
    width: 1.15rem;
    height: 1.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.18);
    line-height: 1;
    transition: transform 0.2s ease, background 0.2s ease;
}

.menu-item:hover .menu-icon {
    transform: translateY(-1px) scale(1.05);
    background: rgba(255, 183, 3, 0.22);
}

.menu-item.active {
    opacity: 1;
    position: relative;
}

.menu-item.active .menu-icon {
    background: linear-gradient(140deg, var(--accent), #ff8e00);
    border-color: transparent;
}

.menu-item.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -0.55rem;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.glass {
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero {
    padding: 2rem;
    display: grid;
    gap: 2rem;
    grid-template-columns: 1.2fr 0.9fr;
}

.hero h1 {
    font-size: clamp(2rem, 4vw, 3.2rem);
    margin: 0.5rem 0;
    line-height: 1.05;
    font-family: "Space Grotesk", sans-serif;
}

.kicker {
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.16rem;
    color: var(--accent);
    font-weight: 700;
}

.cta-row {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-top: 1.2rem;
}

.hero-card {
    padding: 1.2rem;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(0, 194, 168, 0.2), rgba(255, 183, 3, 0.22));
}

.hero-card ul {
    margin: 0.8rem 0 0;
    padding-left: 1rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.stats article {
    padding: 1.1rem;
    display: grid;
    gap: 0.2rem;
}

.stats strong {
    font-size: 1.7rem;
    font-family: "Space Grotesk", sans-serif;
}

.stat-card {
    position: relative;
    padding-left: 3.4rem !important;
}

.stat-icon {
    position: absolute;
    left: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.6rem;
    line-height: 1;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.feature {
    padding: 1.1rem;
}

.auth-card,
.inline-form,
.chat-shell,
.table,
.mission-list {
    width: 100%;
}

.auth-card,
.glass {
    padding: 1.3rem;
}

.form-grid {
    display: grid;
    gap: 0.8rem;
}

label {
    display: grid;
    gap: 0.35rem;
    font-weight: 600;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(8, 27, 42, 0.8);
    color: var(--text);
    border-radius: 12px;
    padding: 0.72rem 0.85rem;
}

textarea {
    resize: vertical;
}

.btn {
    border: none;
    border-radius: 12px;
    padding: 0.72rem 1rem;
    font-weight: 700;
    text-decoration: none;
    color: #1d1600;
    background: linear-gradient(140deg, var(--accent), #ff8e00);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
    filter: saturate(1.15);
}

.btn-small {
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.listen-btn {
    border: 1px solid rgba(0, 194, 168, 0.5);
    border-radius: 999px;
    padding: 0.52rem 0.95rem;
    font-weight: 800;
    letter-spacing: 0.01rem;
    color: #f3fffb;
    background: linear-gradient(120deg, rgba(0, 194, 168, 0.8), rgba(0, 132, 255, 0.82));
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    margin-top: 0.45rem;
    box-shadow: 0 0 0 0 rgba(0, 194, 168, 0.5);
    animation: listenPulse 1.7s ease-in-out infinite;
}

.listen-btn:hover {
    transform: translateY(-1px);
    filter: saturate(1.15);
}

.listen-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    animation: none;
}

.notice {
    padding: 0.7rem;
    border-radius: 10px;
    font-weight: 700;
}

.notice.error {
    background: rgba(255, 93, 115, 0.25);
    border: 1px solid var(--danger);
}

.notice.success {
    background: rgba(33, 197, 123, 0.23);
    border: 1px solid var(--success);
}

.notice-icon {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.notice-icon::before {
    flex: 0 0 auto;
    font-size: 1.05rem;
}

.notice-icon.success::before {
    content: "✅";
}

.notice-icon.error::before {
    content: "❌";
}

.auto-note {
    opacity: 0.75;
    font-style: italic;
}

.shadow-result {
    margin-top: 1rem;
}

.shadow-result:empty {
    display: none;
}

.word-ok,
.word-miss {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 8px;
    margin: 0.1rem;
    font-weight: 700;
}

.word-ok {
    background: rgba(33, 197, 123, 0.25);
    color: #b9f5d8;
}

.word-miss {
    background: rgba(255, 93, 115, 0.25);
    color: #ffd0d7;
    text-decoration: underline wavy;
}

.mission-list {
    display: grid;
    gap: 0.8rem;
}

.mission-list article {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    padding: 1rem;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: center;
}

.dashboard-hero h1 {
    margin: 0.3rem 0;
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(1.7rem, 3vw, 2.4rem);
}

.hero-badge {
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    padding: 0.8rem 1rem;
    background: linear-gradient(130deg, rgba(255, 183, 3, 0.2), rgba(0, 194, 168, 0.2));
    min-width: 140px;
}

.hero-badge span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
}

.hero-badge strong {
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.25rem;
}

.mission-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.mission-card p {
    margin: 0.45rem 0 0;
    color: var(--muted);
}

.translation-line {
    display: block;
    margin-top: 0.35rem;
    color: #8fe9dc;
    font-size: 0.92rem;
    line-height: 1.35;
}

/* Progressive translation fade-out: A2+ students see translations dimmed by
   default (reducing dependency on Portuguese) but can reveal on hover/focus
   or force them back on via the header toggle. */
body.translation-reduced .translation-line {
    opacity: 0.3;
    transition: opacity 0.2s ease;
}

body.translation-reduced .translation-line:hover,
body.translation-reduced .translation-line:focus-within {
    opacity: 1;
}

body.translation-reduced.force-translations .translation-line {
    opacity: 1;
}

#translationToggle.active-toggle {
    background: rgba(0, 194, 168, 0.25);
    border-color: var(--accent-2);
}

.translation-kicker {
    margin-top: -0.3rem;
    margin-bottom: 0.6rem;
    color: #ffd891;
    font-size: 0.82rem;
}

.chat-log {
    height: 320px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0.8rem;
    display: grid;
    gap: 0.65rem;
    background: rgba(4, 18, 28, 0.75);
}

.msg {
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
}

.msg.user {
    background: rgba(255, 183, 3, 0.16);
}

.msg.npc {
    background: rgba(0, 194, 168, 0.18);
}

.msg.feedback {
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
}

.msg-pt {
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.2);
    color: #aeece3;
    font-size: 0.86rem;
}

.msg.npc .listen-btn {
    margin-left: 0.6rem;
    margin-top: 0.5rem;
}

.chat-controls {
    margin-top: 0.7rem;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.5rem;
}

.inline-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.6rem;
}

.table {
    border-collapse: collapse;
}

.table th,
.table td {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.study-plan {
    margin-top: 1rem;
}

.plan-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}

.plan-grid article {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0.75rem;
    background: rgba(5, 22, 35, 0.7);
}

.plan-grid h4 {
    margin: 0 0 0.6rem;
}

.plan-grid ul {
    margin: 0;
    padding-left: 1rem;
}

.progress-track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.progress-track.large {
    height: 14px;
}

.progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #00c2a8, #ffb703);
}

.word-stage {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem 0;
}

.word-stage h2 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3rem);
    font-family: "Space Grotesk", sans-serif;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.7rem;
}

.option-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    padding: 0.75rem;
    background: rgba(5, 22, 35, 0.6);
}

.option-card input {
    width: auto;
}

.option-card span {
    font-weight: 700;
}

.exam-block {
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    padding: 1rem;
    background: rgba(6, 25, 38, 0.72);
}

.exam-block h3 {
    margin-top: 0;
}

.hint-box {
    border: 1px dashed rgba(255, 183, 3, 0.7);
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    background: rgba(255, 183, 3, 0.12);
    color: #ffe8a8;
}

.example-box {
    border: 1px solid rgba(0, 194, 168, 0.35);
    border-radius: 12px;
    padding: 0.8rem 0.9rem;
    background: rgba(0, 194, 168, 0.08);
    margin: 0.7rem 0 0.95rem;
}

.example-box p {
    margin: 0.25rem 0 0.6rem;
}

.travel-picker {
    display: grid;
    gap: 0.6rem;
    margin-top: 0.7rem;
}

.journey-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.journey-step {
    padding: 1rem;
    border-radius: 14px;
    background: rgba(6, 25, 38, 0.7);
}

.step-count {
    margin: 0;
    font-size: 0.8rem;
    color: #ffd891;
    text-transform: uppercase;
    letter-spacing: 0.08rem;
}

.journey-step h3 {
    margin: 0.45rem 0 0.5rem;
}

.step-focus {
    margin: 0.55rem 0 0;
    padding-left: 1rem;
    color: var(--muted);
}

.chip-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.7rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 0.3rem 0.58rem;
    font-size: 0.82rem;
}

.journey-flow {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.journey-flow span {
    border: 1px dashed rgba(255, 183, 3, 0.5);
    border-radius: 999px;
    padding: 0.35rem 0.62rem;
    background: rgba(255, 183, 3, 0.12);
    font-weight: 600;
}

.chat-layout {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 1rem;
}

.chat-log.global {
    height: 470px;
}

.chat-log.global .msg p {
    margin: 0.35rem 0;
}

.site-footer {
    width: min(1150px, 94vw);
    margin: 0 auto 2rem;
    color: var(--muted);
    text-align: center;
}

.reveal {
    animation: revealUp 0.7s ease both;
}

.pulse {
    animation: pulse 2.4s ease-in-out infinite;
}

@keyframes revealUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

@keyframes listenPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 194, 168, 0.48);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(0, 194, 168, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 194, 168, 0);
    }
}

@media (max-width: 900px) {
    .hero,
    .grid-3,
    .stats {
        grid-template-columns: 1fr 1fr;
    }

    .chat-controls,
    .inline-form {
        grid-template-columns: 1fr;
    }

    .plan-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-hero {
        grid-template-columns: 1fr;
    }

    .mission-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .chat-layout {
        grid-template-columns: 1fr;
    }

    .options-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .journey-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .hero,
    .grid-3,
    .stats {
        grid-template-columns: 1fr;
    }

    .site-header {
        position: static;
    }

    .brand-logo {
        width: min(250px, 58vw);
    }
}

@media (max-width: 780px) {
    .site-header {
        flex-wrap: wrap;
    }

    .menu-toggle {
        display: flex;
    }

    .menu {
        flex-basis: 100%;
        order: 3;
        flex-direction: column;
        align-items: stretch;
        gap: 0.4rem;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height 0.3s ease, opacity 0.2s ease;
    }

    .menu.open {
        max-height: 640px;
        opacity: 1;
        margin-top: 0.9rem;
        padding-top: 0.9rem;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
    }

    .menu-item,
    .menu > .btn {
        width: 100%;
        justify-content: flex-start;
    }

    .menu-item.active {
        background: rgba(255, 183, 3, 0.14);
        border-radius: 10px;
        padding: 0.35rem 0.55rem;
    }

    .menu-item.active::after {
        display: none;
    }
}
