* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;

    background: #101010;
    color: #e8e8e8;

    font-family: Arial, Helvetica, sans-serif;
}

button,
input {
    font: inherit;
}

.hidden {
    display: none !important;
}

/* TOPBAR */

.topbar {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.logo {
    font-size: 21px;
    font-weight: 700;
}

.streak {
    color: #777;
    display: flex;
    gap: 6px;
}

/* INICI */

.home {
    max-width: 850px;
    margin: 120px auto 0;
    text-align: center;
    padding: 0 25px;
}

.home h1 {
    margin: 0;
    font-size: 42px;
    font-weight: 700;
}

.home h1 span {
    color: #f1865b;
}

.subtitle {
    margin-top: 12px;
    color: #777;
    font-size: 17px;
}

.modes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    margin-top: 70px;
}

.mode {
    background: none;
    border: 1px solid #444;
    color: #e8e8e8;
    text-align: left;
    cursor: pointer;
    padding: 20px;
    border-radius: 8px;
    transition: border-color 0.15s;
}

.mode:hover {
    border-color: #aaa;
}

.mode h2 {
    margin: 0 0 10px;
    font-size: 20px;
}

.mode p {
    margin: 0 0 18px;
    color: #777;
    line-height: 1.5;
}

.mode span {
    color: #aaa;
    font-family: monospace;
    font-size: 17px;
}

.textButton {
    margin-top: 40px;
    background: none;
    border: none;
    color: #777;
    cursor: pointer;
}

.textButton:hover {
    color: #ddd;
}

/* CONFIGURACIÓ */

.config {
    max-width: 700px;
    margin: 70px auto;
    padding: 0 25px;
}

.configHeader {
    display: flex;
    align-items: center;
    gap: 20px;
}

.configHeader h1 {
    margin: 0;
    font-size: 28px;
}

.configSection {
    margin-top: 45px;
}

.configSection h2 {
    font-size: 18px;
    margin-bottom: 22px;
}

.categoryOptions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 35px;
}

.categoryOption {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #aaa;
    cursor: pointer;
}

.categoryOption:hover {
    color: #e8e8e8;
}

.categoryOption input {
    width: 16px;
    height: 16px;
    accent-color: #e8e8e8;
}

.configAction {
    margin-top: 20px;
}

.smallOptions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.optionButton {
    background: none;
    border: 1px solid #333;
    color: #777;
    padding: 9px 16px;
    border-radius: 6px;
    cursor: pointer;
}

.optionButton:hover {
    color: #ddd;
    border-color: #777;
}

.optionButton.selected {
    color: #111;
    background: #e8e8e8;
    border-color: #e8e8e8;
}

.config > .mainButton {
    margin-top: 55px;
}

/* BOTONS */

.back {
    background: none;
    border: none;
    color: #777;
    cursor: pointer;
    font-size: 22px;
    text-align: left;
}

.back:hover {
    color: white;
}

.mainButton {
    border: none;
    background: #e8e8e8;
    color: #111;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
}

.mainButton:hover {
    background: white;
}

/* ENTRENAMENT */

.training {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 25px;
}

.trainingHeader {
    display: grid;
    grid-template-columns: 50px 1fr 50px;
    align-items: center;
    text-align: center;
    color: #666;
    margin-top: 35px;
}

