* {
    box-sizing: border-box;
}

:root {
    --ink: #21142d;
    --soft-card: rgba(255, 255, 255, 0.78);
    --good: #7ee7c8;
    --good-deep: #26876f;
    --chaos: #7d35ff;
    --chaos-deep: #210032;
    --danger: #ff5c8a;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 28px;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    text-align: center;
}

a {
    color: inherit;
}

.back-link {
    display: inline-block;
    margin-bottom: 15px;
    color: #555;
    text-decoration: none;
}

.visit-counter {
    margin-top: 20px;
    font-weight: bold;
    opacity: 0.8;
}

.shell,
.result-card {
    width: min(980px, 100%);
    margin: 0 auto;
}

.mission-shell {
    margin: auto;
}

.gauge-card{
    box-shadow: none!important;
    backdrop-filter: none !important;
}

.hero-card,
.gauge-card,
.daily-card,
.stat-card,
.mission-card,
.result-card {
    border: 1px solid rgba(255, 255, 255, 0.7);
    /*border-radius: 28px;*/
    background: var(--soft-card);
    /*box-shadow: 0 20px 60px rgba(66, 30, 92, 0.16);*/
    backdrop-filter: blur(12px);
}

.hero-card {
    border-bottom: solid;
    border-radius: 0;
}

.eyebrow {
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.78rem;
    font-weight: 800;
    opacity: 0.72;
}

h1 {
    margin: 0;
    font-size: clamp(2.2rem, 8vw, 5rem);
    line-height: 0.95;
}

h2 {
    margin: 12px 0 0;
    font-size: clamp(1.15rem, 4vw, 2rem);
    color: #57008c;
}

.subtitle {
    max-width: 620px;
    margin: 20px auto 0;
    font-size: 1.08rem;
    opacity: 0.72;
}

.dashboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 22px 0;
}

.stat-card {
    padding: 22px;
    color: #fff;
}

.stat-label {
    display: block;
    font-weight: 800;
    opacity: 0.75;
}

.stat-card strong {
    display: block;
    margin: 8px 0;
    font-size: 3rem;
}

.stat-card small {
    font-weight: 700;
}

.positive-stat {
    background: linear-gradient(160deg, rgba(59, 0, 95, 0.92), rgba(163, 92, 255, 0.74));
}

.chaos-stat {
    background: linear-gradient(160deg, rgba(234, 216, 255, 0.94), rgba(255, 255, 255, 0.74));
}

.failed-stat {
    background: linear-gradient(160deg, rgba(0, 0, 0, 0.95), rgba(64, 64, 64, 0.74));
}

.gauge-card{
    padding: 24px;
}

.daily-card {
    padding: 24px;
    margin-top: 20px;
}

.split-gauge {
    display: flex;
    min-height: 48px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.08);
}

.good-bar,
.chaos-bar {
    display: grid;
    place-items: center;
    min-width: 54px;
    color: white;
    font-weight: 900;
    transition: width 0.4s ease;
}

.good-bar {
    background: linear-gradient(90deg, #31c99f, #91f4d6);
}

.chaos-bar {
    background: linear-gradient(90deg, #3b005f, #a35cff);
}

.legend {
    display: flex;
    justify-content: center;
    gap: 22px;
    flex-wrap: wrap;
    margin-top: 16px;
    font-weight: 800;
}

.dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 6px;
    border-radius: 50%;
}

.good {
    background: var(--good-deep);
}

.chaos-dot {
    background: var(--chaos);
}

.bloc{
    display: block;
    width: 50§;
}

.hero-card{
    box-shadow: none !important;
    padding: 32px 24px;
}

.main-button,
.accept-button,
.complete-button,
.small-button,
.refuse-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    margin: 14px 8px 0;
    padding: 14px 24px;
    border: 0;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
}

