/* Meta-Skill Routing Table - layout and styling
   Fixed-height column: title row, request controls, Mermaid diagram, shared
   infobox panel. The height of <main> must equal the CANVAS_HEIGHT comment in
   meta-skill-routing-table.js. */

html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
}

main {
    box-sizing: border-box;
    height: 550px;
    display: flex;
    flex-direction: column;
    background-color: aliceblue;
    border: 1px solid silver;
    overflow: hidden;
}

.sim-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 2px 12px;
    padding: 8px 14px 0 14px;
}

.sim-header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: normal;
    color: #111;
}

.hint {
    margin: 0;
    font-size: 15px;
    color: #475569;
}

/* Request controls */
.controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    padding: 8px 14px 2px 14px;
    font-size: 16px;
}

.controls label {
    font-weight: bold;
}

.controls input[type="text"] {
    flex: 1 1 240px;
    min-width: 0;
    font-size: 15px;
    padding: 3px 6px;
}

.controls button,
.controls select {
    font-size: 15px;
    padding: 3px 8px;
}

.controls select {
    flex: 0 1 190px;
    min-width: 0;
}

/* Mermaid diagram: scales down with the container */
.diagram {
    flex: 0 0 auto;
    padding: 4px 10px 6px 10px;
    text-align: center;
}

.diagram svg {
    max-height: 262px;
}

.diagram .node {
    cursor: pointer;
    transition: opacity 0.15s;
}

.diagram .node:hover rect,
.diagram .node:hover polygon {
    filter: brightness(1.08);
}

.diagram .node:focus {
    outline: none;
}

/* The selected node gets a dark halo. (Mermaid writes each node's own stroke
   as an inline !important style, so the highlight is a filter, not a stroke.) */
.diagram .node.selected,
.diagram .node:focus-visible {
    filter: drop-shadow(0 0 1px #111) drop-shadow(0 0 3px #111);
}

/* Guides, edges, and edge labels that are not on the matched route */
.diagram .dimmed {
    opacity: 0.5;
}

/* Shared infobox panel below the diagram */
.infobox {
    flex: 1 1 auto;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 9px 14px;
    background-color: white;
    border-top: 1px solid silver;
    font-size: 15px;
    line-height: 1.35;
    color: #1f2937;
    overflow: hidden;
}

.info-text {
    flex: 1 1 38%;
    min-width: 0;
}

.info-text h2 {
    margin: 0 0 4px 0;
    font-size: 18px;
    color: #00695c;
}

.info-text h2.warn {
    color: #b45309;
}

.info-text p {
    margin: 0 0 5px 0;
}

.info-text .label {
    font-weight: bold;
}

.info-text code,
.keyword-table code {
    font-size: 13px;
    background-color: #eef2f5;
    padding: 1px 3px;
    border-radius: 3px;
}

.info-text mark {
    background-color: #b2dfdb;
    padding: 0 2px;
}

/* The routing table excerpt */
.keyword-table {
    flex: 1 1 62%;
    min-width: 0;
    border-collapse: collapse;
    font-size: 13px;
    line-height: 1.2;
}

.keyword-table td:last-child,
.keyword-table th:last-child {
    white-space: nowrap;
}

.keyword-table code {
    font-size: 12px;
}

.keyword-table caption {
    caption-side: top;
    text-align: left;
    font-weight: bold;
    font-size: 14px;
    padding-bottom: 3px;
}

.keyword-table th,
.keyword-table td {
    border: 1px solid #cbd5e1;
    padding: 2px 6px;
    text-align: left;
    vertical-align: top;
}

.keyword-table thead th {
    background-color: #e2e8f0;
}

.keyword-table tr.matched td {
    background-color: #b2dfdb;
}

.keyword-table .kw-hit {
    text-decoration: underline;
}

/* Narrow iframes: stack the text above the table */
@media (max-width: 660px) {
    .sim-header h1 {
        font-size: 19px;
    }
    .hint {
        font-size: 13px;
    }
    .controls {
        font-size: 14px;
        padding: 6px 10px 2px 10px;
    }
    .infobox {
        flex-direction: column;
        gap: 4px;
        font-size: 13px;
        line-height: 1.25;
        padding: 6px 10px;
    }
    .info-text h2 {
        font-size: 15px;
    }
    .info-text,
    .keyword-table {
        flex: 0 0 auto;
        width: 100%;
    }
    .keyword-table {
        font-size: 11.5px;
    }
    .keyword-table caption {
        display: none;
    }
    .info-text p {
        margin-bottom: 3px;
    }
    .info-text code,
    .keyword-table code {
        font-size: 11px;
    }
}

/* Phone-width iframes: tighten the table so all five rows stay visible */
@media (max-width: 460px) {
    .hint {
        display: none;
    }
    .controls label {
        display: none;
    }
    .infobox {
        font-size: 12px;
        line-height: 1.2;
    }
    .keyword-table {
        font-size: 10.5px;
        line-height: 1.15;
    }
    .keyword-table th,
    .keyword-table td {
        padding: 1px 4px;
    }
    .info-text code,
    .keyword-table code {
        font-size: 10px;
    }
}
