:root {
    --bg: #0c1118;
    --bg-soft: #111926;
    --panel: #171f2e;
    --panel-hi: #212b3f;
    --text: #e6edf8;
    --text-dim: #9ea9bf;
    --line: #2d3b55;
    --accent: #3ec6a8;
    --accent-2: #5aa6ff;
    --warn: #cf7e20;
    --error: #e46c6c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Sora", "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
    color: var(--text);
    background: #fff;
    overflow-x: hidden;
}

.shell {
    width: min(1200px, 94vw);
    margin: 2rem auto 4rem;
    padding: 1rem;
    border-radius: 18px;
    background:
        radial-gradient(circle at 10% 20%, rgba(62, 198, 168, 0.14), transparent 30%),
        radial-gradient(circle at 90% 10%, rgba(90, 166, 255, 0.14), transparent 33%),
        linear-gradient(160deg, #0a0f16 0%, #0f1724 45%, #0c1118 100%);
}

.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: linear-gradient(135deg, rgba(23, 31, 46, 0.95), rgba(33, 43, 63, 0.7));
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.eyebrow {
    margin: 0;
    color: var(--accent);
    letter-spacing: .12em;
    text-transform: uppercase;
    font-size: .72rem;
}

.hero h1 { margin: .3rem 0; font-size: clamp(1.5rem, 3vw, 2rem); }
.hero p { margin: 0; color: var(--text-dim); }
.hero-art { width: 120px; max-width: 30vw; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .4)); }

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin-bottom: .9rem;
    align-items: flex-start;
}

.tab {
    appearance: none;
    border: 1px solid var(--line);
    background: var(--bg-soft);
    color: var(--text-dim);
    border-radius: 999px;
    padding: .55rem .9rem;
    cursor: pointer;
    transition: all .2s ease;
}

.tab:hover { color: var(--text); border-color: var(--accent-2); }
.tab.is-active {
    color: #071019;
    background: linear-gradient(135deg, var(--accent), #77dac4);
    border-color: transparent;
    font-weight: 700;
}

.tab-panel {
    background: linear-gradient(150deg, rgba(23, 31, 46, .96), rgba(18, 26, 39, .96));
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1rem;
    animation: panelIn .28s ease;
    min-width: 0;
}

@keyframes panelIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: .8rem;
}

.card {
    background: rgba(255, 255, 255, .02);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1rem;
}

.card h2 { margin: 0 0 .5rem; font-size: 1.05rem; }
.card p, .card li { color: var(--text-dim); }
.art-card { display: flex; align-items: center; justify-content: center; }
.art-card img { max-width: 100%; height: auto; }

fieldset {
    border: 1px solid var(--line);
    border-radius: 10px;
    margin: 1rem 0;
    padding: .9rem;
    background: rgba(255, 255, 255, .015);
    min-width: 0;
}

legend { color: var(--text); }

label {
    display: block;
    margin: .5rem 0;
    color: var(--text-dim);
}

input, select, button {
    font: inherit;
}

input[type="number"],
select {
    width: 100%;
    margin-top: .3rem;
    background: #0e1522;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .55rem .6rem;
}

input:focus-visible,
select:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent-2);
    outline-offset: 1px;
}

.tool_button-inline {
    font-size: 12px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #061118;
    background: linear-gradient(135deg, var(--accent), #7cdcc8);
    border: 1px solid transparent;
    cursor: pointer;
    transition: filter .2s ease, transform .2s ease;
    border-radius: 999px;
    padding: .72rem 1.2rem;
}

.tool_button-inline:hover { filter: brightness(1.08); transform: translateY(-1px); }
.button-row { display: flex; gap: .5rem; flex-wrap: wrap; }

#wood-info { color: var(--text-dim) !important; }

#result { margin-top: 1rem; }
.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.arrow-table, table {
    width: 100%;
    border-collapse: collapse;
    margin-top: .5rem;
    min-width: 760px;
    background: rgba(8, 12, 19, .5);
}

th, td {
    border: 1px solid var(--line);
    padding: .5rem .6rem;
    text-align: left;
    vertical-align: top;
    color: var(--text);
}

th { background: rgba(90, 166, 255, .12); }

.arrow-card {
    border: 1px solid var(--line);
    border-radius: .5rem;
    padding: .65rem .75rem;
    margin: .6rem 0;
    background: rgba(10, 15, 24, .8);
}

.meta .label { color: var(--text-dim); display: block; font-size: .85rem; }

.arrow-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: .6rem;
    margin: .2rem 0 .7rem;
}

.arrow-summary-card {
    background: linear-gradient(140deg, rgba(90, 166, 255, .15), rgba(62, 198, 168, .12));
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: .55rem .7rem;
}

.arrow-summary-card .label {
    display: block;
    color: var(--text-dim);
    font-size: .8rem;
}

.arrow-summary-card strong {
    display: block;
    font-size: 1.05rem;
    margin-top: .15rem;
}

.arrow-summary-card small {
    color: var(--text-dim);
}

.arrow-suggestion-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(8, 14, 22, .65);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    min-width: 660px;
}

.arrow-suggestion-table th {
    background: rgba(90, 166, 255, .18);
    color: var(--text);
    font-size: .85rem;
    letter-spacing: .02em;
}

.arrow-suggestion-table td,
.arrow-suggestion-table th {
    border: 1px solid var(--line);
    padding: .48rem .55rem;
    vertical-align: middle;
}

.table-wrap > .arrow-table,
.table-wrap > .arrow-suggestion-table,
.table-wrap > table {
    display: table;
    width: max-content;
    min-width: 100%;
    max-width: none;
}

.arrow-table th,
.arrow-table td,
.arrow-suggestion-table th,
.arrow-suggestion-table td {
    white-space: nowrap;
}

.arrow-suggestion-table tbody tr:nth-child(odd) {
    background: rgba(90, 166, 255, .04);
}

.arrow-suggestion-table tbody tr:nth-child(even) {
    background: rgba(62, 198, 168, .04);
}

.arrow-suggestion-table tbody tr:hover {
    background: rgba(255, 255, 255, .06);
}

.result-ok {
    color: #69d39a;
    font-weight: 700;
}

.result-warn {
    color: #ff9b8c;
    font-weight: 700;
}

.qsf-output-flash {
    animation: qsfOutputFlash 420ms ease;
}

@keyframes qsfOutputFlash {
    0% {
        background: rgba(255, 235, 140, 0.26);
        border-radius: 10px;
    }
    100% {
        background: transparent;
    }
}

p[style*="background:#fee"],
p[style*="background:#fff3cd"] {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(228, 108, 108, 0.15) !important;
    color: var(--text) !important;
}

@media (max-width: 720px) {
    .hero { flex-direction: column; align-items: flex-start; }
    .shell { width: min(1200px, 96vw); margin-top: 1rem; padding: .75rem; }
    .hero { padding: 1rem; }
    .hero-art { width: 96px; max-width: 34vw; }
    .tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .45rem;
    }
    .tab {
        min-width: 0;
        white-space: normal;
        text-align: center;
        padding: .7rem .75rem;
        font-size: .92rem;
        line-height: 1.2;
    }
    .tab-panel {
        padding: .8rem;
    }
    fieldset {
        padding: .75rem;
    }
    .tool_button-inline {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
    .button-row {
        flex-direction: column;
    }
    .arrow-summary-grid {
        grid-template-columns: 1fr;
    }
    .arrow-table,
    table,
    .arrow-suggestion-table {
        min-width: 620px;
    }
}
