@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@300;400;600&family=IM+Fell+English:ital@0;1&display=swap');

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

#nofg-container {
    background: #000;
    color: #e8d5a3;
    font-family: 'IM Fell English', serif;
    max-width: 700px;
    margin: 0 auto;
    padding: 60px 30px;
    text-align: center;
    min-height: 600px;
    position: relative;
    overflow: hidden;
}

/* Grain texture overlay */
#nofg-container::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 100;
    opacity: 0.4;
}

/* Fog overlay */
#nofg-fog {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(ellipse at 50% 100%, rgba(138,115,64,0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
    animation: fogBreath 8s ease-in-out infinite;
}

@keyframes fogBreath {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50%       { opacity: 0.7; transform: scale(1.05); }
}

/* Sections */
#nofg-upload-section,
#nofg-loading-section,
#nofg-result-section {
    position: relative;
    z-index: 10;
}

/* ── UPLOAD SECTION ── */
.nofg-eyebrow {
    font-family: 'Cinzel', serif;
    font-size: 10px;
    letter-spacing: 5px;
    color: #5a4f3a;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.nofg-title {
    font-family: 'Cinzel', serif;
    font-size: 34px;
    font-weight: 300;
    color: #e8d5a3;
    margin: 0 0 14px;
    letter-spacing: 3px;
}

.nofg-subtitle {
    font-size: 15px;
    color: #4a4035;
    margin-bottom: 44px;
    font-style: italic;
    line-height: 1.7;
}

/* Path grid */
.nofg-path-label {
    font-size: 10px;
    letter-spacing: 4px;
    color: #3a3228;
    margin-bottom: 16px;
    text-transform: uppercase;
}

.nofg-path-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 40px;
}

.nofg-path-btn {
    border: 1px solid #1a1810;
    padding: 18px 12px;
    cursor: pointer;
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background: #030302;
}

.nofg-path-btn:hover,
.nofg-path-btn.active {
    border-color: #6a5530;
    background: #0a0906;
    box-shadow: 0 0 24px rgba(138,115,64,0.08), inset 0 0 20px rgba(138,115,64,0.03);
}

.path-icon { font-size: 22px; }
.path-name { font-family: 'Cinzel', serif; font-size: 12px; color: #c8b580; letter-spacing: 1px; }
.path-sub  { font-size: 10px; color: #3a3228; letter-spacing: 2px; }

/* Dropzone */
#nofg-dropzone {
    border: 1px solid #1a1810;
    padding: 50px 30px;
    cursor: pointer;
    transition: all 0.5s ease;
    background: #020201;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

#nofg-dropzone::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(138,115,64,0.04) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s;
}

#nofg-dropzone:hover::after,
#nofg-dropzone.drag-over::after { opacity: 1; }
#nofg-dropzone:hover,
#nofg-dropzone.drag-over { border-color: #6a5530; }

.nofg-drop-icon { font-size: 28px; color: #6a5530; margin-bottom: 14px; display: block; }
.nofg-drop-text { font-family: 'Cinzel', serif; font-size: 15px; color: #c8b580; margin-bottom: 8px; letter-spacing: 2px; }
.nofg-drop-sub  { font-size: 11px; color: #2a2218; letter-spacing: 1px; }

#nofg-preview-wrap { margin-bottom: 24px; }
#nofg-preview-img {
    max-width: 180px;
    max-height: 180px;
    border: 1px solid #6a5530;
    filter: sepia(30%) brightness(0.85);
    display: block;
    margin: 0 auto;
    box-shadow: 0 0 40px rgba(138,115,64,0.1);
}

#nofg-submit-btn {
    background: transparent;
    border: 1px solid #6a5530;
    color: #c8b580;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    letter-spacing: 4px;
    padding: 16px 52px;
    cursor: pointer;
    transition: all 0.4s ease;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

#nofg-submit-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(138,115,64,0.15) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s;
}

#nofg-submit-btn:hover::before { opacity: 1; }
#nofg-submit-btn:hover {
    border-color: #8a7340;
    color: #e8d5a3;
    box-shadow: 0 0 30px rgba(138,115,64,0.15);
}

/* ── LOADING SECTION ── */
#nofg-loading-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    position: relative;
}

/* Particles canvas */
#nofg-particles {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
}

