/* ── Variables ─────────────────────────────────────────── */
:root {
    --bg:           #ffffff;
    --surface:      #ffffff;
    --surface-soft: #f8fafc;
    --line:         #e7ecf3;
    --line-strong:  #d8e0eb;

    --text:         #17202b;
    --muted:        #6b7280;

    --primary:      #2563eb;
    --primary-hover:#1d4ed8;
    --primary-soft: rgba(37, 99, 235, 0.10);

    --up:           #059669;
    --down:         #dc2626;

    --shadow-md:    0 22px 48px rgba(15, 23, 42, 0.08);

    --radius-md:    16px;
    --radius-lg:    22px;
    --radius-pill:  999px;

    --content:      780px;
}

/* ── Dark mode ──────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
    :root {
        --bg:           #0f172a;
        --surface:      #1e293b;
        --surface-soft: #1a2436;
        --line:         #2d3f55;
        --line-strong:  #3a5068;

        --text:         #e2e8f0;
        --muted:        #94a3b8;

        --primary:      #3b82f6;
        --primary-hover:#2563eb;
        --primary-soft: rgba(59, 130, 246, 0.15);

        --up:           #34d399;
        --down:         #f87171;

        --shadow-md:    0 22px 48px rgba(0, 0, 0, 0.35);
    }
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin:      0;
    padding:     0;
    background:  var(--bg);
    color:       var(--text);
    font-family: 'Inter', Arial, sans-serif;
}

body {
    min-height:  100vh;
    line-height: 1.6;
}

/* ── Layout ─────────────────────────────────────────────── */
.sim {
    max-width: var(--content);
    margin:    0 auto;
    padding:   32px 18px 56px;
}

.sim-box {
    background:    var(--surface);
    border:        1px solid var(--line);
    border-radius: 28px;
    box-shadow:    var(--shadow-md);
    padding:       30px 26px 28px;
}

/* ── Header ─────────────────────────────────────────────── */
.sim-header { margin-bottom: 24px; }

.sim-header h1 {
    margin:         0 0 10px;
    font-size:      clamp(1.8rem, 1.2rem + 1.8vw, 2.6rem);
    line-height:    1.08;
    letter-spacing: -0.04em;
    font-weight:    800;
}

.sim-header p {
    margin:      0;
    color:       var(--muted);
    font-size:   0.97rem;
    line-height: 1.75;
    max-width:   60ch;
}

/* ── Form ───────────────────────────────────────────────── */
.sim-form { display: grid; gap: 12px; }

.sim-row {
    padding:       14px 14px 12px;
    border:        1px solid var(--line);
    border-radius: var(--radius-lg);
    background:    var(--surface-soft);
    transition:    border-color 0.2s ease, background 0.2s ease;
}

.sim-row:hover {
    border-color: var(--line-strong);
    background:   var(--surface);
}

.sim-row-top {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    gap:             16px;
    margin-bottom:   10px;
}

.sim-row-top label {
    font-size:   0.92rem;
    font-weight: 600;
    line-height: 1.35;
    color:       var(--text);
}

.sim-value {
    min-width:            36px;
    text-align:           right;
    font-size:            1rem;
    font-weight:          800;
    color:                var(--primary);
    font-variant-numeric: tabular-nums;
}

/* ── Slider ─────────────────────────────────────────────── */
.sim-slider {
    width:              100%;
    appearance:         none;
    -webkit-appearance: none;
    background:         transparent;
    cursor:             pointer;
}

.sim-slider:focus { outline: none; }

.sim-slider::-webkit-slider-runnable-track {
    height:        8px;
    border-radius: 999px;
    background:    linear-gradient(90deg, rgba(37,99,235,0.18), rgba(37,99,235,0.08));
    border:        1px solid rgba(37,99,235,0.10);
}

.sim-slider::-moz-range-track {
    height:        8px;
    border-radius: 999px;
    background:    linear-gradient(90deg, rgba(37,99,235,0.18), rgba(37,99,235,0.08));
    border:        1px solid rgba(37,99,235,0.10);
}

.sim-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    margin-top:         -6px;
    width:              20px;
    height:             20px;
    border-radius:      50%;
    border:             2px solid var(--surface);
    background:         var(--primary);
    box-shadow:
        0 4px 12px rgba(37, 99, 235, 0.26),
        0 0 0 1px rgba(37, 99, 235, 0.10);
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.sim-slider:hover::-webkit-slider-thumb {
    transform: scale(1.1);
}

