.back-link {
    color: #2a9d8f;
    text-decoration: none;
}
.back-link:hover { text-decoration: underline; }

.mc-main {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 2fr;
    gap: 1.5em;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 1em 1.5em 3em;
    box-sizing: border-box;
}

@media (max-width: 800px) {
    .mc-main { grid-template-columns: 1fr; padding: 1em; gap: 1em; }
    .mc-controls, .mc-preview { padding: 1em; }
}

@media (max-width: 600px) {
    .block-row { gap: 0.4em; }
    .block-row button, #downloadBtn { padding: 0.6em 0.9em; font-size: 0.9em; }
    .selector-search { flex-direction: column; align-items: stretch; gap: 0.4em; }
    #filterCount { text-align: right; }
    .filter-row { gap: 0.4em; }
    .filter-row select, #filterInput { width: 100%; }
    .block-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); max-height: 360px; gap: 0.3em; padding: 0.3em; }
    .block-item { padding: 0.3em; }
    .block-item img { width: 44px; height: 44px; }
    .block-item span { font-size: 0.6em; }
    .rotate-row { gap: 0.3em; }
    .rotate-row button { padding: 0.4em 0.6em; font-size: 0.9em; }
}

.mc-selector {
    grid-column: 1 / -1;
    background: #fff;
    border-radius: 1em;
    padding: 1.5em;
    box-shadow: 0 10px 20px #dbdbdb;
}

.mc-selector h2 {
    margin: 0 0 0.8em;
    font-size: 1.1em;
    color: #264653;
    border-bottom: 2px solid #e9c46a;
    padding-bottom: 0.2em;
}

.selector-search {
    display: flex;
    align-items: center;
    gap: 0.8em;
    margin-bottom: 0.6em;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6em;
    align-items: center;
    margin-bottom: 0.8em;
}

.filter-row select {
    padding: 0.5em 0.7em;
    border: 1px solid #ccc;
    border-radius: 0.5em;
    background: #fff;
    font-size: 0.9em;
    cursor: pointer;
}

.filter-row select:focus {
    outline: none;
    border-color: #2a9d8f;
}

#clearFiltersBtn {
    background: #f4a261;
    color: #fff;
    border: none;
    padding: 0.5em 0.9em;
    border-radius: 0.5em;
    font-size: 0.85em;
    cursor: pointer;
    font-weight: 600;
}

#clearFiltersBtn:hover {
    background: #e76f51;
}

#filterInput {
    flex: 1;
    padding: 0.7em 0.9em;
    border: 1px solid #ccc;
    border-radius: 0.5em;
    font-size: 0.95em;
}

#filterCount {
    color: #888;
    font-size: 0.85em;
    white-space: nowrap;
}

.block-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
    gap: 0.5em;
    max-height: 480px;
    overflow-y: auto;
    padding: 0.4em;
    background: #fafafa;
    border-radius: 0.5em;
}

.block-item {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.4em;
    border-radius: 0.4em;
    transition: background 0.1s, transform 0.1s;
    background: #fff;
    border: 1px solid #eee;
}

.block-item:hover {
    background: #fff5d6;
    border-color: #e9c46a;
    transform: translateY(-1px);
}

.block-item.active {
    background: #2a9d8f;
    border-color: #264653;
    color: #fff;
}

.block-item.active span { color: #fff; }

.block-item img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    image-rendering: pixelated;
}

.block-item span {
    font-size: 0.65em;
    text-align: center;
    margin-top: 0.3em;
    color: #555;
    line-height: 1.1;
    word-break: break-all;
}

.block-item {
    position: relative;
}

.anim-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #e76f51;
    color: #fff;
    font-size: 0.55em;
    font-style: normal;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 0.3em;
    letter-spacing: 0.5px;
}

.mc-controls, .mc-preview {
    background: #fff;
    border-radius: 1em;
    padding: 1.5em;
    box-shadow: 0 10px 20px #dbdbdb;
}

.mc-controls h2 {
    margin: 1em 0 0.5em;
    font-size: 1.05em;
    color: #264653;
    border-bottom: 2px solid #e9c46a;
    padding-bottom: 0.2em;
}
.mc-controls h2:first-of-type { margin-top: 0; }

.block-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6em;
    align-items: center;
}

.block-row button, #downloadBtn {
    background: #264653;
    color: #fff;
    border: none;
    padding: 0.6em 1.1em;
    border-radius: 0.5em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.block-row button:hover, #downloadBtn:hover { background: #2a9d8f; }
#downloadBtn:disabled { background: #aaa; cursor: not-allowed; }

#searchInput {
    flex: 1;
    min-width: 0;
    padding: 0.55em 0.7em;
    border: 1px solid #ccc;
    border-radius: 0.5em;
    font-size: 0.95em;
}

.block-name {
    margin: 0.6em 0 0;
    color: #555;
    font-size: 0.9em;
}
.block-name strong { color: #264653; }

.dl-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8em 1.2em;
    align-items: center;
}

.block-info {
    margin: 0.2em 0 0;
    color: #888;
    font-size: 0.8em;
}

#status {
    font-size: 0.85em;
    color: #888;
}

.mc-preview {
    display: flex;
    align-items: center;
    justify-content: center;
}

.checker {
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #ddd 25%, transparent 25%),
        linear-gradient(-45deg, #ddd 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ddd 75%),
        linear-gradient(-45deg, transparent 75%, #ddd 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, 10px 0px;
    border-radius: 0.6em;
    padding: 1em;
    max-width: 100%;
}

#blockImg {
    display: block;
    max-width: 100%;
    height: auto;
    max-height: 500px;
    transition: transform 0.2s;
}

.rotate-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
}

.rotate-row button {
    background: #2a9d8f;
    color: #fff;
    border: none;
    padding: 0.5em 0.8em;
    border-radius: 0.5em;
    font-weight: 600;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.15s;
}

.rotate-row button:hover { background: #264653; }

#resetTransformBtn {
    background: #e9c46a;
    color: #264653;
}
#resetTransformBtn:hover { background: #f4a261; color: #fff; }

.rotate-info {
    margin: 0.4em 0 0;
    color: #888;
    font-size: 0.85em;
}

.rotate-slider-row {
    display: flex;
    align-items: center;
    gap: 0.6em;
    margin-top: 0.6em;
}

#rotateSlider {
    flex: 1;
    min-width: 0;
}

#rotateNumber {
    width: 70px;
    padding: 0.4em;
    border: 1px solid #ccc;
    border-radius: 0.4em;
    font-size: 0.9em;
}
