/* --- Aspect Ratio Wrapper --- */
#ar-wrapper {
    font-family: 'Press Start 2P', monospace;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background-color: #111827;
    padding: 30px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    border: 2px solid #374151;
    color: white;
}

/* --- Preview Area --- */
.ar-preview-container {
    width: 100%;
    height: 250px;
    border: 4px solid #333;
    border-radius: 8px;
    margin-bottom: 25px;
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
    position: relative;
    /* Grid Pattern Background */
    background-image: linear-gradient(#1f2937 1px, transparent 1px), linear-gradient(90deg, #1f2937 1px, transparent 1px);
    background-size: 20px 20px;
}

.ar-box {
    background-color: #3b82f6; /* Blue */
    border: 2px solid #60a5fa;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    text-align: center;
    transition: all 0.3s ease;
    max-width: 100%;
    max-height: 100%;
    min-width: 20px;
    min-height: 20px;
    /* aspect-ratio will be set by JS */
}

/* --- Controls Grid --- */
.ar-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    width: 100%;
}

@media (min-width: 768px) {
    .ar-controls {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

/* --- Input Groups --- */
.ar-group {
    background-color: #1f2937;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #374151;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ar-label {
    font-size: 0.7rem;
    color: #9ca3af;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.ar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ar-separator {
    color: #6b7280;
    font-weight: bold;
}

/* Inputs */
.ar-input {
    background-color: #000;
    border: 2px solid #374151;
    color: #fff;
    padding: 10px;
    font-family: 'Press Start 2P', monospace, sans-serif;
    font-size: 1rem;
    border-radius: 4px;
    outline: none;
    width: 100%;
    text-align: center;
}

.ar-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

/* --- Presets --- */
.ar-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.ar-preset-btn {
    background-color: #374151;
    color: #d1d5db;
    border: 1px solid #4b5563;
    padding: 8px;
    font-size: 0.7rem;
    cursor: pointer;
    border-radius: 4px;
    font-family: inherit;
    transition: all 0.2s;
}

.ar-preset-btn:hover {
    background-color: #4b5563;
    color: white;
}

.ar-preset-btn.active {
    background-color: #3b82f6;
    border-color: #2563eb;
    color: white;
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
}

/* --- Action Buttons --- */
.ar-btn-reset {
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    background-color: #7f1d1d;
    color: #fca5a5;
    border: none;
    border-bottom: 4px solid #590d0d;
    font-family: inherit;
    font-size: 0.7rem;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 4px;
}

.ar-btn-reset:hover {
    background-color: #991b1b;
    color: white;
}

.ar-btn-reset:active {
    transform: translateY(4px);
    border-bottom: none;
    margin-top: 24px; /* offset + margin */
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #ar-wrapper { padding: 15px; }
    .ar-preview-container { height: 200px; }
}