/* TraceBase regional — prefecture & ward analytics pages */

:root {
            --pika-pink: #ffdae9;
            --pika-text: #6d4c41;
            --accent: #ff77aa;
            --teal: #0aa896;
            --orange: #e07a30;
            --purple: #9b59b6;
            --white: #ffffff;
            --border: #ffb3d9;
        }

        * { margin: 0; padding: 0; box-sizing: border-box; }

        html {
            -webkit-text-size-adjust: 100%;
        }

        body {
            font-family: 'M PLUS Rounded 1c', sans-serif;
            background: linear-gradient(135deg, #fff5f8 0%, #f0f4ff 100%);
            color: var(--pika-text);
            min-height: 100vh;
            font-size: 16px;
        }

        .header {
            background: rgba(255,255,255,0.6);
            backdrop-filter: blur(10px);
            padding: 0 40px;
            height: 70px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            position: sticky;
            top: 0;
            z-index: 100;
            border-bottom: 2px solid var(--border);
        }

        .logo-mark {
            font-family: 'Noto Serif JP', serif;
            font-size: 20px;
            font-weight: 700;
            color: var(--accent);
        }

        .header-meta {
            font-family: 'DM Mono', monospace;
            font-size: 11px;
            color: var(--accent);
            background: white;
            padding: 4px 12px;
            border-radius: 20px;
            border: 1px solid var(--border);
        }

        .hero {
            padding: 60px 40px;
            text-align: center;
        }

        .hero-eyebrow {
            font-family: 'DM Mono', monospace;
            font-size: 12px;
            color: var(--accent);
            letter-spacing: 0.15em;
            margin-bottom: 16px;
            font-weight: 700;
        }

        .hero-title {
            font-size: 32px;
            font-weight: 700;
            color: var(--pika-text);
            line-height: 1.4;
            margin-bottom: 24px;
        }

        .hero-title em {
            color: var(--accent);
            font-style: normal;
            text-decoration: underline wavy var(--border);
        }

        .hero-desc {
            font-size: 14px;
            color: var(--pika-text);
            line-height: 1.8;
            max-width: 700px;
            margin: 0 auto 40px;
            background: rgba(255,255,255,0.4);
            padding: 20px;
            border-radius: 30px;
        }

        .hero-kpi-row {
            display: flex;
            gap: 20px;
            justify-content: center;
            flex-wrap: wrap;
        }

        .kpi-card {
            background: white;
            border: 3px solid var(--border);
            border-radius: 30px;
            padding: 20px 30px;
            min-width: 200px;
            box-shadow: 0 8px 0 var(--pika-pink);
        }

        .hero-kpi-val {
            font-family: 'DM Mono', monospace;
            font-size: 28px;
            font-weight: 700;
            color: var(--accent);
        }

        .hero-kpi-val span { font-size: 14px; margin-left: 4px; color: var(--pika-text); }
        .hero-kpi-label { font-size: 12px; font-weight: 700; margin-top: 4px; }

        .content {
            padding: 40px;
            max-width: 1200px;
            margin: 0 auto;
            display: flex;
            flex-direction: column;
            gap: 40px;
        }

        .section-label {
            font-weight: 700;
            font-size: 14px;
            color: var(--accent);
            margin-bottom: 20px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .section-label::after {
            content: '';
            flex: 1;
            height: 3px;
            background: var(--border);
            border-radius: 3px;
        }

        .insight-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 16px;
        }

        .insight-card {
            background: white;
            border: 3px solid var(--border);
            border-radius: 30px;
            padding: 20px;
            transition: transform 0.3s;
        }

        .insight-card:hover { transform: translateY(-5px); }
        .insight-ward { font-size: 16px; font-weight: 700; margin: 8px 0; }

        .insight-val {
            font-family: 'DM Mono', monospace;
            font-size: 28px;
            color: var(--accent);
        }

        .charts-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 30px;
        }

        .landprice-cta {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            margin-top: 20px;
            padding: 14px 22px;
            border-radius: 999px;
            border: 3px solid var(--accent);
            background: rgba(255, 255, 255, 0.95);
            font-size: 13px;
            font-weight: 700;
            color: var(--accent);
            text-decoration: none;
            box-shadow: 0 6px 0 var(--pika-pink);
            transition: transform 0.2s, box-shadow 0.2s;
        }

        .landprice-cta:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 0 var(--pika-pink);
        }

        .card {
            background: rgba(255,255,255,0.8);
            border: 4px solid white;
            border-radius: 40px;
            padding: 30px;
            box-shadow: 0 10px 20px rgba(255,182,193,0.2);
        }

        .card-title {
            font-weight: 700;
            font-size: 18px;
            color: var(--accent);
            margin-bottom: 20px;
            display: block;
        }

        .card-wide { grid-column: 1 / -1; }

        /* ダブル取得カードは2カラムレイアウト */
        .double-inner {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 30px;
        }

        .bar-row {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 0;
            border-bottom: 1px dashed var(--border);
        }

        .bar-track {
            flex: 1;
            height: 12px;
            background: var(--white);
            border-radius: 10px;
            overflow: hidden;
            border: 1px solid var(--border);
        }

        .bar-fill {
            height: 100%;
            transition: width 1s cubic-bezier(0.16,1,0.3,1);
        }

        .data-note {
            margin-top: 16px;
            padding-top: 14px;
            border-top: 1px dashed var(--border);
            font-size: 11px;
            color: var(--pika-text);
            opacity: 0.7;
            line-height: 1.8;
        }

        .data-note a {
            color: var(--accent);
            text-decoration: none;
            font-weight: 700;
        }

        .data-note a:hover { text-decoration: underline; }

        .double-desc {
            font-size: 13px;
            line-height: 1.9;
            color: var(--pika-text);
            background: rgba(255,200,220,0.1);
            border-radius: 20px;
            padding: 16px 20px;
            margin-bottom: 20px;
        }

        .context-box {
            background: white;
            border: 4px solid var(--border);
            border-radius: 40px;
            padding: 40px;
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 40px;
        }

        .context-title {
            font-size: 18px;
            font-weight: 700;
            color: var(--accent);
            margin-bottom: 15px;
        }

        .context-text { font-size: 14px; line-height: 2; }

        .footer {
            background: white;
            padding: 30px;
            text-align: center;
            font-size: 12px;
            border-top: 2px solid var(--border);
        }

        .spinner {
            width: 20px;
            height: 20px;
            border: 3px solid var(--pika-pink);
            border-top-color: var(--accent);
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        @keyframes spin { to { transform: rotate(360deg); } }

        @media (max-width: 900px) {
            .charts-row, .insight-grid, .context-box, .double-inner { grid-template-columns: 1fr; }
        }

        @media (max-width: 768px) {
            .header {
                height: auto;
                min-height: 56px;
                padding: 10px 14px;
                flex-wrap: wrap;
                gap: 8px;
                row-gap: 6px;
            }

            .logo-mark { font-size: clamp(17px, 4.5vw, 20px); }

            .header-meta {
                font-size: 10px;
                padding: 4px 10px;
            }

            .hero {
                padding: 36px 16px 28px;
            }

            .hero-eyebrow {
                font-size: 11px;
                letter-spacing: 0.1em;
            }

            .hero-title {
                font-size: clamp(1.25rem, 5.5vw, 1.75rem);
            }

            .hero-desc {
                font-size: 15px;
                padding: 16px 14px;
                margin-bottom: 28px;
            }

            .hero-kpi-row {
                gap: 12px;
            }

            .kpi-card {
                min-width: 0;
                width: 100%;
                max-width: 22rem;
                padding: 16px 18px;
            }

            .hero-kpi-val {
                font-size: clamp(1.35rem, 6vw, 1.65rem);
            }

            .hero-kpi-val span { font-size: 13px; }

            .hero-kpi-label { font-size: 13px; }

            .content {
                padding: 22px 14px 28px;
                gap: 28px;
            }

            .card {
                padding: 20px 16px;
                border-radius: 28px;
                min-width: 0;
            }

            .card-title { font-size: 16px; }

            .section-label { font-size: 13px; }

            .double-desc,
            .context-text {
                font-size: 15px;
                line-height: 1.85;
            }

            .context-title { font-size: 17px; }

            .insight-val { font-size: clamp(1.25rem, 6vw, 1.6rem); }

            .bar-row {
                flex-wrap: wrap;
                row-gap: 4px;
                font-size: 13px;
            }

            .bar-row > div:nth-child(2) {
                width: auto !important;
                min-width: 3.5rem;
                flex: 0 0 auto;
            }

            .bar-track { min-width: 0; flex: 1 1 120px; }

            .data-note { font-size: 12px; }

            .charts-row { min-width: 0; }

            .footer { padding: 22px 14px; font-size: 13px; }
        }

        /* Matrix dashboard: high-density Gotham extension */
        .matrix-dashboard {
            background: #0a0c10;
            border: 1px solid #30363d;
            color: #c9d1d9;
        }

        .matrix-head {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-bottom: 14px;
        }

        .matrix-sub {
            margin: 0;
            font-size: 12px;
            font-family: "DM Mono", monospace;
            color: #8b949e;
            line-height: 1.5;
        }

        .matrix-operator {
            display: flex;
            align-items: flex-start;
            gap: 10px;
        }

        .matrix-operator-avatar {
            width: 44px;
            height: 44px;
            object-fit: contain;
            filter: drop-shadow(0 0 10px #00d4ff88);
            flex-shrink: 0;
        }

        .matrix-operator-console {
            flex: 1;
            border: 1px solid #30363d;
            background: #161b22;
            border-radius: 2px;
            overflow: hidden;
        }

        .matrix-operator-console__bar {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 5px 8px;
            border-bottom: 1px solid #30363d;
            font-size: 10px;
            letter-spacing: 0.12em;
            color: #00d4ff;
            font-family: "DM Mono", monospace;
        }

        .matrix-dot {
            width: 6px;
            height: 6px;
            background: #39ff14;
            box-shadow: 0 0 8px #39ff14;
            flex-shrink: 0;
        }

        #matrixTrendLine {
            margin: 0;
            padding: 8px 10px 10px;
            font-size: 12px;
            line-height: 1.6;
            color: #c9d1d9;
        }

        .matrix-table-wrap {
            overflow: auto;
            border: 1px solid #30363d;
            border-radius: 2px;
        }

        .matrix-table {
            width: 100%;
            border-collapse: collapse;
            min-width: 1040px;
            background: #0a0c10;
            font-family: "DM Mono", "M PLUS Rounded 1c", sans-serif;
        }

        .matrix-table thead th {
            position: sticky;
            top: 0;
            background: #161b22;
            border-bottom: 1px solid #30363d;
            border-right: 1px solid #30363d;
            padding: 0;
            text-align: left;
        }

        .matrix-table thead th:last-child {
            border-right: none;
        }

        .matrix-sort {
            width: 100%;
            border: none;
            background: transparent;
            color: #8b949e;
            text-align: left;
            padding: 8px 10px;
            cursor: pointer;
            font-size: 11px;
            letter-spacing: 0.05em;
            font-weight: 700;
        }

        .matrix-sort:hover,
        .matrix-sort.is-active {
            color: #00d4ff;
        }

        .matrix-hdr-stub {
            font-size: 9px;
            letter-spacing: 0.06em;
            font-weight: 600;
            color: #484f58;
            vertical-align: super;
            margin-left: 2px;
        }

        .matrix-table tbody th,
        .matrix-table tbody td {
            border-right: 1px solid #30363d;
            border-bottom: 1px solid #30363d;
            padding: 0;
        }

        .matrix-table tbody td:last-child,
        .matrix-table tbody th:last-child {
            border-right: none;
        }

        .matrix-table tbody tr:hover {
            background: #161b22;
        }

        .matrix-ward {
            min-width: 92px;
            font-size: 12px;
            font-weight: 700;
            color: #c9d1d9;
            padding: 9px 10px;
            white-space: nowrap;
            background: rgba(22, 27, 34, 0.35);
        }

        .matrix-cell {
            position: relative;
            min-width: 80px;
            padding: 9px 10px;
            font-size: 11px;
            color: #c9d1d9;
            font-weight: 700;
            text-align: right;
        }

        .matrix-cell--pct::before {
            content: "";
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: calc(var(--pct, 0) * 1%);
            background: linear-gradient(90deg, rgba(0, 212, 255, 0.28), rgba(0, 212, 255, 0.08));
            pointer-events: none;
        }

        .matrix-cell--pct span {
            position: relative;
            z-index: 1;
        }

        .matrix-cell--na {
            text-align: center;
            color: #484f58;
            font-weight: 600;
        }

        .matrix-cell--na span {
            position: relative;
            z-index: 1;
        }

        .matrix-empty {
            margin: 0;
            padding: 20px;
            font-size: 13px;
            color: #8b949e;
            text-align: center;
        }

        @media (max-width: 768px) {
            .matrix-sub {
                font-size: 11px;
            }

            .matrix-operator {
                align-items: stretch;
            }

            .matrix-operator-avatar {
                width: 38px;
                height: 38px;
            }

            #matrixTrendLine {
                font-size: 11px;
            }
        }
