@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Rajdhani:wght@400;500;600;700&family=Share+Tech+Mono&display=swap');

/* =============================================
   Perso Gen by 8L0R3 — Dark GTA Aesthetic
   ============================================= */

:root {
    --bg-void:    #050506;
    --bg-dark:    #0a0a0d;
    --bg-card:    #0f0f14;
    --bg-input:   #16161e;
    --border:     #2a2a35;
    --border-glow:#c9a84c;
    --gold:       #c9a84c;
    --gold-light: #e8c96a;
    --gold-dim:   #7a6330;
    --red:        #c0392b;
    --red-glow:   #e74c3c;
    --text:       #e8e4d8;
    --text-muted: #6b6860;
    --text-dim:   #3d3c38;
    --mono:       'Share Tech Mono', monospace;
    --display:    'Bebas Neue', sans-serif;
    --body:       'Rajdhani', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
    background: var(--bg-void);
    color: var(--text);
    font-family: var(--body);
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Grain overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    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: 9999;
    opacity: 0.4;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 2px; }

/* ---- NAVBAR ---- */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 60px;
    background: rgba(5,5,6,0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.nav-logo {
    display: flex;
    align-items: baseline;
    gap: 8px;
    text-decoration: none;
}

.nav-logo-main {
    font-family: var(--display);
    font-size: 1.6rem;
    letter-spacing: 2px;
    color: var(--gold);
    text-shadow: 0 0 20px rgba(201,168,76,0.4);
}

.nav-logo-sub {
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
}

.nav-links a {
    font-family: var(--body);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.nav-links a:hover { color: var(--gold); }

.nav-links .btn-nav {
    padding: 6px 18px;
    border: 1px solid var(--gold-dim);
    color: var(--gold);
    border-radius: 2px;
    transition: all 0.2s;
}

.nav-links .btn-nav:hover {
    background: var(--gold);
    color: var(--bg-void);
}

.nav-links .btn-nav-ghost {
    padding: 6px 18px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 2px;
    transition: all 0.2s;
}

.nav-links .btn-nav-ghost:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

/* ---- LAYOUT ---- */
.page-wrapper {
    padding-top: 60px;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ---- HERO ---- */
.hero {
    text-align: center;
    padding: 5rem 0 3rem;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 50%; transform: translateX(-50%);
    width: 600px; height: 300px;
    background: radial-gradient(ellipse at 50% 0%, rgba(201,168,76,0.06) 0%, transparent 70%);
    pointer-events: none;
}

.hero-eyebrow {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 6px;
    color: var(--gold-dim);
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.hero-title {
    font-family: var(--display);
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: 4px;
    line-height: 0.95;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.hero-title span {
    color: var(--gold);
    text-shadow: 0 0 40px rgba(201,168,76,0.3);
}

.hero-sub {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 1px;
    margin-top: 1rem;
}

/* ---- DIVIDER ---- */
.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.divider-icon {
    color: var(--gold-dim);
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 3px;
}

/* ---- CARD ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

.card-title {
    font-family: var(--display);
    font-size: 1.4rem;
    letter-spacing: 3px;
    color: var(--gold);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title .tag {
    font-family: var(--mono);
    font-size: 0.55rem;
    letter-spacing: 2px;
    color: var(--text-dim);
    border: 1px solid var(--text-dim);
    padding: 2px 6px;
    border-radius: 2px;
    vertical-align: middle;
}

/* ---- FORM ---- */
.form-group {
    margin-bottom: 1.2rem;
}

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 10px 14px;
    color: var(--text);
    font-family: var(--body);
    font-size: 1rem;
    font-weight: 500;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-input:focus {
    border-color: var(--gold-dim);
    box-shadow: 0 0 0 3px rgba(201,168,76,0.07);
}

.form-input::placeholder { color: var(--text-dim); }

/* ---- CHECKBOXES ---- */
.checks-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    flex: 1;
    min-width: 150px;
}

.check-item:hover { border-color: var(--gold-dim); }

.check-item input[type="checkbox"],
.check-item input[type="radio"] {
    display: none;
}

.check-box {
    width: 16px; height: 16px;
    border: 1px solid var(--border);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.check-item input:checked ~ .check-box,
.check-item.active .check-box {
    background: var(--gold);
    border-color: var(--gold);
}

.check-box::after {
    content: '';
    width: 8px; height: 5px;
    border-left: 2px solid var(--bg-void);
    border-bottom: 2px solid var(--bg-void);
    transform: rotate(-45deg) translate(1px, -1px);
    opacity: 0;
    transition: opacity 0.15s;
}

.check-item input:checked ~ .check-box::after,
.check-item.active .check-box::after { opacity: 1; }

.check-label {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    transition: color 0.2s;
}

.check-item:has(input:checked) .check-label,
.check-item.active .check-label { color: var(--text); }

/* Radio alignment */
.radio-row {
    display: flex;
    gap: 1rem;
}

.radio-item {
    flex: 1;
}

.radio-item .check-box {
    border-radius: 50%;
}

.radio-item input:checked ~ .check-box {
    background: var(--red);
    border-color: var(--red);
    box-shadow: 0 0 10px rgba(192,57,43,0.4);
}

.radio-legal input:checked ~ .check-box {
    background: var(--gold);
    border-color: var(--gold);
    box-shadow: 0 0 10px rgba(201,168,76,0.4);
}

/* ---- GENERATE BUTTON ---- */
.btn-generate {
    display: block;
    width: 100%;
    padding: 16px;
    background: transparent;
    border: 1px solid var(--gold);
    border-radius: 2px;
    color: var(--gold);
    font-family: var(--display);
    font-size: 1.4rem;
    letter-spacing: 5px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}

.btn-generate::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gold);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 0;
}

.btn-generate:hover::before { transform: translateX(0); }

.btn-generate:hover {
    color: var(--bg-void);
    text-shadow: none;
}

.btn-generate span { position: relative; z-index: 1; }

.btn-generate:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-generate:disabled::before { display: none; }

/* ---- LOADING ---- */
.loading-overlay {
    display: none;
    text-align: center;
    padding: 3rem;
}

.loading-overlay.active { display: block; }

.loading-bar {
    width: 100%;
    height: 2px;
    background: var(--border);
    border-radius: 1px;
    overflow: hidden;
    margin: 1.5rem 0;
}

.loading-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-dim), var(--gold), var(--gold-dim));
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    width: 60%;
    border-radius: 1px;
}

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

