/*
============================================================================
PROJECTE: Motor Educatiu Step Quiz (Vanilla JS)
FITXER: css/teorema-sin-cos.css
ROL: Estils específics del joc "Triangles — Sinus i Cosinus".
     Carrega DESPRÉS de css/shared.css.
ARQUITECTURA:
- Sobreescriu les variables de color de shared.css amb el tema verd-esmeralda.
- Inclou únicament els components exclusius d'aquest joc:
  triangle SVG, panell d'ajuda, pistes (hints), botons de valor.
============================================================================
*/

/* ── COMPACTACIÓ VERTICAL (overrides shared.css per cabre en portàtil) ──── */
body                { padding: 8px 20px; }
.home-icon-link     { width: 48px; height: 48px; }
.title-row          { margin-bottom: 0; }
.subtitle           { display: none; }
h1                  { font-size: 1.4em; }
.header-info        { padding: 8px 20px; }
.level-text         { font-size: 1.1em; }
.score-text         { font-size: 1.1em; }
.attempts-counter   { font-size: 1.1em; padding: 4px 8px; }

/* ── TEMA DE COLOR (sobreescriptura del shared.css) ─────────────────────── */
:root {
    --bg-color:      #f0fdfa;
    --primary:       #0f766e;
    --primary-light: #ccfbf1;
    --primary-hover: #0d9488;
    --primary-dark:  #134e4a;
    --accent:        #d97706;
}

/* ── H1 (color específic del tema) ─────────────────────────────────────── */
h1 { color: #134e4a; }

/* ── CAPÇALERA DEL JOC (color de fons del tema) ─────────────────────────── */
.header-info { background-color: #f0fdfa; }
.level-text  { color: #134e4a; }


/* ── ZONA DEL PROBLEMA (SVG triangle + etiqueta) ────────────────────────── */
.problem-box {
    padding: 8px 20px 0;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

#triangle-svg {
    width: 100%;
    max-width: 210px;
    max-height: 140px;
    height: auto;
}

/* ── PANELL DE RESOLUCIÓ ────────────────────────────────────────────────── */
.resolution-panel {
    background-color: #f8fafc;
    border-top: 1px solid var(--border-color);
    padding: 10px 20px 12px;
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 8px;
}

.step-instruction {
    font-size: 1.05em;
    color: #334155;
    font-weight: bold;
    text-align: center;
    line-height: 1.3;
    margin: 0;
}

.step-container {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    animation: fadeIn 0.3s;
}
.step-container.active { display: flex; }

/* ── BOTÓ D'AJUDA ────────────────────────────────────────────────────────── */
.btn-help {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 2px solid #d97706;
    background: white;
    color: #92400e;
    font-size: 0.85em;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    touch-action: manipulation;
}
@media (hover: hover) {
    .btn-help:hover { background: #fef3c7; transform: scale(1.04); }
}
.btn-help:active { transform: scale(0.96); }
.btn-help:focus-visible { outline: 3px solid #d97706; outline-offset: 2px; }
.btn-help.open { background: #fef3c7; border-color: #b45309; }

/* ── PANELL D'AJUDA (hints) ─────────────────────────────────────────────── */
.help-panel {
    display: none;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 480px;
    animation: fadeIn 0.25s;
}
.help-panel.visible { display: flex; }

.hint-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.88em;
    line-height: 1.4;
    color: #78350f;
}
.hint-item.hint-best {
    background: #f0fdf4;
    border: 2px solid #86efac;
    box-shadow: 0 2px 8px rgba(16,185,129,0.12);
}

.hint-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    min-width: 34px;
}
.hint-item .hint-icon { font-size: 1.3em; line-height: 1; }

.hint-badge {
    font-size: 0.7em;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    white-space: nowrap;
    letter-spacing: 0.3px;
}
.badge-best   { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.badge-second { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.badge-tip    { background: #fef9c3; color: #713f12; border: 1px solid #fde68a; }

.hint-item .hint-body    { display: flex; flex-direction: column; gap: 3px; }
.hint-item .hint-name    { font-weight: bold; color: #92400e; }
.hint-item.hint-best .hint-name { color: #166534; }
.hint-item .hint-formula {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95em;
    color: #b45309;
    background: rgba(0,0,0,0.03);
    padding: 2px 5px;
    border-radius: 4px;
}
.hint-item.hint-best .hint-formula { color: #047857; }
.hint-reason {
    font-size: 0.85em;
    color: #64748b;
    font-style: italic;
    margin-top: 2px;
}
.hint-item.hint-best .hint-reason {
    color: #15803d;
    font-style: normal;
    font-weight: 500;
}

/* ── BOTONS DE VALOR (4 opcions múltiples) ──────────────────────────────── */
.value-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    max-width: 440px;
}

.btn-value {
    padding: 13px 10px;
    font-size: 1.35em;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    border-radius: 8px;
    border: 2px solid var(--border-heavy);
    background: white;
    color: #334155;
    cursor: pointer;
    transition: 0.2s;
    text-align: center;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}
@media (hover: hover) {
    .btn-value:hover {
        background: var(--primary-light);
        border-color: var(--primary);
        color: var(--primary-dark);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(15,118,110,0.2);
    }
}
.btn-value:active          { transform: scale(0.95); }
.btn-value:focus-visible   { outline: 3px solid var(--primary); outline-offset: 2px; }
.btn-value.error-shake {
    background: var(--danger-light);
    border-color: var(--danger);
    color: var(--danger);
    animation: shake 0.25s;
}

/* ── COMPTADOR D'INTENTS (blink específic) ──────────────────────────────── */
@keyframes blinkAttempts {
    0%, 100% { background-color: #fef3c7; }
    50%       { background-color: white; }
}
.attempts-counter.blink { animation: blinkAttempts 0.22s linear 5; }

/* ── RESPONSIU ──────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
    .btn-value { font-size: 1.15em; min-height: 58px; }
    .value-buttons { max-width: 360px; gap: 10px; }
    #triangle-svg { max-width: 260px; }
}
@media (max-width: 380px) {
    .btn-value { font-size: 1em; }
    #triangle-svg { max-width: 220px; }
}
