/* =========================================================
   VIKING RISE SINGULARITY
   DIVINE JEWEL BUILDER
   ========================================================= */

/* =========================================================
   TOOL ROOT
   ========================================================= */

:root {
    --dj-bg: var(--background, #0d0d0f);
    --dj-surface: var(--surface, #151518);
    --dj-surface-light: var(--surface-light, #1c1c20);
    --dj-border: var(--border, #2a2a2f);
    --dj-border-red: var(--border-red, rgba(197, 31, 50, 0.45));
    --dj-red: var(--red, #c51f32);
    --dj-red-light: var(--red-light, #e34a5b);
    --dj-text: var(--text, #f1f1f1);
    --dj-muted: var(--text-muted, #96969d);

    --dj-radius: 8px;
    --dj-radius-small: 6px;
}


/* =========================================================
   PAGE
   ========================================================= */

body {
    background: var(--black);
    color: var(--text);
    font-family: Inter, Arial, Helvetica, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}


/* =========================================================
   MAIN CONTAINER
   ========================================================= */

.wrap {
    width: min(1180px, calc(100% - 48px));

    margin: 0 auto;
}


/* =========================================================
   TOOL HEADER
   ========================================================= */

.wrap > header {
    display: flex;

    align-items: flex-end;
    justify-content: space-between;

    gap: 20px;

    margin: 45px 0 25px;

    padding-bottom: 25px;

    border-bottom: 1px solid var(--dj-border);
}


#appTitle {
    margin: 0;

    color: var(--dj-text);

    font-size: 2rem;
    font-weight: 900;

    letter-spacing: 0.04em;

    text-transform: uppercase;
}


#appTitle::after {
    content: "";

    display: block;

    width: 42px;
    height: 3px;

    margin-top: 12px;

    background: var(--dj-red);
}


/* =========================================================
   LANGUAGE BUTTON
   ========================================================= */

#langToggle {
    min-width: 58px;

    padding: 9px 14px;

    border: 1px solid var(--dj-border);

    border-radius: var(--dj-radius-small);

    background: var(--dj-surface);

    color: var(--dj-muted);

    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 800;

    letter-spacing: 0.07em;

    cursor: pointer;

    transition:
        border-color 0.2s ease,
        color 0.2s ease,
        background 0.2s ease;
}


#langToggle:hover {
    border-color: var(--dj-border-red);

    background: var(--dj-surface-light);

    color: var(--dj-text);
}


/* =========================================================
   TABS
   ========================================================= */

.tabs {
    display: flex;

    gap: 8px;

    margin-bottom: 25px;

    padding-bottom: 1px;

    border-bottom: 1px solid var(--dj-border);
}


.tabbtn {
    min-height: auto;

    padding: 11px 16px;

    border: 1px solid transparent;
    border-bottom: 2px solid transparent;

    border-radius: 0;

    background: transparent;

    color: var(--dj-muted);

    font-family: inherit;

    font-size: 0.68rem;
    font-weight: 800;

    letter-spacing: 0.07em;

    text-transform: uppercase;

    cursor: pointer;

    transition:
        color 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease;
}


.tabbtn:hover {
    color: var(--dj-text);

    background: var(--dj-surface);
}


.tabbtn.active {
    border-color: transparent;
    border-bottom-color: var(--dj-red);

    background: transparent;

    color: var(--dj-red-light);
}


/* =========================================================
   MAIN GRID
   ========================================================= */

.grid {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        minmax(340px, 0.82fr);

    gap: 22px;

    align-items: start;
}


/* =========================================================
   PANELS
   ========================================================= */

.panel {
    overflow: hidden;

    border: 1px solid var(--dj-border);

    border-radius: var(--dj-radius);

    background: var(--dj-surface);

    box-shadow: none;
}


.body {
    padding: 25px;
}


/* =========================================================
   LABELS
   ========================================================= */

label {
    display: block;

    margin: 0 0 8px;

    color: var(--dj-muted);

    font-family: inherit;

    font-size: 0.68rem;
    font-weight: 800;

    letter-spacing: 0.08em;

    text-transform: uppercase;
}


/* =========================================================
   SELECTS / INPUTS
   ========================================================= */

select,
.input-text,
textarea {
    width: 100%;

    box-sizing: border-box;

    padding: 11px 12px;

    border: 1px solid var(--dj-border);

    border-radius: var(--dj-radius-small);

    outline: none;

    background: var(--dj-surface-light);

    color: var(--dj-text);

    font-family: inherit;

    font-size: 0.82rem;
}


select {
    appearance: auto;
}


select:hover,
.input-text:hover,
textarea:hover {
    border-color: #3a3a40;
}


select:focus,
.input-text:focus,
textarea:focus {
    border-color: var(--dj-red);

    box-shadow:
        0 0 0 2px rgba(197, 31, 50, 0.12);
}


textarea {
    min-height: 110px;

    resize: vertical;

    line-height: 1.55;
}


.input-text::placeholder,
textarea::placeholder {
    color: #65656b;
}


/* =========================================================
   SECTION TITLES
   ========================================================= */

.section-title {
    margin: 28px 0 12px;

    padding-bottom: 10px;

    border-bottom: 1px solid var(--dj-border);

    color: var(--dj-text);

    font-size: 0.72rem;
    font-weight: 900;

    letter-spacing: 0.09em;

    text-transform: uppercase;
}


.section-title::before {
    content: "";

    display: inline-block;

    width: 3px;
    height: 12px;

    margin-right: 8px;

    vertical-align: -1px;

    background: var(--dj-red);
}


/* =========================================================
   ROWS
   ========================================================= */

.row {
    display: grid;

    gap: 9px;

    margin-bottom: 12px;
}


.row.mode {
    grid-template-columns:
        minmax(0, 0.34fr)
        minmax(0, 1fr);
}


/* =========================================================
   VALUE PILL
   ========================================================= */

.value-pill {
    display: flex;

    align-items: center;
    justify-content: center;

    min-height: 43px;

    box-sizing: border-box;

    border: 1px solid var(--dj-border);

    border-radius: var(--dj-radius-small);

    background: var(--dj-surface-light);

    color: var(--dj-text);

    font-family: "JetBrains Mono", monospace;

    font-size: 0.75rem;
    font-weight: 800;
}


/* =========================================================
   SMALL PILLS
   ========================================================= */

.pill {
    display: inline-flex;

    align-items: center;

    gap: 6px;

    padding: 4px 8px;

    border: 1px solid var(--dj-border);

    border-radius: 4px;

    background: var(--dj-surface-light);

    color: var(--dj-muted);

    font-family: "JetBrains Mono", monospace;

    font-size: 0.62rem;
}


/* =========================================================
   BUTTONS
   ========================================================= */

button {
    min-height: auto;

    padding: 10px 14px;

    border: 1px solid var(--dj-red);

    border-radius: var(--dj-radius-small);

    background: var(--dj-red);

    color: #fff;

    font-family: inherit;

    font-size: 0.68rem;
    font-weight: 800;

    letter-spacing: 0.04em;

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}


button:hover {
    background: var(--dj-red-light);

    border-color: var(--dj-red-light);

    transform: translateY(-1px);
}


button.secondary {
    border-color: var(--dj-border);

    background: var(--dj-surface-light);

    color: var(--dj-muted);
}


button.secondary:hover {
    border-color: var(--dj-border-red);

    background: var(--dj-surface);

    color: var(--dj-text);
}


button.danger {
    border-color: rgba(197, 31, 50, 0.45);

    background: transparent;

    color: var(--dj-red-light);
}


button.danger:hover {
    background: rgba(197, 31, 50, 0.08);
}


/* =========================================================
   ACTIONS
   ========================================================= */

.actions,
.overview-actions {
    display: flex;

    flex-wrap: wrap;

    gap: 8px;

    margin-top: 24px;

    padding-top: 20px;

    border-top: 1px solid var(--dj-border);
}


/* =========================================================
   SKILL PICKER
   ========================================================= */

.skill-grid {
    display: grid;

    gap: 9px;

    max-height: 520px;

    margin-top: 12px;

    padding-right: 4px;

    overflow-y: auto;
}


.skill-card {
    width: 100%;

    box-sizing: border-box;

    padding: 13px 14px;

    border: 1px solid var(--dj-border);

    border-left: 3px solid var(--dj-border);

    border-radius: var(--dj-radius-small);

    background: var(--dj-surface-light);

    color: var(--dj-text);

    font-family: inherit;

    text-align: left;

    box-shadow: none;

    cursor: pointer;

    transition:
        border-color 0.2s ease,
        background 0.2s ease;
}


.skill-card:hover {
    border-color: var(--dj-border-red);

    background: #202024;
}


.skill-card.selected {
    border-color: var(--dj-red);

    outline: none;

    background: rgba(197, 31, 50, 0.07);
}


.skill-top {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 10px;

    margin-bottom: 6px;
}


.skill-name {
    color: var(--dj-text);

    font-weight: 800;
}


.skill-desc {
    color: var(--dj-muted);

    font-size: 0.76rem;

    line-height: 1.55;
}


.skill-picked {
    margin-top: 12px;
}


.change-skill,
.add-row-btn {
    margin-top: 9px;

    padding: 8px 10px;

    border: 1px solid var(--dj-border);

    background: transparent;

    color: var(--dj-muted);

    font-size: 0.65rem;
}


.change-skill:hover,
.add-row-btn:hover {
    border-color: var(--dj-red);

    background: rgba(197, 31, 50, 0.06);

    color: var(--dj-red-light);
}


/* =========================================================
   LIVE JEWEL SUMMARY
   ========================================================= */

.card-head {
    display: flex;

    align-items: center;

    gap: 12px;

    padding: 18px 20px;

    background:
        linear-gradient(
            90deg,
            var(--jewel-color, var(--dj-red)),
            #222226
        );

    border-bottom: 1px solid var(--dj-border);
}


.gem {
    flex: 0 0 auto;

    width: 32px;
    height: 32px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle at 30% 30%,
            rgba(255,255,255,.9),
            transparent 28%
        ),
        var(--jewel-color, var(--dj-red));

    border: 2px solid rgba(255,255,255,.55);

    box-shadow:
        0 0 0 3px rgba(0,0,0,.2);
}


.card-title {
    color: #fff;

    font-size: 1rem;
    font-weight: 900;

    line-height: 1.2;
}


.card-sub {
    margin-top: 4px;

    color: rgba(255,255,255,.72);

    font-family: "JetBrains Mono", monospace;

    font-size: 0.62rem;
}


/* =========================================================
   SUMMARY BLOCKS
   ========================================================= */

.summary-block {
    padding: 20px;

    border-bottom: 1px solid var(--dj-border);
}


.summary-block:last-child {
    border-bottom: 0;
}


.summary-block h3 {
    margin: 0 0 12px;

    color: var(--dj-text);

    font-size: 0.7rem;
    font-weight: 900;

    letter-spacing: 0.08em;

    text-transform: uppercase;
}


.lines,
.totals {
    display: grid;

    gap: 7px;
}


.line {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 12px;

    padding: 9px 11px;

    border: 1px solid var(--dj-border);

    border-left: 3px solid var(--dj-border);

    border-radius: var(--dj-radius-small);

    background: var(--dj-surface-light);

    color: var(--dj-text);

    font-size: 0.76rem;
}


.line .name {
    font-weight: 700;
}


.meta {
    color: var(--dj-muted);

    font-family: "JetBrains Mono", monospace;

    font-size: 0.62rem;

    white-space: nowrap;
}


.line.basic {
    border-left-color: var(--dj-red);
}


.line.common,
.line.grade-blue {
    border-left-color: #537f9d;
}


.line.uncommon,
.line.grade-purple {
    border-left-color: #7950a8;
}


.line.excellent,
.line.grade-orange {
    border-left-color: #b66a12;
}


.line.skill {
    display: block;

    border-left-color: var(--dj-red);
}


.total {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto;

    gap: 8px;

    align-items: center;

    padding: 9px 11px;

    border: 1px solid var(--dj-border);

    border-radius: var(--dj-radius-small);

    background: var(--dj-surface-light);
}


.total .value {
    color: #d8d8dc;

    font-family: "JetBrains Mono", monospace;

    font-weight: 800;
}


/* =========================================================
   RARITY / GRADE
   ========================================================= */

.rarity-text,
.grade-mark {
    color: var(--dj-muted);

    font-family: "JetBrains Mono", monospace;

    font-size: 0.62rem;
}


.grade-dot {
    display: inline-block;

    width: 8px;
    height: 8px;

    margin-right: 5px;

    border-radius: 50%;
}


.grade-dot.blue {
    background: #537f9d;
}


.grade-dot.purple {
    background: #7950a8;
}


.grade-dot.orange {
    background: #b66a12;
}


/* =========================================================
   SAVED JEWELS
   ========================================================= */

.overview-grid {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        minmax(340px, .72fr);

    gap: 22px;

    align-items: start;
}


.jewel-list {
    display: grid;

    gap: 10px;
}


.jewel-card {
    padding: 13px;

    border: 1px solid var(--dj-border);

    border-left: 3px solid var(--dj-red);

    border-radius: var(--dj-radius-small);

    background: var(--dj-surface-light);
}


.jewel-card:hover {
    border-color: var(--dj-border-red);
}


.jewel-card.missing {
    opacity: .55;

    border-left-color: var(--dj-border);
}


.jewel-card-head {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 10px;

    margin-bottom: 8px;
}


.jewel-name {
    color: var(--dj-text);

    font-weight: 800;
}


.mini-lines {
    display: grid;

    gap: 5px;

    margin-top: 9px;
}


.mini-line {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto;

    gap: 8px;

    color: var(--dj-muted);

    font-size: 0.7rem;
}


.mini-line .v {
    color: #d2d2d6;

    font-family: "JetBrains Mono", monospace;

    font-weight: 800;
}


.total-count {
    color: var(--dj-muted);

    font-family: "JetBrains Mono", monospace;

    font-size: 0.65rem;
}


/* =========================================================
   RECOMMENDATIONS
   ========================================================= */

.rec-grid {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        minmax(340px, .82fr);

    gap: 22px;

    align-items: start;
}


.field-row {
    display: grid;

    gap: 8px;

    margin-bottom: 14px;
}


.compact-rows {
    display: grid;

    gap: 8px;
}


.rec-skill-list {
    display: grid;

    gap: 8px;
}


.rec-skill {
    padding: 10px 11px;

    border: 1px solid var(--dj-border);

    border-left: 3px solid var(--dj-red);

    border-radius: var(--dj-radius-small);

    background: var(--dj-surface-light);
}


.rec-skill.orange {
    border-left-color: #b66a12;
}


.rec-skill.purple {
    border-left-color: #7950a8;
}


.rec-skill .name {
    color: var(--dj-text);

    font-size: 0.75rem;
    font-weight: 800;
}


.rec-skill .desc {
    margin-top: 5px;

    color: var(--dj-muted);

    font-size: 0.7rem;

    line-height: 1.5;
}


.rec-note {
    color: var(--dj-muted);

    font-size: 0.76rem;

    line-height: 1.55;

    white-space: pre-wrap;
}


/* =========================================================
   STICKY SUMMARY
   ========================================================= */

.sticky {
    position: sticky;

    top: 20px;
}


/* =========================================================
   EMPTY STATE
   ========================================================= */

.empty {
    color: var(--dj-muted);

    font-size: 0.75rem;

    font-style: italic;
}


/* =========================================================
   TOAST
   ========================================================= */

.toast {
    position: fixed;

    bottom: 24px;
    left: 50%;

    transform:
        translateX(-50%)
        translateY(10px);

    padding: 9px 14px;

    border: 1px solid var(--dj-border);

    border-radius: 6px;

    background: #18181c;

    color: var(--dj-text);

    font-size: 0.72rem;

    opacity: 0;

    pointer-events: none;

    transition:
        opacity .2s ease,
        transform .2s ease;

    z-index: 999;
}


.toast.show {
    opacity: 1;

    transform:
        translateX(-50%)
        translateY(0);
}


/* =========================================================
   SCROLLBARS
   ========================================================= */

.skill-grid::-webkit-scrollbar {
    width: 6px;
}


.skill-grid::-webkit-scrollbar-track {
    background: transparent;
}


.skill-grid::-webkit-scrollbar-thumb {
    border-radius: 3px;

    background: #34343a;
}


.skill-grid::-webkit-scrollbar-thumb:hover {
    background: #45454d;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 860px) {

    .wrap {
        width: min(100% - 28px, 700px);
    }


    .wrap > header {
        align-items: flex-start;

        margin-top: 30px;

        flex-direction: column;
    }


    #appTitle {
        font-size: 1.55rem;
    }


    #langToggle {
        align-self: flex-end;
    }


    .grid,
    .overview-grid,
    .rec-grid {
        grid-template-columns: 1fr;
    }


    .sticky {
        position: static;
    }


    .body {
        padding: 20px;
    }


    .row,
    .row.mode {
        grid-template-columns: 1fr;
    }


    .skill-grid {
        max-height: none;
    }

}


@media (max-width: 600px) {

    body {
        padding-bottom: 50px;
    }


    .wrap {
        width: calc(100% - 20px);
    }


    .tabs {
        gap: 2px;

        overflow-x: auto;
    }


    .tabbtn {
        flex: 0 0 auto;

        padding: 10px 12px;

        font-size: 0.62rem;
    }


    .body {
        padding: 16px;
    }


    .summary-block {
        padding: 16px;
    }


    .actions,
    .overview-actions {
        flex-direction: column;
    }


    .actions button,
    .overview-actions button {
        width: 100%;
    }

}

.builder-internal-controls {
    display: none;
}
/* =========================================================
   VIEW VISIBILITY
   ========================================================= */

.view.hidden {
    display: none !important;
}