.sim-slider:focus-visible::-webkit-slider-thumb {
    box-shadow:
        0 0 0 5px rgba(37, 99, 235, 0.22),
        0 4px 12px rgba(37, 99, 235, 0.26);
}

.sim-slider::-moz-range-thumb {
    width:         20px;
    height:        20px;
    border-radius: 50%;
    border:        2px solid var(--surface);
    background:    var(--primary);
    box-shadow:
        0 4px 12px rgba(37, 99, 235, 0.26),
        0 0 0 1px rgba(37, 99, 235, 0.10);
}

/* ── Live average ───────────────────────────────────────── */
.sim-live-avg {
    padding:       14px 16px 12px;
    border:        1px solid var(--primary-soft);
    border-radius: var(--radius-lg);
    background:    var(--primary-soft);
    transition:    background 0.3s ease;
}

.sim-live-avg-top {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    gap:             12px;
    margin-bottom:   10px;
}

.sim-live-avg-label {
    font-size:   0.82rem;
    font-weight: 700;
    color:       var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sim-live-avg-value {
    font-size:            1.15rem;
    font-weight:          800;
    color:                var(--primary);
    font-variant-numeric: tabular-nums;
    display:              flex;
    align-items:          center;
    gap:                  6px;
}

.sim-live-avg-emoji {
    font-size: 1.3rem;
    line-height: 1;
}

.sim-live-bar-wrap {
    height:        6px;
    border-radius: 999px;
    background:    rgba(37, 99, 235, 0.12);
    overflow:      hidden;
    margin-bottom: 8px;
}

.sim-live-bar {
    height:        100%;
    border-radius: 999px;
    background:    var(--primary);
    transition:    width 0.25s cubic-bezier(.4, 0, .2, 1);
    min-width:     4px;
}

.sim-live-avg-hint {
    font-size:   0.8rem;
    font-weight: 600;
    color:       var(--primary);
    opacity:     0.75;
}

/* ── Submit ─────────────────────────────────────────────── */
.sim-submit {
    margin-top:    4px;
    width:         100%;
    min-height:    52px;
    border:        none;
    border-radius: var(--radius-pill);
    background:    var(--primary);
    color:         #fff;
    font-size:     1rem;
    font-weight:   700;
    letter-spacing:0.01em;
    cursor:        pointer;
    transition:    background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    box-shadow:    0 10px 22px rgba(37, 99, 235, 0.18);
}

.sim-submit:hover {
    background: var(--primary-hover);
    transform:  translateY(-1px);
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.24);
}

.sim-submit:focus-visible {
    outline:        3px solid var(--primary);
    outline-offset: 3px;
}

.sim-submit:disabled {
    opacity:    0.6;
    cursor:     not-allowed;
    transform:  none;
    box-shadow: none;
}

/* ── Result section ─────────────────────────────────────── */
.sim-result {
    margin-top:  30px;
    padding-top: 26px;
    border-top:  1px solid var(--line);
    animation:   fadeSlideIn 0.4s ease both;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.sim-result-head {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    gap:             12px;
    margin-bottom:   20px;
}

.sim-result-head h2 {
    margin:      0;
    font-size:   1.2rem;
    font-weight: 800;
}

.sim-badge {
    display:       inline-flex;
    align-items:   center;
    gap:           6px;
    padding:       7px 14px;
    border-radius: var(--radius-pill);
    background:    var(--primary-soft);
    color:         var(--primary);
    font-size:     0.83rem;
    font-weight:   700;
    white-space:   nowrap;
}

/* ── Score cards ─────────────────────────────────────────── */
.sim-score-grid {
    display:               grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap:                   12px;
    margin-bottom:         22px;
}

.score-card {
    background:    var(--surface-soft);
    border:        1px solid var(--line);
    border-radius: var(--radius-md);
    padding:       16px 14px 14px;
    display:       flex;
    flex-direction:column;
    gap:           5px;
    transition:    border-color 0.2s ease;
}

.score-card:hover { border-color: var(--line-strong); }

.score-card-icon {
    font-size:   1.4rem;
    line-height: 1;
}

.score-label {
    display:        block;
    font-size:      0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color:          var(--muted);
    font-weight:    700;
}

.score-value {
    font-size:            2rem;
    font-weight:          800;
    line-height:          1;
    font-variant-numeric: tabular-nums;
    color:                var(--text);
}

.score-sub {
    font-size:   0.78rem;
    color:       var(--muted);
    font-weight: 500;
}

.diff-up   { color: var(--up)   !important; }
.diff-down { color: var(--down) !important; }

/* ── Meme ────────────────────────────────────────────────── */
.sim-meme {
    position:      relative;
    margin:        0 0 22px;
    border-radius: var(--radius-lg);
    overflow:      hidden;
    border:        1px solid var(--line);
    background:    var(--surface-soft);
}

.sim-meme-img {
    display:         block;
    /*
	width:           100%;
    height:          580px;
	*/
	height: 180px;
	width: 180px;
	margin: 0 auto;
    object-fit:      cover;
    object-position: center;
}

.sim-meme-caption {
    position:   absolute;
    bottom:     0;
    left:       0;
    right:      0;
    padding:    10px 16px;
    background: linear-gradient(transparent, rgba(15, 23, 42, 0.72));
    color:      #fff;
    font-size:  0.85rem;
    font-weight:700;
}

/* ── Breakdown ───────────────────────────────────────────── */
.sim-breakdown-title {
    margin:         0 0 10px;
    font-size:      0.76rem;
    font-weight:    700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color:          var(--muted);
}

.sim-breakdown { display: grid; gap: 8px; margin-bottom: 20px; }

/* ── Klasyczny układ Breakdown z dwoma paskami ── */
.breakdown-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    transition: border-color 0.2s ease;
}

