/* === IMPORTS & BASE === */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

/* === VARIÁVEIS GLOBAIS === */
:root {
    --primary: #800020;
    --primary-dark: #5a0015;
    --primary-light: #a0283a;
    --gold: #c9a84c;
    --gold-light: #e8d08a;
    --text-light: #f5f0e8;
    --text-muted: rgba(255, 255, 255, 0.5);
    --text-dark: #2c1810;
    --overlay: rgba(0, 0, 0, 0.4);
    --overlay-strong: rgba(0, 0, 0, 0.7);
    --card-bg: rgba(20, 12, 8, 0.85);
    --font-size-base: 16px;
    --font-size-h1: 3.2em;
    --btn-width: 280px;
    --btn-height: 50px;
    --btn-font-size: 16px;
    --font-family: 'Noto Sans JP', sans-serif;
}

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

body {
    font-family: var(--font-family);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    background-image: url('../images/menu_background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
    overflow: hidden;
}

/* Esconde o overlay padrão — o PNG precisa ficar totalmente transparente */
body::before {
    display: none;
}

body.no-background {
    background-image: none;
}

body.no-background::before {
    display: none;
}

/* === MENU PRINCIPAL (estilo Visual Novel / Ren'Py) === */
.menu {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: 0;
    animation: fadeIn 1s ease-out;
}

/* Afasta levemente o cenário, mantendo o caderno como foco visual. */
.menu::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: rgba(12, 8, 10, 0.04);
    backdrop-filter: blur(200px);
    -webkit-backdrop-filter: blur(20px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Background com movimento lento da esquerda para direita */
body.menu-active {
    animation: slowPan 60s ease-in-out infinite alternate;
}

@keyframes slowPan {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 100% center;
    }
}

/* Container transparente para o título */
.menu .title-group {
    position: absolute;
    top: 85%;
    left: 3%;
    transform: translateY(-50%);
    text-align: left;
    z-index: 2;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 24px 32px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.menu .subtitle {
    color: var(--gold);
    font-size: 13px;
    font-weight: 300;
    letter-spacing: 6px;
    text-transform: uppercase;
    margin-bottom: 10px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.menu h1 {
    color: var(--text-light);
    font-size: var(--font-size-h1);
    font-weight: 700;
    text-align: left;
    letter-spacing: 2px;
    line-height: 1.3;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

/* Container do caderno na lateral esquerda */
.caderno-container {
    position: absolute;
    left: 0;
    right: auto;
    top: 48%;
    /* AJUSTE AQUI a rotação do caderno (negativo = torto pra esquerda) */
    transform: translateY(-50%) rotate(-3deg);
    width: min(800px, 72vh);
    aspect-ratio: 1122 / 1402;
    container-type: size;
    z-index: 1;
    filter: drop-shadow(8px 12px 20px rgba(0, 0, 0, 0.4));
    transition: transform 0.3s ease;
}

.caderno-container:hover {
    transform: translateY(-50%) rotate(-2deg);
}

.main-chibi {
    display: none;
}

.caderno-stage {
    display: contents;
}

.mobile-zoom-tip {
    position: fixed;
    top: max(20px, env(safe-area-inset-top));
    left: 50%;
    z-index: 4;
    display: block;
    width: min(62vw, 560px);
    margin: 0;
    padding: 9px 14px;
    transform: translateX(-50%);
    border: 1px solid rgba(73, 20, 39, 0.3);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.86);
    color: #491427;
    font-size: clamp(12px, 1vw, 14px);
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.14);
    box-sizing: border-box;
}

.caderno-bg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

.caderno-buttons {
    position: absolute;
    /* AJUSTE AQUI a posição dos botões dentro do caderno */
    top: 42%;
    left: 25%;
    right: auto;
    width: 54%;
    display: flex;
    flex-direction: column;
    gap: 3cqh;
}

/* Botões com estilo "caderno de papel / estudantil" - MAIS DESTACADOS */
.caderno-buttons button {
    width: 100%;
    height: 7.5cqh;
    font-family: var(--font-family);
    font-size: 1.5cqh;
    font-weight: 600;
    color: #1a1a1a;
    background: linear-gradient(180deg, #fffef5 0%, #f5edd6 100%);
    border: 0.2cqh solid #8b7355;
    border-bottom: 0.3cqh solid #6b5a45;
    border-radius: 0.4cqh;
    cursor: pointer;
    padding: 0 2cqw;
    letter-spacing: 0.08cqh;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 3px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* Linhas de caderno no fundo do botão */
.caderno-buttons button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 1cqh,
        rgba(180, 200, 230, 0.2) 1cqh,
        rgba(180, 200, 230, 0.2) 1.1cqh
    );
    pointer-events: none;
}

/* Margem vermelha estilo caderno no lado esquerdo */
.caderno-buttons button::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0.3cqh;
    height: 100%;
    background: linear-gradient(180deg, #e57373, #ef5350);
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.caderno-buttons button:hover {
    background: linear-gradient(180deg, #ffffff 0%, #faf3e0 100%);
    transform: translateX(6px) scale(1.03);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 1);
    border-color: #a08060;
    border-bottom-color: #6b5a45;
}

.caderno-buttons button:hover::after {
    opacity: 1;
    width: 4px;
}

.caderno-buttons button:active {
    transform: translateX(3px) scale(0.98);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    transition-duration: 0.05s;
}

/* === COPYRIGHT === */
.copyright {
    position: fixed;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 50%;
    width: fit-content;
    max-width: calc(100vw - 32px);
    transform: translateX(-50%);
    text-align: center;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    color: #491427;
    letter-spacing: 1px;
    z-index: 1;
    box-sizing: border-box;
    border: 1px solid rgba(73, 20, 39, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.76);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    text-shadow: 0 1px 4px rgba(255, 255, 255, 0.95);
    white-space: nowrap;
}

/* === SETTINGS === */
.settings {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    background: var(--overlay-strong);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeIn 0.3s ease-out;
}

.settings-content {
    background: var(--card-bg);
    border: 1px solid rgba(201, 168, 76, 0.3);
    border-radius: 12px;
    padding: 40px 36px;
    width: 90%;
    max-width: 400px;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.4s ease-out;
}

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

.settings-content h1 {
    color: var(--text-light);
    font-size: 1.6em;
    font-weight: 500;
    text-align: center;
    margin-bottom: 32px;
    letter-spacing: 2px;
}

.settings-group {
    margin-bottom: 24px;
}

.settings-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-light);
    font-size: 14px;
    font-weight: 300;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.settings-group label span {
    color: var(--gold);
    font-weight: 500;
    font-size: 13px;
}

.settings-upgrade {
    margin: 4px 0 20px;
    padding: 16px;
    border: 1px solid rgba(201, 168, 76, 0.38);
    border-radius: 10px;
    background: rgba(201, 168, 76, 0.08);
    color: var(--text-light);
}

.settings-upgrade[hidden] { display: none; }

.settings-upgrade > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
}

.settings-upgrade > div span {
    color: var(--gold);
    font-size: 12px;
    text-align: right;
}

.settings-upgrade p {
    margin: 9px 0 12px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    line-height: 1.4;
}

.settings-upgrade button {
    width: 100%;
    min-height: 42px;
    border: 1px solid rgba(201, 168, 76, 0.65);
    border-radius: 7px;
    background: linear-gradient(135deg, #c9a84c, #9b8035);
    color: #211708;
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.settings-upgrade button:hover { filter: brightness(1.08); }

/* === SLIDER CUSTOM === */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--gold);
    border: 2px solid var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--gold);
    border: 2px solid var(--primary);
    cursor: pointer;
}

