:root {
    --bg-main: #F4F1EC;       /* Torrat clar web */
    --card-bg: #FFFFFF;
    --text-dark: #42474A;     /* Gris fosc elegant */
    --text-muted: #666E73;
    --accent-blue: #5A6B8C;   /* Blau corporatiu */
    --accent-green: #7D8F69;  /* Verd suau per a la pedra activa */
    --accent-glow: rgba(125, 143, 105, 0.4);
    --border-soft: #DFD8CB;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
}

body {
    background-color: #E2DDD5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* Contenidor principal de l'aplicació */
.app-container {
    width: 100%;
    max-width: 430px;
    height: 100vh;
    max-height: 932px;
    background-color: var(--bg-main);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden; /* S'elimina el scroll general per ajustar-ho a la pantalla */
    padding-bottom: 60px; /* Espai per al menú inferior */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

/* Header amb Logo centrat i Rodeta d'Ajustos a la dreta */
.app-header {
    text-align: center;
    padding: 12px 16px 4px;
}

.header-top {
    position: relative;
    display: flex;
    justify-content: center; /* Centra el logo exactament al mig */
    align-items: center;
    margin-bottom: 4px;
}

.app-logo {
    max-width: 125px;
    height: auto;
}

.btn-icon-settings {
    position: absolute;
    right: 0; /* Ancobra la rodeta a la dreta sense moure el logo */
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: color 0.2s, transform 0.2s;
}

.btn-icon-settings:hover {
    color: var(--accent-blue);
    transform: translateY(-50%) rotate(30deg);
}

.subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 300;
}

/* Selector d'Estat d'Ànim */
.mood-container {
    margin: 6px 16px;
    background: rgba(255, 255, 255, 0.65);
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
}

.mood-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
}

.mood-slider {
    width: 100%;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

/* --- SECCIÓ DEL CAMÍ SINUÓS (FES EL TEU CAMÍ) --- */
.path-section {
    position: relative;
    margin: 4px 16px;
    padding: 4px 0;
    min-height: 250px;
    flex-grow: 1;
}

.path-title-box {
    margin-bottom: 6px;
}

.path-title-box h2 {
    font-size: 0.90rem;
    color: var(--text-dark);
    font-weight: 600;
}

.path-title-box p {
    font-size: 0.70rem;
    color: var(--text-muted);
}

/* Linia corba SVG de fons */
.curved-path-svg {
    position: absolute;
    top: 35px;
    left: 0;
    width: 100%;
    height: 210px;
    z-index: 1;
    pointer-events: none;
}

.stones-container {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stone-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

/* Posicionament Sinuós en Zig-Zag */
.pos-right { justify-content: flex-end; padding-right: 45px; }
.pos-center { justify-content: center; padding-left: 30px; }
.pos-left { justify-content: flex-start; padding-left: 25px; }
.pos-center-right { justify-content: center; padding-left: 70px; }

.stone-item {
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.stone-item:hover {
    transform: scale(1.05);
}

.stone-img {
    width: 70px;
    height: auto;
    filter: drop-shadow(0 3px 5px rgba(0,0,0,0.15));
}

/* Icona de Check completat */
.check-icon {
    position: absolute;
    top: 28%;
    left: 40%;
    color: #FFFFFF;
    font-size: 0.80rem;
    font-weight: bold;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.check-icon.hidden {
    display: none;
}

/* Estats de les Pedres */
.completed .stone-img {
    filter: sepia(0.3) hue-rotate(-20deg) contrast(1.1) drop-shadow(0 2px 4px rgba(0,0,0,0.12));
}

.active .stone-img {
    width: 80px;
    filter: hue-rotate(60deg) saturate(0.8) drop-shadow(0 5px 10px var(--accent-glow));
}

.stone-glow {
    position: absolute;
    width: 100px;
    height: 50px;
    background: radial-gradient(circle, var(--accent-glow) 0%, rgba(244, 241, 236, 0) 70%);
    top: -4px;
    left: -10px;
    z-index: -1;
    border-radius: 50%;
}

.locked .stone-img {
    opacity: 0.45;
    filter: grayscale(0.5);
}

.locked-far .stone-img {
    opacity: 0.25;
    filter: grayscale(0.8);
}

/* Popover Desplegable d'Acció */
.stone-popover {
    position: absolute;
    left: 110px;
    top: -5px;
    background: #FFFFFF;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 10px 12px;
    width: 190px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    z-index: 10;
    animation: fadeIn 0.3s ease-in-out;
}

.stone-popover::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 20px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 8px solid #FFFFFF;
}

.popover-badge {
    color: var(--accent-green);
    font-size: 0.65rem;
    font-weight: 600;
    display: block;
    margin-bottom: 2px;
}

.stone-popover h4 {
    font-size: 0.72rem;
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.2;
}

.btn-start {
    background-color: var(--accent-green);
    color: #FFFFFF;
    border: none;
    padding: 6px 10px;
    border-radius: 18px;
    font-size: 0.70rem;
    font-weight: 600;
    width: 100%;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-start:hover {
    background-color: #697857;
}

/* Targetes inferiors */
.card-section {
    padding: 0 16px;
    margin-bottom: 6px;
}

.card {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 10px 14px;
    border: 1px solid var(--border-soft);
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.card-tag {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--accent-blue);
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 2px;
}

.card h3 {
    font-size: 0.80rem;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.card p {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.25;
}

/* --- MODALS (Settings i Onboarding) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(3px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.modal-overlay.hidden {
    display: none;
}

.modal-card {
    background: #FFFFFF;
    border-radius: 18px;
    padding: 20px;
    width: 88%;
    max-width: 360px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    border: 1px solid var(--border-soft);
}

.modal-card h3 {
    font-size: 0.95rem;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.modal-card p {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.modal-card input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 14px;
    outline: none;
}

.modal-card input:focus {
    border-color: var(--accent-blue);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
}

.setting-group {
    margin-bottom: 14px;
    text-align: left;
}

.setting-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dark);
    display: block;
    margin-bottom: 4px;
}

.instructions-box {
    background: var(--bg-main);
    padding: 10px 12px;
    border-radius: 10px;
}

.instructions-box h4 {
    font-size: 0.75rem;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.instructions-box p {
    font-size: 0.70rem;
    margin-bottom: 4px;
    line-height: 1.3;
}

/* Menú Inferior (Footer Nav) */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: #FFFFFF;
    border-top: 1px solid var(--border-soft);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.62rem;
    gap: 2px;
    flex: 1;
}

.nav-item svg {
    width: 18px;
    height: 18px;
}

.nav-item.active, .nav-item:hover {
    color: var(--accent-blue);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}