.main-button{
     background: linear-gradient(135deg, #9f63ff, #050505);
     color: white;
     margin-bottom: 14px;
}

.accept-button,
.complete-button {
    color: white;
    background: linear-gradient(135deg, #9f63ff, #050505);
}

.refuse-button,
.small-button {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.78);
}

.closed {
    display: inline-block;
    max-width: 720px;
    margin: 18px auto 0;
    padding: 18px 22px;
    border-radius: 20px;
    background: rgba(33, 0, 50, 0.1);
    font-size: clamp(1.2rem, 4vw, 2rem);
    font-weight: 900;
}

.footer {
    margin-top: 30px;
    font-style: italic;
    font-weight: 700;
    opacity: 0.7;
}

.mission-page {
    display: grid;
    place-items: center;
    overflow-x: hidden;
}

.positive {
    background: linear-gradient(-45deg, #ffd6e7, #d6f5ff, #fff3c4, #d9ffd8, #eadcff);
    background-size: 500% 500%;
    animation: softBackground 18s ease infinite;
}

.chaos {
    color: white;
    background:
        radial-gradient(circle at 25% 18%, rgba(162, 92, 255, 0.28), transparent 28%),
        radial-gradient(circle at 80% 70%, rgba(255, 92, 184, 0.12), transparent 25%),
        linear-gradient(-45deg, #060008, #160020, #2f004d, #0c0012);
    background-size: 420% 420%;
    animation: softBackground 9s ease infinite;
}

.daily-card{
    border: solid #000;
    border-left: 0;
    border-right: 0;
    margin-top: 50px;
    border-radius: none !important;
}

.margin{
    margin-top: 5%;
}

@keyframes softBackground {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.mission-card {
    width: min(820px, 100%);
    padding: clamp(26px, 6vw, 54px);
}

.chaos .mission-card {
    border-color: rgba(168, 92, 255, 0.45);
    background: rgba(8, 0, 16, 0.74);
    box-shadow: 0 0 80px rgba(126, 53, 255, 0.28);
}

.positive .mission-card {
    background: rgba(255, 255, 255, 0.72);
}

.mission-intro,
.mission-text {
    font-size: clamp(1.2rem, 3vw, 1.7rem);
    line-height: 1.45;
}

.mission-text {
    margin: 26px auto;
    max-width: 680px;
    font-weight: 900;
}

#timer {
    margin: 22px 0 0;
    font-size: clamp(4rem, 18vw, 9rem);
    font-variant-numeric: tabular-nums;
}

.hidden {
    display: none !important;
}

.status-message {
    min-height: 24px;
    margin-top: 18px;
    font-weight: 800;
    opacity: 0.72;
}

.result-page {
    display: grid;
    place-items: center;
    overflow: hidden;
}

.success-page {
    background: linear-gradient(-45deg, #fff3c4, #d9ffd8, #d6f5ff, #ffd6e7);
    background-size: 400% 400%;
    animation: softBackground 12s ease infinite;
}

.failure-page {
    color: white;
    background: radial-gradient(circle, #3b0018, #100008 60%, #000);
}

.result-card {
    position: relative;
    z-index: 2;
    padding: clamp(28px, 6vw, 56px);
}

.failure-card {
    background: rgba(16, 0, 10, 0.76);
    border-color: rgba(255, 92, 138, 0.38);
}

.result-gif {
    display: block;
    max-width: min(420px, 92%);
    max-height: 320px;
    margin: 28px auto;
    border-radius: 24px;
}

.tomato-layer {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.tomato {
    position: absolute;
    top: -120px;
    width: clamp(70px, 12vw, 150px);
    animation-name: tomatoFall;
    animation-timing-function: cubic-bezier(.2, .7, .4, 1);
    animation-fill-mode: forwards;
}

.moit{
    display: inline-block;
    text-align: center;
    width: 30%;
}

.vert {
    color: #57008c;
    font-weight: bold;
}

.moit .vio{
    color:#a35cff;
    font-weight: bold;
}

.anotempo{
    color : #ff5c8a;
    font-weight: bold;
    font-size: 1rem;
}

.red{
    color: #dd0000;
    font-weight: bold;
}
.grey{
    color: #8c8c8c;
    font-weight: bold;
}

@keyframes tomatoFall {
    0% {
        top: -140px;
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    75% {
        top: 72vh;
        transform: scale(1) rotate(260deg);
    }
    100% {
        top: 84vh;
        transform: scale(1.35) rotate(360deg);
        opacity: 0;
    }
}

@media (max-width: 760px) {
    body {
        padding: 18px;
    }

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

    .gauge-card,
    .mission-card,
    .result-card {
        border-radius: 22px;
    }

    .main-button,
    .accept-button,
    .complete-button,
    .small-button,
    .refuse-button {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        font-size: 1.05rem;
    }
}


/* Correctif V2 : les contrôles de mission sont invisibles tant que la mission n'est pas acceptée. */
#missionArea.awaiting-acceptance {
    display: none !important;
}

#preAccept.accepted {
    display: none !important;
}


/* Correctif V2.1 : affichage simple et fiable */
#missionArea {
    display: none;
}


.failed-bar {
    display: grid;
    place-items: center;
    min-width: 54px;
    color: white;
    font-weight: 900;
    transition: width 0.4s ease;
    background: linear-gradient(90deg, #404040, #000);
}

.failed-dot {
    background: #303030;
}


/* V4 unifiée : une seule catégorie de missions */
.dashboard.two-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mission-status {
    max-width: 520px;
    margin: 20px auto;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.58);
    font-weight: 900;
}

@media (max-width: 760px) {
    .dashboard.two-cards {
        grid-template-columns: 1fr;
    }
}


.completed-bar {
    display: grid;
    place-items: center;
    min-width: 54px;
    color: white;
    font-weight: 900;
    transition: width 0.4s ease;
    background: linear-gradient(90deg, #3b005f, #a35cff);
}

.completed-dot {
    background: #57008c;
}

.dashboard.two-cards .positive-stat {
    background: linear-gradient(160deg, rgba(59, 0, 95, 0.92), rgba(163, 92, 255, 0.74));
}

.abandon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    margin: 14px 8px 0;
    padding: 14px 24px;
    border: 0;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
    color: white;
    background: linear-gradient(135deg, #dd0000, #101010);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
}

.chaos .mission-card {
    border-color: rgba(168, 92, 255, 0.45);
    background: rgba(8, 0, 16, 0.74);
    box-shadow: 0 0 80px rgba(126, 53, 255, 0.28);
}

@media (max-width: 760px) {
    .abandon-button {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        font-size: 1.05rem;
    }
}
