/* =========================================================
   电子烟花工具 - electronic_fireworks.css
   ========================================================= */

/* 入场动画 */
@keyframes ef-fadein {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes ef-toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(16px) scale(0.95); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes ef-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(16, 185, 129, 0.35); }
    50%       { box-shadow: 0 0 22px rgba(16, 185, 129, 0.75), 0 0 40px rgba(16, 185, 129, 0.3); }
}

@keyframes ef-hint-pulse {
    0%, 100% { color: rgba(255, 255, 255, 0.28); }
    50%       { color: rgba(255, 255, 255, 0.62); }
}

/* =========================================================
   整体容器
   ========================================================= */
.ef-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px 24px 28px;
    animation: ef-fadein 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================================
   Canvas 舞台区域
   ========================================================= */
.ef-stage-wrap {
    position: relative;
    width: 100%;
    background: linear-gradient(180deg, #010108 0%, #020210 55%, #080618 100%);
    border-radius: 12px;
    overflow: hidden;
    border: 1.5px solid #1a2540;
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(99,102,241,0.08), inset 0 1px 0 rgba(255,255,255,0.04);
    min-height: 420px;
    cursor: crosshair;
}

.ef-canvas {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 420px;
}

/* 引导提示（有烟花后自动消失） */
.ef-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.35);
    font-size: 16px;
    font-weight: 400;
    letter-spacing: 0.04em;
    pointer-events: none;
    user-select: none;
    transition: opacity 0.6s ease;
    white-space: nowrap;
    animation: ef-hint-pulse 2.5s ease-in-out infinite;
}

.ef-hint.ef-hint-hidden {
    opacity: 0;
    animation: none;
}

/* 计数器 */
.ef-counter {
    position: absolute;
    top: 12px;
    left: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 12.5px;
    color: rgba(255,255,255,0.75);
    pointer-events: none;
}

.ef-counter strong {
    color: #fbbf24;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.ef-counter-sep {
    opacity: 0.35;
}

/* 全屏按钮 */
.ef-fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    color: rgba(255,255,255,0.7);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s, transform 0.15s;
    line-height: 1;
}

.ef-fullscreen-btn:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
    transform: scale(1.08);
}

/* 全屏模式下的 canvas 包裹层 */
.ef-stage-wrap.ef-fullscreen-mode {
    position: fixed;
    inset: 0;
    z-index: 9999;
    border-radius: 0;
    border: none;
    min-height: 100vh;
}

.ef-stage-wrap.ef-fullscreen-mode .ef-canvas {
    min-height: 100vh;
}

.ef-stage-wrap.ef-fullscreen-mode .ef-fullscreen-btn {
    top: 16px;
    right: 16px;
}

/* =========================================================
   控制面板
   ========================================================= */
.ef-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.ef-section {
    background: #f8fafc;
    border: 1px solid #e8ecf0;
    border-radius: 10px;
    padding: 14px 16px;
    transition: border-color 0.22s, box-shadow 0.22s;
}

.ef-section:hover {
    border-color: #c7d2e8;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.07);
}

.ef-section-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 7px;
}

.ef-section-title::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 13px;
    background: linear-gradient(180deg, #6366f1, #8b5cf6);
    border-radius: 2px;
    flex-shrink: 0;
}

/* =========================================================
   场景预设按钮
   ========================================================= */
.ef-preset-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ef-preset-btn {
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    background: #fff;
    border: 1.5px solid #cbd5e1;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.ef-preset-btn:hover {
    border-color: #6366f1;
    color: #6366f1;
    background: #eef2ff;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(99, 102, 241, 0.15);
}

.ef-preset-btn:active {
    transform: translateY(0);
}

/* =========================================================
   操控按钮
   ========================================================= */
.ef-action-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ef-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.01em;
}

.ef-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

.ef-action-btn:active {
    transform: translateY(0);
}

.ef-btn-icon {
    font-size: 15px;
    line-height: 1;
}

.ef-btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
}

