:root {
    --bg-dark: #07090f;
    --bg-card: #101522;
    --bg-hover: #1a2132;
    --bg-elevated: #20283a;
    --border: #283147;
    --border-hover: #46526d;
    --text-primary: #f5f7ff;
    --text-secondary: #b5bfd3;
    --text-muted: #8994aa;
    --accent: #ff8a3d;
    --accent-hover: #ffa35f;
    --accent-subtle: rgba(255, 138, 61, 0.1);
    --accent-glow: rgba(255, 107, 53, 0.2);
    --indigo: #7c6cff;
    --indigo-subtle: rgba(124, 108, 255, 0.12);
    --success: #54d69b;
    --error: #ef4444;
    --warning: #eab308;
    --crop-color: #3b82f6;
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.34);
    --shadow-md: 0 14px 36px rgba(0,0,0,0.24);
    --shadow-lg: 0 24px 64px rgba(0,0,0,0.38);
    --transition: 170ms ease;
    --checker: repeating-conic-gradient(#141a27 0% 25%, #20283a 0% 50%) 50% / 12px 12px;
}

@media (prefers-reduced-motion: reduce) {
    :root { --transition: 0ms; }
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

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

button:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid #fbbf24 !important;
    outline-offset: 3px;
    box-shadow: 0 0 0 3px #09090b, 0 0 0 6px #fbbf24 !important;
}

body {
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background:
        radial-gradient(circle at 16% -10%, rgba(255, 107, 53, 0.13), transparent 31rem),
        radial-gradient(circle at 88% 4%, rgba(124, 108, 255, 0.1), transparent 28rem),
        linear-gradient(180deg, #090c14 0, var(--bg-dark) 38rem);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1480px;
    margin: 0 auto;
    padding: 1.25rem 2rem 2rem;
}

.is-hidden {
    display: none !important;
}

.mt-xs {
    margin-top: 0.35rem;
}

.mt-sm {
    margin-top: 0.4rem;
}

.mt-md {
    margin-top: 1rem;
}

.full-width {
    width: 100%;
}

.panel-header.spaced {
    margin-top: 1rem;
}

.section-label.flush {
    margin: 0;
}

.helper-note {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.helper-note.compact {
    font-size: 0.65rem;
}

.inline-check {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.app-header {
    min-height: 4.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 1rem;
    padding: 0.65rem 0.25rem;
    text-align: left;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.7rem;
    margin-bottom: 0.1rem;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(145deg, #ffad66, #ff6b35 58%, #dd471c);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    box-shadow: 0 10px 28px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.28);
}

h1 {
    font-size: 1.35rem;
    font-weight: 760;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    white-space: nowrap;
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.78rem;
    margin: 0 0 0 3.25rem;
}

.trust-signal {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0;
    padding: 0.45rem 0.8rem;
    background: rgba(84, 214, 155, 0.07);
    border: 1px solid rgba(84, 214, 155, 0.22);
    border-radius: 999px;
    font-size: 0.72rem;
    color: var(--success);
    letter-spacing: 0.01em;
}

.trust-signal svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.main-grid {
    display: grid;
    grid-template-columns: minmax(320px, 0.72fr) minmax(620px, 1.48fr);
    gap: 1rem;
    align-items: start;
}

.main-grid > * {
    min-width: 0;
}

@media (max-width: 900px) {
    .main-grid { grid-template-columns: 1fr; }
    .container { padding: 1rem; }
    header { margin-bottom: 1.5rem; }
    h1 { font-size: 1.75rem; }
    .size-grid { grid-template-columns: 1fr 1fr; }
    .emoji-grid { grid-template-columns: repeat(6, 1fr); }
}

@media (max-width: 480px) {
    .container { padding: 0.75rem; }
    h1 { font-size: 1.5rem; }
    .tagline { font-size: 0.85rem; }
    .size-grid { grid-template-columns: 1fr; }
    .emoji-grid { grid-template-columns: repeat(5, 1fr); }
    .control-grid { grid-template-columns: 1fr; }
    .mask-preview-wrap { grid-template-columns: 1fr; }
    .crop-numeric-inputs { flex-wrap: wrap; }
    .custom-size-input { flex-wrap: wrap; }
    .text-color-row { flex-direction: column; gap: 0.5rem; }
    .preset-buttons { gap: 0.25rem; }
}

.panel {
    background: linear-gradient(180deg, rgba(18, 24, 38, 0.97), rgba(13, 18, 29, 0.98));
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.2rem;
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.025);
    min-width: 0;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border);
}

.panel-header h2 {
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.panel-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    background: var(--accent-subtle);
    border: 1px solid rgba(255, 138, 61, 0.22);
    border-radius: 8px;
}

.panel-icon svg {
    width: 18px;
    height: 18px;
}

/* Drop Zone */
.drop-zone {
    border: 1px dashed rgba(255, 138, 61, 0.48);
    border-radius: var(--radius-lg);
    min-height: 240px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 50% 42%, rgba(255, 138, 61, 0.14), transparent 8rem),
        linear-gradient(180deg, rgba(12, 16, 27, 0.9), rgba(8, 11, 18, 0.94));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.018);
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--accent);
    background:
        radial-gradient(circle at 50% 42%, rgba(255, 138, 61, 0.22), transparent 9rem),
        linear-gradient(180deg, rgba(25, 21, 23, 0.94), rgba(10, 12, 19, 0.96));
    box-shadow: 0 0 0 4px rgba(255, 138, 61, 0.06), inset 0 0 36px rgba(255, 107, 53, 0.05);
}

