@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    --bg-base: #09090b;
    --bg-elevated: #131316;
    --bg-surface: #1a1a1f;
    --bg-surface-hover: #222228;
    --bg-input: #18181b;
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-glass-hover: rgba(255, 255, 255, 0.06);

    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-dim: rgba(59, 130, 246, 0.12);
    --accent-glow: rgba(59, 130, 246, 0.25);
    --success: #22c55e;
    --success-dim: rgba(34, 197, 94, 0.12);
    --danger: #ef4444;
    --danger-dim: rgba(239, 68, 68, 0.12);

    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-accent: #3b82f6;

    --border: rgba(255, 255, 255, 0.06);
    --border-subtle: rgba(255, 255, 255, 0.04);
    --border-accent: rgba(59, 130, 246, 0.3);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 30px var(--accent-glow);

    --font-sans: 'Inter', 'Space Grotesk', system-ui, -apple-system, sans-serif;
    --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59, 130, 246, 0.1), transparent),
        radial-gradient(ellipse 60% 40% at 80% 50%, rgba(99, 102, 241, 0.05), transparent),
        radial-gradient(ellipse 60% 40% at 20% 80%, rgba(34, 197, 94, 0.03), transparent);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
    background:
        radial-gradient(ellipse 50% 30% at 30% 10%, rgba(56, 189, 248, 0.12), transparent 70%),
        radial-gradient(ellipse 40% 25% at 70% 15%, rgba(139, 92, 246, 0.10), transparent 70%),
        radial-gradient(ellipse 35% 20% at 50% 5%, rgba(34, 211, 238, 0.08), transparent 60%);
    filter: blur(40px);
    animation: aurora 12s ease-in-out infinite alternate;
}

@keyframes aurora {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.5;
    }
    33% {
        transform: translateY(8px) scale(1.02) translateX(-10px);
        opacity: 0.6;
    }
    66% {
        transform: translateY(-5px) scale(0.98) translateX(10px);
        opacity: 0.45;
    }
    100% {
        transform: translateY(3px) scale(1.01) translateX(-5px);
        opacity: 0.55;
    }
}

#app {
    position: relative;
    z-index: 1;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

header {
    text-align: center;
    padding: 56px 0 40px;
    position: relative;
}

header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

.header-content h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.header-content h1 .accent {
    color: var(--accent);
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 400;
    margin-top: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.section-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    letter-spacing: -0.3px;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 24px;
    line-height: 1.7;
}

.card {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    transition: border-color var(--transition-base);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.08);
}

.card h2 {
    font-family: var(--font-display);
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.card > .info-text:first-of-type {
    margin-bottom: 24px;
}

.guide-section {
    margin-bottom: 32px;
}

.guide-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.guide-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

.step-content {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.step-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.file-path {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent);
    white-space: nowrap;
}

.file-path svg {
    width: 14px;
    height: 14px;
    opacity: 0.5;
}

.upload-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 24px 0;
}

.upload-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 20px 24px;
    text-align: center;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.upload-box::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 2px dashed transparent;
    transition: border-color var(--transition-base);
    pointer-events: none;
}

.upload-box:hover {
    background: var(--bg-surface-hover);
    border-color: transparent;
}

.upload-box:hover::before {
    border-color: var(--accent);
}

.upload-box.loaded {
    border-color: var(--success);
    background: var(--success-dim);
}

.upload-box.loaded::before {
    border-color: transparent;
}

.upload-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    display: block;
    filter: grayscale(0.2);
}

.upload-box h3 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.upload-box .upload-desc {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 6px;
    line-height: 1.4;
}

.upload-box .expected-file {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    margin-bottom: 16px;
}

.upload-box input[type="file"] {
    display: none;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    color: var(--text-secondary);
    padding: 9px 20px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    border: 1px solid var(--border);
    text-decoration: none;
}

.upload-btn:hover {
    background: var(--accent);
    color: var(--bg-base);
    border-color: var(--accent);
}

