.rkg {
    display: grid;
    grid-template-columns: 220px 1fr;
    background: #2b2725;
    color: #e8e2d0;
    border: 2px solid #3b332c;
    min-height: 520px;
    gap: 0;
    font-family: "Segoe UI", sans-serif;
}

.rkg__sidebar {
    background: #1f1b19;
    padding: 16px;
    border-right: 1px solid #3b332c;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rkg__sidebar-title {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 12px;
    color: #9e8c7a;
    width: 100%;
}

.rkg__filter {
    text-align: left;
    color: #e8e2d0;
    background: transparent;
    border: 1px solid transparent;
    padding: 10px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.15s, border-color 0.15s;
}

button.rkg__filter span {
    text-transform: uppercase;
}

.rkg__filter:hover,
.rkg__filter.is-active {
    background: #3b332c;
    border-color: #56483e;
}

.rkg__count {
    color: #8ca2b0;
    font-size: 12px;
}

.rkg__main {
    padding: 18px 18px 0px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

.rkg__controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}

.rkg__search {
    flex: 1 1 260px;
    padding: 10px 38px 10px 12px;
    border-radius: 4px;
    border: 1px solid #4b4037;
    background: #1f1b19;
    color: #e8e2d0;
    width: 100%;
}

.rkg__hint {
    font-size: 12px;
    color: #9e8c7a;
}

.rkg__search-wrap {
    position: relative;
    flex: 1 1 260px;
}

.rkg__clear {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border-radius: 4px;
    border: 1px solid #4b4037;
    background: #322c27;
    color: #e8e2d0;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: none;
}

.rkg__clear.is-visible {
    display: inline-grid;
    place-items: center;
}

.rkg__sort {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.rkg__sort-label {
    font-size: 12px;
    color: #9e8c7a;
}

.rkg__sort-select {
    background: #1f1b19;
    border: 1px solid #4b4037;
    color: #e8e2d0;
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 13px;
}

.rkg__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    height: 41rem;
    grid-auto-rows: minmax(auto, 0fr);
    overflow: hidden;
    overflow-y: scroll;
    padding-top: 6px;
}

.rkg__grid::-webkit-scrollbar {
    width: 10px;
}

.rkg__grid::-webkit-scrollbar-track {
    background: #1f1b19;
    border: 1px solid #3b332c;
}

.rkg__grid::-webkit-scrollbar-thumb {
    background: #4b4037;
    border: 1px solid #322c27;
}

.rkg__grid::-webkit-scrollbar-thumb:hover {
    background: #d0a55f;
}

.rkg__card {
    background: #322c27;
    border: 1px solid #4b4037;
    color: inherit;
    text-align: left;
    padding: 12px;
    border-radius: 6px;
    cursor: default;
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 8px;
    position: relative;
    transition: transform 0.1s ease, border-color 0.1s ease, box-shadow 0.1s ease;
    height: 100%;
}

.rkg__card:hover {
    transform: translateY(-1px);
    border-color: #d0a55f;
    box-shadow: 0 5px 18px rgba(0,0,0,0.35);
}

.rkg__card-media {
    width: 100%;
    background: #24201e;
    border: 1px solid #3b332c;
    display: grid;
    place-items: center;
    padding: 8px;
    height: fit-content;
}

.rkg__card-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.rkg__placeholder {
    color: #8ca2b0;
    font-size: 22px;
}

.rkg__card-title {
    font-weight: 700;
    letter-spacing: 0.01em;
    text-align: center;
    font-size: 14px;
    line-height: 1.3;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px 2px;
}

.rkg__count-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.4);
    color: #e8e2d0;
    font-weight: 700;
    font-size: 12px;
    border: 1px solid #4b4037;
    border-radius: 5px;
    display: none;
}

.rkg__card.has-count .rkg__count-badge {
    display: inline-block;
}

.rkg__info {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.4);
    color: #e8e2d0;
    font-weight: 700;
    font-size: 12px;
    border: 1px solid #4b4037;
    cursor: pointer;
}

.rkg__info:hover {
    background: #d0a55f;
    color: #1f1b19;
}

.rkg__detail {
    margin-top: 10px;
    border: 1px solid #4b4037;
    border-radius: 6px;
    padding: 12px;
    background: #26211f;
    display: none;
    gap: 10px;
    width: 100%;
    position: absolute;
    right: 0;
    bottom: 0;
    border-radius: 6px 6px 0 0;
}

