/* =====================================================
   PUZZLE GAME — Las Casas  |  Mobile-first
===================================================== */

/* ----- Кнопка ----- */
.pz-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #1565c0, #42a5f5);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(21,101,192,.4);
    touch-action: manipulation;
}
.pz-open-btn:active { transform: scale(.97); }

/* ----- Modal ----- */
.pz-modal {
    position: fixed;
    inset: 0;
    z-index: 99990;
    background: rgba(0,0,0,.88);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.pz-modal-inner {
    width: 100%;
    max-width: 420px;
    min-height: 100dvh;
    background: #0d1b2a;
    display: flex;
    flex-direction: column;
}

/* Themes */
.pz-modal[data-theme="green"]  .pz-header { background: #1b5e20; }
.pz-modal[data-theme="green"]  .pz-logo span { color: #a5d6a7; }
.pz-modal[data-theme="purple"] .pz-header { background: #4a148c; }
.pz-modal[data-theme="dark"]   .pz-modal-inner { background: #111; }

/* ----- Header ----- */
.pz-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #1565c0;
    position: sticky;
    top: 0;
    z-index: 10;
}
.pz-logo { font-size: 18px; font-weight: 800; color: #fff; flex-shrink: 0; }
.pz-logo span { color: #90caf9; }
.pz-header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    gap: 12px;
}
.pz-timer-box, .pz-moves-box {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,.15);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}
.pz-timer-icon { font-size: 14px; }
.pz-moves-label { font-size: 11px; color: #90caf9; }
.pz-close {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.4);
    background: transparent;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    touch-action: manipulation;
}
.pz-close:active { background: rgba(255,255,255,.2); }

/* ----- Ticker ----- */
.pz-ticker {
    height: 36px;
    overflow: hidden;
    background: #0a1628;
    border-bottom: 1px solid #1a3050;
}
.pz-ticker-track {
    display: flex;
    align-items: center;
    white-space: nowrap;
    animation: pz-scroll 30s linear infinite;
}
.pz-ticker-track:hover { animation-play-state: paused; }
@keyframes pz-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.pz-ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 18px;
    text-decoration: none;
    color: #90a4ae;
    font-size: 12px;
    height: 36px;
    border-right: 1px solid #1a3050;
    transition: color .2s;
}
.pz-ticker-item:hover { color: #42a5f5; }
.pz-ticker-item img {
    width: 22px; height: 22px;
    border-radius: 4px;
    object-fit: cover;
}
.pz-ticker-name  { font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.pz-ticker-price { color: #42a5f5; font-weight: 700; }

/* ----- Screens ----- */
.pz-screen { flex: 1; display: flex; flex-direction: column; }

/* ----- Start screen ----- */
.pz-screen--start { align-items: center; justify-content: center; padding: 20px 16px; }
.pz-start-content { text-align: center; width: 100%; max-width: 320px; }
.pz-start-icon  { font-size: 52px; margin-bottom: 12px; }
.pz-start-content h2 { color: #fff; font-size: 20px; margin-bottom: 8px; }
.pz-start-content p  { color: #90a4ae; font-size: 14px; margin-bottom: 20px; }

.pz-difficulty-picker { margin-bottom: 20px; }
.pz-diff-label { color: #90a4ae; font-size: 13px; display: block; margin-bottom: 8px; }
.pz-diff-btns { display: flex; gap: 8px; justify-content: center; }
.pz-diff-btn {
    flex: 1;
    max-width: 90px;
    padding: 10px 6px;
    background: #1a3050;
    border: 2px solid #2a4060;
    border-radius: 8px;
    color: #90a4ae;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    line-height: 1.3;
}
.pz-diff-btn small { font-size: 11px; font-weight: 400; }
.pz-diff-btn--active {
    border-color: #42a5f5;
    color: #fff;
    background: #1565c0;
}
.pz-diff-btn:active { transform: scale(.96); }

.pz-start-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #1565c0, #42a5f5);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
}
.pz-start-btn:active { transform: scale(.98); }

/* ----- Game screen ----- */
.pz-screen--game { padding: 10px 12px 8px; align-items: center; }

/* Preview bar */
.pz-preview-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 360px;
    background: #1a3050;
    border-radius: 8px;
    padding: 6px 8px;
    margin-bottom: 8px;
}
.pz-preview-img {
    width: 44px; height: 44px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    opacity: .4;
    filter: blur(2px);
    transition: opacity .3s, filter .3s;
}
.pz-preview-img.pz-reveal {
    opacity: 1;
    filter: none;
}
.pz-preview-info { flex: 1; min-width: 0; }
.pz-preview-title { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pz-preview-city  { font-size: 11px; color: #90a4ae; }
.pz-peek-btn {
    width: 34px; height: 34px;
    background: rgba(255,255,255,.1);
    border: none; border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
    touch-action: manipulation;
}
.pz-peek-btn:active { background: rgba(255,255,255,.2); }

/* Board */
.pz-board-wrap {
    position: relative;
    width: min(360px, calc(100vw - 24px));
    aspect-ratio: 1/1;
}
.pz-board {
    width: 100%;
    height: 100%;
    display: grid;
    gap: 3px;
    background: #0a1628;
    border-radius: 8px;
    padding: 3px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Плитки */
.pz-piece {
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: transform .12s, box-shadow .12s;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}
.pz-piece--selected {
    transform: scale(.92);
    box-shadow: 0 0 0 3px #42a5f5;
    z-index: 2;
}
.pz-piece--correct {
    box-shadow: 0 0 0 2px rgba(76,175,80,.6);
}
.pz-piece--empty {
    background: #1a3050 !important;
    cursor: default;
}

/* Peek overlay */
.pz-peek-overlay {
    position: absolute;
    inset: 0;
    border-radius: 8px;
    overflow: hidden;
    z-index: 10;
    pointer-events: none;
}
.pz-peek-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .75;
}

/* Shuffle btn */
.pz-shuffle-btn {
    margin-top: 10px;
    padding: 10px 20px;
    background: #1a3050;
    color: #90a4ae;
    border: 1px solid #2a4060;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
}
.pz-shuffle-btn:active { background: #1565c0; color: #fff; }

/* ----- Win screen ----- */
.pz-screen--win { align-items: center; justify-content: center; padding: 20px 16px; }
.pz-win-content { text-align: center; width: 100%; max-width: 320px; }
.pz-win-icon  { font-size: 52px; }
.pz-win-title { font-size: 24px; font-weight: 800; color: #fff; margin: 8px 0 4px; }
.pz-win-stats { font-size: 14px; color: #90a4ae; margin-bottom: 12px; }
.pz-win-img {
    width: 100%;
    max-height: 160px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 10px;
}
.pz-win-name { font-size: 15px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.pz-win-link {
    display: inline-block;
    font-size: 13px;
    color: #42a5f5;
    text-decoration: none;
    margin-bottom: 16px;
}
.pz-play-again {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #1565c0, #42a5f5);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
}
.pz-play-again:active { transform: scale(.98); }

/* ----- Ad block ----- */
.pz-ad-block {
    border-top: 1px solid #1a3050;
    background: #0a1628;
    min-height: 64px;
    flex-shrink: 0;
}
.pz-ad-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    text-decoration: none;
    color: inherit;
}
.pz-ad-link:active { background: rgba(255,255,255,.04); }
.pz-ad-img {
    width: 52px; height: 52px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}
.pz-ad-body  { flex: 1; }
.pz-ad-badge { font-size: 10px; color: #546e7a; text-transform: uppercase; letter-spacing: .05em; }
.pz-ad-title { font-size: 13px; color: #cfd8dc; font-weight: 700; line-height: 1.3; }
.pz-ad-label { font-size: 12px; color: #42a5f5; font-weight: 700; margin-top: 2px; }
.pz-ad-placeholder {
    padding: 18px 12px;
    text-align: center;
    font-size: 12px;
    color: #546e7a;
    font-style: italic;
}

/* Loading */
.pz-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #90a4ae;
    font-size: 14px;
    gap: 8px;
}
@keyframes pz-spin { to { transform: rotate(360deg); } }
.pz-spinner {
    width: 20px; height: 20px;
    border: 2px solid #1a3050;
    border-top-color: #42a5f5;
    border-radius: 50%;
    animation: pz-spin .7s linear infinite;
}