.file-status {
    display: block;
    margin-top: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: color var(--transition-base);
}

.file-status.loaded {
    color: var(--success);
}

/* Bulk Upload */
.bulk-upload {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
}

.bulk-upload p {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 12px;
}

.bulk-upload input[type="file"] {
    display: none;
}

.bulk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    border: 1px dashed var(--text-muted);
    color: var(--text-muted);
    padding: 10px 24px;
    border-radius: var(--radius-full);
    font-family: var(--font-sans);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.bulk-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    border-style: solid;
    background: var(--accent-dim);
}

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 0;
    padding: 4px;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.tab:hover {
    color: var(--text-secondary);
    background: var(--bg-glass-hover);
}

.tab.active {
    background: var(--accent);
    color: var(--bg-base);
    font-weight: 600;
}

.tab.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.tab.disabled:hover {
    background: transparent;
    color: var(--text-muted);
}

.tabs + .card,
.tabs + .editor-panel {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    margin-top: 0;
}

.editor-group {
    margin-bottom: 28px;
    padding: 24px;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

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

.editor-group h3 {
    font-family: var(--font-display);
    color: var(--text-primary);
    margin-bottom: 16px;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-group h3::before {
    content: '';
    width: 3px;
    height: 16px;
    background: var(--accent);
    border-radius: 2px;
    flex-shrink: 0;
}

.editor-group h4 {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.info-text {
    color: var(--text-muted);
    font-size: 0.825rem;
    margin-bottom: 16px;
    line-height: 1.7;
}

.info-text code {
    background: var(--bg-surface);
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--accent);
    border: 1px solid var(--border-subtle);
}

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

.field-row label {
    min-width: 140px;
    color: var(--text-secondary);
    font-size: 0.825rem;
    font-weight: 500;
}

.field-row input,
.field-row select {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    max-width: 350px;
    transition: all var(--transition-fast);
    appearance: none;
    -webkit-appearance: none;
}

.field-row select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.field-row input:hover,
.field-row select:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.field-row input:focus,
.field-row select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.field-hint {
    color: var(--text-muted);
    font-size: 0.78rem;
    white-space: nowrap;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 8px;
}

.xp-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.preset-btn {
    background: var(--bg-surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.preset-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 10px;
    margin: 16px 0;
}

.char-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 14px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.char-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity var(--transition-fast);
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.06) 0%, transparent 100%);
    pointer-events: none;
}

.char-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.char-card:hover::after {
    opacity: 1;
}

.char-card.unlocked {
    border-color: rgba(34, 197, 94, 0.3);
    background: var(--success-dim);
}

.char-card.unlocked::after {
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.06) 0%, transparent 100%);
    opacity: 1;
}

.char-card.locked {
    opacity: 0.55;
}

.char-card.locked:hover {
    opacity: 0.8;
}

.char-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.char-id {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.7rem;
}

.char-desc {
    color: var(--text-muted);
    font-size: 0.72rem;
    margin-top: 4px;
    line-height: 1.4;
}

.char-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--success);
    color: var(--bg-base);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.char-card.locked .char-badge {
    background: var(--bg-surface-hover);
    color: var(--text-muted);
}

.action-row {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.action-btn {
    background: var(--accent);
    color: var(--bg-base);
    border: none;
    padding: 10px 22px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.825rem;
    font-weight: 600;
    transition: all var(--transition-fast);
    letter-spacing: 0.01em;
}

.action-btn:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-1px);
}

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

.action-btn.secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.action-btn.secondary:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
    background: var(--bg-glass-hover);
    box-shadow: none;
}

/* Save Button */
.save-row {
    display: flex;
    gap: 10px;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
    flex-wrap: wrap;
}

.save-btn {
    background: var(--success);
    color: var(--bg-base);
    border: none;
    padding: 12px 28px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 700;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.save-btn::before {
    content: '↓';
    font-size: 1rem;
    font-weight: 700;
}

.save-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.25);
}

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