#nofg-loading-inner {
    position: relative;
    z-index: 2;
    text-align: center;
    width: 100%;
}

.nofg-loading-moon {
    font-size: 42px;
    display: block;
    margin: 0 auto 40px;
    animation: moonPulse 4s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(138,115,64,0.4));
}

@keyframes moonPulse {
    0%, 100% { opacity: 0.5; transform: scale(1);    filter: drop-shadow(0 0 10px rgba(138,115,64,0.2)); }
    50%       { opacity: 1;   transform: scale(1.04); filter: drop-shadow(0 0 30px rgba(138,115,64,0.5)); }
}

/* Ambient glow ring */
.nofg-glow-ring {
    width: 120px;
    height: 120px;
    border: 1px solid rgba(138,115,64,0.15);
    border-radius: 50%;
    margin: 0 auto 16px;
    position: relative;
    animation: glowRing 4s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nofg-glow-ring::before {
    content: '';
    position: absolute;
    inset: -8px;
    border: 1px solid rgba(138,115,64,0.07);
    border-radius: 50%;
    animation: glowRing 4s ease-in-out infinite reverse;
}

@keyframes glowRing {
    0%, 100% { box-shadow: 0 0 20px rgba(138,115,64,0.05); }
    50%       { box-shadow: 0 0 50px rgba(138,115,64,0.15); }
}

/* Typing text */
#nofg-loading-label {
    font-family: 'Cinzel', serif;
    font-size: 9px;
    letter-spacing: 5px;
    color: #3a3228;
    text-transform: uppercase;
    margin-bottom: 20px;
    display: block;
}

#nofg-loading-text {
    font-family: 'IM Fell English', serif;
    font-size: 16px;
    color: #8a7340;
    min-height: 28px;
    margin-bottom: 48px;
    font-style: italic;
    letter-spacing: 1px;
}

#nofg-cursor {
    display: inline-block;
    width: 1px;
    height: 16px;
    background: #8a7340;
    margin-left: 2px;
    vertical-align: middle;
    animation: blink 1s step-end infinite;
}

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

/* Progress line */
.nofg-progress-wrap {
    width: 240px;
    margin: 0 auto 32px;
}

.nofg-progress-track {
    height: 1px;
    background: #0f0e0a;
    width: 100%;
    overflow: hidden;
    position: relative;
}

.nofg-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, transparent, #8a7340, transparent);
    width: 30%;
    position: absolute;
    animation: progressSlide 3s ease-in-out infinite;
}

@keyframes progressSlide {
    0%   { left: -30%; }
    100% { left: 130%; }
}

.nofg-progress-sub {
    font-size: 9px;
    color: #2a2218;
    letter-spacing: 3px;
    margin-top: 12px;
    text-transform: uppercase;
}

/* ── RESULT SECTION ── */
#nofg-result-section {
    animation: sectionFadeIn 1.5s ease forwards;
}

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

/* Rarity badge */
.nofg-rarity-wrap {
    margin-bottom: 8px;
}

.nofg-rarity-badge {
    display: inline-block;
    font-family: 'Cinzel', serif;
    font-size: 9px;
    letter-spacing: 4px;
    padding: 4px 16px;
    border: 1px solid currentColor;
    text-transform: uppercase;
}