.settings-content .back-btn {
    width: 100%;
    margin-top: 8px;
    height: 48px;
    font-family: var(--font-family);
    font-size: 15px;
    font-weight: 400;
    color: var(--text-light);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.2s ease;
}

.settings-content .back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--gold);
}

.settings-content .logout-btn {
    width: 100%;
    min-height: 48px;
    margin-top: 12px;
    border: 1px solid rgba(255, 120, 120, 0.48);
    border-radius: 8px;
    background: rgba(128, 0, 32, 0.34);
    color: #ffd9d9;
    font-family: var(--font-family);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.settings-content .logout-btn:hover {
    border-color: #ff8f8f;
    background: rgba(155, 0, 42, 0.62);
    transform: translateY(-1px);
}

/* === VISUAL NOVEL === */
.visual-novel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 1000;
    overflow: hidden;
}

.background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: -1;
}

/* === MENUS DE SELEÇÃO === */
.visual-novel-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--overlay-strong);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.choice-box {
    background: var(--card-bg);
    border: 1px solid rgba(201, 168, 76, 0.2);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    width: 85%;
    max-width: 480px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    max-height: 80vh;
    max-height: 80dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: slideUp 0.3s ease-out;
}

.choice-box h1 {
    color: var(--text-light);
    font-size: 1.4em;
    font-weight: 500;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

.choice-box button {
    display: block;
    width: 100%;
    padding: 14px 20px;
    margin: 6px 0;
    background: rgba(128, 0, 32, 0.4);
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.choice-box button:hover {
    background: rgba(128, 0, 32, 0.7);
    border-color: var(--gold);
    transform: translateX(4px);
}

.choice-box button:active {
    transform: translateX(2px);
}

/* === VISUAL NOVEL COM SPRITE GRANDE === */
.character-sprite-large {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    height: 90vh;
    width: auto;
    z-index: 5;
    pointer-events: none;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.5));
    transition: left 0.45s ease, transform 0.45s ease, height 0.45s ease;
}

#feedback-medica .character-sprite-large.feedback-result-intermediate {
    height: 105vh;
    bottom: -7vh;
}

/* Primeiro quadro: Isabela centralizada. Após o clique, ela abre espaço para o menu. */
.visual-novel.story-hub-open .character-sprite-large {
    left: 24%;
    transform: translateX(-50%);
    height: 82vh;
}

.story-choice-menu {
    position: absolute;
    right: 4%;
    top: 50%;
    width: 66vw;
    max-width: 920px;
    transform: translateY(-50%) translateX(24px);
    opacity: 0;
    pointer-events: none;
    z-index: 12;
    transition: opacity 0.3s ease 0.15s, transform 0.3s ease 0.15s;
}

.visual-novel.story-hub-open .story-choice-menu {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    pointer-events: auto;
}

.story-choice-menu#story-theory-menu { display: none; }
.visual-novel.story-theory-open .character-sprite-large { left: 24%; transform: translateX(-50%); height: 82vh; }
.visual-novel.story-theory-open #story-theory-menu { display: block; opacity: 1; transform: translateY(-50%) translateX(0); pointer-events: auto; }
.visual-novel.story-theory-open #story-choice-menu { display: none; }

.story-choice-menu button {
    display: block;
    width: 100%;
    margin: 12px 0;
    padding: 20px 28px;
    background: rgba(10, 6, 4, 0.92);
    color: var(--text-light);
    border: 1px solid rgba(201, 168, 76, 0.35);
    border-radius: 18px;
    font-family: var(--font-family);
    font-size: clamp(16px, 1.35vw, 20px);
    font-weight: 500;
    cursor: pointer;
}

.story-choice-menu button:hover { border-color: var(--gold); background: rgba(128, 0, 32, 0.8); }
.story-choice-menu .story-choice-back {
    margin-top: 22px;
    background: rgba(20, 12, 8, 0.72);
    border-color: rgba(255, 255, 255, 0.2);
}
.story-choice-menu .story-choice-back:hover {
    background: rgba(20, 12, 8, 0.9);
    border-color: rgba(255, 255, 255, 0.4);
}
.learning-statistics-screen {
    align-items: flex-start;
    overflow-y: auto;
    padding: clamp(18px, 4vw, 48px);
}

.learning-statistics-shell {
    position: relative;
    z-index: 2;
    width: min(1080px, 100%);
    min-height: calc(100vh - clamp(36px, 8vw, 96px));
    margin: auto;
    padding: clamp(22px, 4vw, 44px);
    border: 1px solid rgba(138, 80, 57, 0.48);
    border-radius: 24px;
    color: #432b22;
    background:
        repeating-linear-gradient(0deg, transparent 0 31px, rgba(83, 117, 142, 0.07) 32px),
        linear-gradient(145deg, rgba(255, 251, 239, 0.97), rgba(235, 218, 185, 0.97));
    box-shadow: 0 28px 80px rgba(10, 20, 39, 0.48), inset 0 0 0 5px rgba(255, 252, 239, 0.55);
}

.learning-statistics-header,
.statistics-dashboard-heading,
.statistics-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.learning-statistics-header {
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(117, 75, 55, 0.24);
}

.learning-statistics-header h1,
.statistics-selection-panel h2,
.statistics-dashboard-heading h2,
.statistics-report-section h3 {
    margin: 0;
    color: #572b23;
}

.learning-statistics-header h1 { font-size: clamp(25px, 4vw, 38px); }
.statistics-dashboard-heading h2 { font-size: clamp(22px, 3vw, 30px); }
.statistics-report-section h3 { font-size: clamp(18px, 2.5vw, 24px); }