.entity-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 16px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
}

.entity-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition-fast);
}

.entity-item:hover {
    background: var(--bg-glass-hover);
}

.entity-item:last-child {
    border-bottom: none;
}

.entity-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.entity-type {
    font-weight: 600;
    font-size: 0.85rem;
    min-width: 160px;
}

.entity-count {
    background: var(--accent-dim);
    color: var(--accent);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.entity-actions {
    display: flex;
    gap: 6px;
}

.entity-actions button {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    transition: all var(--transition-fast);
}

.entity-actions button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.entity-actions button.danger:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* Add Entity Form */
.add-entity-form {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.save-slot {
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 12px;
    border: 1px solid var(--border-subtle);
    transition: border-color var(--transition-base);
}

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

.save-slot h3::before {
    content: '';
    width: 3px;
    height: 14px;
    background: var(--accent);
    border-radius: 2px;
}

.save-slot.empty {
    opacity: 0.4;
}

.save-slot.active {
    border-color: rgba(34, 197, 94, 0.3);
}

.raw-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    padding: 3px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    width: fit-content;
}

.raw-tab {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.raw-tab:hover {
    color: var(--text-secondary);
}

.raw-tab.active {
    background: var(--accent);
    color: var(--bg-base);
    font-weight: 600;
}

#raw-textarea {
    width: 100%;
    min-height: 480px;
    background: var(--bg-base);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.7;
    resize: vertical;
    tab-size: 2;
    transition: border-color var(--transition-fast);
}

#raw-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.console-section {
    margin-bottom: 28px;
}

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

.console-section h3::before {
    content: '›';
    color: var(--accent);
    font-size: 1.2rem;
    font-weight: 700;
}

.command-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.command {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    flex-wrap: wrap;
}

.command:hover {
    background: var(--bg-glass-hover);
}

.command code {
    background: var(--bg-base);
    color: var(--accent);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    border: 1px solid var(--border-subtle);
}

.command code:hover {
    background: var(--accent-dim);
    border-color: var(--border-accent);
}

.command code:active {
    background: var(--accent);
    color: var(--bg-base);
    border-color: var(--accent);
}

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

.prefab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 4px;
    max-height: 380px;
    overflow-y: auto;
    padding: 12px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.prefab-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    transition: background var(--transition-fast);
}

.prefab-item:hover {
    background: var(--bg-glass-hover);
}

.prefab-item .prefab-name {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.prefab-item .prefab-label {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    z-index: 1000;
    transition: all var(--transition-base);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast::before {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: var(--success);
    color: var(--bg-base);
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.toast.hidden {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
    pointer-events: none;
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.3);
}

.toast.error::before {
    content: '✕';
    background: var(--danger);
}

.hidden {
    display: none !important;
}

footer {
    text-align: center;
    padding: 40px 0 0;
    margin-top: 40px;
}

footer::before {
    content: '';
    display: block;
    width: 40px;
    height: 1px;
    background: var(--border);
    margin: 0 auto 32px;
}

footer p {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.7;
}

.disclaimer {
    font-size: 0.72rem !important;
    margin-top: 6px;
    opacity: 0.5;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

@media (max-width: 768px) {
    #app {
        padding: 0 16px 60px;
    }

    header {
        padding: 40px 0 32px;
    }

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

    .card {
        padding: 24px 20px;
        border-radius: var(--radius-md);
    }

    .upload-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .field-row {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .field-row label {
        min-width: unset;
    }

    .field-row input,
    .field-row select {
        max-width: unset;
    }

    .tabs {
        gap: 2px;
        padding: 3px;
    }

    .tab {
        padding: 8px 12px;
        font-size: 0.72rem;
    }

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

    .command {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .guide-step {
        flex-direction: column;
        gap: 8px;
    }

    .step-number {
        margin-top: 0;
    }
}

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

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