:root {
    --lib-bg: #0e141d;
    --lib-card: #141d29;
    --lib-line: #273649;
    --lib-text: #e7eef9;
    --lib-muted: #9ab0c8;
    --lib-accent: #3aa9f0;
    --lib-accent-dark: #1187d4;
}

* { box-sizing: border-box; }

html,
body {
    min-height: 100%;
}

html {
    background-color: #0d121a;
    background-image:
        radial-gradient(1100px 620px at 12% 8%, rgba(24, 58, 96, 0.14), transparent 66%),
        radial-gradient(980px 640px at 88% 86%, rgba(24, 58, 96, 0.14), transparent 72%),
        linear-gradient(180deg, #101723 0%, #0d121a 100%);
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: transparent;
    color: var(--lib-text);
}

.library-wrap {
    max-width: 860px;
    margin: 34px auto;
    padding: 0 16px;
}

.library-card {
    border: 1px solid var(--lib-line);
    border-radius: 18px;
    padding: 22px;
    background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01)), var(--lib-card);
}

.library-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

h1 {
    margin: 0;
    font-size: 34px;
    font-weight: 700;
}

.muted {
    margin: 6px 0 0;
    color: var(--lib-muted);
}

.back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #3c4d64;
    color: #dce6f4;
    text-decoration: none;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 700;
}

.calc-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    max-width: 460px;
    margin: 0 auto;
}

.field {
    display: grid;
    gap: 6px;
}

.field span {
    color: #c9d8eb;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.field input {
    width: 100%;
    border: 1px solid #33465d;
    background: #0f1722;
    color: #ecf2fc;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 16px;
    outline: none;
    text-align: center;
}

.field input:focus {
    border-color: var(--lib-accent);
    box-shadow: 0 0 0 2px rgba(58, 169, 240, 0.28);
}

/* remove number +/- controls */
.field input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Basic stars like VUEXY: clean row, gray default, yellow selected/hover */
.star-picker {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
}

.star-btn {
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    color: #9aa9bb;
    font-size: 34px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.star-btn.is-active,
.star-btn.is-hover,
.star-btn:hover {
    color: #ffbf00;
}

.actions {
    margin: 14px auto 0;
    max-width: 460px;
    display: flex;
    justify-content: center;
}

.btn-primary {
    border: 0;
    border-radius: 10px;
    background: linear-gradient(180deg, var(--lib-accent), var(--lib-accent-dark));
    color: #062844;
    font-weight: 800;
    font-size: 15px;
    padding: 10px 16px;
    cursor: pointer;
}

.result {
    margin: 16px auto 0;
    max-width: 460px;
    border: 1px solid #355175;
    border-radius: 12px;
    background: #0f1e31;
    padding: 14px;
    text-align: center;
}

.result-main {
    font-size: 20px;
    font-weight: 800;
}

.hidden {
    display: none;
}

@media (max-width: 700px) {
    h1 {
        font-size: 28px;
    }

    .calc-grid,
    .actions,
    .result {
        max-width: 100%;
    }
}


.lead-magnet {
    margin: 50px auto 10px;
    max-width: 920px;
    padding: 26px 28px 28px;
    text-align: center;
}

.lead-line {
    margin: 0;
    color: #f2f7ff;
    font-size: clamp(1.35rem, 2.85vw, 2.1rem);
    font-weight: 800;
    line-height: 1.28;
    letter-spacing: 0.01em;
}

.lead-static {
    margin-right: 6px;
}

.lead-dynamic-wrap {
    position: relative;
    display: inline-flex;
    align-items: baseline;
    min-width: 18ch;
    justify-content: flex-start;
    text-align: left;
    color: #8ed7ff;
}

.lead-dynamic {
    white-space: nowrap;
}

.lead-caret {
    width: 1px;
    height: 1.02em;
    margin-left: 3px;
    background: #8ed7ff;
    box-shadow: 0 0 10px rgba(95, 187, 238, 0.55);
    animation: lead-blink 0.95s steps(1) infinite;
}

.lead-more-btn {
    margin-top: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 12px 20px;
    text-decoration: none;
    font-family: "Manrope", sans-serif;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #032341;
    background: linear-gradient(180deg, #8ad8ff 0%, #3aa9f0 100%);
    box-shadow: 0 8px 20px rgba(39, 154, 228, 0.34);
}

@keyframes lead-blink {
    0% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 1; }
}

@media (max-width: 700px) {
    .lead-magnet {
        margin-top: 5px;
        padding: 20px 16px 22px;
    }

    .lead-line {
        font-size: 1.14rem;
        line-height: 1.36;
    }

    .lead-dynamic-wrap {
        min-width: 0;
    }

    .lead-dynamic {
        white-space: normal;
    }
}


/* smooth rounded SVG stars */
.star-btn {
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    color: #9aa9bb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.star-btn svg {
    width: 24px;
    height: 24px;
    display: block;
}

.star-btn svg path {
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 0.75;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.star-btn.is-active,
.star-btn.is-hover,
.star-btn:hover {
    color: #ffbf00;
}

/* character type cards + stars row */
.selector-row {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.character-picker {
    display: flex;
    gap: 10px;
}

.character-card {
    width: 94px;
    border: 1px solid #3e4f64;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(22, 34, 51, 0.92), rgba(15, 24, 38, 0.92));
    padding: 8px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    color: #c9d8eb;
    transition: border-color .15s ease, box-shadow .15s ease, filter .15s ease, transform .15s ease;
    filter: brightness(0.82);
}

.character-card:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
}

.character-card.is-active {
    filter: brightness(1);
    border-color: #6ec3ff;
    box-shadow: 0 0 0 2px rgba(90, 185, 245, 0.2), 0 6px 18px rgba(14, 42, 66, 0.45);
}

.character-thumb {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-size: cover;
    background-position: center;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: hidden;
}

.character-thumb.legendary {
    background-image:
        radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.5), transparent 40%),
        linear-gradient(160deg, #ff6c2f, #ff00b8);
}

.character-thumb.purple {
    background-image:
        radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.5), transparent 40%),
        linear-gradient(160deg, #f7a400, #4959ff);
}