.breakdown-row:hover {
    border-color: var(--line-strong);
}

.breakdown-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 8px;
}

.breakdown-bar-wrap {
    height: 5px; /* Delikatnie grubszy pasek */
    border-radius: 999px;
    background: var(--line);
    overflow: hidden;
}

.breakdown-bar {
    height: 100%;
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(.4, 0, .2, 1);
}

.breakdown-bar--user {
    background: var(--primary);
}

.breakdown-bar--global {
    background: var(--muted);
}

.breakdown-values {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    font-size: 0.82rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.breakdown-values strong {
    color: var(--text);
    font-weight: 700;
}

/* Pogrubiona wartość użytkownika przyjmuje kolor paska (primary) dla lepszej czytelności */
.user-label strong {
    color: var(--primary);
}

/* Responsywność dla rzędów */
@media (max-width: 600px) {
    .breakdown-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .breakdown-values {
        justify-content: flex-start;
    }
}

.chip {
    display:       inline-flex;
    align-items:   center;
    padding:       2px 8px;
    border-radius: var(--radius-pill);
    font-size:     0.76rem;
    font-weight:   700;
    background:    var(--surface-soft);
    border:        1px solid var(--line);
}

/* ── Note ────────────────────────────────────────────────── */
.sim-note {
    padding:       14px 16px;
    border-radius: var(--radius-md);
    background:    var(--surface-soft);
    border:        1px solid var(--line);
    font-size:     0.84rem;
    color:         var(--muted);
    line-height:   1.7;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
    .sim {
        padding: 16px 12px 36px;
    }

    .sim-box {
        padding:       20px 14px 18px;
        border-radius: 22px;
    }

    .sim-score-grid {
        grid-template-columns: 1fr;
    }

    .score-value {
        font-size: 1.6rem;
    }

    .sim-result-head {
        flex-direction: column;
        align-items:    flex-start;
    }

    .breakdown-row {
        grid-template-columns: 1fr;
    }

    .breakdown-values {
        justify-content: flex-start;
    }

    .sim-meme-img {
        /*height: 260px;*/
        height: 160px;
        width: 160px;
        margin: 0 auto;
    }

    .sim-live-avg-top {
        flex-direction: column;
        align-items:    flex-start;
        gap:            4px;
    }
}
/* Układ dla sumy w 2 kolumnach */
.sim-score-grid--two {
    grid-template-columns: repeat(2, 1fr);
}

.text-primary {
    color: var(--primary) !important;
}

/* Przycisk spróbuj jeszcze raz */
.sim-retry {
    display: block;
    text-align: center;
    margin-top: 20px;
    padding: 14px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s, border-color 0.2s;
}

.sim-retry:hover {
    background: var(--surface);
    border-color: var(--line-strong);
}


/* Animacja monet */
.coins-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.falling-coin {
    position: absolute;
    top: -50px;
    font-size: 2rem;
    animation: fall linear forwards;
    will-change: transform;
}

@keyframes fall {
    0% {
        transform: translateY(-50px) rotate(0deg);
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        transform: translateY(110vh) rotate(360deg);
        opacity: 0;
    }
}


.footer-box div{
	display:box;
	margin: 0 auto;
	text-align:center;
	padding:10px;
	margin-top:10px;
}