.loading-text {
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 4px;
    color: var(--text-muted);
    animation: blink 1.5s step-end infinite;
}

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

/* ---- RESULT ---- */
.result-section {
    display: none;
    animation: fadeUp 0.5s ease forwards;
}

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

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

.result-header {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.result-portrait {
    flex-shrink: 0;
    width: 160px;
    height: 160px;
    border: 1px solid var(--border);
    border-radius: 3px;
    overflow: hidden;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-portrait-placeholder {
    font-family: var(--mono);
    font-size: 0.6rem;
    color: var(--text-dim);
    letter-spacing: 2px;
    text-align: center;
}

.result-identity-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.identity-field {
    border-left: 2px solid var(--gold-dim);
    padding-left: 12px;
}

.identity-field-label {
    font-family: var(--mono);
    font-size: 0.6rem;
    letter-spacing: 3px;
    color: var(--text-dim);
    text-transform: uppercase;
}

.identity-field-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 2px;
}

.identity-field-value.gold { color: var(--gold); }

.result-background {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text);
    white-space: pre-wrap;
}

.result-appearance {
    display: grid;
    gap: 1rem;
}

.appearance-block {
    background: var(--bg-input);
    border-left: 2px solid var(--gold-dim);
    padding: 12px 16px;
    border-radius: 0 3px 3px 0;
}

.appearance-block-label {
    font-family: var(--mono);
    font-size: 0.6rem;
    letter-spacing: 3px;
    color: var(--gold-dim);
    margin-bottom: 4px;
    text-transform: uppercase;
}

