:root {
    /* Refined Theme Palette */
    --bg-color: #F6F7F4;
    --primary-green: #0B3327;
    --accent-emerald: #0EA875;
    --accent-gold: #D9A54A;
    --accent-glow: rgba(14, 168, 117, 0.14);
    --secondary-bg: #EAEDE7;
    --text-main: #16211D;
    --text-muted: #647169;
    --light-gray: #E1E6DE;
    --white: #FFFFFF;

    /* Dark Terminal Palette */
    --sidebar-bg-start: #0A2E22;
    --sidebar-bg-mid: #0D2A20;
    --sidebar-bg-end: #05130E;
    --sidebar-border: rgba(14, 168, 117, 0.22);
    --text-dark-muted: #9FB6AC;

    --radius-sm: 10px;
    --radius-md: 18px;
    --radius-lg: 28px;
    --shadow-soft: 0 20px 50px rgba(11, 51, 39, 0.08);
    --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);

    /* Fluid scaling for responsiveness */
    --container-pad: clamp(18px, 4vw, 44px);
    --title-size: clamp(1.9rem, 4.5vw, 2.7rem);
    --gauge-size: clamp(190px, 42vw, 230px);
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(circle at top left, #FAFBF8 0%, var(--bg-color) 60%);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: clamp(16px, 4vw, 40px) 12px;
}

/* App Main Container */
.app-container {
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    align-items: center;
    gap: clamp(24px, 3vw, 44px);
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: var(--container-pad);
    border: 1px solid var(--light-gray);
    animation: containerIn 0.6s var(--transition) both;
}

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

/* LEFT PANEL */
.hero-section {
    margin-bottom: clamp(20px, 3vw, 32px);
    animation: fadeIn 0.6s ease-out both;
}

.subtitle-tag {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.8px;
    color: var(--accent-emerald);
    text-transform: uppercase;
}

.hero-title {
    font-family: 'Playfair Display', serif;
    font-size: var(--title-size);
    color: var(--primary-green);
    margin: 6px 0 10px 0;
    line-height: 1.15;
}

.hero-subtitle {
    font-size: clamp(0.86rem, 1.6vw, 0.94rem);
    color: var(--text-muted);
    max-width: 92%;
}

.premium-form {
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 2.5vw, 22px);
}

.form-group-section {
    background: #FAFCF9;
    padding: clamp(16px, 2.5vw, 24px);
    border-radius: var(--radius-md);
    border: 1px solid var(--light-gray);
    transition: var(--transition);
    animation: sectionIn 0.5s var(--transition) both;
}

.form-group-section:nth-of-type(1) { animation-delay: 0.05s; }
.form-group-section:nth-of-type(2) { animation-delay: 0.12s; }
.form-group-section:nth-of-type(3) { animation-delay: 0.19s; }

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

.form-group-section:hover {
    border-color: rgba(14, 168, 117, 0.35);
    box-shadow: 0 8px 20px rgba(11, 51, 39, 0.05);
}

.form-group-section:focus-within {
    border-color: var(--accent-emerald);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.section-heading {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: var(--primary-green);
    margin-bottom: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-heading::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-gold);
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.input-wrapper.full-width {
    grid-column: 1 / -1;
}

label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.input-wrapper:focus-within label {
    color: var(--accent-emerald);
}

input, select {
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid #D7DFD3;
    background: var(--white);
    outline: none;
    transition: var(--transition);
    color: var(--text-main);
    width: 100%;
}

input:hover, select:hover {
    border-color: #B9C7B4;
}

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

/* Custom select arrow for consistent cross-browser look */
select {
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%23647169' stroke-width='1.5' fill='none' fill-rule='evenodd'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 34px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 14px;
    margin-top: 4px;
    flex-wrap: wrap;
}

button {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    padding: 15px 24px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.95rem;
    transition: var(--transition);
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-green), #0F4433);
    color: var(--white);
    flex: 2;
    min-width: 200px;
    box-shadow: 0 10px 24px rgba(11, 51, 39, 0.22);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(11, 51, 39, 0.3);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--secondary-bg);
    color: var(--primary-green);
    flex: 1;
    min-width: 110px;
}

.btn-secondary:hover {
    background: #DCE2D7;
    transform: translateY(-2px);
}

.btn-secondary:active {
    transform: translateY(0) scale(0.98);
}

/* RIGHT PANEL */
.right-panel {
    display: flex;
    justify-content: center;
    animation: fadeIn 0.7s ease-out 0.1s both;
}

.prediction-card {
    width: 100%;
    background: linear-gradient(165deg, var(--sidebar-bg-start) 0%, var(--sidebar-bg-mid) 45%, var(--sidebar-bg-end) 100%);
    border-radius: var(--radius-lg);
    padding: clamp(28px, 4vw, 44px) clamp(18px, 3vw, 30px);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 1px solid var(--sidebar-border);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.28);
    position: relative;
    overflow: hidden;
    min-height: clamp(440px, 60vh, 540px);
    justify-content: center;
    transition: box-shadow 0.4s ease;
}

.prediction-card:hover {
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.34);
}

.card-grid-bg {
    position: absolute;
    inset: 0;
    background-size: 30px 30px;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    pointer-events: none;
}

.ambient-glow {
    position: absolute;
    top: -70px;
    right: -70px;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, rgba(14, 168, 117, 0.18) 0%, rgba(0,0,0,0) 70%);
    pointer-events: none;
}

.radar-beam {
    position: absolute;
    top: -30%;
    left: -10%;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(217, 165, 74, 0.10) 0%, rgba(0,0,0,0) 70%);
    pointer-events: none;
}

.card-state {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    position: relative;
    z-index: 2;
}

