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

:root {
    --bg-deep: #0a0612;
    --bg-surface: rgba(20, 10, 35, 0.8);
    --border-glow: rgba(150, 100, 255, 0.3);
    --text-primary: #e8e0f0;
    --text-secondary: #a090c0;
    --accent-primary: #9060ff;
    --accent-secondary: #ff60a0;
    --accent-gold: #ffd700;
}

body {
    font-family: 'Rajdhani', sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, rgba(150, 100, 255, 0.8), transparent);
    border-radius: 50%;
    animation: float 20s infinite ease-in-out;
}

@keyframes float {
    0%, 100% { transform: translateY(0) translateX(0); opacity: 0; }
    10% { opacity: 0.6; }
    50% { transform: translateY(-100vh) translateX(50px); opacity: 0.3; }
    90% { opacity: 0.6; }
}

.app-container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    padding: 30px 0;
}

.title {
    font-family: 'Cinzel', serif;
    font-size: clamp(1.5rem, 5vw, 3rem);
    font-weight: 900;
    background: linear-gradient(135deg, #ff60a0, #9060ff, #60d0ff, #ff60a0);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 5s ease infinite;
    text-shadow: 0 0 30px rgba(150, 100, 255, 0.5);
    line-height: 1.2;
}

@keyframes shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-top: 10px;
}

.oracle-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    padding: 8px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-glow);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #50ff50;
    border-radius: 50%;
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 5px #50ff50; }
    50% { box-shadow: 0 0 15px #50ff50, 0 0 25px #50ff50; }
}

.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin: 20px 0;
}

@media (min-width: 900px) {
    .main-content {
        grid-template-columns: 1fr 320px;
        grid-template-rows: auto auto;
    }
    
    .canvas-container {
        grid-row: span 2;
    }
}

.canvas-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(ellipse at center, rgba(30, 15, 50, 0.8), var(--bg-deep));
    border: 2px solid var(--border-glow);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 0 40px rgba(150, 100, 255, 0.2), inset 0 0 60px rgba(150, 100, 255, 0.1);
    min-height: 300px;
}

#auraCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 6, 18, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 18px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid transparent;
    border-top-color: var(--accent-primary);
    border-right-color: var(--accent-secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    margin-top: 20px;
    font-size: 1.1rem;
    color: var(--text-secondary);
    animation: fadeInOut 0.5s ease;
    text-align: center;
    padding: 0 20px;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.controls-panel, .details-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glow);
    border-radius: 16px;
    padding: 20px;
}

.oracle-button {
    position: relative;
    width: 100%;
    padding: 16px 24px;
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.oracle-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(150, 100, 255, 0.4);
}

.oracle-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3), transparent 60%);
    animation: rotate 3s linear infinite;
    pointer-events: none;
}

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

.seed-section {
    margin-top: 20px;
}

.seed-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.seed-input-group {
    display: flex;
    gap: 8px;
}

.seed-input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    font-family: monospace;
    font-size: 0.7rem;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glow);
    border-radius: 8px;
    outline: none;
}

.seed-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(150, 100, 255, 0.3);
}

.seed-btn {
    padding: 10px 14px;
    background: rgba(150, 100, 255, 0.2);
    border: 1px solid var(--border-glow);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.seed-btn:hover {
    background: rgba(150, 100, 255, 0.4);
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

.action-btn {
    padding: 12px 16px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(150, 100, 255, 0.15);
    border: 1px solid var(--border-glow);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.action-btn:hover {
    background: rgba(150, 100, 255, 0.3);
    transform: translateY(-1px);
}

.panel-title {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: var(--accent-primary);
    margin-bottom: 15px;
    text-align: center;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(150, 100, 255, 0.1);
    gap: 10px;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.detail-value {
    font-weight: 600;
    text-align: right;
    word-break: break-word;
}

.rarity-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
}

.rarity-badge.common { background: #606060; }
.rarity-badge.uncommon { background: #2e7d32; }
.rarity-badge.rare { background: #1565c0; }
.rarity-badge.epic { background: #7b1fa2; }
.rarity-badge.legendary { 
    background: linear-gradient(135deg, #ff8f00, #ffd700);
    color: #000;
    animation: legendaryPulse 2s infinite;
}

@keyframes legendaryPulse {
    0%, 100% { box-shadow: 0 0 5px #ffd700; }
    50% { box-shadow: 0 0 15px #ffd700, 0 0 25px #ff8f00; }
}

.gallery-section {
    margin-top: 40px;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.gallery-title {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.clear-btn {
    padding: 8px 16px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.85rem;
    color: #ff6060;
    background: rgba(255, 60, 60, 0.1);
    border: 1px solid rgba(255, 60, 60, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: rgba(255, 60, 60, 0.2);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

.empty-gallery {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px dashed var(--border-glow);
    border-radius: 12px;
}

.gallery-card {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border-glow);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.gallery-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(150, 100, 255, 0.3);
}

.gallery-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.gallery-info {
    padding: 10px;
    text-align: center;
}

.gallery-name {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-rarity {
    display: inline-block;
    margin-top: 5px;
    padding: 2px 8px;
    font-size: 0.6rem;
    border-radius: 10px;
}

.delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    font-size: 16px;
    line-height: 1;
    color: #ff6060;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.gallery-card:hover .delete-btn {
    opacity: 1;
}

.footer {
    text-align: center;
    padding: 40px 20px;
    margin-top: 40px;
    border-top: 1px solid var(--border-glow);
}

.disclaimer {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.footer-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 10px;
}

.footer-link {
    display: inline-block;
    margin-top: 15px;
    padding: 8px 20px;
    color: var(--accent-primary);
    text-decoration: none;
    border: 1px solid var(--accent-primary);
    border-radius: 20px;
    transition: all 0.2s;
}

.footer-link:hover {
    background: var(--accent-primary);
    color: white;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    padding: 20px;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border-glow);
    border-radius: 20px;
    padding: 30px;
    max-width: 90%;
    max-height: 90vh;
    overflow: auto;
    text-align: center;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10;
}

.modal-close:hover {
    color: var(--accent-secondary);
}

#modalCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

.modal-details {
    margin-top: 20px;
    text-align: left;
}

.modal-details h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: var(--accent-primary);
    margin-bottom: 15px;
    text-align: center;
    word-break: break-word;
}

.modal-details p {
    margin: 8px 0;
    color: var(--text-secondary);
}

.modal-details strong {
    color: var(--text-primary);
}

.seed-display {
    font-family: monospace;
    font-size: 0.7rem;
    word-break: break-all;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 8px;
    margin-top: 15px;
}

@media (max-width: 600px) {
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .oracle-status .status-text {
        display: none;
    }
    
    .oracle-status::after {
        content: "VRF v0.1 (Simulated)";
        font-size: 0.7rem;
    }
    
    .title {
        font-size: 1.4rem;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .detail-value {
        text-align: left;
    }
}