.rarity-common    { color: #5a5040; border-color: #2a2218; }
.rarity-rare      { color: #8a7340; border-color: #6a5530; }
.rarity-forbidden { color: #8a3030; border-color: #5a2020; }
.rarity-lunar     { color: #6a7a9a; border-color: #4a5a7a; box-shadow: 0 0 20px rgba(106,122,154,0.2); }
.rarity-shrine    { color: #9a8050; border-color: #7a6040; box-shadow: 0 0 20px rgba(154,128,80,0.2); }

/* Generated title */
.nofg-gen-title {
    font-family: 'Cinzel', serif;
    font-size: 30px;
    font-weight: 300;
    color: #e8d5a3;
    margin: 16px 0 8px;
    letter-spacing: 3px;
    line-height: 1.3;
}

.nofg-gen-subtitle {
    font-size: 12px;
    color: #4a4035;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 32px;
}

/* Lore */
.nofg-lore {
    font-style: italic;
    color: #5a5040;
    font-size: 15px;
    line-height: 1.9;
    max-width: 480px;
    margin: 0 auto 40px;
}

/* Result image */
#nofg-result-img-wrap {
    position: relative;
    display: inline-block;
    margin-bottom: 40px;
}

#nofg-result-img-wrap::before {
    content: '';
    position: absolute;
    inset: -1px;
    border: 1px solid #3a3228;
    pointer-events: none;
    z-index: 2;
}

#nofg-result-img-wrap::after {
    content: '';
    position: absolute;
    inset: -20px;
    background: radial-gradient(ellipse at center, rgba(138,115,64,0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: imgGlow 4s ease-in-out infinite;
}

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

#nofg-result-img {
    max-width: 100%;
    max-height: 520px;
    display: block;
    position: relative;
    z-index: 1;
    filter: contrast(1.05) brightness(0.95);
}

/* CTA */
.nofg-result-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.nofg-cta-btn {
    display: inline-block;
    border: 1px solid #8a7340;
    color: #c8b580;
    font-family: 'Cinzel', serif;
    font-size: 11px;
    letter-spacing: 4px;
    padding: 16px 48px;
    text-decoration: none;
    transition: all 0.4s ease;
    text-transform: uppercase;
    background: transparent;
    position: relative;
    overflow: hidden;
}

.nofg-cta-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(138,115,64,0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.4s;
}

.nofg-cta-btn:hover::before { opacity: 1; }
.nofg-cta-btn:hover {
    border-color: #c8b580;
    color: #e8d5a3;
    box-shadow: 0 0 40px rgba(138,115,64,0.4);
}

#nofg-retry-btn {
    background: transparent;
    border: none;
    color: #2a2218;
    font-family: 'IM Fell English', serif;
    font-size: 12px;
    font-style: italic;
    cursor: pointer;
    padding: 0;
    transition: color 0.3s;
}

#nofg-retry-btn:hover { color: #6a5530; }

/* Fade utility */
.nofg-fade-out { animation: fadeOut 0.6s ease forwards; }
.nofg-fade-in  { animation: fadeIn  0.8s ease forwards; }

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

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

/* Divider */
.nofg-divider {
    width: 60px;
    height: 1px;
    background: #2a2218;
    margin: 32px auto;
}

/* Mobile */
@media (max-width: 480px) {
    #nofg-container { padding: 40px 20px; }
    .nofg-title     { font-size: 26px; }
    .nofg-gen-title { font-size: 22px; }
    .nofg-path-grid { grid-template-columns: repeat(2, 1fr); }
}

.nofg-pose-select {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 40px;
}

.nofg-pose-btn {
    border: 1px solid #1a1810;
    padding: 18px 12px;
    cursor: pointer;
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background: #030302;
}

.nofg-pose-btn:hover,
.nofg-pose-btn.active {
    border-color: #6a5530;
    background: #0a0906;
    box-shadow: 0 0 24px rgba(138,115,64,0.08), inset 0 0 20px rgba(138,115,64,0.03);
}
.nofg-pose-btn.active {
    border-color: #c6a56b;
    background:
        radial-gradient(circle at top,
        rgba(198,165,107,0.12),
        rgba(0,0,0,0.95));
        
    box-shadow:
        0 0 30px rgba(198,165,107,0.15),
        inset 0 0 30px rgba(198,165,107,0.05);
}

#nofg-current-ritual{
    margin-top:14px;
    margin-bottom:20px;
    text-align:center;
}

.nofg-ritual-path{
    font-size:12px;
    letter-spacing:3px;
    color:#9f8a63;
    margin-bottom:8px;
}

.nofg-ritual-pose{
    font-size:18px;
    letter-spacing:2px;
    color:#e7dcc2;
    margin-bottom:10px;
}

.nofg-ritual-lore{
    font-size:13px;
    color:#7d7463;
    font-style:italic;
    letter-spacing:1px;
}

#nofg-current-ritual {
    display: block;
    margin: 16px 0 22px;
    color: #d8c49a;
    text-align: center;
    z-index: 10;
    position: relative;
}

.nofg-ritual-path {
    font-size: 12px;
    letter-spacing: 4px;
    margin-bottom: 8px;
}

.nofg-ritual-pose {
    font-size: 15px;
    letter-spacing: 3px;
}