.drop-zone-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.drop-zone-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

.drop-zone-formats {
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.file-input {
    display: none;
}

/* Preview */
.preview-container {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.preview-container.active {
    display: flex;
}

.preview-image-wrapper {
    position: relative;
    background: var(--checker);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    max-width: 100%;
    overflow: hidden;
    border: 1px solid var(--border);
}

.preview-image {
    max-width: 280px;
    max-height: 280px;
    display: block;
    border-radius: 3px;
}

.preview-info {
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

.preview-info span {
    color: var(--accent);
}

.btn-change {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.4rem 0.875rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    transition: all var(--transition);
}

.btn-change:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* Crop Section */
.crop-section {
    display: none;
    margin-top: 1.25rem;
    padding: 1rem;
    background: var(--bg-dark);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.crop-section.active {
    display: block;
}

.crop-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.crop-header h3 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--crop-color);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.crop-header svg {
    color: var(--crop-color);
}

.crop-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}

.btn-crop {
    padding: 0.45rem 0.75rem;
    min-height: 36px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-crop:hover {
    border-color: var(--border-hover);
    background: var(--bg-hover);
}

.btn-crop.active {
    border-color: var(--crop-color);
    background: rgba(59, 130, 246, 0.1);
    color: var(--crop-color);
}

.btn-crop.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    font-weight: 500;
}

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

.btn-crop svg {
    width: 13px;
    height: 13px;
}

.draft-recovery {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: grid;
    gap: 0.6rem;
}

.draft-recovery-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.draft-source-check {
    color: var(--text-secondary);
    font-size: 0.76rem;
}

.draft-source-check input {
    accent-color: var(--accent);
}

.crop-canvas-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--checker);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 0.75rem;
    max-height: 350px;
    border: 1px solid var(--border);
}

#cropCanvas {
    max-width: 100%;
    max-height: 350px;
    cursor: crosshair;
}

.crop-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.crop-info .dimensions {
    color: var(--crop-color);
}

.crop-tolerance {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
}

.crop-tolerance label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.crop-tolerance input[type="range"] {
    flex: 1;
    max-width: 120px;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    -webkit-appearance: none;
}

.crop-tolerance input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--crop-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.crop-tolerance .tolerance-value {
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: 0.7rem;
    color: var(--crop-color);
    min-width: 24px;
}

/* Size Options */
.size-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.size-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.size-option:hover {
    border-color: var(--border-hover);
}

.size-option.selected {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.size-option input {
    display: none;
}

.size-checkbox {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
}

.size-option.selected .size-checkbox {
    background: var(--accent);
    border-color: var(--accent);
}

.size-checkbox svg {
    width: 11px;
    height: 11px;
    stroke: white;
    opacity: 0;
    transition: opacity var(--transition);
}

.size-option.selected .size-checkbox svg {
    opacity: 1;
}

.size-label {
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: 0.8rem;
}

.size-label small {
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-left: 0.15rem;
}

/* Custom Size */
.custom-size-section {
    margin-bottom: 1.25rem;
}

.section-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    display: block;
}