/* ---- SAVE BUTTON ---- */
.btn-save {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 28px;
    background: transparent;
    border: 1px solid var(--gold-dim);
    border-radius: 2px;
    color: var(--gold);
    font-family: var(--body);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-save:hover {
    background: rgba(201,168,76,0.08);
    border-color: var(--gold);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 28px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 2px;
    color: var(--text-muted);
    font-family: var(--body);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover { border-color: var(--text-muted); color: var(--text); }

.action-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* ---- ALERT ---- */
.alert {
    padding: 12px 16px;
    border-radius: 2px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    border-left: 3px solid;
}

.alert-error   { background: rgba(192,57,43,0.08); border-color: var(--red); color: #e57373; }
.alert-success { background: rgba(201,168,76,0.08); border-color: var(--gold); color: var(--gold-light); }
.alert-info    { background: rgba(42,42,53,0.5); border-color: var(--border); color: var(--text-muted); }

/* ---- AUTH PAGES ---- */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 440px;
}

.auth-title {
    font-family: var(--display);
    font-size: 2.5rem;
    letter-spacing: 4px;
    color: var(--text);
    margin-bottom: 0.3rem;
}

.auth-title span { color: var(--gold); }

.auth-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 2px;
    margin-bottom: 2rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--gold);
    text-decoration: none;
}

.auth-footer a:hover { text-decoration: underline; }

.btn-submit {
    width: 100%;
    padding: 13px;
    background: var(--gold);
    border: none;
    border-radius: 2px;
    color: var(--bg-void);
    font-family: var(--display);
    font-size: 1.3rem;
    letter-spacing: 4px;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 0.5rem;
}

.btn-submit:hover { opacity: 0.88; }

/* ---- ACCOUNT PAGE ---- */
.account-header {
    padding: 3rem 0 2rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}

.account-title {
    font-family: var(--display);
    font-size: 2.5rem;
    letter-spacing: 4px;
    color: var(--text);
}

.account-title span { color: var(--gold); }

.characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.2rem;
    padding-bottom: 3rem;
}

.char-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.2s, transform 0.2s;
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.char-card:hover {
    border-color: var(--gold-dim);
    transform: translateY(-2px);
}

.char-card-portrait {
    width: 100%;
    height: 160px;
    background: var(--bg-input);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.char-card-portrait img {
    width: 100%; height: 100%;
    object-fit: cover;
}

.char-card-portrait-placeholder {
    font-family: var(--display);
    font-size: 3rem;
    color: var(--text-dim);
    letter-spacing: 4px;
}

.char-card-body {
    padding: 1rem;
}

.char-card-name {
    font-family: var(--display);
    font-size: 1.3rem;
    letter-spacing: 2px;
    color: var(--text);
    margin-bottom: 4px;
}

.char-card-meta {
    font-family: var(--mono);
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: var(--text-muted);
}

.char-card-align {
    display: inline-block;
    margin-top: 8px;
    padding: 2px 8px;
    border-radius: 2px;
    font-family: var(--mono);
    font-size: 0.6rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.align-legal   { background: rgba(201,168,76,0.1); color: var(--gold-dim); border: 1px solid var(--gold-dim); }
.align-illegal { background: rgba(192,57,43,0.1);  color: #e57373; border: 1px solid var(--red); }

.empty-state {
    text-align: center;
    padding: 5rem 0;
    color: var(--text-muted);
}

.empty-state-icon {
    font-family: var(--display);
    font-size: 5rem;
    color: var(--text-dim);
    letter-spacing: 8px;
    margin-bottom: 1rem;
}

.empty-state p {
    font-size: 0.85rem;
    letter-spacing: 2px;
}

/* ---- FOOTER ---- */
footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    text-align: center;
    font-family: var(--mono);
    font-size: 1.10rem;
    letter-spacing: 3px;
    color: var(--text-dim);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
    .result-header { flex-direction: column; }
    .result-identity-grid { grid-template-columns: 1fr; }
    .checks-row { flex-direction: column; }
    .radio-row  { flex-direction: column; }
    .nav-links .btn-nav-ghost { display: none; }
}
