@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

@font-face {
    font-family: 'Mojangles';
    src: url('../fonts/mojangles/mojangles.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: hsl(228, 32%, 7%);
    --surface: hsl(228, 32%, 6%);
    --surface2: hsl(228, 32%, 5%);
    --surface3: hsl(228, 32%, 3%);
    --border: hsl(228, 32%, 15%);
    --border2: #353860;
    --text: #d0d8f0;
    --text-dim: #d3d8ec;
    --text-faint: #383d58;
    --hotpink: hotpink;
    --hotpink-glow: rgba(255, 255, 255, 0.055);
    --cyan: rgb(0, 168, 168);
    --green: #55ff55;
    --focus: #ff2d78;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 120%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Mojangles', system-ui, sans-serif;
    font-size: 1rem;
    min-height: 100vh;
    padding: 2rem 1.25rem 6rem;
    image-rendering: pixelated;
    line-height: 1.4;
}

/* ── Layout ── */
.app {
    max-width: 1230px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 780px) {
    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        order: -1;
    }
}

a {
    color: #aaaaaa;
    text-decoration-inset: -2px;
    text-underline-offset: 0.25rem;
    transition: all 0.15s;
    text-decoration-color: hotpink;
}

a:hover,
a:focus-visible,
a:active {
    color: white;
    text-decoration-style: wavy;
    text-decoration-thickness: 2px;
    text-decoration-color: cyan;
}

img {
    pointer-events: none;
}

*::selection {
    background: gold;
    color: black;
}

img::selection {
    background: none;
}


/* ── Header ── */
header {
    grid-column: 1 / -1;
    padding: 2rem 0;
}

header::before {
    content: "";
    height: .25rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-image: linear-gradient(to right, violet, #ff1493, #ff4500, gold, #00ff7f, #00bfff);
    z-index: 99999999;
}

header h1 {
    font-size: 2rem;
    color: #ffffff;
    line-height: 1.1;
}

header p {
    color: var(--text-dim);
    font-size: 0.8rem;
    margin-top: 0.3rem;
}

/* ── Main panel ── */
.panel {
    background: var(--surface);
    border-radius: 10px;
    padding: 1.25rem;
}

/* ── Stars list ── */
.stars-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── Star card ── */
.star-card {
    background: var(--surface2);
    border: 3px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
}

.star-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}

.star-label {
    font-family: 'Mojangles', monospace;
    font-size: 1.2rem;
    color: #cabc26;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.star-icon {
    width: 3rem;
    aspect-ratio: 1 / 1;
    display: block;
    border-radius: 2px;
}

.star-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

button {
    font-family: 'Mojangles',
        monospace;
}

.btn-preset {
    font-weight: 400;
    line-height: 1;
    background: transparent;
    border: 1px solid #474c5f;
    color: #d3d8ec;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.65rem;
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: background 0.15s, border-color 0.15s;
}

.btn-preset:hover {
    border-color: var(--hotpink);
    color: var(--hotpink);
}

.btn-preset:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.remove-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    border-radius: 4px;
    width: 26px;
    height: 26px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    transition: color 0.15s;
    flex-shrink: 0;
}

.remove-btn:hover {
    color: #ff6b6b;
}

.remove-btn:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

/* ── Fieldsets ── */
.star-card fieldset {
    border: none;
    margin-bottom: 0.75rem;
}

.star-card fieldset:last-child {
    margin-bottom: 0;
}

.star-card legend {
    font-size: 1rem;
    color: var(--text-dim);
    margin-bottom: 0.35rem;
    padding-top: 0.5rem;
}

/* ── Colour grid ── */
.color-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.35rem;
}

@media (max-width: 500px) {
    .color-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

.color-grid label {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    border: 2px solid transparent;
    padding: 2px;
    transition: border-color 0.15s;
    position: relative;
}

.color-grid label:hover {
    border-color: rgba(255, 255, 255, 0.4);
}

.color-grid label:has(input:checked) {
    border-color: white;
    box-shadow: 0 0 0 1px white;
}

.color-grid input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.color-grid input:focus-visible+.dye-img {
    outline: 2px solid var(--focus);
    outline-offset: 3px;
}

/* the dye sprite */
.dye-img {
    width: 100%;
    aspect-ratio: 1;
    display: block;
    border-radius: 2px;
}

/* ── Shape / Effects grids ── */
.check-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.check-grid label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface3);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0.25rem 1rem 0.25rem 0.25rem;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text);
    transition: border-color 0.12s, background 0.12s;
    user-select: none;
}

.check-grid label.no-img {
    padding: 0.25rem 1rem;
}

.check-grid label:hover {
    border-color: #474c5f;
}

