/* ============================================
   Toi vs la vie - Style Rétro/Pixel
   ============================================ */

:root {
    --bg-dark: #1a1a2e;
    --bg-medium: #16213e;
    --primary: #e94560;
    --secondary: #0f3460;
    --accent: #f1c40f;
    --text: #eee;
    --text-dim: #888;
    --success: #2ecc71;
    --warning: #e67e22;
    --pixel-border: 4px;
}

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

body {
    font-family: 'Press Start 2P', cursive;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.8;
    font-size: 12px;
    overflow-x: hidden;
}

/* Scanlines effect */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1),
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 2px
    );
}

/* ============================================
   Header
   ============================================ */

header {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(180deg, var(--secondary) 0%, var(--bg-dark) 100%);
    border-bottom: var(--pixel-border) solid var(--primary);
}

h1 {
    font-size: 1.8rem;
    color: var(--primary);
    text-shadow:
        4px 4px 0 var(--bg-dark),
        -2px -2px 0 var(--accent);
    margin-bottom: 0.5rem;
}

/* Glitch effect */
.glitch {
    position: relative;
    animation: glitch 3s infinite;
}

@keyframes glitch {
    0%, 90%, 100% { transform: translate(0); }
    92% { transform: translate(-2px, 2px); }
    94% { transform: translate(2px, -2px); }
    96% { transform: translate(-2px, -2px); }
    98% { transform: translate(2px, 2px); }
}

.subtitle {
    color: var(--text-dim);
    font-size: 0.6rem;
    margin-top: 0.5rem;
}

/* ============================================
   Main Layout
   ============================================ */

main {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* ============================================
   Pixel Box (main container)
   ============================================ */

.pixel-box {
    background: var(--bg-medium);
    border: var(--pixel-border) solid var(--text);
    padding: 1.5rem;
    margin: 1rem 0;
    position: relative;
    box-shadow:
        8px 8px 0 rgba(0, 0, 0, 0.3),
        inset -4px -4px 0 rgba(255, 255, 255, 0.1);
}

.pixel-box::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: 8px;
    bottom: 8px;
    border: 2px solid var(--primary);
    pointer-events: none;
}

/* ============================================
   Buttons
   ============================================ */

.pixel-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7rem;
    padding: 1rem 1.5rem;
    background: var(--secondary);
    color: var(--text);
    border: var(--pixel-border) solid var(--text);
    cursor: pointer;
    transition: all 0.1s;
    display: inline-block;
    margin: 0.5rem;
    text-transform: uppercase;
    position: relative;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
}

.pixel-btn:hover {
    background: var(--primary);
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}

.pixel-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.pixel-btn.big {
    font-size: 1rem;
    padding: 1.5rem 3rem;
}

.pixel-btn.small {
    font-size: 0.5rem;
    padding: 0.6rem 0.8rem;
}

.pixel-btn .icon {
    margin-right: 0.5rem;
}

.back-btn {
    background: var(--bg-dark);
    border-color: var(--text-dim);
    color: var(--text-dim);
    margin-top: 2rem;
}

/* ============================================
   Form Elements
   ============================================ */

.decision-input {
    margin: 1.5rem 0;
}

.decision-input label {
    display: block;
    margin-bottom: 0.8rem;
    color: var(--accent);
    font-size: 0.7rem;
}

input[type="text"],
textarea {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.6rem;
    width: 100%;
    padding: 1rem;
    background: var(--bg-dark);
    color: var(--text);
    border: var(--pixel-border) solid var(--secondary);
    margin-bottom: 0.5rem;
}

input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.options-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.options-container input {
    flex: 1;
    margin-bottom: 0;
}

.vs {
    color: var(--primary);
    font-size: 0.8rem;
    padding: 0 0.5rem;
}

/* ============================================
   Menu
   ============================================ */

.menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.menu .pixel-btn {
    width: 100%;
    text-align: left;
}

/* ============================================
   Module: Tirage
   ============================================ */

.coin-container {
    perspective: 1000px;
    margin: 2rem auto;
    width: 120px;
    height: 120px;
}

.coin {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.1s;
}

.coin.flipping {
    animation: coinFlip 1.5s ease-out forwards;
}

.coin.flipping.result-b {
    animation: coinFlipB 1.5s ease-out forwards;
}

@keyframes coinFlip {
    0% { transform: rotateX(0); }
    100% { transform: rotateX(1800deg); }
}

@keyframes coinFlipB {
    0% { transform: rotateX(0); }
    100% { transform: rotateX(1980deg); }
}

.coin-face {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: bold;
    border: var(--pixel-border) solid var(--text);
    backface-visibility: hidden;
}

