:root {
    --bg: #0a0a1a;
    --bg-card: #12122a;
    --bg-card-hover: #1a1a3a;
    --text: #e8e6f0;
    --text-dim: #8888aa;
    --accent: #7b68ee;
    --accent-glow: rgba(123, 104, 238, 0.3);
    --gold: #d4a853;
    --fire: #e74c3c;
    --earth: #27ae60;
    --air: #f1c40f;
    --water: #3498db;
    --harmonious: #27ae60;
    --tense: #e74c3c;
    --neutral: #f1c40f;
    --radius: 12px;
    --font-serif: 'Cormorant Garamond', Georgia, serif;
    --font-sans: 'Inter', -apple-system, sans-serif;
}

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

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

.stars-bg {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle var(--duration) ease-in-out infinite;
    opacity: 0;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.1; }
    50% { opacity: var(--max-opacity); }
}

header {
    text-align: center;
    padding: 3rem 1rem 1rem;
    position: relative;
    z-index: 1;
}

header h1 {
    font-family: var(--font-serif);
    font-size: 2.8rem;
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 0.02em;
}

.subtitle {
    color: var(--text-dim);
    font-size: 0.95rem;
    margin-top: 0.5rem;
    font-weight: 300;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    position: relative;
    z-index: 1;
}

/* Form */
.form-section {
    max-width: 480px;
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem;
    border: 1px solid rgba(123, 104, 238, 0.15);
    box-shadow: 0 0 40px rgba(123, 104, 238, 0.05);
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 0.4rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group { flex: 1; }

input, select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    font-family: var(--font-sans);
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238888aa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 2rem;
}

.autocomplete-wrapper {
    position: relative;
}

.suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    display: none;
}

.suggestions.active { display: block; }

.suggestion-item {
    padding: 0.7rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.15s;
}

.suggestion-item:hover {
    background: var(--bg-card-hover);
}

.selected-place {
    font-size: 0.8rem;
    color: var(--accent);
    margin-top: 0.3rem;
    min-height: 1.2em;
}

button[type="submit"] {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--accent), #6c5ce7);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1.05rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    margin-top: 0.5rem;
}

button[type="submit"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-glow);
}

button[type="submit"]:active { transform: translateY(0); }

/* Results */
.back-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-dim);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: var(--font-sans);
    margin-bottom: 2rem;
    transition: color 0.2s, border-color 0.2s;
}

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

.chart-container {
    display: flex;
    justify-content: center;
    margin-bottom: 3rem;
}

.wheel-container {
    width: 100%;
    max-width: 700px;
    aspect-ratio: 1;
}

.wheel-container svg {
    width: 100%;
    height: 100%;
}

/* Info panels */
.info-panels {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid rgba(123, 104, 238, 0.1);
}

.panel h2 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--gold);
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    text-align: left;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    color: var(--text-dim);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.data-table td {
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.data-table tr:hover td {
    background: rgba(255,255,255,0.02);
}

.planet-symbol { font-size: 1.2em; }
.sign-symbol { font-size: 1.1em; }

.element-fire { color: var(--fire); }
.element-earth { color: var(--earth); }
.element-air { color: var(--air); }
.element-water { color: var(--water); }

.aspect-harmonious { color: var(--harmonious); }
.aspect-tense { color: var(--tense); }
.aspect-neutral { color: var(--neutral); }

.retrograde { color: var(--fire); font-weight: 600; }

/* Interpretations */
.interp-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.interp-section:last-child { border-bottom: none; }

.interp-title {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.interp-text {
    color: var(--text-dim);
    line-height: 1.7;
    font-size: 0.95rem;
}

/* Auth bar */
.auth-bar {
    position: relative;
    z-index: 10;
    padding: 0.6rem 1rem;
    text-align: right;
}

.auth-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.auth-link {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.85rem;
    font-family: var(--font-sans);
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.auth-link:hover { color: var(--gold); }

.auth-sep {
    color: var(--text-dim);
    margin: 0 0.5rem;
    font-size: 0.8rem;
}

.auth-name {
    color: var(--text);
    font-size: 0.85rem;
    margin-right: 0.8rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--bg-card);
    border: 1px solid rgba(123,104,238,0.2);
    border-radius: var(--radius);
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    position: relative;
}

.modal h2 {
    font-family: var(--font-serif);
    color: var(--gold);
    font-size: 1.6rem;
    margin-bottom: 1.2rem;
    text-align: center;
}

.modal-close {
    position: absolute;
    top: 0.8rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

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

.auth-error {
    color: var(--fire);
    font-size: 0.85rem;
    min-height: 1.2em;
    margin-bottom: 0.5rem;
}

.auth-switch {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-top: 1rem;
}

.btn-primary {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, var(--accent), #6c5ce7);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

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

/* Saved charts */
.saved-section {
    max-width: 480px;
    margin: 0 auto 1.5rem;
    position: relative;
    z-index: 1;
}

.saved-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.saved-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid rgba(255,255,255,0.05);
}

.saved-item:hover {
    background: rgba(123,104,238,0.1);
    border-color: rgba(123,104,238,0.2);
}

.saved-item-info {
    flex: 1;
    min-width: 0;
}

.saved-item-label {
    font-weight: 500;
    color: var(--text);
    font-size: 0.95rem;
}

.saved-item-details {
    color: var(--text-dim);
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

.saved-item-delete {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.saved-item-delete:hover {
    color: var(--fire);
    background: rgba(231,76,60,0.1);
}

/* Result top bar */
.result-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.save-btn {
    background: rgba(212,168,83,0.15);
    border: 1px solid rgba(212,168,83,0.3);
    color: var(--gold);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: var(--font-sans);
    transition: background 0.2s, border-color 0.2s;
}

.save-btn:hover {
    background: rgba(212,168,83,0.25);
    border-color: var(--gold);
}

.save-btn.saved {
    opacity: 0.6;
    cursor: default;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-dim);
    font-size: 0.8rem;
    position: relative;
    z-index: 1;
}

/* Responsive */
@media (max-width: 600px) {
    header h1 { font-size: 2rem; }
    .form-section { padding: 1.2rem; }
    .panel { padding: 1rem; }
    .data-table { font-size: 0.8rem; }
    .data-table th, .data-table td { padding: 0.4rem 0.5rem; }
}