.statistics-eyebrow,
.statistics-section-kicker {
    display: block;
    margin-bottom: 4px;
    color: #9a5142;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

button.statistics-close-button {
    display: grid;
    flex: 0 0 44px;
    place-items: center;
    width: 44px;
    min-width: 44px;
    height: 44px;
    margin: 0;
    padding: 0 0 3px;
    border: 1px solid rgba(95, 47, 37, 0.34);
    border-radius: 50%;
    color: #65372e;
    background: rgba(255, 251, 239, 0.66);
    box-shadow: 0 3px 0 rgba(95, 47, 37, 0.2);
    font-size: 30px;
    line-height: 1;
}

.statistics-selection-panel {
    width: min(760px, 100%);
    margin: clamp(40px, 8vh, 84px) auto 20px;
    text-align: center;
}

.statistics-selection-panel > p {
    margin: 10px auto 28px;
    color: #75584a;
    line-height: 1.55;
}

.statistics-choice-grid,
.statistics-scope-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

button.statistics-choice-card,
button.statistics-scope-button {
    width: 100%;
    min-height: 150px;
    margin: 0;
    padding: 24px;
    border: 1px solid #b9876f;
    border-radius: 18px;
    color: #4d3028;
    background: rgba(255, 252, 241, 0.72);
    box-shadow: 0 6px 0 rgba(120, 76, 57, 0.22), 0 12px 24px rgba(75, 46, 34, 0.12);
    text-align: left;
}

button.statistics-choice-card:hover,
button.statistics-scope-button:hover {
    border-color: #7a4036;
    background: rgba(255, 252, 241, 0.96);
    transform: translateY(-2px);
}

.statistics-choice-card strong,
.statistics-choice-card small {
    display: block;
}

.statistics-choice-card strong { margin: 12px 0 5px; font-size: 23px; }
.statistics-choice-card small { color: #806458; font-size: 13px; }
.statistics-choice-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    color: #fff8e9;
    background: #7d3b31;
    font: 800 20px/1 var(--font-family);
}

.statistics-scope-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
button.statistics-scope-button {
    min-height: 86px;
    padding: 18px;
    text-align: center;
    font-weight: 800;
}

button.statistics-scope-button.statistics-scope-general {
    color: #fff;
    background: linear-gradient(145deg, #236ea2, #174d76);
    border-color: #6db4e3;
}

button.statistics-inline-back,
button.statistics-filter-button {
    width: auto;
    min-height: 40px;
    margin: 0;
    padding: 9px 15px;
    border: 1px solid rgba(111, 66, 50, 0.35);
    border-radius: 11px;
    color: #653a30;
    background: rgba(255, 252, 241, 0.68);
    box-shadow: none;
    font-size: 13px;
    font-weight: 800;
}

button.statistics-inline-back { margin-bottom: 22px; }
.statistics-dashboard { padding-top: 28px; }
.statistics-loading {
    margin: 34px 0;
    padding: 30px;
    border-radius: 16px;
    color: #70443a;
    background: rgba(255, 252, 241, 0.58);
    text-align: center;
    font-weight: 700;
}

.statistics-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 13px;
    margin: 24px 0 16px;
}

.statistics-summary-card {
    padding: 18px;
    border: 1px solid rgba(126, 79, 59, 0.25);
    border-radius: 15px;
    background: rgba(255, 253, 245, 0.69);
}

.statistics-summary-card strong {
    display: block;
    margin-bottom: 4px;
    color: #66352b;
    font-size: clamp(24px, 4vw, 34px);
}

.statistics-summary-card span { color: #806357; font-size: 12px; font-weight: 700; }

.statistics-priority-card {
    margin-bottom: 20px;
    padding: 18px 20px;
    border: 1px solid rgba(173, 121, 61, 0.42);
    border-radius: 15px;
    color: #604127;
    background: rgba(246, 210, 133, 0.25);
    line-height: 1.55;
}

.statistics-priority-card strong { color: #673b27; }
.statistics-report-section {
    margin-top: 18px;
    padding: 22px;
    border: 1px solid rgba(126, 79, 59, 0.26);
    border-radius: 18px;
    background: rgba(255, 253, 245, 0.65);
}

.statistics-subject-list,
.statistics-error-type-list,
.statistics-recommendation-list {
    display: grid;
    gap: 11px;
    margin-top: 18px;
}

.statistics-subject-row {
    display: grid;
    grid-template-columns: minmax(160px, 1.25fr) minmax(140px, 2fr) auto;
    align-items: center;
    gap: 14px;
}

.statistics-subject-name {
    color: #52372f;
    font-size: 13px;
    font-weight: 800;
}

.statistics-progress-track {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(106, 75, 61, 0.14);
}

.statistics-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: #5f9a62;
}

.statistics-progress-fill.is-medium { background: #d09a3e; }
.statistics-progress-fill.is-low { background: #b55549; }
.statistics-progress-fill.is-empty { width: 0 !important; }
.statistics-subject-score {
    min-width: 98px;
    color: #72574b;
    font-size: 12px;
    text-align: right;
}

.statistics-error-type-row,
.statistics-recommendation-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-radius: 13px;
    background: rgba(238, 224, 198, 0.5);
}

.statistics-error-type-row strong,
.statistics-recommendation-copy strong {
    display: block;
    color: #57352c;
    font-size: 14px;
}

.statistics-error-type-row span,
.statistics-recommendation-copy span {
    display: block;
    margin-top: 3px;
    color: #806358;
    font-size: 12px;
}

.statistics-error-badge {
    flex: 0 0 auto;
    padding: 7px 10px;
    border-radius: 999px;
    color: #8b3028 !important;
    background: rgba(181, 85, 73, 0.13);
    font-weight: 800;
}

button.statistics-play-button {
    flex: 0 0 auto;
    width: auto;
    min-width: 112px;
    min-height: 40px;
    margin: 0;
    padding: 10px 15px;
    border: 0;
    border-radius: 10px;
    color: #fff;
    background: #236ea2;
    box-shadow: 0 3px 0 #154766;
    font-size: 12px;
    font-weight: 800;
}

.statistics-empty {
    margin: 0;
    padding: 18px;
    border-radius: 12px;
    color: #806357;
    background: rgba(238, 224, 198, 0.38);
    text-align: center;
    line-height: 1.5;
}

.statistics-error { min-height: 20px; color: #9b382e; font-weight: 700; }

@media (max-width: 720px) {
    .learning-statistics-screen { padding: 10px; }
    .learning-statistics-shell {
        min-height: calc(100vh - 20px);
        padding: 18px 14px 26px;
        border-radius: 18px;
    }
    .statistics-choice-grid,
    .statistics-scope-grid,
    .statistics-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .statistics-selection-panel { margin-top: 34px; }
    button.statistics-choice-card { min-height: 132px; padding: 18px; }
    .statistics-dashboard-heading { align-items: flex-start; }
    .statistics-subject-row {
        grid-template-columns: 1fr auto;
        gap: 7px 12px;
    }
    .statistics-progress-track { grid-column: 1 / -1; grid-row: 2; }
    .statistics-subject-score { min-width: 0; }
    .statistics-report-section { padding: 17px 13px; }
    .statistics-error-type-row,
    .statistics-recommendation-row { align-items: flex-start; }
}

@media (max-width: 430px) {
    .statistics-scope-grid { grid-template-columns: 1fr; }
    .statistics-summary-card { padding: 14px 12px; }
    .statistics-summary-card strong { font-size: 25px; }
    .statistics-recommendation-row { flex-direction: column; }
    button.statistics-play-button { width: 100%; }
}
.theoretical-game-box { max-width: 720px; }
#theoretical-progress, #theoretical-feedback { color: var(--text-light); line-height: 1.5; }
#theoretical-feedback { min-height: 1.5em; }

/* === QUESTÕES TEÓRICAS — CADERNO SOBRE A MESA DO JOGO === */
#theoretical-exams,
#theoretical-topics,
#theoretical-difficulty,
#theoretical-game {
    background:
        linear-gradient(rgba(18, 8, 14, 0.48), rgba(18, 8, 14, 0.62)),
        url('../images/game_background.jpg') center / cover no-repeat fixed;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.theoretical-selection-background {
    background-image: url('../images/dialogue_bg.jpg');
}

#theoretical-topics,
#theoretical-difficulty {
    background: var(--overlay-strong);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.theoretical-topic-container .phase-button:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    transform: none;
}

.theoretical-step-label {
    margin: 0 0 8px;
    color: var(--gold);
    text-align: center;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

#theoretical-exams .choice-box,
#theoretical-topics .choice-box,
#theoretical-game .choice-box {
    position: relative;
    width: min(90vw, 680px);
    max-width: 680px;
    padding: 38px 34px 34px 66px;
    border: 1px solid rgba(105, 78, 43, 0.38);
    border-radius: 10px 16px 14px 9px;
    background-color: #fffaf0;
    background-image:
        linear-gradient(90deg, transparent 0, transparent 42px, rgba(178, 54, 69, 0.28) 42px, rgba(178, 54, 69, 0.28) 44px, transparent 44px),
        repeating-linear-gradient(0deg, transparent 0, transparent 31px, rgba(63, 117, 181, 0.12) 31px, rgba(63, 117, 181, 0.12) 32px);
    color: #302925;
    box-shadow: 0 22px 55px rgba(24, 10, 15, 0.48), inset 0 0 32px rgba(127, 94, 47, 0.06);
}

#theoretical-game .choice-box {
    max-width: 780px;
}

#theoretical-question {
    font-size: clamp(1.05rem, 2.1vw, 1.35rem);
    line-height: 1.48;
    text-align: left;
}

.theoretical-question-line {
    display: block;
}

.theoretical-question-introduction {
    margin-bottom: 1rem;
}

.theoretical-question-assertion + .theoretical-question-assertion {
    margin-top: 0.62rem;
}

.theoretical-question-because {
    margin: 1.15rem 0;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-align: center;
}

.theoretical-question-reason {
    margin-bottom: 1rem;
}

.theoretical-question-conclusion {
    margin-top: 1.1rem;
}

#theoretical-options button {
    line-height: 1.42;
    text-align: left;
}

