:root {
    --primary-color: #ea8400;
    --primary-hover: #d67300;
    --primary-light: rgba(234, 132, 0, 0.1);
    --success-color: #10b981;
    --success-hover: #059669;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --surface-color: #ffffff;
    --surface-elevated: #f8fafc;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
}

.dark-mode {
    --primary-color: #ff9d1a;
    --primary-hover: #ea8400;
    --primary-light: rgba(255, 157, 26, 0.15);
    --surface-color: #1e293b;
    --surface-elevated: #334155;
    --border-color: #475569;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
}

.tool-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

.tool-header {
    text-align: center;
    padding: 40px 20px 30px;
    margin-bottom: 20px;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
}

.header-icon {
    margin-bottom: 16px;
}

.icon-ant {
    font-size: 3rem;
    display: inline-block;
    animation: ant-walk 2s ease-in-out infinite;
}

@keyframes ant-walk {

    0%,
    100% {
        transform: translateX(0) rotate(0deg);
    }

    25% {
        transform: translateX(-5px) rotate(-5deg);
    }

    50% {
        transform: translateX(0) rotate(0deg);
    }

    75% {
        transform: translateX(5px) rotate(5deg);
    }
}

.tool-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.tool-header .subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
}

.keyboard-hint {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 16px 24px;
    background: var(--surface-elevated);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-icon {
    font-size: 1.2rem;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.tool-content {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    align-items: start;
}

.options-sidebar {
    position: sticky;
    top: 20px;
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--primary-light);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.option-card {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.option-card:last-child {
    border-bottom: none;
}

.option-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px 0;
}

.card-icon {
    font-size: 1.1rem;
}

.control-group {
    margin-bottom: 16px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.control-label span:first-child {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.control-label span:last-child {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-color);
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px var(--primary-light);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    display: inline-block;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border-color);
    transition: var(--transition-fast);
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: var(--transition-fast);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--primary-color);
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

.toggle-switch input:focus+.toggle-slider {
    box-shadow: 0 0 0 3px var(--primary-light);
}

.option-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.option-item:last-child {
    margin-bottom: 0;
}

.option-label {
    font-size: 0.9rem;
    color: var(--text-primary);
    flex: 1;
}

.canvas-container {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    padding: 20px;
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.canvas-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.canvas-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

canvas {
    display: block;
    margin: 0 auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    background: #1a1a1a;
    cursor: crosshair;
}

.dark-mode canvas {
    background: #0f172a;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 8px;
}

.action-btn:last-child {
    margin-bottom: 0;
}

.action-btn:hover {
    background: var(--surface-elevated);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn.primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.action-btn.primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.action-btn.secondary {
    background: var(--surface-elevated);
}

.action-btn.full-width {
    width: 100%;
}

.help-box {
    margin-top: 30px;
    padding: 20px;
    background: var(--primary-light);
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--primary-color);
}

.help-box strong {
    display: block;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.help-box ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-box li {
    padding: 6px 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.help-box li:before {
    content: "→ ";
    color: var(--primary-color);
    font-weight: bold;
    margin-right: 8px;
}

@media (max-width: 1024px) {
    .tool-content {
        grid-template-columns: 1fr;
    }

    .options-sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    .tool-header h1 {
        font-size: 1.8rem;
    }

    .tool-header .subtitle {
        font-size: 1rem;
    }

    .stats-bar {
        gap: 16px;
        padding: 12px 16px;
    }

    .stat-item {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }

    canvas {
        max-width: 100%;
        height: auto;
    }
}

@media (max-width: 480px) {
    .tool-header {
        padding: 24px 16px;
    }

    .tool-header h1 {
        font-size: 1.5rem;
    }

    .tool-main {
        padding: 0 12px 32px;
    }
}