.custom-size-input {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.custom-size-input input {
    width: 72px;
    padding: 0.4rem 0.6rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: 0.8rem;
    transition: border-color var(--transition);
}

.custom-size-input input:focus {
    outline: none;
    border-color: var(--accent);
}

.custom-size-input span {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.btn-add-size {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    transition: all var(--transition);
}

.btn-add-size:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Format Options */
.format-section {
    margin-bottom: 1.25rem;
}

.format-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.format-option {
    padding: 0.4rem 0.875rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: 0.8rem;
    transition: all var(--transition);
}

.format-option:hover {
    border-color: var(--border-hover);
}

.format-option.selected {
    border-color: var(--accent);
    background: var(--accent-subtle);
    color: var(--accent);
}

.format-option input {
    display: none;
}

/* Generate Button */
.generation-actions {
    display: flex;
    gap: 0.65rem;
}

.btn-generate {
    width: 100%;
    padding: 0.875rem 2rem;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-generate:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.2);
    transform: translateY(-1px);
}

.btn-generate:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 8px var(--accent-glow);
}

.btn-generate:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--bg-hover);
    color: var(--text-muted);
    box-shadow: none;
}

.btn-cancel {
    min-width: 7rem;
    padding: 0.875rem 1rem;
    background: transparent;
    border: 1px solid var(--error);
    border-radius: var(--radius-md);
    color: #fca5a5;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-cancel:hover {
    background: rgba(239, 68, 68, 0.1);
}

.generation-progress {
    margin-top: 0.75rem;
    display: grid;
    gap: 0.4rem;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.generation-progress-track {
    height: 0.45rem;
    overflow: hidden;
    border-radius: 999px;
    background: var(--bg-hover);
}

.generation-progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 120ms ease;
}

/* Output Section */
.output-section {
    margin-top: 1.5rem;
}

.output-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.output-item {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    text-align: center;
    transition: border-color var(--transition);
    animation: fadeInUp 200ms ease both;
}

.output-item:hover {
    border-color: var(--border-hover);
}