#theoretical-exams .choice-box h1,
#theoretical-topics .choice-box h1,
#theoretical-game .choice-box h1 {
    color: #491427;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-shadow: none;
}

#theoretical-progress {
    color: #315e91;
    font-weight: 700;
}

#theoretical-feedback {
    color: #491427;
    white-space: pre-line;
}

#theoretical-feedback.theoretical-feedback-correct,
#theoretical-feedback.theoretical-feedback-incorrect {
    min-height: 0;
    margin: 18px 0 12px;
    padding: 16px 18px;
    border: 1px solid;
    border-radius: 12px;
    line-height: 1.55;
    box-shadow: 0 5px 14px rgba(52, 35, 27, 0.1);
}

#theoretical-feedback.theoretical-feedback-correct {
    border-color: rgba(35, 125, 76, 0.48);
    color: #155d37;
    background: rgba(93, 190, 128, 0.2);
}

#theoretical-feedback.theoretical-feedback-incorrect {
    border-color: rgba(174, 54, 62, 0.48);
    color: #842d35;
    background: rgba(222, 91, 98, 0.18);
}

#theoretical-next {
    border: 1px solid #64132f;
    border-bottom: 3px solid #3e0b1d;
    color: #fffaf0;
    background: #861b43;
    box-shadow: 0 5px 12px rgba(73, 20, 39, 0.24);
}

#theoretical-next:hover {
    border-color: #4d0d25;
    color: #fff;
    background: #a02252;
}

#theoretical-exam-buttons button,
#theoretical-options button,
#theoretical-topics .choice-box > button,
#theoretical-game .choice-box > button {
    border: 1px solid rgba(73, 20, 39, 0.24);
    border-bottom: 3px solid rgba(73, 20, 39, 0.38);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.76);
    color: #3b2d2a;
    box-shadow: 0 4px 10px rgba(73, 20, 39, 0.08);
}

#theoretical-exam-buttons button:hover,
#theoretical-options button:hover,
#theoretical-topics .choice-box > button:hover,
#theoretical-game .choice-box > button:hover {
    border-color: #8f1641;
    background: #fff;
    color: #701234;
}

#theoretical-options button.theoretical-option-correct,
#theoretical-options button.theoretical-option-correct:hover,
#theoretical-options button.theoretical-option-correct:disabled {
    opacity: 1;
    border-color: #17613a;
    border-bottom-color: #10452a;
    color: #fff;
    background: #31875a;
    box-shadow: 0 4px 10px rgba(30, 104, 66, 0.28);
    cursor: default;
    transform: none;
}

#theoretical-options button.theoretical-option-incorrect,
#theoretical-options button.theoretical-option-incorrect:hover,
#theoretical-options button.theoretical-option-incorrect:disabled {
    opacity: 1;
    border-color: #83232d;
    border-bottom-color: #5e1820;
    color: #fff;
    background: #b73d4a;
    box-shadow: 0 4px 10px rgba(145, 38, 49, 0.28);
    cursor: default;
    transform: none;
}

@media (max-width: 600px) {
    #theoretical-exams .choice-box,
    #theoretical-topics .choice-box,
    #theoretical-game .choice-box {
        width: 94vw;
        padding: 28px 18px 24px 42px;
        background-image:
            linear-gradient(90deg, transparent 0, transparent 25px, rgba(178, 54, 69, 0.28) 25px, rgba(178, 54, 69, 0.28) 27px, transparent 27px),
            repeating-linear-gradient(0deg, transparent 0, transparent 27px, rgba(63, 117, 181, 0.12) 27px, rgba(63, 117, 181, 0.12) 28px);
    }

    #theoretical-question {
        font-size: 1rem;
        line-height: 1.42;
    }

    .theoretical-question-introduction {
        margin-bottom: 0.8rem;
    }

    .theoretical-question-because {
        margin: 0.9rem 0;
    }
}

.dialogue-container-large {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: 0 10px 30px;
    box-sizing: border-box;
    z-index: 10;
}

.dialogue-box-large {
    background: rgba(10, 6, 4, 0.92);
    border: 1px solid rgba(201, 168, 76, 0.3);
    padding: 28px 32px;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.dialogue-text-large {
    font-size: 1.4em;
    font-weight: 400;
    color: var(--text-light);
    line-height: 1.8;
    margin: 0 0 20px 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

.continue-button {
    padding: 14px 40px;
    background: rgba(128, 0, 32, 0.7);
    color: var(--text-light);
    border: 1px solid rgba(201, 168, 76, 0.4);
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.25s ease;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}

.continue-button:hover {
    background: rgba(128, 0, 32, 0.9);
    border-color: var(--gold);
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.5);
}

@media (orientation: portrait) {
    .visual-novel.story-hub-open .character-sprite-large,
    .visual-novel.story-theory-open .character-sprite-large {
        display: none;
    }

    .visual-novel.story-hub-open .dialogue-container-large,
    .visual-novel.story-theory-open .dialogue-container-large {
        display: none;
    }

    .story-choice-menu {
        right: auto;
        left: 50%;
        width: min(88vw, 620px);
        transform: translate(-50%, -50%) translateY(20px);
    }

    .visual-novel.story-hub-open .story-choice-menu,
    .visual-novel.story-theory-open #story-theory-menu {
        transform: translate(-50%, -50%);
    }

    .story-choice-menu button {
        min-height: 58px;
        margin: 12px 0;
        padding: 16px 20px;
        border-radius: 16px;
        font-size: clamp(16px, 4.5vw, 20px);
    }
}

/* Relato de erro — regras finais para não herdar a aparência dos menus antigos. */
button.report-error-button {
    position: relative;
    width: auto;
    min-width: 172px;
    min-height: 42px;
    margin: 10px 0;
    padding: 9px 18px 9px 42px;
    border: 1px solid rgba(111, 48, 39, 0.48) !important;
    border-radius: 999px !important;
    color: #633128 !important;
    background: linear-gradient(180deg, rgba(255, 250, 235, 0.96), rgba(229, 207, 167, 0.96)) !important;
    box-shadow: 0 4px 0 #9b6251, 0 7px 16px rgba(49, 25, 19, 0.2) !important;
    font: 700 14px/1.2 var(--font-family) !important;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

button.report-error-button::before {
    content: '!';
    position: absolute;
    left: 13px;
    top: 50%;
    display: grid;
    place-items: center;
    width: 21px;
    height: 21px;
    transform: translateY(-50%);
    border-radius: 50%;
    color: #fff8e9;
    background: #843d35;
    font: 800 14px/1 var(--font-family);
}

button.report-error-button:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
    box-shadow: 0 5px 0 #9b6251, 0 9px 18px rgba(49, 25, 19, 0.24) !important;
}

