/* Custom styles for the simulator */
body {
    font-family: 'Noto Sans JP', 'Inter', sans-serif;
    background-color: #f3f4f6;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 2rem;
    box-sizing: border-box;
}
.container {
    background-color: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    width: 100%;
    max-width: 1200px;
}
.simulator-area {
    display: flex; /* Default for mobile (single column) */
    flex-direction: column;
    gap: 2.5rem;
    width: 100%;
}
.preview-column {
     width: 100%;
}
.controls {
    width: 100%;
}
.svg-container {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    overflow: hidden;
    position: relative;
}

/* Desktop layout: Side-by-side using CSS Grid */
@media (min-width: 1024px) {
    .simulator-area {
        display: grid; /* Use Grid for robust two-column layout */
        grid-template-columns: repeat(2, minmax(0, 1fr)); /* Create two equal columns */
        align-items: flex-start;
        gap: 2.5rem;
    }
    .preview-column, .controls {
        width: auto; /* Reset width, let the grid control it */
    }
    .preview-column {
        position: -webkit-sticky; /* For Safari */
        position: sticky;
        top: 2rem;
    }
}

svg.uniform-svg { /* Common class for all uniform SVGs */
    display: block;
    width: 100%;
    height: auto;
}
.controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.control-group {
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    background-color: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.control-item {
    display: grid;
    grid-template-columns: 100px 1fr;
    align-items: center;
    gap: 1rem;
}
.control-item label, .checkbox-control label, .radio-group-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
}
.view-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    background-color: #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.25rem;
}
.view-toggle button {
    padding: 0.5rem 1rem;
    border: none;
    background-color: transparent;
    color: #4b5563;
    font-weight: 600;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}
.view-toggle button.active {
    background-color: #ffffff;
    color: #1f2937;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.color-swatch-btn {
    width: 44px;
    height: 44px;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}
.color-swatch-btn:hover {
    transform: scale(1.05);
}

#color-palette-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: none; /* Initially hidden */
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}
.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 0.75rem;
}
.palette-swatch {
    width: 40px;
    height: 40px;
    border-radius: 0.375rem;
    cursor: pointer;
    border: 1px solid #e5e7eb;
}
.category-header {
    grid-column: 1 / -1;
    font-weight: 700;
    color: #4b5563;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.25rem;
}
.category-header:first-of-type {
    margin-top: 0;
}

input[type="file"], input[type="text"], input[type="number"], select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    color: #374151;
    width: 100%;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus, select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}
input[type="file"]::file-selector-button {
    background-color: #4f46e5;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    border: none;
    cursor: pointer;
    margin-right: 0.75rem;
    transition: background-color 0.2s ease;
}
input[type="file"]::file-selector-button:hover {
    background-color: #4338ca;
}
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    outline: none;
    opacity: 0.9;
    transition: opacity .2s;
}
input[type="range"]:hover { opacity: 1; }
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #4f46e5;
    cursor: pointer;
    border-radius: 50%;
}
input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #4f46e5;
    cursor: pointer;
    border-radius: 50%;
    border: none;
}
.slider-control {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1rem;
}
.error-message {
    font-size: 0.8rem;
    color: #ef4444;
    margin-top: -0.75rem;
    grid-column: 2;
}
.radio-group {
    display: flex;
    gap: 1rem;
    align-items: center;
}
.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: normal;
}
.checkbox-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    grid-column: 1 / -1;
}
.action-btn {
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s;
    border: none;
}
.action-btn:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

/* Notification Banner */
#notification-banner {
    position: fixed;
    top: -100px; /* Start off-screen */
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: top 0.5s ease-in-out;
    z-index: 2000;
    text-align: center;
}
#notification-banner.show {
    top: 20px;
}
#notification-banner.success {
    background-color: #28a745; /* Green */
}
#notification-banner.error {
    background-color: #dc3545; /* Red */
}
#notification-banner.info {
    background-color: #17a2b8; /* Blue */
}

/* Mini Preview */
#mini-preview-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 150px;
    height: 180px; /* Increased height for buttons */
    background-color: white;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1500;
    overflow: hidden;
    display: none; /* Hidden by default */
    transition: opacity 0.3s, transform 0.3s;
    opacity: 0;
    transform: scale(0.95);
    flex-direction: column;
    padding: 0.5rem;
    box-sizing: border-box;
}
#mini-preview-container.visible {
    display: flex;
    opacity: 1;
    transform: scale(1);
}
#mini-preview-content {
    flex-grow: 1;
    overflow: hidden;
}
#mini-preview-content svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
#mini-preview-toggle {
    margin-top: 0.5rem;
    margin-bottom: 0;
    padding: 2px;
    flex-shrink: 0;
}
#mini-preview-toggle button {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}
@media (min-width: 1024px) {
    #mini-preview-container {
        display: none !important;
    }
}