.check-grid input[type="checkbox"],
.check-grid input[type="radio"] {
    accent-color: var(--hotpink);
    flex-shrink: 0;
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.check-grid label:has(input:checked) {
    background: var(--hotpink-glow);
    border-color: var(--hotpink);
    color: #fff;
}

.check-grid input:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

/* inline ingredient image in check-grid labels */
.ing-img {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

/* ── Flight duration row ── */
.duration-row {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    padding: 2rem 0 0 0;
}

.duration-row label {
    padding: 0.25rem 0.5rem;
}

.duration-row .fd-value {
    padding: 3px 0 0 0;
}

.dur-label {
    font-size: 1rem;
    color: var(--text-dim);
    margin-bottom: 0.35rem;
}

@keyframes rotate {
    from {
        --angle: 0deg;
    }

    to {
        --angle: 360deg;
    }
}

@property --angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

.btn-add {
    background: none;
    color: #aaaaaa;
    border-radius: 6px;
    padding: 0.75rem;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.15s, border-color 0.15s;
    width: 100%;
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
    z-index: 1;
    border: 3px dotted var(--border);
}

.btn-add::before {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 3px solid #0000;
    background: linear-gradient(var(--angle),
            /* violet, #ff1493, #ff4500, gold, #00ff7f, #00bfff*/
            #ff1493, #00bfff
            ) border-box;
    animation: 2s rotate linear infinite;
    z-index: -2;
}

.btn-add::after {
    top: 3px;
    left: 3px;
    right: 3px;
    bottom: 3px;
    background: var(--surface2);
    border-radius: 4px;
    z-index: -1;
}

.btn-add:before,
.btn-add:after {
    content: '';
    display: block;
    position: absolute;
    pointer-events: none;
    opacity: 0;
}

.btn-add:hover {
    color: white;
    border-color: cyan;
    border-color: transparent;
}

.btn-add:hover::before,
.btn-add:hover::after {
    opacity: 1;
}

.btn-add:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

/* ── Validation ── */

.validation-msg {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    border-radius: 8px;
    background: #f32d63;
    color: var(--bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0.85rem 1.5rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    z-index: 100;
    width: 400px;
    max-width: 100%;
    overflow: hidden;
    font-size: 1rem;
    display: none;
    margin-left: 0.5rem;
    padding-left: 3.5rem;
    transform: translateX(0.000000001px);
}

.validation-msg.visible {
    display: flex;
}

.validation-msg-icon {
    background-color: var(--surface2);
    padding: 1rem 0.5rem;
    position: absolute;
    left: 3px;
    top: 3px;
    bottom: 3px;
    border-radius: 6px 0 0 6px;
    display: flex;
    align-items: center;
}

@keyframes wiggle {
    0% {
        transform: translateX(0);
    }

    15% {
        transform: translateX(-6px);
    }

    30% {
        transform: translateX(6px);
    }

    45% {
        transform: translateX(-5px);
    }

    60% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-3px);
    }

    90% {
        transform: translateX(3px);
    }

    100% {
        transform: translateX(0);
    }
}

.validation-msg.wiggle {
    animation: wiggle 0.5s ease-in-out;
}

/* ── Sidebar ── */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 1.25rem;
    margin-top: 1.25rem;
}

.sidebar-links-label {
    font-size: 1.2rem;
    color: white;
    margin-bottom: 1rem;
    font-weight: 400;
}

.sidebar-links ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-links ul a {
    font-size: 1rem;
}

/* ── MC Tooltip ── */
.mc-tooltip {
    position: relative;
}

.mc-tooltip::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 3px solid white;
    border-radius: 4px;
    pointer-events: none;
    z-index: 1;
}

.mc-tooltip-inner {
    position: relative;
    z-index: 2;
    padding: 0.75rem 1rem;
}

.mc-title {
    font-size: 1.2rem;
    color: white;
    margin-bottom: 0.25rem;
    display: block;
    /* background: -webkit-linear-gradient(right, #ff1493, #00bfff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent; */
}

.mc-divider {
    width: 100%;
    height: 3px;
    background: var(--border);
    margin: 1rem 0;
}

.mc-flight {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.mc-line {
    font-size: 1rem;
    display: grid;
    grid-template-columns: auto auto;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 1rem;
}

.mc-label,
.mc-val {
    color: #aaaaaa;
}

.mc-cost {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.mc-diamond {
    color: var(--cyan);
}

.mc-diamond-blocks {
    color: cyan;
    font-size: 0.75rem;
    margin-left: 2px;
}

.mc-plus {
    font-size: 1.2rem;
    line-height: 0;
}

.mc-star-name {
    font-size: 1rem;
    color: white;
    padding-left: 8px;
    display: flex;
    align-items: baseline;
    margin-bottom: 0.15rem;
}

.mc-attr {
    line-height: 1.2;
    font-size: 0.75rem;
    color: white;
    padding-left: 14px;
    display: block;
    margin-bottom: 0.25rem;
}

.mc-attr-color {
    margin-left: 4px
}

.mc-attr-color-dark {
    text-shadow: 1px 1px 0 #b8b8b8;
}

/* colour dots inside mc-attr */
.mc-color-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 1px;
    margin-right: 2px;
    vertical-align: middle;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* .mc-tooltip:has(.mc-no-result) {
    display: none;
} */