button.report-error-button:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #9b6251, 0 3px 7px rgba(49, 25, 19, 0.2) !important;
}

div.error-report-overlay {
    background: rgba(28, 15, 12, 0.74);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}

div.error-report-card {
    position: relative;
    isolation: isolate;
    width: min(540px, calc(100vw - 32px));
    overflow: hidden;
    padding: 30px;
    border: 1px solid #b98b65;
    border-radius: 22px;
    color: #432a21;
    background:
        repeating-linear-gradient(0deg, transparent 0 27px, rgba(116, 72, 50, 0.045) 28px),
        linear-gradient(145deg, #fffaf0, #ead8b9);
    box-shadow: 0 28px 80px rgba(17, 7, 4, 0.55), inset 0 0 0 5px rgba(255, 250, 232, 0.6);
    font-family: var(--font-family);
}

div.error-report-card::after {
    content: '';
    position: absolute;
    inset: 9px;
    z-index: -1;
    pointer-events: none;
    border: 1px solid rgba(126, 67, 48, 0.22);
    border-radius: 15px;
}

.error-report-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.error-report-icon {
    display: grid;
    flex: 0 0 46px;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    color: #fff8e7;
    background: linear-gradient(145deg, #9a4a3d, #64281f);
    box-shadow: 0 4px 0 #4e211b;
    font-size: 26px;
    font-weight: 800;
}
.error-report-eyebrow {
    display: block;
    margin-bottom: 2px;
    color: #9b5948;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
div.error-report-card h2 { margin: 0; color: #5d291f; font-size: clamp(22px, 4vw, 29px); line-height: 1.15; }
.error-report-helper { margin: 0 0 18px; color: #674a3e; font-size: 14px; line-height: 1.55; }
.error-report-label { display: block; margin-bottom: 7px; color: #4d2b23; font-size: 13px; font-weight: 800; }
div.error-report-card textarea {
    display: block;
    width: 100%;
    min-height: 132px;
    padding: 13px 14px;
    border: 1px solid #b68b74;
    border-radius: 12px;
    outline: none;
    color: #3e2921;
    background: rgba(255, 253, 246, 0.82);
    box-shadow: inset 0 2px 5px rgba(75, 42, 30, 0.09);
    font: 400 14px/1.5 var(--font-family);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}
div.error-report-card textarea:focus {
    border-color: #863f34;
    box-shadow: 0 0 0 3px rgba(134, 63, 52, 0.14), inset 0 2px 5px rgba(75, 42, 30, 0.08);
}
.error-report-meta { display: flex; justify-content: space-between; margin-top: 6px; color: #8a6b5c; font-size: 11px; }
div.error-report-card #error-report-status { min-height: 21px; margin: 10px 0 0; color: #7a3028; font-size: 13px; font-weight: 700; }
div.error-report-actions { justify-content: flex-end; gap: 10px; margin-top: 5px; }
div.error-report-actions button {
    width: auto;
    min-width: 128px;
    min-height: 44px;
    margin: 0;
    padding: 10px 18px;
    border: 0;
    border-radius: 12px;
    color: #fff9ed;
    background: linear-gradient(180deg, #984a3d, #682b23);
    box-shadow: 0 4px 0 #4d201a, 0 7px 14px rgba(64, 29, 22, 0.18);
    font: 700 14px/1 var(--font-family);
    cursor: pointer;
}
div.error-report-actions button:hover { filter: brightness(1.08); transform: translateY(-1px); }
div.error-report-actions button:active { transform: translateY(2px); box-shadow: 0 2px 0 #4d201a; }
div.error-report-actions button:disabled { opacity: 0.55; cursor: wait; transform: none; }
div.error-report-actions button.report-cancel-button {
    border: 1px solid #a78370;
    color: #604035;
    background: rgba(255, 250, 237, 0.68) !important;
    box-shadow: 0 3px 0 #b9947e;
}

@media (orientation: portrait) {
    div.error-report-card { padding: 24px 20px; border-radius: 18px; }
    div.error-report-actions { display: grid; grid-template-columns: 1fr 1fr; }
    div.error-report-actions button { min-width: 0; width: 100%; padding-inline: 10px; }
    button.report-error-button { width: auto; min-width: 172px; }
}

.question-actions,
.error-report-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.question-actions > [hidden],
#practical-report-error[hidden] { display: none !important; }

.report-error-button {
    background: rgba(82, 45, 35, 0.82) !important;
    border: 1px solid rgba(255, 244, 222, 0.65) !important;
    color: #fff8e8 !important;
}

.error-report-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(30, 18, 14, 0.72);
}

.error-report-overlay[hidden] { display: none; }

.error-report-card {
    width: min(520px, 100%);
    padding: 26px;
    border: 2px solid #7c3d31;
    border-radius: 20px;
    color: #38251e;
    background: linear-gradient(145deg, #fff7e4, #ead8b5);
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.38);
}

.error-report-card h2 { margin-top: 0; color: #792f29; }
.error-report-card textarea {
    box-sizing: border-box;
    width: 100%;
    resize: vertical;
    padding: 12px;
    border: 1px solid #9b7462;
    border-radius: 10px;
    color: #38251e;
    background: rgba(255, 255, 255, 0.72);
    font: inherit;
}
.error-report-card button { margin-top: 12px; }
.error-report-card #error-report-status { min-height: 1.3em; color: #792f29; }
.report-cancel-button { background: #715f56 !important; }

@media (orientation: portrait) {
    .error-report-card { padding: 20px; }
    .question-actions > button { width: 100%; }
}

/* === TELA DE SELEÇÃO DE FASES (SEPARADA) === */
.phase-selection {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--overlay-strong);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.phase-selection-container {
    background: var(--card-bg);
    border: 1px solid rgba(201, 168, 76, 0.3);
    padding: 40px 36px;
    border-radius: 16px;
    text-align: center;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    max-height: 85vh;
    max-height: 85dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: slideUp 0.4s ease-out;
}

.phase-selection-title {
    color: var(--text-light);
    font-size: 1.8em;
    font-weight: 500;
    margin-bottom: 30px;
    letter-spacing: 1px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.phase-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.phase-button {
    display: block;
    width: 100%;
    padding: 18px 24px;
    background: rgba(128, 0, 32, 0.5);
    color: var(--text-light);
    border: 1px solid rgba(201, 168, 76, 0.3);
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 16px;
    font-weight: 400;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all 0.25s ease;
    text-align: left;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.phase-button::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: var(--gold);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.phase-button:hover {
    background: rgba(128, 0, 32, 0.75);
    border-color: var(--gold);
    transform: translateX(6px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.phase-button.phase-button-locked {
    filter: grayscale(0.35);
    opacity: 0.68;
    background: rgba(82, 35, 47, 0.48);
    border-style: dashed;
}

.phase-button.phase-button-locked:hover {
    opacity: 1;
}

.phase-button:hover::before {
    opacity: 1;
}

.phase-button:active {
    transform: translateX(3px) scale(0.98);
    transition: all 0.1s ease;
}

.phase-button-exam {
    background: rgba(30, 120, 65, 0.72);
    border-color: rgba(105, 210, 135, 0.55);
}

.phase-button-exam::before {
    background: #8ee6a8;
}

.phase-button-exam:hover {
    background: rgba(35, 145, 75, 0.9);
    border-color: #8ee6a8;
    box-shadow: 0 4px 18px rgba(25, 130, 65, 0.38);
}

.phase-button-exam.phase-button-locked {
    filter: grayscale(0.08);
    background: rgba(30, 120, 65, 0.52);
    border-color: rgba(105, 210, 135, 0.48);
}

.phase-button-exam.phase-button-locked:hover {
    background: rgba(35, 145, 75, 0.78);
    border-color: #8ee6a8;
}

.theoretical-exam-section-label {
    margin: 12px 4px 0;
    color: #f4d77f;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-align: left;
    text-transform: uppercase;
}

.theoretical-exam-divider {
    display: block;
    height: 1px;
    margin: 8px 4px;
    background: linear-gradient(90deg, transparent, rgba(244, 215, 127, 0.7), transparent);
}

button.phase-button.phase-button-custom-exam {
    background: #1769c2;
    border-color: #82bdff;
}

button.phase-button.phase-button-custom-exam::before {
    background: #78b7ff;
}

button.phase-button.phase-button-custom-exam:hover {
    background: #2180e5;
    border-color: #9acaff;
    box-shadow: 0 4px 18px rgba(30, 110, 220, 0.42);
}

.phase-button-back {
    background: rgba(20, 12, 8, 0.6);
    border-color: rgba(255, 255, 255, 0.15);
    text-align: center;
    margin-top: 12px;
}

.phase-button-back:hover {
    background: rgba(20, 12, 8, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
}

/* === SOBRE O JOGO E MAIS === */
.about-menu-background {
    background-image:
        linear-gradient(rgba(12, 6, 10, 0.38), rgba(12, 6, 10, 0.58)),
        url('../images/dialogue_bg.jpg');
}

.about-scroll-container {
    width: min(92vw, 760px);
    max-width: 760px;
    max-height: 88vh;
    max-height: 88dvh;
    padding: 34px;
    text-align: left;
    scrollbar-width: thin;
    scrollbar-color: rgba(201, 168, 76, 0.65) rgba(255, 255, 255, 0.06);
}

.about-scroll-container .phase-selection-title {
    text-align: center;
}

.about-options {
    display: grid;
    gap: 12px;
}

.about-option {
    overflow: hidden;
    border: 1px solid rgba(201, 168, 76, 0.32);
    border-radius: 10px;
    background: rgba(128, 0, 32, 0.42);
    color: var(--text-light);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}

.about-option summary {
    position: relative;
    padding: 18px 48px 18px 22px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.4px;
    cursor: pointer;
    list-style: none;
}

.about-option summary::-webkit-details-marker {
    display: none;
}

.about-option summary::after {
    content: '+';
    position: absolute;
    top: 50%;
    right: 22px;
    transform: translateY(-50%);
    color: var(--gold);
    font-size: 24px;
    line-height: 1;
}

.about-option[open] {
    border-color: var(--gold);
    background: rgba(128, 0, 32, 0.64);
}

.about-option[open] summary::after {
    content: '−';
}

.about-option p {
    margin: 0;
    padding: 0 22px 20px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 14px;
    line-height: 1.65;
}

.about-back-button {
    margin-top: 20px;
}

@media (max-width: 600px) {
    .about-scroll-container {
        width: 94vw;
        padding: 26px 18px;
    }

    .about-option summary {
        padding: 16px 42px 16px 18px;
        font-size: 14px;
    }

    .about-option p {
        padding: 0 18px 18px;
        font-size: 13px;
    }
}

/* === CONFIGURAÇÃO DAS PROVAS PRÁTICAS E TEÓRICAS === */
.study-set-config-box,
.theoretical-exam-config-box {
    width: min(92vw, 620px);
    max-height: 88vh;
    max-height: 88dvh;
    overflow-y: auto;
}

#study-set-config-helper,
.theoretical-exam-config-helper {
    margin: 0 0 8px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 14px;
    line-height: 1.45;
}

.study-set-total-row,
.study-set-topic-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 90px;
    align-items: center;
    gap: 6px 16px;
    padding: 12px 0;
    color: var(--text-light);
    text-align: left;
}

.study-set-total-row {
    padding: 14px 0 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 500;
}

.study-set-total-row span,
.study-set-topic-row small {
    grid-column: 1 / -1;
    color: rgba(255, 255, 255, 0.62);
    font-size: 12px;
}

.study-set-topic-row + .study-set-topic-row {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.study-set-total-row input,
.study-set-topic-row input {
    width: 90px;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid rgba(142, 230, 168, 0.5);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-light);
    font: inherit;
    text-align: center;
    box-sizing: border-box;
}

#study-set-config-summary,
#theoretical-exam-config-summary {
    color: #8ee6a8;
    font-size: 14px;
}

#study-set-config-error,
#theoretical-exam-config-error {
    min-height: 20px;
    color: #ff8b8b;
    font-size: 14px;
}

.study-set-config-back {
    background: transparent !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Scrollbar customizada para phase-buttons */
.phase-buttons::-webkit-scrollbar {
    width: 6px;
}

.phase-buttons::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.phase-buttons::-webkit-scrollbar-thumb {
    background: rgba(201, 168, 76, 0.4);
    border-radius: 3px;
}

.phase-buttons::-webkit-scrollbar-thumb:hover {
    background: rgba(201, 168, 76, 0.6);
}

/* === GAME AREA === */
.game {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    text-align: center;
    transition: opacity 0.5s ease-in-out;
    opacity: 0;
    background-image: url('../images/game_background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    z-index: 1000;
}

.game.active {
    opacity: 1;
}

.game::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    pointer-events: none;
}

.game-content {
    background: var(--card-bg);
    border: 1px solid rgba(201, 168, 76, 0.2);
    padding: 24px;
    border-radius: 12px;
    max-width: 800px;
    width: 92%;
    margin: 20px auto;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
}

.game-content h1 {
    font-size: 1.4em;
    color: var(--text-light);
    font-weight: 500;
    letter-spacing: 1px;
}

/* === CONTAINER & TARGETS === */
.container {
    position: relative;
    display: inline-block;
    border: 1px solid rgba(201, 168, 76, 0.3);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    max-width: 100%;
    box-sizing: border-box;
}

.container img {
    display: block;
    max-width: 100%;
    height: auto;
}

.img-wrapper {
    position: relative;
    display: inline-block;
    line-height: 0;
}

#targets {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.target {
    position: absolute;
    background-color: rgb(255, 251, 0);
    border: 2px solid var(--gold);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    pointer-events: auto;
    transform: translate(-50%, -50%);
}

.target:hover {
    transform: translate(-50%, -50%) scale(1.3);
    background-color: rgba(201, 168, 76, 0.6);
}

.target.correct {
    background-color: rgba(76, 175, 80, 0.6);
    border-color: #4CAF50;
}

.target.incorrect {
    background-color: rgba(244, 67, 54, 0.6);
    border-color: #F44336;
}

.blinking {
    animation: blink 1s infinite;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* === PROGRESS BAR === */
.progress-bar {
    width: 100%;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    margin-top: 20px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--gold) 100%);
    width: 0;
    transition: width 0.5s ease-in-out;
}

/* === FEEDBACK === */
#feedback {
    font-size: 16px;
    font-weight: 400;
    margin-top: 10px;
    color: var(--text-light);
}

#question {
    background: rgba(128, 0, 32, 0.5);
    border: 1px solid rgba(201, 168, 76, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-light);
    font-style: normal;
    font-weight: 300;
    font-size: clamp(14px, 4vw, 17px);
}

.structure-name {
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* === TIMER === */
#timer {
    font-size: 18px;
    font-weight: 400;
    color: var(--text-light);
    margin: 16px 0;
    text-align: center;
    background: var(--card-bg);
    border: 1px solid rgba(201, 168, 76, 0.2);
    padding: 10px 16px;
    border-radius: 6px;
    display: none;
}

#timer span {
    color: var(--gold);
    font-weight: 500;
}

/* === INPUT CONTAINER (modo escrita/prova) === */
#input-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

#input-container input {
    flex: 1 1 200px;
    padding: 12px 16px;
    font-size: 15px;
    font-family: var(--font-family);
    border-radius: 6px;
    border: 1px solid rgba(201, 168, 76, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-light);
    outline: none;
    min-height: 44px;
}

#input-container input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.15);
}

#input-container input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

#input-container button {
    padding: 12px 24px;
    background: rgba(128, 0, 32, 0.5);
    color: var(--text-light);
    border: 1px solid rgba(201, 168, 76, 0.2);
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    min-height: 44px;
    min-width: 80px;
    transition: all 0.2s ease;
}

#input-container button:hover {
    background: rgba(128, 0, 32, 0.7);
    border-color: var(--gold);
}

/* === SCORE === */
#score {
    font-size: 1em;
    font-weight: 400;
    color: var(--text-light);
    margin-top: 8px;
}

/* === GAME BUTTONS === */
#voltar-button,
#continuar-button {
    padding: 12px 24px;
    background: rgba(128, 0, 32, 0.5);
    color: var(--text-light);
    border: 1px solid rgba(201, 168, 76, 0.2);
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 15px;
    font-weight: 400;
    cursor: pointer;
    margin-top: 15px;
    min-height: 44px;
    transition: all 0.2s ease;
}

#voltar-button:hover,
#continuar-button:hover {
    background: rgba(128, 0, 32, 0.7);
    border-color: var(--gold);
}

/* ==================================================================
   LAYOUT MOBILE EM ORIENTAÇÃO RETRATO
   A orientação, e não o tamanho da tela, define qual composição será usada.
   ================================================================== */
@media (orientation: portrait) {
    :root {
        --font-size-h1: 2.2em;
        --btn-width: 240px;
        --btn-height: 46px;
        --btn-font-size: 15px;
    }

    .menu .title-group {
        top: 50%;
        left: 4%;
        transform: translateY(-50%);
    }

    .menu .subtitle {
        font-size: 11px;
        letter-spacing: 4px;
    }

    .menu h1 {
        font-size: var(--font-size-h1);
    }

    .mobile-zoom-tip {
        position: fixed;
        top: max(72px, calc(env(safe-area-inset-top) + 58px));
        left: 50%;
        z-index: 4;
        display: block;
        width: min(84vw, 440px);
        margin: 0;
        padding: 9px 14px;
        transform: translateX(-50%);
        border: 1px solid rgba(73, 20, 39, 0.24);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.82);
        color: #491427;
        font-size: clamp(11px, 2.8vw, 14px);
        font-weight: 600;
        line-height: 1.35;
        text-align: center;
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.14);
        box-sizing: border-box;
    }

    /* Cenário mobile do menu — vence tanto o CSS desktop quanto estilos inline. */
    body,
    body.menu-active {
        background-image: url('../images/menu_background_mobile.png') !important;
        background-position: center;
        background-attachment: scroll;
        animation: none;
    }

    /* As demais telas continuam sem o cenário do menu atrás delas. */
    body.no-background {
        background-image: none !important;
    }

    /*
     * Área realmente disponível entre os dois avisos. Ela vira a referência
     * de tamanho do caderno em celulares de qualquer proporção.
     */
    .caderno-stage {
        display: block;
        position: absolute;
        top: max(130px, calc(env(safe-area-inset-top) + 116px));
        right: 0;
        bottom: max(64px, calc(env(safe-area-inset-bottom) + 56px));
        left: 0;
        z-index: 1;
        container-type: size;
    }

    .caderno-container {
        /*
         * O caderno visível mede 846x1182 dentro do PNG de 1122x1402.
         * 132,624vw neutraliza as margens laterais transparentes.
         * O segundo limite considera também a parte da chibi fora do caderno.
         */
        left: 50%;
        right: auto;
        top: 50%;
        width: min(calc(132.624vw - 6px), calc(78dvh - 151px));
        height: auto;
        transform: translate(-50.45%, -61.79%);
    }

    .caderno-container:hover {
        transform: translate(-50.45%, -61.79%);
    }

    /*
     * A personagem pertence ao sistema de coordenadas do caderno:
     * a extremidade medial fica próxima de 49,5% da largura do caderno.
     */
    .main-chibi {
        display: block !important;
        position: absolute;
        top: 80%;
        left: 42.9%;
        right: auto;
        bottom: auto;
        width: 33.6%;
        height: auto;
        z-index: 3;
        pointer-events: none;
        filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.28));
    }

    .game-content {
        width: 95%;
        padding: 16px;
        margin: 10px auto;
    }

    .game-content h1 {
        font-size: 1.2em;
    }

    .container {
        border-width: 1px;
        padding: 4px;
    }

    #question {
        font-size: clamp(13px, 3.5vw, 15px);
        padding: 10px;
    }

    #feedback {
        font-size: 14px;
    }

    #timer {
        font-size: 15px;
        padding: 8px 12px;
        margin: 10px 0;
    }

    .progress-bar {
        height: 3px;
    }

    #score {
        font-size: 0.9em;
    }

    .choice-box {
        width: 92%;
        max-width: 92%;
        padding: 24px 18px;
        max-height: 85vh;
        max-height: 85dvh;
    }

    .choice-box h1 {
        font-size: 1.2em;
        margin-bottom: 16px;
    }

    .choice-box button {
        padding: 13px 14px;
        font-size: 13px;
        margin: 5px 0;
        min-height: 46px;
    }

    .settings-content {
        padding: 30px 24px;
    }

    .settings-content h1 {
        font-size: 1.3em;
        margin-bottom: 24px;
    }

    #input-container input {
        font-size: 16px;
        padding: 10px 14px;
    }

    #input-container button {
        font-size: 13px;
        padding: 10px 20px;
    }

    #voltar-button,
    #continuar-button {
        font-size: 14px;
        padding: 10px 20px;
    }

    .copyright {
        width: calc(100vw - 16px);
        max-width: none;
        font-size: clamp(10px, 2.8vw, 12px);
        letter-spacing: 0.25px;
        color: #ffffff;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        white-space: nowrap;
    }

    /* TELA DE SELEÇÃO DE FASES */
    .phase-selection-container {
        padding: 30px 24px;
        max-height: 80vh;
        max-height: 80dvh;
    }

    .phase-selection-title {
        font-size: 1.4em;
        margin-bottom: 24px;
    }

    .phase-button {
        padding: 16px 20px;
        font-size: 15px;
    }
}

