* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    color: #1f2937;
    line-height: 1.5;
}

.max-w-7xl { max-width: 80rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.pt-1 { padding-top: 0.25rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-6 { margin-top: 1.5rem; }
.mr-2 { margin-right: 0.5rem; }
.mr-3 { margin-right: 0.75rem; }
.ml-auto { margin-left: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }

.w-full { width: 100%; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-6 { width: 1.5rem; }
.w-7 { width: 1.75rem; }
.w-8 { width: 2rem; }
.w-10 { width: 2.5rem; }
.w-16 { width: 4rem; }
.w-20 { width: 5rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-6 { height: 1.5rem; }
.h-7 { height: 1.75rem; }
.h-8 { height: 2rem; }
.h-10 { height: 2.5rem; }
.h-16 { height: 4rem; }
.h-20 { height: 5rem; }
.h-40 { height: 10rem; }
.h-80 { height: 20rem; }
.min-h-screen { min-height: 100vh; }
.min-h-80 { min-height: 20rem; }
.min-h-96 { min-height: 24rem; }
.max-h-96 { max-height: 24rem; }
.max-h-\[80vh\] { max-height: 80vh; }
.max-w-full { max-width: 100%; }
.max-w-md { max-width: 28rem; }
.max-w-4xl { max-width: 56rem; }
.max-h-full { max-height: 100%; }

.flex { display: flex; }
.grid { display: grid; }
.inline-flex { display: inline-flex; }
.hidden { display: none; }
.block { display: block; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }

.fixed { position: fixed; }
.relative { position: relative; }
.absolute { position: absolute; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-0 { top: 0; }
.top-4 { top: 1rem; }
.-top-12 { top: -3rem; }
.right-0 { right: 0; }
.right-4 { right: 1rem; }
.top-4px { top: 4px; }
.right-4px { right: 4px; }
.z-50 { z-index: 50; }

.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }

.rounded { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-full { border-radius: 9999px; }
.rounded-sm { border-radius: 0.125rem; }
.rounded { border-radius: 0.25rem; }

.border { border-width: 1px; border-style: solid; border-color: #e5e7eb; }
.border-2 { border-width: 2px; border-style: solid; }
.border-3 { border-width: 3px; border-style: solid; }
.border-current { border-color: currentColor; }
.border-gray-100 { border-color: #f3f4f6; }
.border-gray-200 { border-color: #e5e7eb; }
.border-dashed { border-style: dashed; }
.border-none { border: none; }

.bg-white { background-color: #ffffff; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-blue-50 { background-color: #eff6ff; }
.bg-blue-600 { background-color: #2563eb; }
.bg-green-50 { background-color: #f0fdf4; }
.bg-green-500 { background-color: #22c55e; }
.bg-red-500 { background-color: #ef4444; }
.bg-amber-500 { background-color: #f59e0b; }
.bg-purple-50 { background-color: #faf5ff; }
.bg-red-50 { background-color: #fef2f2; }
.bg-\[rgba\(0\2c 0\2c 0\2c 0\.5\)\] { background-color: rgba(0, 0, 0, 0.5); }
.bg-\[rgba\(239\2c 68\2c 68\2c 0\.9\)\] { background-color: rgba(239, 68, 68, 0.9); }
.modal-overlay { background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); }

.text-white { color: #ffffff; }
.text-gray-300 { color: #d1d5db; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-900 { color: #111827; }
.text-blue-600 { color: #2563eb; }
.text-blue-700 { color: #1d4ed8; }
.text-blue-900 { color: #1e3a8a; }
.text-green-600 { color: #16a34a; }
.text-red-500 { color: #ef4444; }
.text-red-600 { color: #dc2626; }
.text-purple-600 { color: #9333ea; }
.text-purple-500 { color: #a855f7; }
.text-amber-500 { color: #f59e0b; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-normal { font-weight: 400; }
.leading-none { line-height: 1; }
.leading-relaxed { line-height: 1.625; }
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.whitespace-nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opacity-70 { opacity: 0.7; }
.opacity-0 { opacity: 0; }

.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); }
.shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); }

.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }
.select-none { user-select: none; }

.resize-none { resize: none; }

.appearance-none { appearance: none; }
.select-field {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
    padding-right: 2.5rem;
}

.object-cover { object-fit: cover; }
.object-contain { object-fit: contain; }

.btn-primary {
    background: #2563eb;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-primary:hover {
    background: #1d4ed8;
}
.btn-primary:disabled {
    background: #93c5fd;
    cursor: not-allowed;
}
.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-secondary:hover {
    background: #e5e7eb;
}

.input-field {
    border: 1px solid #e5e7eb;
    background: #ffffff;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 0.875rem;
}
.input-field:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.input-field::placeholder {
    color: #9ca3af;
}

.card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.loading-spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}
.loading-spinner.w-5 {
    width: 1.25rem;
    height: 1.25rem;
    border-width: 2px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.image-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.image-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.history-item {
    cursor: pointer;
    transition: background 0.2s ease;
}
.history-item:hover {
    background: #f9fafb;
}

.toast {
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
}
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.upload-area {
    border: 2px dashed #e5e7eb;
    transition: all 0.2s ease;
    cursor: pointer;
}
.upload-area:hover {
    border-color: #2563eb;
    background: #eff6ff;
}
.upload-area.dragover {
    border-color: #2563eb;
    background: #eff6ff;
}

.ref-thumb {
    position: relative;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}
.ref-thumb img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
}
.ref-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    transition: background 0.2s;
    border: none;
}
.ref-remove:hover {
    background: #dc2626;
}

textarea.input-field {
    font-family: inherit;
}

img {
    display: block;
    max-width: 100%;
}

button {
    font-family: inherit;
}

a {
    text-decoration: none;
    color: inherit;
}

select.input-field option {
    padding: 0.5rem;
}

@media (min-width: 1024px) {
    .lg\:col-span-2 { grid-column: span 2 / span 2; }
    .lg\:col-span-3 { grid-column: span 3 / span 3; }
    .lg\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.p-4 { padding: 1rem; }
.p-2 { padding: 0.5rem; }
.flex-grow { flex-grow: 1; }
.min-w-0 { min-width: 0; }
.stroke-current { stroke: currentColor; }

img[src=""] {
    visibility: hidden;
}

.size-icon {
    display: inline-block;
    flex-shrink: 0;
}

.size-icon-1-1 {
    width: 20px;
    height: 20px;
}

.size-icon-4-3 {
    width: 24px;
    height: 18px;
}

.size-icon-3-4 {
    width: 18px;
    height: 24px;
}

.size-icon-16-9 {
    width: 28px;
    height: 16px;
}

.size-icon-9-16 {
    width: 16px;
    height: 28px;
}
