/* ========== 基础与配色（MCG 深色主题） ========== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    background-color: #0D0D0D;
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(93, 140, 58, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(60, 133, 39, 0.04) 0%, transparent 50%);
    color: #D0D0D0;
    font-family: 'Noto Sans SC', system-ui, sans-serif;
}

/* ========== 像素风边框系统（Minecraft 风格 UI） ========== */
.pixel-panel {
    background: #1E1E1E;
    border: 2px solid #3A3A3A;
    border-right-color: #111111;
    border-bottom-color: #111111;
    box-shadow:
        inset 1px 1px 0 #2A2A2A,
        inset -1px -1px 0 #252525;
}

.pixel-btn {
    background: #2A2A2A;
    border: 2px solid #4A4A4A;
    border-right-color: #111111;
    border-bottom-color: #111111;
    color: #D0D0D0;
    font-weight: 700;
    text-shadow: 1px 1px 0 #000000;
    transition: all 0.08s ease;
    cursor: pointer;
    position: relative;
    user-select: none;
}
.pixel-btn:hover {
    background: #333333;
    border-color: #555555;
    border-right-color: #111111;
    border-bottom-color: #111111;
}
.pixel-btn:active {
    border: 2px solid #111111;
    border-right-color: #4A4A4A;
    border-bottom-color: #4A4A4A;
    transform: translateY(1px);
    box-shadow: inset 1px 1px 2px rgba(0,0,0,0.5);
}