/*
 * Tablets em retrato têm proporcionalmente menos altura para a largura.
 * Neles, prioriza-se mostrar o caderno inteiro com respiro entre os avisos.
 */
@media (min-width: 600px) and (orientation: portrait) {
    .caderno-container {
        width: min(112vw, 65dvh);
    }
}

/* ==================================================================
   CELULARES PEQUENOS (até 380px)
   ================================================================== */
@media (max-width: 380px) and (orientation: portrait) {
    :root {
        --font-size-h1: 1.8em;
        --btn-width: 200px;
        --btn-height: 42px;
        --btn-font-size: 13px;
    }

    .choice-box h1 {
        font-size: 1em;
    }

    .choice-box button {
        font-size: 12px;
        min-height: 42px;
    }

    /* TELA DE SELEÇÃO DE FASES */
    .phase-selection-container {
        padding: 24px 18px;
    }

    .phase-selection-title {
        font-size: 1.2em;
        margin-bottom: 20px;
    }

    .phase-button {
        padding: 14px 16px;
        font-size: 14px;
    }
}

/* ==================================================================
   TELAS MUITO GRANDES (acima de 1400px)
   ================================================================== */
@media (min-width: 1400px) {
    :root {
        --font-size-h1: 4em;
        --btn-width: 320px;
        --btn-height: 56px;
        --btn-font-size: 18px;
    }

    .game-content {
        max-width: 1000px;
        padding: 30px;
    }

    .dialogue-container {
        max-width: 1400px;
    }

    /* TELA DE SELEÇÃO DE FASES */
    .phase-selection-container {
        padding: 50px 48px;
        max-width: 800px;
    }

    .phase-selection-title {
        font-size: 2em;
        margin-bottom: 36px;
    }

    .phase-button {
        padding: 20px 28px;
        font-size: 17px;
    }
}