.exercise {
    min-height: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.instruction {
    color: #777;
    margin-bottom: 20px;
}

.context {
    color: #999;
    font-size: 15px;
    margin-bottom: 20px;
    max-width: 600px;
    line-height: 1.5;
}

.targetText {
    font-family: monospace;
    font-size: clamp(32px, 5vw, 55px);
    line-height: 1.5;
    letter-spacing: 1px;
    min-height: 80px;
    cursor: text;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* CARÀCTERS */

.character {
    color: #555;
    transition: color 0.05s;
}

.character.pending {
    color: #555;
}

.character.correct {
    color: #63c174;
}

.character.incorrect {
    color: #e15d5d;
}

.character.current {
    text-decoration: underline;
    text-decoration-color: #666;
    text-underline-offset: 7px;
}

/* INPUT INVISIBLE */

#typingInput {
    position: fixed;
    left: -1000px;
    top: -1000px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

/* INFORMACIÓ */

.typingHint {
    margin-top: 35px;
    color: #555;
    font-size: 14px;
}

.liveStats {
    display: flex;
    justify-content: center;
    gap: 35px;
    color: #555;
    font-size: 14px;
}

.liveStats strong {
    color: #999;
}

/* RESULTATS */

.results {
    max-width: 600px;
    margin: 100px auto;
    padding: 0 20px;
    text-align: center;
}

.results h1 {
    font-size: 30px;
}

.bigResult {
    margin-top: 50px;
    font-size: 70px;
    font-weight: 700;
}

.results > p {
    color: #666;
}

.resultStats {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin: 50px 0;
}

.resultStats div {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.resultStats span {
    color: #666;
    font-size: 13px;
}

.resultStats strong {
    font-size: 20px;
}

/* COMPARTIR */
/* COMPARTIR */

.shareResult {
    margin: 45px auto;
    max-width: 420px;
    padding: 25px 20px;
    text-align: center;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color:#101010;

    background: #f8f8f8;
    border-radius: 18px;
}

.shareResult strong {
    font-size: 24px;
    font-weight: 700;
}

.shareResult span {
    color: #666;
    font-size: 15px;
}

.shareResult .mainButton {
    margin-top: 12px;
    padding: 13px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

#shareStatus {
    font-size: 13px;
    min-height: 18px;
}

/* ESTADÍSTIQUES */

.stats {
    max-width: 700px;
    margin: 70px auto;
    padding: 0 25px;
}

.statsHeader {
    display: flex;
    align-items: center;
    gap: 20px;
}

.statsHeader h1 {
    margin: 0;
}

.statsNumbers {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin: 60px 0 25px;
    border-top: 1px solid #222;
    border-bottom: 1px solid #222;
    padding: 25px 0;
}

.statsNumbers div {
    text-align: center;
}

.statsNumbers span,
.statsExtra span {
    display: block;
    color: #666;
    font-size: 13px;
    margin-bottom: 8px;
}

.statsNumbers strong,
.statsExtra strong {
    font-size: 22px;
}

.statsExtra {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    margin-bottom: 55px;
}

.statsExtra div {
    text-align: center;
}

.stats h2 {
    font-size: 18px;
    margin: 35px 0 25px;
}

.accentRow {
    display: grid;
    grid-template-columns: 40px 1fr 60px;
    align-items: center;
    gap: 10px;
    padding: 13px 0;
    border-bottom: 1px solid #1d1d1d;
}

.accentLetter {
    font-size: 18px;
    font-weight: 700;
}

.accentDescription {
    color: #666;
}

.accentAccuracy {
    text-align: right;
    color: #aaa;
}

/* MÒBIL */

@media (max-width: 700px) {
    .topbar {
        padding: 0 18px;
    }

    .home {
        margin-top: 80px;
    }

    .home h1 {
        font-size: 32px;
    }

    .modes {
        grid-template-columns: 1fr;
        gap: 25px;
        margin-top: 45px;
    }

    .config {
        margin-top: 50px;
    }

    .categoryOptions {
        grid-template-columns: 1fr;
    }

    .statsNumbers {
        grid-template-columns: 1fr 1fr;
        gap: 25px;
    }

    .statsExtra {
        grid-template-columns: 1fr 1fr;
    }

    .resultStats {
        gap: 30px;
    }

    .targetText {
        font-size: 30px;
    }

    .results {
        margin-top: 60px;
    }
}

/* =========================
   SEO CONTENT
   ========================= */

.seoContent {
    width: 100%;
    margin-top: 80px;
    padding: 56px 24px 64px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.seoContentInner {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.seoContent h1 {
    margin: 0 0 16px;
    font-size: 28px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.seoContent p {
    margin: 0;
    max-width: 760px;
    color: #9a9a9a;
    font-size: 15px;
    line-height: 1.7;
}

.seoTopics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 40px;
    margin-top: 42px;
}

.seoTopics h2 {
    margin: 0 0 12px;
    font-size: 18px;
    line-height: 1.3;
    font-weight: 600;
}

.seoTopics p {
    font-size: 14px;
    line-height: 1.7;
}

@media (max-width: 700px) {
    .seoContent {
        margin-top: 56px;
        padding: 42px 20px 50px;
    }

    .seoContent h1 {
        font-size: 24px;
    }

    .seoTopics {
        grid-template-columns: 1fr;
        gap: 30px;
        margin-top: 32px;
    }
}