.character-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: brightness(0.72) saturate(1.05);
    transition: filter .15s ease;
}

.character-card.is-active .character-thumb img,
.character-card:hover .character-thumb img {
    filter: brightness(0.92) saturate(1.1);
}

.character-name {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.star-picker {
    min-height: 94px;
    align-content: center;
    padding: 8px 6px;
    border: 1px solid #33465d;
    border-radius: 14px;
    background: #0f1722;
}

.star-btn.is-disabled {
    opacity: 0.35;
    pointer-events: none;
}

@media (max-width: 700px) {
    .selector-row {
        align-items: stretch;
    }

    .character-picker {
        width: 100%;
        justify-content: center;
    }

    .star-picker {
        width: 100%;
        justify-content: center;
    }
}

/* clean star look: no frames at all */
.star-picker {
    border: 0 !important;
    background: transparent !important;
    padding: 0 !important;
    min-height: auto !important;
}

.star-btn {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    width: 30px !important;
    height: 30px !important;
    padding: 0 !important;
}

.star-btn svg {
    width: 22px !important;
    height: 22px !important;
}

/* image-only cards, border by image color */
.character-card {
    width: auto !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    filter: brightness(0.78) !important;
    transform: none !important;
}

.character-card:hover {
    filter: brightness(0.9) !important;
}

.character-thumb {
    width: 72px !important;
    height: 72px !important;
    border: 2px solid !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 2px #00000080 !important;
    background: none !important;
}

.character-thumb.legendary {
    border-color: #f3c209 !important;
    box-shadow: 0 2px 2px #00000080, 0 0 15px #f3c209 !important;
}

.character-thumb.purple {
    border-color: #c83fff !important;
    box-shadow: 0 2px 2px #00000080, 0 0 15px #c83fff !important;
}

.character-thumb img {
    filter: brightness(0.78) saturate(1.02) !important;
}

.character-card.is-active {
    filter: brightness(1) !important;
}

.character-card.is-active .character-thumb img,
.character-card:hover .character-thumb img {
    filter: brightness(0.95) saturate(1.06) !important;
}

/* no text labels in cards */
.character-name {
    display: none !important;
}

/* compact cards + centered stars */
.selector-row {
    align-items: center !important;
    gap: 10px !important;
}

.character-picker {
    align-items: center !important;
}

.character-thumb {
    width: 44px !important;
    height: 44px !important;
}

.star-picker {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 44px !important;
    height: 44px !important;
    gap: 6px !important;
}

.star-btn {
    width: 24px !important;
    height: 24px !important;
}

.star-btn svg {
    width: 18px !important;
    height: 18px !important;
}

/* tune: restore star size + softer card glow */
.star-btn {
    width: 30px !important;
    height: 30px !important;
}

.star-btn svg {
    width: 22px !important;
    height: 22px !important;
}

.character-thumb.legendary {
    box-shadow: 0 2px 2px #00000080, 0 0 8px #f3c209 !important;
}

.character-thumb.purple {
    box-shadow: 0 2px 2px #00000080, 0 0 8px #c83fff !important;
}


/* spacing and star size tune */
.selector-row {
    gap: 50px !important;
}

.character-picker {
    gap: 25px !important;
}

.star-picker {
    gap: 6px !important;
}

.star-btn {
    width: 48px !important;
    height: 48px !important;
}

.star-btn svg {
    width: 36px !important;
    height: 36px !important;
}

/* final star sizing/spacing */
.star-btn {
    width: 36px !important;
    height: 36px !important;
}

.star-btn svg {
    width: 28px !important;
    height: 28px !important;
}

.star-picker {
    gap: 4px !important;
}

/* mobile: reduce gap between cards and stars */
@media (max-width: 700px) {
    .selector-row {
        gap: 10px !important;
    }
}

/* ultra-tight stars */
.star-picker {
    gap: 0 !important;
}

.star-btn {
    margin: 0 !important;
    padding: 0 !important;
}

/* tiny extra tighten */
.star-btn {
    width: 34px !important;
    height: 34px !important;
}

.star-btn svg {
    width: 28px !important;
    height: 28px !important;
}

/* result typography */
.result-value {
    font-size: 20px;
    line-height: 1.15;
    font-weight: 800;
}

.result-tier {
    margin-top: 4px;
    font-size: 16px;
    line-height: 1.2;
    font-weight: 700;
}
