body {
    margin: 0;
    font-family: system-ui, -apple-system, sans-serif;
    background-color: #0f0f0f;
    color: #ececec;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 320px;
    background-color: #181818;
    padding: 24px;
    overflow-y: auto;
    border-right: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #2e2e2e;
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #444;
}

h1 {
    margin: 0;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, #fff 60%, #888);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #a0a0a0;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}

label::before {
    content: '';
    display: inline-block;
    width: 2px;
    height: 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    flex-shrink: 0;
}

.input-group>label:first-child::before {
    display: inline-block;
}

.toggle-label::before,
.check-item::before,
label.btn::before,
label.btn-secondary::before {
    display: none !important;
}

input[type="text"],
select {
    width: 100%;
    padding: 10px;
    background: #1e1e1e;
    border: 1px solid #2e2e2e;
    color: white;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 0.9rem;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    -webkit-appearance: none;
    appearance: none;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

select option {
    background-color: #222;
    color: white;
}

.toggle-row {
    margin-top: 4px;
    display: flex;
    align-items: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    text-transform: none;
    color: #ccc;
    font-weight: normal;
    cursor: pointer;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    border: 1.5px solid #444;
    border-radius: 4px;
    background: #1e1e1e;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    position: relative;
}

input[type="checkbox"]:checked {
    background: #fff;
    border-color: #fff;
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 1px;
    width: 5px;
    height: 8px;
    border: 2px solid #111;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

input[type="checkbox"]:hover {
    border-color: #666;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    text-transform: none;
    color: #ccc;
    font-weight: normal;
}

.btn {
    width: 100%;
    padding: 12px;
    background: #fff;
    color: #000;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.btn:hover {
    background: #e0e0e0;
}

.btn-secondary {
    background: #2a2a2a;
    color: #fff;
    border: 1px solid #3a3a3a;
    padding: 8px;
    margin-top: 4px;
    font-size: 0.85rem;
}

.btn-secondary:hover {
    background: #3a3a3a;
}

.title-mode-btns {
    display: flex;
    gap: 6px;
}

.title-mode-btn {
    flex: 1;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: #888;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.title-mode-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ccc;
    border-color: rgba(255, 255, 255, 0.2);
}

.title-mode-btn.active {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.28);
}

.preview-area {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #0a0a0a;
    background-image: radial-gradient(#222 1px, transparent 1px);
    background-size: 24px 24px;
    position: relative;
}

canvas {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #141414;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 24px;
    width: 500px;
    max-width: 90%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
}

.modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.5px;
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 4px;
}

.modal-grid::-webkit-scrollbar {
    width: 6px;
}

.modal-grid::-webkit-scrollbar-track {
    background: transparent;
}

.modal-grid::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

.popular-item-card {
    background: #1d1d1d;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 12px 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.15s ease;
    user-select: none;
}

.popular-item-card:hover {
    border-color: #444;
    background: #242424;
}

.popular-item-card.selected {
    border-color: #00a2ff;
    background: rgba(0, 162, 255, 0.08);
}

.popular-item-card img {
    width: 64px;
    height: 64px;
    border-radius: 6px;
    background: #181818;
}

.popular-item-card span {
    font-size: 0.72rem;
    color: #ccc;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

#loadedItemsList::-webkit-scrollbar {
    height: 4px;
}

#loadedItemsList::-webkit-scrollbar-track {
    background: transparent;
}

#loadedItemsList::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 2px;
}

.loaded-item-thumb {
    width: 48px;
    height: 48px;
    background: #181818;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease;
}

.loaded-item-thumb:hover {
    border-color: #444;
}

.loaded-item-thumb img {
    width: 90%;
    height: 90%;
    object-fit: contain;
    border-radius: 4px;
}

.loaded-item-remove-btn {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 14px;
    height: 14px;
    background: #ff3333;
    color: white;
    font-size: 10px;
    font-weight: bold;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    border: 1px solid #141414;
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.loaded-item-remove-btn:hover {
    background: #ff5555;
    transform: scale(1.15);
}

#supportBtn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(155, 89, 182, 0.2);
    color: #e0b0ff;
    border: 1px solid rgba(155, 89, 182, 0.4);
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    z-index: 10;
}

#supportBtn:hover {
    background: rgba(155, 89, 182, 0.4);
    border-color: rgba(155, 89, 182, 0.7);
    color: #fff;
    box-shadow: 0 0 12px rgba(155, 89, 182, 0.3);
}

.support-row {
    display: flex;
    align-items: center;
    background: #1c1c1c;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 10px 12px;
    gap: 12px;
}

.support-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #aaa;
    min-width: 60px;
    text-transform: uppercase;
}

.support-addr {
    font-size: 0.8rem;
    font-family: monospace;
    color: #eee;
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    user-select: all;
}

.copy-btn {
    background: #2a2a2a;
    color: #fff;
    border: 1px solid #3a3a3a;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.copy-btn:hover {
    background: #fff;
    color: #000;
    border-color: #fff;
}

.copy-btn.copied {
    background: #27ae60;
    border-color: #27ae60;
    color: #fff;
}