.card-state.active {
    display: flex;
    animation: fadeIn 0.45s ease-out;
}

/* IDLE STATE */
.floating-badge {
    position: absolute;
    top: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-dark-muted);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}

.badge-top-left { left: 20px; }
.badge-top-right { right: 20px; }

.pulse-dot.idle {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-gold);
    display: inline-block;
    animation: pulse 1.8s ease-in-out infinite;
}

.orbital-scanner-wrapper {
    position: relative;
    width: clamp(96px, 20vw, 120px);
    height: clamp(96px, 20vw, 120px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 26px;
}

.ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(14, 168, 117, 0.25);
}

.outer-ring { width: 100%; height: 100%; animation: spin 12s linear infinite; }
.middle-ring { width: 73%; height: 73%; border-color: rgba(217, 165, 74, 0.25); animation: spin 9s linear infinite reverse; }
.inner-ring { width: 48%; height: 48%; }

.core-orb {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(14, 168, 117, 0.12);
    border: 1px solid rgba(14, 168, 117, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-spark {
    color: var(--accent-emerald);
    font-size: 1.3rem;
}

.empty-title {
    font-family: 'Playfair Display', serif;
    color: #FFFFFF;
    font-size: clamp(1.5rem, 3.5vw, 1.85rem);
    margin-bottom: 12px;
}

.empty-desc {
    color: var(--text-dark-muted);
    font-size: 0.92rem;
    line-height: 1.6;
    max-width: 85%;
    margin: 0 auto 24px auto;
}

.preview-skeleton-box {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.skeleton-line {
    height: 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: hidden;
}

.skeleton-line::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    animation: shimmer 1.6s ease-in-out infinite;
}

.skeleton-line.short { width: 40%; }
.skeleton-line.long { width: 65%; }

/* LOADING STATE */
.cyber-spinner {
    position: relative;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.spinner-ring {
    position: absolute;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--accent-emerald);
    border-right-color: var(--accent-gold);
    animation: spin 0.9s linear infinite;
}

.spinner-core {
    font-size: 1.2rem;
}

.loading-text {
    color: #FFFFFF;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.4px;
}

/* RESULT STATE */
.card-top-pill {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--accent-emerald);
    background: rgba(14, 168, 117, 0.14);
    border: 1px solid rgba(14, 168, 117, 0.28);
    padding: 6px 16px;
    border-radius: 20px;
    margin-bottom: 18px;
}

.result-title {
    font-family: 'Playfair Display', serif;
    color: #FFFFFF;
    font-size: clamp(1.6rem, 3.5vw, 2.1rem);
    margin-bottom: 20px;
}

.gauge-wrapper {
    position: relative;
    width: var(--gauge-size);
    margin-bottom: 8px;
}

.gauge-container {
    position: relative;
    width: var(--gauge-size);
    height: calc(var(--gauge-size) / 2);
    overflow: hidden;
}

.gauge-background {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--gauge-size);
    height: var(--gauge-size);
    border-radius: 50%;
    border: 18px solid rgba(255, 255, 255, 0.07);
    box-sizing: border-box;
}

.gauge-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--gauge-size);
    height: var(--gauge-size);
    border-radius: 50%;
    border: 18px solid var(--accent-emerald);
    box-sizing: border-box;
    border-bottom-color: transparent;
    border-left-color: transparent;
    transform: rotate(-45deg);
}

.gauge-needle {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 4px;
    height: calc(var(--gauge-size) * 0.443);
    background: #FFFFFF;
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(-90deg);
    border-radius: 4px;
    z-index: 5;
}

.needle-base {
    position: absolute;
    bottom: -6px;
    left: -5px;
    width: 14px;
    height: 14px;
    background: #FFFFFF;
    border: 2px solid #05130E;
    border-radius: 50%;
}

.gauge-labels {
    display: flex;
    justify-content: space-between;
    padding: 0 12px;
    margin-top: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-dark-muted);
}

.score-display {
    margin: 12px 0 18px 0;
}

.huge-score {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.8rem, 7vw, 3.9rem);
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: -1px;
}

.score-max {
    font-size: 1.1rem;
    color: var(--text-dark-muted);
    font-weight: 500;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 22px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.88rem;
    margin-bottom: 24px;
    border: 1px solid transparent;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.recommendation-box {
    background: rgba(255, 255, 255, 0.035);
    padding: clamp(16px, 3vw, 20px) clamp(16px, 3vw, 22px);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-left: 4px solid var(--accent-emerald);
    width: 100%;
    text-align: left;
}

.rec-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.recommendation-box h5 {
    color: #FFFFFF;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
}

.recommendation-box p {
    font-size: 0.9rem;
    color: var(--text-dark-muted);
    line-height: 1.55;
}

/* Animations */
@keyframes spin {
    100% { transform: rotate(360deg); }
}

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

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

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

@media (max-width: 992px) {
    .app-container {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
    .right-panel { order: -1; }
    .hero-subtitle { max-width: 100%; }
}

@media (max-width: 640px) {
    body { padding: 10px; }
    .app-container { border-radius: var(--radius-md); }
    .input-grid { grid-template-columns: 1fr; }
    .input-wrapper.full-width { grid-column: 1; }
    .form-actions { flex-direction: column; }
    .btn-primary, .btn-secondary { flex: 1; width: 100%; min-width: 0; }
    .prediction-card { min-height: 420px; }
    .floating-badge { font-size: 0.6rem; }
    .badge-top-left { left: 14px; top: 14px; }
    .badge-top-right { right: 14px; top: 14px; }
}

@media (max-width: 400px) {
    .form-group-section { padding: 14px; }
    .gauge-labels { font-size: 0.75rem; }
    .huge-score { letter-spacing: -0.5px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}