.pixel-btn-primary {
    background: linear-gradient(180deg, #5D8C3A 0%, #3C8527 100%);
    border: 2px solid #7AB54D;
    border-right-color: #2D5A1E;
    border-bottom-color: #2D5A1E;
    color: #FFFFFF;
    text-shadow: 1px 1px 0 #1A3A10;
}
.pixel-btn-primary:hover {
    background: linear-gradient(180deg, #6B9E44 0%, #4A9A30 100%);
    border-color: #8BC75A;
    border-right-color: #2D5A1E;
    border-bottom-color: #2D5A1E;
}
.pixel-btn-primary:active {
    border: 2px solid #2D5A1E;
    border-right-color: #7AB54D;
    border-bottom-color: #7AB54D;
    background: linear-gradient(180deg, #3C8527 0%, #2D5A1E 100%);
}

/* 芯片标签 - 像素风 */
.pixel-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #252525;
    border: 2px solid #3A3A3A;
    border-right-color: #111111;
    border-bottom-color: #111111;
    color: #888888;
    font-size: 12px;
    font-weight: 600;
    box-shadow: inset 1px 1px 0 #333333;
}

/* 输入框 - 像素风 */
.pixel-input {
    background: #151515;
    border: 2px solid #2A2A2A;
    border-right-color: #3A3A3A;
    border-bottom-color: #3A3A3A;
    color: #FFFFFF;
    font-family: 'Courier New', monospace;
    transition: all 0.15s ease;
}
.pixel-input:focus {
    outline: none;
    border-color: #5D8C3A;
    box-shadow: 0 0 0 2px rgba(93, 140, 58, 0.2), inset 0 1px 2px rgba(0,0,0,0.3);
}
.pixel-input::placeholder {
    color: #444444;
}

/* 目标选择器芯片 - 像素风 */
.target-chip {
    background: #252525;
    border: 2px solid #3A3A3A;
    border-right-color: #111111;
    border-bottom-color: #111111;
    color: #888888;
    font-weight: 600;
    transition: all 0.1s ease;
    cursor: pointer;
    box-shadow: inset 1px 1px 0 #333333;
}
.target-chip:hover {
    background: #2E2E2E;
    border-color: #4A4A4A;
    border-right-color: #111111;
    border-bottom-color: #111111;
    color: #CCCCCC;
}
.target-chip.active {
    background: rgba(93, 140, 58, 0.2);
    border: 2px solid #5D8C3A;
    border-right-color: #2D5A1E;
    border-bottom-color: #2D5A1E;
    color: #7AB54D;
    box-shadow: inset 1px 1px 0 rgba(122, 181, 77, 0.3), 0 0 12px rgba(93, 140, 58, 0.15);
}
.target-chip.active:active {
    border: 2px solid #2D5A1E;
    border-right-color: #5D8C3A;
    border-bottom-color: #5D8C3A;
}

/* 开关 - 像素风 */
label.switch {
    width: 48px;
    height: 24px;
    background: #252525;
    border: 2px solid #111111;
    border-right-color: #3A3A3A;
    border-bottom-color: #3A3A3A;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    flex-shrink: 0;
}
label.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
label.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 1px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #555555;
    border: 1px solid #666666;
    border-right-color: #333333;
    border-bottom-color: #333333;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
label.switch input:checked + .slider {
    left: 26px;
    background: #5D8C3A;
    border-color: #7AB54D;
    border-right-color: #2D5A1E;
    border-bottom-color: #2D5A1E;
    box-shadow: 0 0 6px rgba(93, 140, 58, 0.5);
}
label.switch:has(input:checked) {
    background: rgba(93, 140, 58, 0.25);
    border-color: #2D5A1E;
    border-right-color: #5D8C3A;
    border-bottom-color: #5D8C3A;
}

/* 高级选项头部 - 像素面板 */
.section-header {
    background: linear-gradient(90deg, #1E1E1E 0%, #252525 100%);
    border: 2px solid #3A3A3A;
    border-right-color: #111111;
    border-bottom-color: #111111;
    box-shadow: inset 1px 1px 0 #2A2A2A;
    transition: all 0.15s ease;
    cursor: pointer;
}
.section-header:hover {
    background: linear-gradient(90deg, #222222 0%, #2A2A2A 100%);
    border-color: #4A4A4A;
}
.section-header.open {
    border-bottom: 2px solid #1E1E1E;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.section-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
    background: #1A1A1A;
    border: 2px solid transparent;
    border-top: none;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}
.section-body.open {
    max-height: 2000px;
    opacity: 1;
    border-color: #2A2A2A;
    border-right-color: #111111;
    border-bottom-color: #111111;
}

/* 颜色选择器 */
.color-dot {
    width: 28px;
    height: 28px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.1s ease;
    position: relative;
    box-shadow: inset 1px 1px 0 rgba(255,255,255,0.2), inset -1px -1px 0 rgba(0,0,0,0.3);
    flex-shrink: 0;
    transform-origin: center center;
}
.color-dot:hover {
    box-shadow: inset 1px 1px 0 rgba(255,255,255,0.3), inset -1px -1px 0 rgba(0,0,0,0.2), 0 0 8px rgba(93, 140, 58, 0.4);
}
.color-dot.active {
    border: 2px solid #FFFFFF;
    box-shadow: 0 0 0 2px #5D8C3A, inset 1px 1px 0 rgba(255,255,255,0.3), 0 0 10px rgba(93, 140, 58, 0.5);
}

/* 文本片段卡片 - 像素风 */
.text-fragment {
    background: #222222;
    border: 2px solid #333333;
    border-right-color: #111111;
    border-bottom-color: #111111;
    box-shadow: inset 1px 1px 0 #2A2A2A;
    transition: all 0.15s ease;
    box-sizing: border-box;
}
.text-fragment:hover {
    border-color: #3A3A3A;
}

/* 附魔条目 */
.enchant-row {
    background: rgba(93, 140, 58, 0.08);
    border-left: 3px solid #5D8C3A;
    border-top: 1px solid #2A2A2A;
    border-right: 1px solid #111111;
    border-bottom: 1px solid #111111;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
}
.enchant-row:hover {
    background: rgba(93, 140, 58, 0.15);
    transform: translateX(3px);
}

/* 命令高亮 */
.cmd-give { color: #5D8C3A; font-weight: 700; }
.cmd-target { color: #E8A838; }
.cmd-item { color: #5D9CCE; }
.cmd-nbt { color: #CE5D8C; }
.cmd-number { color: #9C7DFF; }
.cmd-bracket { color: #555555; }

/* 滚动条 */
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: #0D0D0D; }
::-webkit-scrollbar-thumb { background: #333333; border: 2px solid #0D0D0D; }
::-webkit-scrollbar-thumb:hover { background: #5D8C3A; }

/* 动画 */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-in {
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes obfuscate {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
.obfuscated {
    font-family: monospace;
}

/* 响应式 */
@media (max-width: 1024px) {
    .main-grid { grid-template-columns: 1fr !important; }
}

/* 颜色选择器 - 扩展（名称编辑用） */
.text-mc-text { color: #D0D0D0; }
.text-mc-textDim { color: #888888; }
.text-mc-green { color: #5D8C3A; }
.text-mc-greenLight { color: #7AB54D; }

.bg-mc-panel { background-color: #1E1E1E; }
.bg-mc-panelLight { background-color: #252525; }
.bg-mc-dark { background-color: #0D0D0D; }
.bg-mc-green { background-color: #5D8C3A; }

.border-mc-border { border-color: #3A3A3A; }
.border-mc-green { border-color: #5D8C3A; }

.hover\:bg-mc-panel:hover { background-color: #1E1E1E; }
.hover\:bg-mc-panelLight:hover { background-color: #252525; }

/* ========== JS动态生成组件样式 ========== */
.mc-btn {
    background: #2A2A2A;
    border: 2px solid #4A4A4A;
    border-right-color: #111111;
    border-bottom-color: #111111;
    color: #D0D0D0;
    font-weight: 700;
    text-shadow: 1px 1px 0 #000000;
    transition: all 0.08s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}
.mc-btn:hover {
    background: #333333;
    border-color: #555555;
    border-right-color: #111111;
    border-bottom-color: #111111;
}
.mc-btn:active {
    border: 2px solid #111111;
    border-right-color: #4A4A4A;
    border-bottom-color: #4A4A4A;
    transform: translateY(1px);
    box-shadow: inset 1px 1px 2px rgba(0,0,0,0.5);
}

.mc-btn-primary {
    background: linear-gradient(180deg, #5D8C3A 0%, #3C8527 100%);
    border: 2px solid #7AB54D;
    border-right-color: #2D5A1E;
    border-bottom-color: #2D5A1E;
    color: #FFFFFF;
    text-shadow: 1px 1px 0 #1A3A10;
}
.mc-btn-primary:hover {
    background: linear-gradient(180deg, #6B9E44 0%, #4A9A30 100%);
    border-color: #8BC75A;
    border-right-color: #2D5A1E;
    border-bottom-color: #2D5A1E;
}
.mc-btn-primary:active {
    border: 2px solid #2D5A1E;
    border-right-color: #7AB54D;
    border-bottom-color: #7AB54D;
    background: linear-gradient(180deg, #3C8527 0%, #2D5A1E 100%);
}

.mc-input {
    background: #151515;
    border: 2px solid #2A2A2A;
    border-right-color: #3A3A3A;
    border-bottom-color: #3A3A3A;
    color: #FFFFFF;
    font-family: 'Courier New', monospace;
    transition: all 0.15s ease;
    width: 100%;
}
.mc-input:focus {
    outline: none;
    border-color: #5D8C3A;
    box-shadow: 0 0 0 2px rgba(93, 140, 58, 0.2), inset 0 1px 2px rgba(0,0,0,0.3);
}
.mc-input::placeholder {
    color: #444444;
}

.mc-color-swatch {
    box-shadow: inset 1px 1px 0 rgba(255,255,255,0.2), inset -1px -1px 0 rgba(0,0,0,0.3);
    transition: all 0.1s ease;
    cursor: pointer;
    flex-shrink: 0;
    transform-origin: center center;
}
.mc-color-swatch:hover {
    box-shadow: inset 1px 1px 0 rgba(255,255,255,0.3), inset -1px -1px 0 rgba(0,0,0,0.2), 0 0 8px rgba(93, 140, 58, 0.4);
}
.mc-color-swatch.active {
    box-shadow: 0 0 0 2px #5D8C3A, inset 1px 1px 0 rgba(255,255,255,0.3), 0 0 10px rgba(93, 140, 58, 0.5);
}

/* 文本片段容器 */
.mc-text-part {
    background: #222222;
    border: 2px solid #333333;
    border-right-color: #111111;
    border-bottom-color: #111111;
    box-shadow: inset 1px 1px 0 #2A2A2A;
}

/* 附魔/属性条目 */
.enchant-item, .attribute-item {
    background: rgba(93, 140, 58, 0.08);
    border-left: 3px solid #5D8C3A;
    border-top: 1px solid #2A2A2A;
    border-right: 1px solid #111111;
    border-bottom: 1px solid #111111;
    transition: all 0.15s ease;
}
.enchant-item:hover, .attribute-item:hover {
    background: rgba(93, 140, 58, 0.15);
}

/* 滚动条美化 */
#nameParts, #loreLines, #enchantmentParts, #attributeModifiers {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* 防止 flex 布局压缩 switch */
.flex.items-center.justify-between label.switch {
    flex-shrink: 0;
    margin-left: auto;
}

/* switch-wrap 容器样式 */
.switch-wrap {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}
.switch-wrap label.switch {
    flex-shrink: 0;
}