.coin-face.front {
    background: linear-gradient(135deg, var(--primary), #ff6b6b);
    color: var(--text);
}

.coin-face.back {
    background: linear-gradient(135deg, var(--accent), #f39c12);
    color: var(--bg-dark);
    transform: rotateX(180deg);
}

.result-zone,
.insight-zone,
.scenario-insight {
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-left: var(--pixel-border) solid var(--accent);
    min-height: 60px;
}

.reaction-zone,
.scenario-reaction {
    margin: 1.5rem 0;
    text-align: center;
}

.reaction-question {
    color: var(--accent);
    margin-bottom: 1rem;
}

.reaction-btns {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3rem;
}

.hidden {
    display: none !important;
}

/* ============================================
   Module: Conseil
   ============================================ */

.council-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.sage-card {
    background: var(--bg-dark);
    border: var(--pixel-border) solid var(--secondary);
    padding: 1rem;
    text-align: center;
    transition: all 0.2s;
}

.sage-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
}

.sage-avatar {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    display: block;
}

.sage-name {
    color: var(--primary);
    font-size: 0.6rem;
    margin-bottom: 0.5rem;
}

.sage-opinion {
    font-size: 0.5rem;
    color: var(--text-dim);
    line-height: 1.6;
}

.sage-verdict {
    margin-top: 0.8rem;
    padding: 0.5rem;
    font-size: 0.5rem;
    background: rgba(233, 69, 96, 0.2);
    border: 2px solid var(--primary);
}

/* ============================================
   Module: Scénario
   ============================================ */

.scenario-container {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--secondary), var(--bg-dark));
    border: var(--pixel-border) solid var(--accent);
    position: relative;
}

.scenario-container::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: 10px;
    font-size: 3rem;
    color: var(--accent);
    opacity: 0.5;
}

.scenario-text {
    font-size: 0.7rem;
    line-height: 2;
}

/* ============================================
   Module: Miroir
   ============================================ */

.mirror-container {
    margin: 1.5rem 0;
}

.mirror-question {
    font-size: 0.8rem;
    color: var(--accent);
    padding: 1.5rem;
    background: var(--bg-dark);
    border: var(--pixel-border) solid var(--primary);
    margin-bottom: 1rem;
    text-align: center;
    line-height: 2;
}

.mirror-reflection {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(46, 204, 113, 0.1);
    border-left: var(--pixel-border) solid var(--success);
    font-size: 0.6rem;
    line-height: 2;
}

/* ============================================
   Footer
   ============================================ */

footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 2rem;
    border-top: 2px dashed var(--secondary);
    color: var(--text-dim);
    font-size: 0.5rem;
}

.disclaimer {
    margin-top: 0.5rem;
    font-size: 0.4rem;
    opacity: 0.6;
}

/* ============================================
   Utilities & Animations
   ============================================ */