.rkg__detail.is-visible {
    display: grid;
}

.rkg__detail-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.rkg__detail-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.rkg__detail-label {
    font-size: 12px;
    color: #9e8c7a;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.rkg__detail-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.rkg__pill {
    padding: 6px 10px;
    background: #322c27;
    border: 1px solid #4b4037;
    border-radius: 999px;
    font-size: 12px;
}

.rkg__close {
    width: 28px;
    height: 28px;
    border: 1px solid #4b4037;
    border-radius: 50%;
    background: #322c27;
    color: #e8e2d0;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding-bottom: 4px;
    padding-left: 7px;
}

.rkg__close:hover {
    background: #d0a55f;
    color: #1f1b19;
}

.rkg__detail-body {
    display: grid;
    gap: 10px;
}

.rkg__detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.rkg__detail-value {
    font-size: 16px;
}

.rkg__keybind {
    margin-top: 14px;
    border: 1px solid #4b4037;
    border-radius: 6px;
    padding: 12px;
    background: #26211f;
    display: grid;
    gap: 10px;
}

.rkg-gen {
    background: #2b2725;
    border: 2px solid #3b332c;
    border-top: 0px;
    color: #e8e2d0;
    padding: 16px;
    display: grid;
    gap: 12px;
    font-family: "Segoe UI", sans-serif;
}

.rkg-gen .rkg__keybind {
    margin-top: 0;
}

.rkg__keybind-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.rkg__keybind-body {
    display: grid;
    gap: 10px;
}

.rkg__active-block {
    border: 1px solid #4b4037;
    border-radius: 4px;
    padding: 10px;
    background: #322c27;
    display: grid;
    gap: 10px;
}

.rkg__active-list {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.rkg__active-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: #26211f;
    border: 1px solid #4b4037;
    border-radius: 4px;
    padding: 8px 10px;
}

.rkg__active-actions {
    display: inline-flex;
    gap: 6px;
}

.rkg__remove {
    width: 28px;
    height: 28px;
    border: 1px solid #4b4037;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.4);
    color: #e8e2d0;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.rkg__remove:hover {
    background: #d0a55f;
    color: #1f1b19;
}

.rkg__materials {
    border-top: 1px solid #4b4037;
    padding-top: 8px;
    display: grid;
    gap: 6px;
}

.rkg__materials-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 4px;
}

.rkg__materials-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #26211f;
    border: 1px solid #4b4037;
    border-radius: 4px;
    padding: 6px 8px;
}

.rkg__bind-controls {
    display: grid;
    gap: 8px;
    background: #322c27;
    border: 1px solid #4b4037;
    border-radius: 4px;
    padding: 10px;
}

.rkg__bind-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    align-items: center;
}

.rkg__capture,
.rkg__copy {
    padding: 10px 12px;
    background: #322c27;
    border: 1px solid #4b4037;
    color: #e8e2d0;
    border-radius: 4px;
    cursor: pointer;
}

.rkg__capture.is-active {
    background: #d0a55f;
    color: #1f1b19;
}

.rkg__key-input,
.rkg__message {
    width: 100%;
    padding: 10px 12px;
    border-radius: 4px;
    border: 1px solid #4b4037;
    background: #1f1b19;
    color: #e8e2d0;
}

.rkg__checkbox {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    color: #e8e2d0;
}

.rkg__preview {
    border: 1px solid #4b4037;
    border-radius: 4px;
    padding: 10px;
    background: #322c27;
    word-break: break-all;
    min-height: 54px;
}

.rkg__recipe {
    list-style: none;
    padding: 0;
    margin: 6px 0 0;
    display: grid;
    gap: 6px;
}

.rkg__recipe li {
    background: #322c27;
    border: 1px solid #4b4037;
    padding: 8px 10px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rkg__muted {
    color: #9e8c7a;
}

@media (max-width: 800px) {
    .rkg {
        grid-template-columns: 1fr;
    }
    .rkg__grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
    .rkg__sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        border-right: none;
        border-bottom: 1px solid #3b332c;
    }
    .rkg__filter {
        flex: 1 1 46%;
    }
}

@media (max-width: 425px) {
    .rkg__sidebar {
        flex-direction: column;
        flex-wrap: nowrap;
        border-right: none;
        border-bottom: 1px solid #3b332c;
    }
}