.output-preview {
    background: var(--checker);
    border-radius: var(--radius-sm);
    padding: 0.625rem;
    margin-bottom: 0.5rem;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.output-preview img {
    max-width: 56px;
    max-height: 56px;
    image-rendering: pixelated;
}

.output-info {
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    line-height: 1.4;
}

.output-file-size {
    color: var(--text-muted);
}

.btn-download {
    width: 100%;
    padding: 0.4rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-download:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.base64-section {
    margin-top: 0.4rem;
}

.base64-label {
    display: none;
}

.base64-container {
    display: flex;
    gap: 0.2rem;
}

.base64-input {
    flex: 1;
    padding: 0.25rem 0.4rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-muted);
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: 0.6rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.base64-input:focus {
    outline: none;
    border-color: var(--accent);
    color: var(--text-secondary);
}

.btn-copy {
    padding: 0.25rem 0.4rem;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.6rem;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.btn-copy:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-copy.copied {
    border-color: var(--success);
    color: var(--success);
}

.btn-copy svg {
    width: 9px;
    height: 9px;
}

/* Download All */
.download-all-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-download-all {
    width: 100%;
    padding: 0.75rem 1.25rem;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-download-all:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Generation Diagnostics */
.diagnostics-panel {
    margin-top: 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.diagnostics-summary {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    background: rgba(59, 130, 246, 0.05);
}

.diagnostics-summary strong {
    display: block;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.diagnostics-summary span {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.5;
}

.diagnostics-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.diagnostics-action {
    min-height: 2rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.72rem;
}

.diagnostics-action svg {
    width: 12px;
    height: 12px;
}

.diagnostics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    padding: 0.75rem;
}

.diagnostics-metric {
    min-width: 0;
    padding: 0.55rem 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.diagnostics-metric span,
.diagnostics-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.diagnostics-metric strong {
    display: block;
    margin-top: 0.2rem;
    color: var(--text-primary);
    font-size: 0.78rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.diagnostics-support {
    padding: 0 0.75rem 0.75rem;
}

.diagnostics-list {
    list-style: none;
    margin: 0.45rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.4rem;
}

.diagnostics-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.74rem;
    line-height: 1.45;
}

.diagnostics-state {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 999px;
    margin-top: 0.22rem;
    background: var(--text-muted);
}

.diagnostics-state.pass { background: var(--success); }
.diagnostics-state.warn { background: var(--warning); }
.diagnostics-state.fail { background: var(--error); }
.diagnostics-state.info { background: var(--crop-color); }

.diagnostics-item strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.76rem;
}

@media (max-width: 480px) {
    .diagnostics-grid { grid-template-columns: 1fr; }
}

/* Export Validation */
.validation-panel {
    margin-top: 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.validation-summary {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.validation-summary strong {
    display: block;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.validation-summary span {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.5;
}

.validation-summary.pass {
    border-color: rgba(34, 197, 94, 0.18);
    background: rgba(34, 197, 94, 0.05);
}

.validation-summary.warn {
    border-color: rgba(234, 179, 8, 0.18);
    background: rgba(234, 179, 8, 0.05);
}

.validation-summary.fail {
    border-color: rgba(239, 68, 68, 0.18);
    background: rgba(239, 68, 68, 0.05);
}

.validation-list {
    list-style: none;
    padding: 0.5rem 0.75rem 0.75rem;
    margin: 0;
    display: grid;
    gap: 0.45rem;
}

.validation-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.74rem;
    line-height: 1.45;
}

.validation-state {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 999px;
    margin-top: 0.22rem;
}

.validation-state.pass { background: var(--success); }
.validation-state.warn { background: var(--warning); }
.validation-state.fail { background: var(--error); }

.validation-item strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.76rem;
}

/* Code Snippets */
.snippet-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.75rem;
}

.snippet-tab {
    padding: 0.4rem 0.55rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.snippet-tab:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.snippet-tab.active {
    background: var(--accent-subtle);
    border-color: rgba(249, 115, 22, 0.45);
    color: var(--accent);
}

.snippet-block {
    margin-top: 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.snippet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.snippet-code {
    padding: 0.75rem;
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: 0.7rem;
    line-height: 1.6;
    color: var(--text-secondary);
    overflow-x: auto;
    white-space: pre;
    margin: 0;
}

/* Status Messages */
.status {
    padding: 0.6rem 0.875rem;
    border-radius: var(--radius-sm);
    margin-top: 0.75rem;
    font-size: 0.8rem;
    display: none;
    animation: fadeInUp 150ms ease;
}

.status.visible {
    display: block;
}

.status.info {
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.status.success {
    background: rgba(34, 197, 94, 0.06);
    border: 1px solid rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.status.error {
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.status.warning {
    background: rgba(234, 179, 8, 0.06);
    border: 1px solid rgba(234, 179, 8, 0.15);
    color: var(--warning);
}

/* Update notice */
.update-notice {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 80;
    width: min(360px, calc(100vw - 2rem));
    padding: 0.85rem;
    background: rgba(18, 18, 22, 0.96);
    border: 1px solid rgba(249, 115, 22, 0.28);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.65rem;
    align-items: center;
    backdrop-filter: blur(12px);
}

.update-notice[hidden] {
    display: none;
}

.update-notice strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.82rem;
}

.update-notice span {
    display: block;
    margin-top: 0.2rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.4;
}

.update-action,
.update-dismiss {
    border: 1px solid var(--border);
    background: var(--bg-hover);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}

.update-action {
    padding: 0.45rem 0.65rem;
    font-size: 0.76rem;
    font-weight: 600;
}

.update-dismiss {
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
    line-height: 1;
}

.update-action:hover,
.update-dismiss:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Supported Formats Info */
.formats-info {
    margin-top: 1.25rem;
    padding: 0.75rem;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    border: 1px solid var(--border);
}

.formats-info h4 {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.4rem;
}

.formats-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.format-badge {
    padding: 0.15rem 0.4rem;
    background: var(--bg-card);
    border-radius: 3px;
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.format-badge.native {
    color: var(--success);
}

.format-badge.limited {
    color: var(--warning);
}

/* Loading spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Footer */
footer {
    text-align: center;
    margin-top: 2.5rem;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    border-top: 1px solid var(--border);
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition);
}

footer a:hover {
    color: var(--accent);
}

/* Input mode tabs */
.input-mode-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.mode-tab {
    flex: 1;
    padding: 0.4rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.mode-tab:hover {
    color: var(--text-primary);
}

.mode-tab.active {
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.mode-tab:focus,
.mode-tab:focus-visible {
    position: relative;
    z-index: 1;
    outline: 3px solid #fbbf24 !important;
    outline-offset: 3px;
    box-shadow: 0 0 0 3px #09090b, 0 0 0 6px #fbbf24 !important;
}

/* Text-to-favicon */
.text-favicon-section {
    padding: 0.25rem 0;
}

.text-input {
    width: 100%;
    padding: 0.6rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: 1.75rem;
    text-align: center;
    transition: border-color var(--transition);
}

.text-input:focus {
    outline: none;
    border-color: var(--accent);
}

.font-select {
    width: 100%;
    padding: 0.4rem 0.6rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8rem;
    transition: border-color var(--transition);
}

.font-select:focus {
    outline: none;
    border-color: var(--accent);
}

.text-color-row {
    display: flex;
    gap: 1.25rem;
}

.text-color-row label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.text-color-row input[type="color"] {
    width: 32px;
    height: 26px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: none;
    cursor: pointer;
    padding: 1px;
}

.shape-options {
    display: flex;
    gap: 0.375rem;
}

.text-preview-area {
    display: flex;
    justify-content: center;
}

#textPreviewCanvas, #emojiPreviewCanvas {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-md);
    background: var(--checker);
    border: 1px solid var(--border);
}

/* Emoji grid */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    max-height: 180px;
    overflow-y: auto;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.4rem;
}

.emoji-btn {
    padding: 0.3rem;
    min-width: 36px;
    min-height: 36px;
    background: none;
    border: 2px solid transparent;
    border-radius: 5px;
    font-size: 1.35rem;
    cursor: pointer;
    line-height: 1;
    text-align: center;
    transition: all var(--transition);
}

.emoji-btn:hover {
    background: var(--bg-hover);
}

.emoji-btn.selected {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

/* SVG dark mode section */
.svg-darkmode-section {
    margin-bottom: 1.25rem;
    padding: 0.75rem;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.svg-color-row {
    display: flex;
    gap: 1.25rem;
    align-items: center;
}

.svg-color-row label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.svg-color-row input[type="color"] {
    width: 32px;
    height: 26px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: none;
    cursor: pointer;
    padding: 1px;
}

.processing-section {
    margin-bottom: 1.25rem;
    padding: 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.control-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.control-field.full {
    grid-column: 1 / -1;
}

.control-field label,
.toggle-field {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.control-field select,
.control-field input[type="file"],
.control-field input[type="number"] {
    width: 100%;
    min-height: 34px;
    padding: 0.4rem 0.55rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.78rem;
}

.control-field input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.color-pair {
    display: flex;
    gap: 0.4rem;
}

.color-pair input[type="color"] {
    width: 100%;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: none;
    cursor: pointer;
    padding: 2px;
}

.toggle-field {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 34px;
    padding: 0.4rem 0.55rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.toggle-field input {
    accent-color: var(--accent);
}

.range-value {
    color: var(--accent);
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
}

.mask-preview-wrap {
    display: grid;
    grid-template-columns: 144px 1fr;
    gap: 0.75rem;
    align-items: center;
}

#maskPreviewCanvas {
    width: 144px;
    height: 144px;
    background: var(--checker);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.template-status {
    min-height: 1rem;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.manifest-metadata-section {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.metadata-heading-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.metadata-status {
    color: var(--success);
    font-size: 0.7rem;
    text-align: right;
}

.metadata-status.error {
    color: var(--error);
}

.manifest-metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    gap: 0.65rem;
}

.metadata-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.metadata-field.full {
    grid-column: 1 / -1;
}

.metadata-field label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.metadata-field input,
.metadata-field select,
.metadata-field textarea {
    width: 100%;
    min-height: 34px;
    padding: 0.4rem 0.55rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.78rem;
    resize: vertical;
}

.metadata-field input[type="color"] {
    height: 34px;
    padding: 2px;
    cursor: pointer;
}

.metadata-field.checkbox-field {
    justify-content: end;
}

.metadata-field .inline-check {
    min-height: 34px;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.55rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: none;
    letter-spacing: 0;
}

.metadata-field .inline-check input[type="checkbox"] {
    width: auto;
    min-height: 0;
    padding: 0;
    accent-color: var(--accent);
}

/* Preset buttons */
.preset-section {
    margin-bottom: 1rem;
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.btn-preset {
    padding: 0.45rem 0.75rem;
    min-height: 36px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-preset:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-preset.active {
    border-color: var(--accent);
    background: var(--accent-subtle);
    color: var(--accent);
}

/* Focus indicators */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.drop-zone:focus-visible {
    border-color: var(--accent);
    background: var(--accent-subtle);
    outline: none;
}

button:focus-visible {
    outline-offset: 1px;
}

.crop-numeric-inputs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
}

.crop-numeric-inputs label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
}

.crop-numeric-inputs input[type="number"] {
    width: 54px;
    padding: 0.25rem 0.35rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-primary);
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: 0.7rem;
    transition: border-color var(--transition);
}

.crop-numeric-inputs input[type="number"]:focus {
    outline: none;
    border-color: var(--crop-color);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

::selection {
    background: rgba(249, 115, 22, 0.25);
    color: var(--text-primary);
}

/* Forge workstation */
.workflow-rail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 3rem minmax(0, 1fr) 3rem minmax(0, 1fr);
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.65rem;
    background: rgba(14, 19, 31, 0.88);
    border: 1px solid rgba(51, 61, 84, 0.8);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.025);
}

.workflow-step {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
    padding: 0.55rem 0.7rem;
    border: 1px solid transparent;
    border-radius: 10px;
}

.workflow-step.is-current {
    background: linear-gradient(135deg, rgba(255, 138, 61, 0.14), rgba(255, 107, 53, 0.06));
    border-color: rgba(255, 138, 61, 0.28);
}

.workflow-number {
    width: 2rem;
    height: 2rem;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    color: var(--text-secondary);
    background: #171d2b;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: 0.72rem;
    font-weight: 800;
}

.workflow-step.is-current .workflow-number {
    color: #160b04;
    background: linear-gradient(145deg, #ffb26f, #ff7b39);
    border-color: transparent;
    box-shadow: 0 7px 20px rgba(255, 107, 53, 0.2);
}

.workflow-copy {
    min-width: 0;
    display: grid;
}

.workflow-copy strong {
    color: var(--text-primary);
    font-size: 0.78rem;
    line-height: 1.3;
}

.workflow-copy small {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.65rem;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-connector {
    height: 1px;
    background: linear-gradient(90deg, var(--border), rgba(124, 108, 255, 0.5), var(--border));
}

.source-panel {
    position: sticky;
    top: 1rem;
}

.forge-panel {
    overflow: hidden;
}

.input-mode-tabs {
    min-height: 42px;
    padding: 4px;
    background: rgba(7, 10, 17, 0.76);
    border-color: #313a50;
    border-radius: 11px;
}

.mode-tab {
    min-height: 32px;
    border-radius: 7px;
}

.mode-tab.active {
    color: #fff5ed;
    background: linear-gradient(180deg, rgba(255, 138, 61, 0.18), rgba(255, 107, 53, 0.1));
    box-shadow: inset 0 0 0 1px rgba(255, 138, 61, 0.27);
}

.drop-zone-icon {
    width: 3.5rem;
    height: 3.5rem;
    display: grid;
    place-items: center;
    margin-bottom: 0.9rem;
    opacity: 1;
    background: rgba(255, 138, 61, 0.1);
    border: 1px solid rgba(255, 138, 61, 0.22);
    border-radius: 15px;
    font-size: 1.55rem;
    box-shadow: 0 10px 30px rgba(255, 107, 53, 0.1);
}

.drop-zone-text {
    max-width: 17rem;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 650;
}

.drop-zone-formats {
    color: #7f8ba2;
    letter-spacing: 0.015em;
}

.preview-image-wrapper {
    background: var(--checker);
    border-color: #35415a;
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 38px rgba(0,0,0,0.24);
}

.crop-section,
.draft-recovery,
.formats-info,
.svg-darkmode-section {
    background: rgba(8, 12, 20, 0.66);
    border-color: #2a354b;
    border-radius: var(--radius-md);
}

.preset-section,
.manifest-metadata-section,
.output-shape-card,
.processing-section {
    margin-bottom: 0.8rem;
    padding: 0.9rem;
    background: rgba(8, 12, 20, 0.58);
    border: 1px solid #28344b;
    border-radius: var(--radius-lg);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.018);
}

.preset-section {
    background:
        linear-gradient(135deg, rgba(124, 108, 255, 0.08), transparent 55%),
        rgba(8, 12, 20, 0.62);
}

.preset-buttons {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.45rem;
}

.btn-preset {
    min-height: 40px;
    padding: 0.48rem 0.65rem;
    background: #111725;
    border-color: #303a50;
    border-radius: 9px;
    color: var(--text-secondary);
    font-weight: 600;
}

.btn-preset:hover {
    border-color: rgba(124, 108, 255, 0.72);
    background: var(--indigo-subtle);
}

.btn-preset.active {
    color: #e9e6ff;
    background: linear-gradient(135deg, rgba(124, 108, 255, 0.24), rgba(124, 108, 255, 0.1));
    border-color: rgba(145, 132, 255, 0.76);
    box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.06);
}

.section-label {
    margin-bottom: 0.55rem;
    color: #c8d0e0;
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.025em;
}

.metadata-heading-row {
    padding-bottom: 0.55rem;
    border-bottom: 1px solid rgba(50, 61, 83, 0.72);
}

.metadata-status {
    padding: 0.18rem 0.5rem;
    background: rgba(84, 214, 155, 0.08);
    border: 1px solid rgba(84, 214, 155, 0.16);
    border-radius: 999px;
    font-size: 0.64rem;
}

.manifest-metadata-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
}

.metadata-field label,
.control-field label,
.toggle-field {
    color: #8995ad;
    font-size: 0.65rem;
    letter-spacing: 0.055em;
}

.metadata-field input,
.metadata-field select,
.metadata-field textarea,
.control-field select,
.control-field input[type="file"],
.control-field input[type="number"],
.custom-size-input input,
.toggle-field {
    min-height: 38px;
    background: #0b101b;
    border-color: #2e3950;
    border-radius: 8px;
}

.metadata-field input:hover,
.metadata-field select:hover,
.metadata-field textarea:hover,
.control-field select:hover,
.control-field input:hover,
.custom-size-input input:hover {
    border-color: var(--border-hover);
}

.metadata-field input:focus,
.metadata-field select:focus,
.metadata-field textarea:focus,
.control-field select:focus,
.control-field input:focus,
.custom-size-input input:focus {
    border-color: var(--indigo);
}

.metadata-field .inline-check {
    min-height: 38px;
    background: #0b101b;
    border-color: #2e3950;
    border-radius: 8px;
}

.output-shape-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(15rem, 0.72fr);
    grid-template-areas:
        "label label"
        "sizes sizes"
        "custom formats";
    column-gap: 1rem;
}

.output-shape-card > .section-label { grid-area: label; }
.output-shape-card > .size-grid { grid-area: sizes; }
.output-shape-card > .custom-size-section { grid-area: custom; }
.output-shape-card > .format-section { grid-area: formats; }

.size-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
    margin-bottom: 0.9rem;
}

.size-option {
    min-height: 40px;
    background: #0d1320;
    border-color: #2d384e;
    border-radius: 9px;
}

.size-option.selected {
    background: linear-gradient(135deg, rgba(255, 138, 61, 0.14), rgba(255, 107, 53, 0.06));
    border-color: rgba(255, 138, 61, 0.58);
}

.custom-size-section,
.format-section {
    margin: 0;
    padding-top: 0.7rem;
    border-top: 1px solid rgba(50, 61, 83, 0.7);
}

.btn-add-size,
.format-option {
    min-height: 38px;
    background: #111725;
    border-color: #303a50;
    border-radius: 8px;
}

.format-option.selected {
    background: var(--accent-subtle);
    border-color: rgba(255, 138, 61, 0.58);
}

.processing-section {
    padding: 0.9rem;
}

.control-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
}

.control-field.full {
    grid-column: span 2;
}

.mask-preview-wrap {
    grid-template-columns: 112px minmax(0, 1fr);
}

#maskPreviewCanvas {
    width: 112px;
    height: 112px;
    border-radius: 12px;
}

.generation-console {
    position: relative;
    display: grid;
    grid-template-columns: minmax(12rem, 0.7fr) minmax(19rem, 1fr);
    gap: 1rem;
    align-items: center;
    margin-top: 1rem;
    padding: 1rem;
    overflow: hidden;
    background:
        radial-gradient(circle at 88% 20%, rgba(255, 138, 61, 0.18), transparent 14rem),
        linear-gradient(135deg, rgba(29, 24, 29, 0.96), rgba(13, 17, 28, 0.98));
    border: 1px solid rgba(255, 138, 61, 0.34);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 36px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.04);
}

.generation-console::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: linear-gradient(180deg, #ffb36f, #ff6b35);
}

.generation-copy {
    min-width: 0;
}

.generation-kicker {
    display: block;
    color: #ffd1ad;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.generation-copy p {
    max-width: 28rem;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.73rem;
    line-height: 1.5;
}

.generation-actions {
    min-width: 0;
}

.btn-generate {
    min-height: 52px;
    padding: 0.8rem 1.5rem;
    color: #1c0c03;
    background: linear-gradient(135deg, #ffae68, #ff7b39 54%, #ff6b35);
    border: 1px solid rgba(255, 196, 143, 0.32);
    border-radius: 11px;
    font-size: 0.92rem;
    font-weight: 800;
    box-shadow: 0 12px 28px rgba(255, 107, 53, 0.2), inset 0 1px 0 rgba(255,255,255,0.34);
}

.btn-generate:hover:not(:disabled) {
    color: #170a03;
    background: linear-gradient(135deg, #ffc18c, #ff914f 54%, #ff7440);
    box-shadow: 0 16px 34px rgba(255, 107, 53, 0.28), inset 0 1px 0 rgba(255,255,255,0.42);
}

.btn-generate:disabled {
    color: #6f7788;
    background: linear-gradient(180deg, #20283a, #1a2130);
    border-color: #303a50;
    opacity: 0.72;
}

.generation-progress,
.generation-console .status {
    grid-column: 1 / -1;
}

.generation-progress-track {
    height: 0.5rem;
    background: #090d16;
    border: 1px solid #2a3346;
}

.generation-progress-track span {
    background: linear-gradient(90deg, var(--accent), #ffca79);
}

.output-section {
    margin-top: 1rem;
    padding: 1rem;
    background:
        linear-gradient(135deg, rgba(124, 108, 255, 0.06), transparent 42%),
        rgba(8, 12, 20, 0.72);
    border: 1px solid #2b3650;
    border-radius: var(--radius-lg);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

.output-section > .panel-header:first-child {
    margin-top: 0;
}

.output-grid {
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
}

.output-item,
.diagnostics-panel,
.validation-panel,
.snippet-block {
    background: #0b101a;
    border-color: #2b3650;
    border-radius: 10px;
}

.download-all-section {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.btn-download-all {
    min-height: 46px;
    background: #151c2a;
    border-color: #35415b;
    border-radius: 10px;
}

.btn-download-all:first-child {
    color: #eeeaff;
    background: linear-gradient(135deg, rgba(124, 108, 255, 0.24), rgba(124, 108, 255, 0.1));
    border-color: rgba(124, 108, 255, 0.62);
}

footer {
    margin-top: 1.25rem;
    padding: 1rem;
    border-top-color: rgba(40, 49, 71, 0.72);
}

@media (max-width: 1120px) {
    .main-grid {
        grid-template-columns: minmax(280px, 0.7fr) minmax(0, 1.3fr);
    }

    .manifest-metadata-grid,
    .size-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .control-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .container {
        padding: 1rem;
    }

    .app-header {
        margin-bottom: 0.75rem;
    }

    .workflow-rail {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .workflow-connector {
        display: none;
    }

    .main-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .source-panel {
        position: static;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 0.7rem;
    }

    .app-header {
        align-items: flex-start;
        gap: 0.75rem;
    }

    .tagline {
        display: none;
    }

    .trust-signal {
        max-width: 10.5rem;
        line-height: 1.35;
    }

    .workflow-rail {
        padding: 0.35rem;
    }

    .workflow-step {
        justify-content: center;
        padding: 0.5rem 0.25rem;
    }

    .workflow-copy small {
        display: none;
    }

    .workflow-number {
        width: 1.7rem;
        height: 1.7rem;
    }

    .panel {
        padding: 0.85rem;
        border-radius: 14px;
    }

    .preset-buttons {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .manifest-metadata-grid,
    .size-grid,
    .control-grid,
    .output-shape-card,
    .generation-console,
    .download-all-section {
        grid-template-columns: minmax(0, 1fr);
    }

    .output-shape-card {
        grid-template-areas:
            "label"
            "sizes"
            "custom"
            "formats";
    }

    .control-field.full,
    .generation-progress,
    .generation-console .status {
        grid-column: 1;
    }

    .generation-console {
        gap: 0.75rem;
    }

    .custom-size-input {
        flex-wrap: nowrap;
    }

    .custom-size-input input {
        min-width: 0;
    }
}