.ef-btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.ef-btn-primary.ef-auto-active {
    background: linear-gradient(135deg, #059669, #10b981);
    animation: ef-glow 2s ease infinite;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.ef-btn-primary.ef-auto-active:hover {
    background: linear-gradient(135deg, #047857, #059669);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.4);
}

.ef-btn-secondary {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: #1c1917;
}

.ef-btn-secondary:hover {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.ef-btn-danger {
    background: linear-gradient(135deg, #64748b, #94a3b8);
    color: #fff;
}

.ef-btn-danger:hover {
    background: linear-gradient(135deg, #475569, #64748b);
    box-shadow: 0 4px 14px rgba(100, 116, 139, 0.4);
}

/* =========================================================
   色彩主题按钮
   ========================================================= */
.ef-theme-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ef-theme-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12.5px;
    font-weight: 500;
    color: #374151;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.ef-theme-btn:hover {
    border-color: #94a3b8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.ef-theme-btn.active {
    border-color: #6366f1;
    background: #eef2ff;
    color: #4f46e5;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.ef-theme-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1.5px solid rgba(0,0,0,0.08);
}

.ef-swatch-rainbow  { background: conic-gradient(red, orange, yellow, green, cyan, blue, violet, red); }
.ef-swatch-classic  { background: linear-gradient(135deg, #f97316, #facc15, #f9a8d4); }
.ef-swatch-gold     { background: linear-gradient(135deg, #f59e0b, #fde68a, #d97706); }
.ef-swatch-chinese  { background: linear-gradient(135deg, #dc2626, #fbbf24, #b91c1c); }
.ef-swatch-ice      { background: linear-gradient(135deg, #7dd3fc, #bae6fd, #38bdf8); }
.ef-swatch-pastel   { background: linear-gradient(135deg, #f9a8d4, #c4b5fd, #a5f3fc); }

/* =========================================================
   滑块调节
   ========================================================= */
.ef-sliders {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 24px;
}

.ef-slider-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ef-slider-label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ef-slider-val {
    font-size: 12px;
    color: #6366f1;
    font-weight: 600;
    min-width: 30px;
    text-align: right;
}

.ef-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 3px;
    background: linear-gradient(
        to right,
        #6366f1 0%,
        #6366f1 var(--ef-slider-pct, 50%),
        #e2e8f0 var(--ef-slider-pct, 50%),
        #e2e8f0 100%
    );
    outline: none;
    cursor: pointer;
    transition: background 0.2s;
}

.ef-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #6366f1;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(99, 102, 241, 0.4);
    transition: transform 0.15s, box-shadow 0.15s;
}

.ef-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.5);
}

.ef-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #6366f1;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(99, 102, 241, 0.4);
}

/* =========================================================
   快捷键说明
   ========================================================= */
.ef-shortcut-section {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.ef-shortcut-list {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.ef-shortcut-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    color: #64748b;
}

.ef-shortcut-list kbd {
    display: inline-block;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 600;
    color: #374151;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    box-shadow: 0 1px 0 #cbd5e1;
    font-family: inherit;
    line-height: 1.5;
}

/* 键盘焦点可见性（无障碍访问） */
.ef-action-btn:focus-visible,
.ef-preset-btn:focus-visible,
.ef-theme-btn:focus-visible,
.ef-fullscreen-btn:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* =========================================================
   Toast 通知
   ========================================================= */
.ef-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    padding: 11px 22px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 99999;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.12);
    white-space: nowrap;
    max-width: 90vw;
}

.ef-toast.ef-toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    animation: ef-toast-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================================
   响应式
   ========================================================= */

/* 桌面端：两列面板布局 */
@media (min-width: 1024px) {
    .ef-panel {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    /* 预设、滑块、快捷键跨全宽 */
    .ef-section-presets,
    .ef-section-sliders,
    .ef-section-shortcuts {
        grid-column: 1 / -1;
    }
}

/* 平板端：收紧间距 */
@media (max-width: 768px) {
    .ef-container {
        padding: 14px 16px 22px;
        gap: 16px;
    }

    .ef-canvas {
        min-height: 340px;
    }

    .ef-stage-wrap {
        min-height: 340px;
    }

    .ef-action-btn {
        padding: 8px 15px;
        font-size: 13px;
    }

    .ef-preset-btn {
        padding: 6px 12px;
        font-size: 12.5px;
    }

    .ef-shortcut-list {
        gap: 10px;
    }
}

@media (max-width: 640px) {
    .ef-container {
        padding: 12px 12px 20px;
        gap: 14px;
    }

    .ef-canvas {
        min-height: 280px;
    }

    .ef-stage-wrap {
        min-height: 280px;
    }

    .ef-sliders {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .ef-action-row {
        gap: 8px;
    }

    .ef-action-btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .ef-preset-row {
        gap: 6px;
    }

    .ef-preset-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .ef-shortcut-list {
        gap: 8px;
    }

    .ef-counter {
        font-size: 11.5px;
        padding: 4px 10px;
    }
}