.blink {
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 600px) {
    h1 {
        font-size: 1.2rem;
    }

    .pixel-box {
        padding: 1rem;
    }

    .pixel-btn {
        font-size: 0.5rem;
        padding: 0.8rem 1rem;
    }

    .pixel-btn.big {
        font-size: 0.7rem;
        padding: 1rem 2rem;
    }

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

    .options-container {
        flex-direction: column;
    }

    .vs {
        padding: 0.3rem 0;
    }

    .council-container {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Special Effects
   ============================================ */

/* CRT curve effect (optional, can be heavy) */
.crt {
    border-radius: 50% / 10%;
}

/* Text typing effect */
.typing::after {
    content: '▋';
    animation: blink 0.7s step-end infinite;
}

/* Victory sparkle */
.sparkle {
    position: relative;
}

.sparkle::after {
    content: '✨';
    position: absolute;
    animation: sparkle 1s ease-out forwards;
}

@keyframes sparkle {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

/* ============================================
   Module: Tribunal des Toi
   ============================================ */

.tribunal-arena {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.5rem 0;
    gap: 1rem;
}

.tribunal-character {
    flex: 1;
    background: var(--bg-dark);
    border: var(--pixel-border) solid var(--secondary);
    padding: 1rem;
    text-align: center;
    min-height: 180px;
}

.tribunal-character.left {
    border-color: var(--primary);
}

.tribunal-character.right {
    border-color: var(--accent);
}

.tribunal-character .char-avatar {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.tribunal-character .char-name {
    font-size: 0.6rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.tribunal-character.right .char-name {
    color: var(--accent);
}

.tribunal-character .char-stance {
    font-size: 0.5rem;
    color: var(--text-dim);
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    margin-top: 0.5rem;
}

.tribunal-vs {
    font-size: 1.5rem;
    color: var(--primary);
    animation: pulse 1s infinite;
}

.tribunal-debate {
    margin: 1.5rem 0;
}

.debate-line {
    padding: 0.8rem;
    margin: 0.5rem 0;
    font-size: 0.55rem;
    line-height: 1.8;
    border-left: 3px solid var(--secondary);
    background: rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
}

.debate-line.left {
    border-left-color: var(--primary);
    margin-right: 2rem;
}

.debate-line.right {
    border-left-color: var(--accent);
    margin-left: 2rem;
    text-align: right;
    border-left: none;
    border-right: 3px solid var(--accent);
}

.debate-line .speaker {
    font-weight: bold;
    display: block;
    margin-bottom: 0.3rem;
}

.debate-line.left .speaker {
    color: var(--primary);
}

.debate-line.right .speaker {
    color: var(--accent);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.tribunal-vote {
    text-align: center;
    margin: 1.5rem 0;
}

.tribunal-vote p {
    color: var(--accent);
    margin-bottom: 1rem;
}

.vote-btns {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tribunal-verdict {
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(46, 204, 113, 0.1);
    border: var(--pixel-border) solid var(--success);
    text-align: center;
}

/* ============================================
   Module: Générateur d'Excuses
   ============================================ */

.excuses-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1.5rem 0;
}

.excuse-card {
    background: var(--bg-dark);
    border: var(--pixel-border) solid var(--secondary);
    padding: 1rem;
    text-align: center;
    transition: all 0.2s;
}

.excuse-card:hover {
    transform: translateY(-4px);
}

#excuse-a {
    border-color: var(--primary);
}

#excuse-b {
    border-color: var(--accent);
}

.excuse-label {
    font-size: 0.6rem;
    color: var(--text-dim);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px dashed var(--secondary);
}

.excuse-label .option-name-a {
    color: var(--primary);
}

.excuse-label .option-name-b {
    color: var(--accent);
}

.excuse-text {
    font-size: 0.6rem;
    line-height: 1.8;
    min-height: 80px;
    padding: 0.5rem;
}

.excuse-insight {
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(241, 196, 15, 0.1);
    border-left: var(--pixel-border) solid var(--accent);
    font-size: 0.6rem;
    line-height: 1.8;
}

/* ============================================
   Module: Roue du Chaos
   ============================================ */

.wheel-container {
    position: relative;
    width: 250px;
    height: 250px;
    margin: 2rem auto;
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(
        var(--primary) 0deg 45deg,
        var(--accent) 45deg 90deg,
        var(--secondary) 90deg 135deg,
        var(--success) 135deg 180deg,
        var(--warning) 180deg 225deg,
        #9b59b6 225deg 270deg,
        #1abc9c 270deg 315deg,
        #e74c3c 315deg 360deg
    );
    border: var(--pixel-border) solid var(--text);
    position: relative;
    transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}

.wheel.spinning {
    animation: none;
}

.wheel-segment {
    position: absolute;
    width: 50%;
    height: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transform-origin: 100% 100%;
}

.wheel-segment[data-segment="0"] { transform: rotate(22.5deg) translateX(-25%); }
.wheel-segment[data-segment="1"] { transform: rotate(67.5deg) translateX(-25%); }
.wheel-segment[data-segment="2"] { transform: rotate(112.5deg) translateX(-25%); }
.wheel-segment[data-segment="3"] { transform: rotate(157.5deg) translateX(-25%); }
.wheel-segment[data-segment="4"] { transform: rotate(202.5deg) translateX(-25%); }
.wheel-segment[data-segment="5"] { transform: rotate(247.5deg) translateX(-25%); }
.wheel-segment[data-segment="6"] { transform: rotate(292.5deg) translateX(-25%); }
.wheel-segment[data-segment="7"] { transform: rotate(337.5deg) translateX(-25%); }

.wheel-pointer {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent);
    z-index: 10;
}

.wheel-challenge {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--secondary), var(--bg-dark));
    border: var(--pixel-border) solid var(--primary);
    text-align: center;
}

.challenge-type {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.challenge-title {
    color: var(--primary);
    font-size: 0.7rem;
    margin-bottom: 1rem;
}

.challenge-text {
    font-size: 0.6rem;
    line-height: 1.8;
}

.wheel-response {
    margin: 1rem 0;
}

.wheel-response textarea {
    margin-bottom: 1rem;
}

.wheel-insight {
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(46, 204, 113, 0.1);
    border-left: var(--pixel-border) solid var(--success);
    font-size: 0.6rem;
    line-height: 1.8;
}

/* Responsive pour nouveaux modules */
@media (max-width: 600px) {
    .tribunal-arena {
        flex-direction: column;
    }

    .tribunal-character {
        width: 100%;
    }

    .tribunal-vs {
        padding: 0.5rem 0;
    }

    .excuses-container {
        grid-template-columns: 1fr;
    }

    .wheel-container {
        width: 200px;
        height: 200px;
    }

    .debate-line.left,
    .debate-line.right {
        margin-left: 0;
        margin-right: 0;
    }
}

/* Back to home link */
.back-home {
    position: fixed;
    top: 1rem;
    left: 1rem;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 10px;
    z-index: 1001;
    transition: color 0.2s;
}

.back-home:hover {
    color: var(--primary);
}