/* ==================================================================
   TOUCH-ONLY
   ================================================================== */
@media (hover: none) and (pointer: coarse) {
    .caderno-buttons button:hover {
        transform: none;
        background: linear-gradient(180deg, #fef9ef 0%, #f5edd6 100%);
        border-bottom: 2px solid #d4c5a0;
        box-shadow: none;
    }

    .caderno-buttons button:hover::after {
        opacity: 0.6;
        width: 3px;
    }

    .choice-box button:hover {
        transform: none;
        background: rgba(128, 0, 32, 0.4);
        border-color: rgba(255, 255, 255, 0.08);
    }

    .target {
        min-width: 14px;
        min-height: 14px;
    }

    * {
        -webkit-tap-highlight-color: transparent;
    }
}

/* ==================================================================
   EXAM TRAINING MODAL
   ================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 16px;
    backdrop-filter: blur(4px);
}

.exam-training-modal {
    background: var(--card-bg);
    border: 1px solid rgba(201, 168, 76, 0.3);
    border-radius: 16px;
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    color: var(--text-light);
    font-family: var(--font-family);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.exam-modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    text-align: center;
}

.exam-modal-header h2 {
    font-size: 1.4em;
    color: var(--gold);
    margin-bottom: 4px;
}

.exam-modal-header h3 {
    font-size: 1.1em;
    font-weight: 400;
    opacity: 0.9;
}

.exam-modal-subtitle {
    font-size: 0.85em;
    opacity: 0.6;
    margin-top: 4px;
}

.exam-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5em;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.exam-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.exam-modal-body {
    padding: 16px 24px;
    overflow-y: auto;
    flex: 1;
}

.exam-modal-section {
    margin-bottom: 20px;
}

.exam-modal-section h4 {
    font-size: 0.95em;
    color: var(--gold-light);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.exam-subject-actions {
    display: flex;
    gap: 8px;
}

.exam-action-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-light);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    cursor: pointer;
    transition: 0.2s;
}

.exam-action-btn:hover:not(:disabled) {
    background: rgba(201, 168, 76, 0.2);
    border-color: var(--gold);
}

.exam-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Mode options */
.exam-mode-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.exam-mode-option {
    flex: 1;
    min-width: 120px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    transition: 0.2s;
    text-align: center;
}

.exam-mode-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.exam-mode-option.active {
    background: rgba(201, 168, 76, 0.15);
    border-color: var(--gold);
}

.exam-mode-option input { display: none; }

.exam-mode-label {
    display: block;
    font-weight: 600;
    font-size: 0.9em;
    margin-bottom: 4px;
}

.exam-mode-desc {
    display: block;
    font-size: 0.75em;
    opacity: 0.6;
}

/* Subject list */
.exam-subject-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.exam-subject-list[aria-disabled="true"] {
    opacity: 0.6;
}

.exam-subject-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
}

