/* ============================================
   Śmieciara w akcji — ZUK Świecie
   Color palette from ZUK logo + eco theme
   ============================================ */

:root {
    --c-primary: #1B5FA8;
    --c-primary-light: #4A8FD9;
    --c-primary-dark: #0D3D78;
    --c-accent: #E84A2F;
    --c-eco: #4CAF50;
    --c-eco-light: #81C784;
    --c-sky-top: #87CEEB;
    --c-sky-bottom: #D4E8F5;
    --c-asphalt: #4A4A4A;
    --c-grass: #7CB342;
    --c-sand: #F5E6D3;
    --c-cream: #FAF7F2;
    --c-white: #FFFFFF;
    --c-text-dark: #1A2B3F;
    --c-text-muted: #5C6B7F;
    --c-text-subtle: #8A9BB0;
    --c-danger: #E84A4A;
    --c-gold: #FFD700;
    --c-silver: #C0C0C0;
    --c-bronze: #CD7F32;

    --font-display: 'Fraunces', serif;
    --font-body: 'DM Sans', sans-serif;

    --t-fast: 150ms;
    --t-base: 250ms;
    --t-slow: 400ms;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.15);
    --shadow-glow: 0 0 20px rgba(27,95,168,0.3);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, var(--c-sky-bottom) 0%, var(--c-cream) 50%, var(--c-sky-bottom) 100%);
    color: var(--c-text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-dark); text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* Layout */
.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-header {
    background: var(--c-white);
    border-bottom: 2px solid var(--c-primary);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-img {
    display: block;
    height: 40px;
    width: auto;
}

.header-nav {
    display: flex;
    gap: 20px;
}

.header-nav a {
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--c-text-muted);
    transition: color var(--t-fast);
}

.header-nav a:hover {
    color: var(--c-primary);
    text-decoration: none;
}

.site-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.site-footer {
    text-align: center;
    padding: 16px 20px;
    font-size: 0.8rem;
    color: var(--c-text-subtle);
    border-top: 1px solid rgba(0,0,0,0.06);
}

.site-footer a { color: var(--c-text-muted); }
.copyright { margin-top: 4px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border: 2px solid transparent;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--t-fast);
    text-decoration: none;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--c-primary);
    color: var(--c-white);
    border-color: var(--c-primary);
    box-shadow: 0 2px 8px rgba(27,95,168,0.3);
}

.btn-primary:hover:not(:disabled) {
    background: var(--c-primary-dark);
    border-color: var(--c-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.btn-ghost {
    background: transparent;
    color: var(--c-primary);
    border-color: var(--c-primary-light);
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(27,95,168,0.06);
    border-color: var(--c-primary);
}

.btn-large {
    padding: 16px 48px;
    font-size: 1.15rem;
    border-radius: 10px;
}

.btn-small {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-filter {
    background: var(--c-white);
    color: var(--c-text-muted);
    border-color: rgba(0,0,0,0.1);
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-filter.active {
    background: var(--c-primary);
    color: var(--c-white);
    border-color: var(--c-primary);
}

/* Intro */
.intro-section {
    width: 100%;
    max-width: 640px;
}

.intro-card {
    background: var(--c-white);
    border-radius: 16px;
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.intro-title {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--c-primary-dark);
    margin-bottom: 8px;
    line-height: 1.2;
}

.intro-subtitle {
    color: var(--c-text-muted);
    margin-bottom: 28px;
    font-size: 0.95rem;
}

.tutorial-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}

.tutorial-card {
    background: var(--c-cream);
    border-radius: 10px;
    padding: 16px 10px;
    text-align: center;
}

.tutorial-icon {
    font-size: 1.8rem;
    margin-bottom: 6px;
}

.tutorial-card h3 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--c-primary-dark);
    margin-bottom: 4px;
}

.tutorial-card p {
    font-size: 0.75rem;
    color: var(--c-text-muted);
    line-height: 1.3;
}

.intro-ranking {
    margin-top: 24px;
}

/* Game wrapper */
.game-section {
    width: 100%;
    max-width: 900px;
}

.game-wrapper {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--c-primary);
    background: var(--c-asphalt);
}

.game-wrapper canvas {
    display: block;
    width: 100% !important;
    height: auto !important;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn var(--t-base) ease-out;
}

.modal {
    background: var(--c-white);
    border-radius: 16px;
    padding: 32px 28px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: scaleIn var(--t-slow) ease-out;
}

.modal-title {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--c-primary-dark);
    text-align: center;
    margin-bottom: 4px;
}

