* { box-sizing: border-box; }

:root {
    --blue: #0a66c2;
    --blue-dark: #004182;
    --blue-soft: #e8f3ff;
    --ink: rgba(0, 0, 0, 0.9);
    --muted: rgba(0, 0, 0, 0.6);
    --line: rgba(0, 0, 0, 0.15);
    --panel: #ffffff;
    --success: #057642;
    --danger-bg: #fff5f5;
    --danger: #b24020;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    background: linear-gradient(145deg, #f4f2ee 0%, #e8eef5 38%, #dce9f7 68%, #f0ebe3 100%);
    background-attachment: fixed;
}

.page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.card {
    width: 100%;
    max-width: 400px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.08);
    padding: 28px 28px 24px;
}

.card-header {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.header-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--blue-soft);
    color: var(--blue);
}

.header-copy h1 {
    margin: 0 0 6px;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.header-copy p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--muted);
    line-height: 1.5;
}

.puzzle-wrap {
    user-select: none;
    -webkit-user-select: none;
}

.puzzle-canvas {
    position: relative;
    width: 320px;
    max-width: 100%;
    height: 180px;
    margin: 0 auto 16px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: #eef3f8;
}

.puzzle-bg {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.puzzle-piece {
    position: absolute;
    left: 0;
    top: 0;
    width: 44px;
    height: 44px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    pointer-events: none;
    will-change: transform;
}

.puzzle-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.94);
    font-size: 0.875rem;
    color: var(--muted);
    font-weight: 500;
}

.slider-track {
    position: relative;
    height: 44px;
    background: #eef3f8;
    border: 1px solid var(--line);
    border-radius: 24px;
    margin: 0 auto;
    max-width: 320px;
    overflow: hidden;
}

.slider-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: linear-gradient(90deg, #d6e8ff 0%, var(--blue-soft) 100%);
    border-radius: 24px 0 0 24px;
    pointer-events: none;
    will-change: width;
}

.slider-knob {
    position: absolute;
    left: 0;
    top: 3px;
    width: 38px;
    height: 38px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    touch-action: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
    color: var(--blue);
    z-index: 2;
    will-change: transform;
}

.slider-knob:active { cursor: grabbing; }

.slider-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted);
    pointer-events: none;
    z-index: 1;
    padding: 0;
    text-align: center;
    opacity: 1;
    transition: opacity 0.18s ease;
}

.slider-track.active .slider-hint,
.slider-track.moved .slider-hint,
.slider-track.done .slider-hint {
    opacity: 0;
}

.slider-track.done .slider-fill {
    background: linear-gradient(90deg, #c8e6d0 0%, #e6f4ea 100%);
}

.status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 0.8125rem;
    color: var(--muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c4c4c4;
    flex-shrink: 0;
}

.status-dot.running {
    background: var(--blue);
    animation: pulse 1.2s ease-in-out infinite;
}

.status-dot.ok { background: var(--success); }

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.92); }
}

.error {
    margin: 14px 0 0;
    padding: 12px 14px;
    background: var(--danger-bg);
    border: 1px solid #f5c4bc;
    border-radius: 6px;
    color: var(--danger);
    font-size: 0.8125rem;
    line-height: 1.4;
}

.card.success {
    text-align: center;
    padding: 48px 28px;
}

.card.success h1 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--ink);
}

.card.success p {
    color: var(--muted);
    font-size: 0.9rem;
}

#recaptcha-container { height: 0; overflow: hidden; }
