/* Page styles for broken-stones.html — served as an EXTERNAL stylesheet on purpose.
   Some content-filtering extensions (AdGuard-family HTML filtering) strip or
   corrupt large inline <style> blocks on cold (non-cached) page loads, which
   rendered these pages unstyled until a manual reload. External same-origin
   stylesheets are not affected. Do not inline this back. */
/* style.css flex-trap guard: this page lays out with a grid, so the
           body must be a plain block container. */
        body.broken-page {
            display: block;
        }

        .broken-wrap {
            max-width: 1180px;
            width: 100%;
            margin: 0 auto;
            padding: 1.5rem 1rem 3rem;
            box-sizing: border-box;
        }

        .broken-header h1 {
            margin: 0 0 0.35rem 0;
            font-size: 1.7rem;
            display: flex;
            align-items: center;
            gap: 0.6rem;
        }
        .broken-header p {
            margin: 0;
            color: var(--text-muted, #6b7280);
            font-size: 0.95rem;
        }

        .broken-asis-banner {
            margin: 1.1rem 0 1.5rem;
            padding: 0.85rem 1rem;
            border: 1px solid rgba(239, 68, 68, 0.35);
            background: rgba(239, 68, 68, 0.07);
            border-radius: 10px;
            font-size: 0.9rem;
            line-height: 1.45;
            display: flex;
            gap: 0.6rem;
            align-items: flex-start;
        }
        .broken-asis-banner strong { color: #ef4444; }

        .broken-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
            gap: 1.25rem;
            width: 100%;
        }

        .broken-card {
            background: var(--bg-card, #ffffff);
            border: 1px solid var(--border-light, rgba(0, 0, 0, 0.1));
            border-radius: 12px;
            overflow: hidden;
            display: flex;
            flex-direction: column;
        }
        .broken-card-imgwrap {
            position: relative;
            aspect-ratio: 4 / 3;
            background: #111;
            cursor: pointer;
            overflow: hidden;
        }
        .broken-card-imgwrap img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }
        .broken-chip {
            position: absolute;
            top: 10px;
            left: 10px;
            background: rgba(239, 68, 68, 0.95);
            color: #fff;
            font-size: 0.68rem;
            font-weight: 800;
            letter-spacing: 0.04em;
            padding: 4px 9px;
            border-radius: 999px;
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
        }
        .broken-chip.damage {
            left: auto;
            right: 10px;
            background: rgba(0, 0, 0, 0.65);
            font-weight: 600;
        }

        .broken-card-body {
            padding: 0.9rem 1rem 1.1rem;
            display: flex;
            flex-direction: column;
            gap: 0.45rem;
            flex: 1;
        }
        .broken-card-body h3 {
            margin: 0;
            font-size: 1.05rem;
            line-height: 1.25;
        }
        .broken-serial {
            font-size: 0.78rem;
            color: var(--text-muted, #6b7280);
            font-family: monospace;
        }
        .broken-meta {
            font-size: 0.8rem;
            color: var(--text-muted, #6b7280);
            line-height: 1.5;
        }
        .broken-comment {
            font-size: 0.82rem;
            background: rgba(239, 68, 68, 0.06);
            border-left: 3px solid rgba(239, 68, 68, 0.55);
            padding: 0.45rem 0.6rem;
            border-radius: 0 6px 6px 0;
            line-height: 1.4;
        }
        .broken-price {
            font-size: 1.15rem;
            font-weight: 800;
            margin-top: auto;
        }
        .broken-price .flat-note {
            font-size: 0.72rem;
            font-weight: 600;
            color: var(--text-muted, #6b7280);
        }
        .broken-asis-line {
            font-size: 0.72rem;
            color: #ef4444;
            font-weight: 600;
            line-height: 1.35;
        }
        .broken-action .btn-add {
            width: 100%;
            border: none;
            border-radius: 8px;
            background: var(--accent, #cf9f47);
            color: #fff;
            font-weight: 700;
            font-size: 0.9rem;
            padding: 0.6rem 0.75rem;
            cursor: pointer;
        }
        .broken-action .btn-add:hover { filter: brightness(1.05); }
        .broken-action .in-cart {
            display: block;
            text-align: center;
            font-size: 0.88rem;
            font-weight: 700;
            color: #10b981;
            padding: 0.55rem 0;
        }
        .broken-action .in-cart a { color: var(--accent, #cf9f47); }
        .broken-contact {
            font-size: 0.82rem;
            text-align: center;
            color: var(--text-muted, #6b7280);
            padding: 0.4rem 0;
            line-height: 1.4;
        }
        .broken-contact strong { white-space: nowrap; }

        .broken-empty, .broken-loading, .broken-error {
            grid-column: 1 / -1;
            text-align: center;
            padding: 3rem 1rem;
            color: var(--text-muted, #6b7280);
        }

        /* ------------------------------------------------------------------
           Lightbox with damage-marks overlay
           ------------------------------------------------------------------ */
        .broken-lightbox {
            position: fixed;
            inset: 0;
            z-index: 3000;
            background: rgba(0, 0, 0, 0.9);
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 0.75rem;
            padding: 0.75rem;
            /* belt-and-braces: any residual overflow scrolls instead of clipping */
            overflow-y: auto;
        }
        .broken-lightbox.open { display: flex; }
        .broken-lightbox-stage {
            position: relative;
            display: inline-block;
        }
        .broken-lightbox-stage img {
            display: block;
            max-width: 94vw;
            /* dvh budget keeps image + marks-toggle + caption inside the REAL
               visible viewport (76vh alone overflowed and clipped both ends
               behind the iOS URL bar). */
            max-height: min(76vh, calc(100dvh - 9.5rem));
            border-radius: 6px;
        }
        .broken-lightbox-stage canvas {
            position: absolute;
            left: 0;
            top: 0;
            pointer-events: none;
            border-radius: 6px;
        }
        .broken-lightbox-bar {
            display: flex;
            gap: 0.6rem;
            align-items: center;
            flex-wrap: wrap;
            justify-content: center;
        }
        .broken-lightbox-bar button {
            background: rgba(255, 255, 255, 0.12);
            color: #fff;
            border: 1px solid rgba(255, 255, 255, 0.25);
            border-radius: 8px;
            padding: 0.45rem 0.9rem;
            font-size: 0.82rem;
            font-weight: 600;
            cursor: pointer;
        }
        .broken-lightbox-close {
            position: absolute;
            /* clear of the iPhone notch/status bar; padding lifts the tap
               target to ~44px */
            top: calc(14px + env(safe-area-inset-top, 0px));
            right: calc(20px + env(safe-area-inset-right, 0px));
            padding: 6px 10px;
            color: #fff;
            font-size: 2.2rem;
            font-weight: 700;
            cursor: pointer;
            user-select: none;
            line-height: 1;
            z-index: 2;
        }
        .broken-lightbox-caption {
            color: #d1d5db;
            font-size: 0.85rem;
            text-align: center;
            max-width: 640px;
        }

        /* Toast (self-contained; app.js is not loaded on this page) */
        .broken-toast {
            position: fixed;
            bottom: calc(24px + env(safe-area-inset-bottom, 0px));
            left: 50%;
            transform: translateX(-50%);
            background: #1f2937;
            color: #fff;
            padding: 0.7rem 1.1rem;
            border-radius: 10px;
            font-size: 0.88rem;
            z-index: 4000;
            box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
            opacity: 0;
            transition: opacity 0.25s ease;
            max-width: 92vw;
        }
        .broken-toast.show { opacity: 1; }
        .broken-toast a { color: var(--accent, #cf9f47); font-weight: 700; }

        /* Admin edit modal fields carry inline styles with NO font-size, so
           they render at the ~13px UA default and trigger iOS auto-zoom on
           focus. 16px is fine on desktop too — no media query needed. */
        #bsEditComment, #bsEditPrice { font-size: 16px; font-family: inherit; }