.exam-subject-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.exam-subject-item.unchecked {
    opacity: 0.5;
}

.exam-subject-item input[type="checkbox"] {
    accent-color: var(--gold);
    width: 18px;
    height: 18px;
}

.exam-subject-item span {
    flex: 1;
    font-size: 0.9em;
}

.subject-count {
    font-size: 0.8em;
    opacity: 0.5;
    flex: 0;
    white-space: nowrap;
}

/* Difficulty options */
.exam-difficulty-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.exam-diff-option {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    cursor: pointer;
    transition: 0.2s;
    font-size: 0.85em;
}

.exam-diff-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.exam-diff-option.active {
    background: rgba(201, 168, 76, 0.2);
    border-color: var(--gold);
    color: var(--gold);
}

.exam-diff-option input { display: none; }

/* Quantity options */
.exam-quantity-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.exam-qty-option {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    min-width: 48px;
    text-align: center;
    font-size: 0.85em;
}

.exam-qty-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.exam-qty-option.active {
    background: rgba(201, 168, 76, 0.2);
    border-color: var(--gold);
}

.exam-qty-option input { display: none; }

.custom-quantity-container {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

.custom-quantity-input {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-light);
    font-size: 1em;
    width: 100px;
    font-family: var(--font-family);
}

.custom-quantity-input:focus {
    outline: none;
    border-color: var(--gold);
}

/* Feedback options */
.exam-feedback-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.exam-feedback-option {
    flex: 1;
    min-width: 140px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: 0.2s;
    text-align: center;
    font-size: 0.85em;
}

.exam-feedback-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.exam-feedback-option.active {
    background: rgba(201, 168, 76, 0.15);
    border-color: var(--gold);
}

.exam-feedback-option input { display: none; }

/* Footer */
.exam-modal-footer {
    padding: 16px 24px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.available-count-message {
    font-size: 0.85em;
    opacity: 0.7;
    text-align: center;
}

.available-count-message.warning {
    color: #f1c40f;
    opacity: 1;
}

.available-count-message.error {
    color: #e74c3c;
    opacity: 1;
}

#exam-start-btn {
    width: 100%;
    max-width: 300px;
    padding: 14px 24px;
    background: var(--gold);
    color: var(--text-dark);
    border: none;
    border-radius: 30px;
    font-weight: 700;
    font-size: 1em;
    cursor: pointer;
    transition: 0.3s;
    font-family: var(--font-family);
}

#exam-start-btn:hover:not(:disabled) {
    transform: scale(1.02);
    background: #d4b85c;
}

#exam-start-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Mobile */
@media (orientation: portrait) {
    .exam-training-modal {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .modal-overlay {
        padding: 0;
    }

    .exam-modal-body {
        padding: 12px 16px;
    }

    .exam-modal-header {
        padding: 16px 16px 12px;
    }

    .exam-modal-footer {
        padding: 12px 16px 16px;
    }

    .exam-mode-options {
        flex-direction: column;
    }

    .exam-mode-option {
        min-width: auto;
    }
}