.modal-subtitle {
    text-align: center;
    color: var(--c-text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* Score display */
.score-display {
    background: linear-gradient(135deg, rgba(27,95,168,0.06), rgba(76,175,80,0.06));
    border: 2px solid var(--c-primary-light);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 16px;
}

.score-value {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 3rem;
    font-weight: 900;
    color: var(--c-primary);
    line-height: 1;
}

.score-label {
    font-size: 0.85rem;
    color: var(--c-text-muted);
    margin-bottom: 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.stat { text-align: center; }

.stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--c-primary-dark);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--c-text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Rank info */
.rank-info {
    text-align: center;
    font-weight: 600;
    color: var(--c-eco);
    padding: 8px;
    background: rgba(76,175,80,0.08);
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

/* PSZOK banner */
.pszok-banner {
    background: linear-gradient(135deg, #FFF3E0, #FFECB3);
    border: 2px solid var(--c-accent);
    border-radius: 10px;
    padding: 14px 16px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--c-text-dark);
    margin-bottom: 16px;
    line-height: 1.5;
}

/* Forms */
.score-form { margin-top: 8px; }

.field {
    margin-bottom: 12px;
    text-align: left;
}

.field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--c-text-muted);
    margin-bottom: 4px;
}

.field input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--c-text-dark);
    background: var(--c-cream);
    transition: border-color var(--t-fast);
}

.field input[type="text"]:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(27,95,168,0.15);
    background: var(--c-white);
}

.field-error {
    font-size: 0.8rem;
    color: var(--c-danger);
    margin-top: 4px;
    display: none;
}

.field-error.show { display: block; }

.form-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.form-buttons .btn { flex: 1; min-width: 140px; }

/* Score saved */
.score-saved { text-align: center; }

.saved-msg {
    font-weight: 700;
    color: var(--c-eco);
    font-size: 1.1rem;
    margin-bottom: 16px;
}

/* Ranking */
.ranking-list {
    margin-top: 12px;
}

.ranking-row {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    font-size: 0.9rem;
}

.ranking-list--full .ranking-row {
    grid-template-columns: 42px 1fr auto auto;
}

.ranking-row .rank {
    font-weight: 700;
    text-align: center;
    color: var(--c-text-muted);
}

.ranking-row .nick {
    font-weight: 500;
    color: var(--c-text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-row .score {
    font-weight: 700;
    color: var(--c-primary);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.ranking-row .detail {
    font-size: 0.75rem;
    color: var(--c-text-subtle);
    text-align: right;
    white-space: nowrap;
}

.ranking-row.top-3 .rank { color: var(--c-gold); }
.ranking-row.top-3:nth-child(2) .rank { color: var(--c-silver); }
.ranking-row.top-3:nth-child(3) .rank { color: var(--c-bronze); }

.ranking-row.is-current-player {
    background: rgba(27,95,168,0.06);
    border-left: 3px solid var(--c-primary);
    border-radius: 4px;
}

/* Hall of Fame page */
.hof-page {
    width: 100%;
    max-width: 640px;
}

.page-title {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--c-primary-dark);
    text-align: center;
    margin-bottom: 20px;
}

.hof-filters {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.hof-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.page-info {
    font-size: 0.85rem;
    color: var(--c-text-muted);
}

.hof-total {
    text-align: center;
    font-size: 0.85rem;
    color: var(--c-text-subtle);
    margin-top: 12px;
}

.text-muted {
    color: var(--c-text-muted);
    text-align: center;
    padding: 20px;
}

/* Legal pages */
.legal-page {
    max-width: 640px;
    background: var(--c-white);
    border-radius: 16px;
    padding: 40px 32px;
    box-shadow: var(--shadow-md);
}

.legal-page h1 {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.5rem;
    color: var(--c-primary-dark);
    margin-bottom: 24px;
}

.legal-page h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--c-text-dark);
    margin: 20px 0 8px;
}

.legal-page p, .legal-page li {
    font-size: 0.9rem;
    color: var(--c-text-muted);
    margin-bottom: 8px;
}

.legal-page ul {
    padding-left: 20px;
}

.legal-date {
    margin-top: 24px;
    font-style: italic;
    font-size: 0.8rem;
    color: var(--c-text-subtle);
}

/* Toasts */
.toast-stack {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--c-white);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: var(--shadow-md);
    font-size: 0.85rem;
    border-left: 3px solid var(--c-eco);
    animation: slideInRight var(--t-base) ease-out;
    max-width: 320px;
}

.toast.error { border-left-color: var(--c-danger); }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Mobile */
@media (max-width: 640px) {
    .header-inner { padding: 10px 14px; }
    .logo-img { height: 32px; }
    .header-nav { gap: 12px; }
    .header-nav a { font-size: 0.75rem; }

    .site-main { padding: 12px; }

    .intro-card { padding: 24px 16px; }
    .intro-title { font-size: 1.4rem; }
    .tutorial-cards { grid-template-columns: 1fr; gap: 8px; }
    .tutorial-card { display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px; }
    .tutorial-icon { font-size: 1.4rem; margin-bottom: 0; flex-shrink: 0; }

    .modal { padding: 24px 18px; }
    .modal-title { font-size: 1.3rem; }
    .score-value { font-size: 2.2rem; }

    .form-buttons { flex-direction: column; }
    .form-buttons .btn { min-width: auto; }

    .game-wrapper {
        max-width: 420px;
        border-radius: 8px;
    }
}
