/* ================================================
   スト値診断AI — Premium Dark Theme
   ================================================ */

/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #07070f;
    --bg-secondary: #0d0d1a;
    --bg-card: rgba(16, 16, 32, 0.65);
    --bg-card-hover: rgba(22, 22, 44, 0.75);
    --border-glass: rgba(255, 255, 255, 0.06);
    --border-glass-hover: rgba(255, 255, 255, 0.12);

    --text-primary: #f0f0f5;
    --text-secondary: rgba(240, 240, 245, 0.6);
    --text-muted: rgba(240, 240, 245, 0.35);

    --accent-blue: #60a5fa;
    --accent-purple: #c084fc;
    --accent-pink: #ff6b9d;
    --accent-green: #34d399;
    --accent-yellow: #fbbf24;
    --accent-orange: #f97316;
    --accent-red: #ef4444;

    --gradient-primary: linear-gradient(135deg, #60a5fa, #c084fc);
    --gradient-hero: linear-gradient(135deg, #60a5fa 0%, #c084fc 50%, #ff6b9d 100%);

    --font-main: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    --shadow-card: 0 4px 30px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px rgba(96, 165, 250, 0.15);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* === Animated Background === */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: 0;
    pointer-events: none;
}

.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 0;
    pointer-events: none;
    animation: float 20s ease-in-out infinite;
}

.bg-glow-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(96,165,250,0.12), transparent 70%);
    top: -10%;
    right: -5%;
    animation-delay: 0s;
}

.bg-glow-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(192,132,252,0.1), transparent 70%);
    bottom: 10%;
    left: -5%;
    animation-delay: -7s;
}

.bg-glow-3 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(255,107,157,0.08), transparent 70%);
    top: 40%;
    right: 20%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -20px) scale(1.05); }
    50% { transform: translate(-20px, 30px) scale(0.95); }
    75% { transform: translate(20px, 20px) scale(1.02); }
}

/* === Header === */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 0 24px;
    height: 64px;
    background: rgba(7, 7, 15, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 20px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-badge {
    font-size: 12px;
    color: var(--text-muted);
    padding: 4px 12px;
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    letter-spacing: 0.02em;
}

/* === Main Content === */
.main-content {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 100px 24px 40px;
}

/* === Sections === */
.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Hero Text === */
.hero-text {
    text-align: center;
    margin-bottom: 36px;
}

.hero-title {
    font-size: clamp(28px, 5vw, 44px);
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
}

.hero-title-gradient {
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-title-white {
    color: var(--text-primary);
}

.hero-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* === Category Badges === */
.category-badges {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    backdrop-filter: blur(10px);
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--dot-color);
    box-shadow: 0 0 8px var(--dot-color);
}

/* === Glass Card === */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 32px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-card);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.glass-card:hover {
    border-color: var(--border-glass-hover);
}

/* === Upload Area === */
.upload-container {
    margin-bottom: 24px;
}

.upload-card {
    cursor: pointer;
    transition: all 0.3s;
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-card:hover {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-glow);
}

.upload-card.drag-over {
    border-color: var(--accent-purple);
    box-shadow: 0 0 50px rgba(192, 132, 252, 0.2);
    background: rgba(192, 132, 252, 0.05);
}

.upload-content {
    text-align: center;
    padding: 20px;
}

.upload-icon {
    color: var(--text-muted);
    margin-bottom: 16px;
    transition: color 0.3s, transform 0.3s;
}

.upload-card:hover .upload-icon {
    color: var(--accent-blue);
    transform: translateY(-4px);
}

.upload-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.upload-note {
    font-size: 12px;
    color: var(--text-muted);
}

/* === Preview === */
.preview-content {
    text-align: center;
    width: 100%;
    position: relative;
}

.preview-image {
    max-width: 320px;
    max-height: 320px;
    width: auto;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    object-fit: cover;
}

.btn-change {
    margin-top: 16px;
}

/* === Buttons === */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 16px 32px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(96, 165, 250, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(96, 165, 250, 0.4);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-outline:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.btn-small {
    padding: 8px 16px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.3s;
}

.btn-small:hover {
    opacity: 0.85;
}

/* === API Key === */
.api-key-card {
    max-width: 500px;
    margin: 0 auto 24px;
    padding: 20px 24px;
}

.api-key-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: block;
}

.api-key-input-wrapper {
    display: flex;
    gap: 8px;
}

.api-key-input {
    flex: 1;
    padding: 8px 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    outline: none;
    transition: border-color 0.3s;
}

.api-key-input:focus {
    border-color: var(--accent-blue);
}

/* === Loading Section === */
.loading-container {
    text-align: center;
    padding: 80px 0;
}

.loading-visual {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 40px;
}

.scan-ring {
    position: absolute;
    inset: 0;
    border: 2px solid transparent;
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
}

.ring-2 {
    inset: 15px;
    border-top-color: var(--accent-purple);
    animation-duration: 2s;
    animation-direction: reverse;
}

.ring-3 {
    inset: 30px;
    border-top-color: var(--accent-pink);
    animation-duration: 2.5s;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-face {
    position: absolute;
    inset: 40px;
    width: calc(100% - 80px);
    height: calc(100% - 80px);
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--border-glass);
}

.loading-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.loading-bar {
    max-width: 300px;
    margin: 0 auto;
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    overflow: hidden;
}

.loading-bar-fill {
    width: 0%;
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* === Result Section === */
.result-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Score Hero */
.score-hero-card {
    overflow: hidden;
    position: relative;
}

.score-hero-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-hero);
}

.score-hero {
    display: flex;
    gap: 32px;
    align-items: center;
}

.score-hero-left {
    flex-shrink: 0;
}

.result-face-image {
    width: 140px;
    height: 140px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 2px solid var(--border-glass);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.score-hero-right {
    flex: 1;
}

.score-label {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

.score-main {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 8px;
}

.score-number {
    font-size: 72px;
    font-weight: 900;
    line-height: 1;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-max {
    font-size: 24px;
    color: var(--text-muted);
    font-weight: 300;
}

.score-rank {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--accent-blue);
}

.score-bar-wrap {
    max-width: 100%;
}

.score-bar-bg {
    height: 8px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--gradient-hero);
    border-radius: 4px;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Result Grid */
.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title-icon {
    font-size: 18px;
}

/* Chart */
.chart-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chart-card canvas {
    width: 100%;
    max-width: 400px;
}

/* Category List */
.category-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-glass);
    transition: border-color 0.3s;
}

.category-item:hover {
    border-color: var(--border-glass-hover);
}

.category-icon {
    font-size: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.category-info {
    flex: 1;
    min-width: 0;
}

.category-name {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 2px;
}

.category-summary {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-score {
    font-size: 22px;
    font-weight: 800;
    flex-shrink: 0;
    min-width: 40px;
    text-align: right;
}

/* Comment Card */
.overall-comment {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.9;
    white-space: pre-line;
}

/* Detail List */
.detail-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.detail-item {
    padding: 20px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-glass);
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.detail-category-icon {
    font-size: 18px;
}

.detail-category-name {
    font-size: 14px;
    font-weight: 600;
    flex: 1;
}

.detail-score {
    font-size: 18px;
    font-weight: 800;
}

.detail-bar {
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    margin-bottom: 12px;
    overflow: hidden;
}

.detail-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 1s ease;
}

.detail-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
    white-space: pre-line;
}

/* Advice List */
.advice-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.advice-item {
    display: flex;
    gap: 16px;
    padding: 20px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-glass);
    transition: border-color 0.3s;
}

.advice-item:hover {
    border-color: var(--border-glass-hover);
}

.advice-priority {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    flex-shrink: 0;
    color: white;
}

.advice-priority-1 { background: linear-gradient(135deg, #ef4444, #f97316); }
.advice-priority-2 { background: linear-gradient(135deg, #f97316, #fbbf24); }
.advice-priority-3 { background: linear-gradient(135deg, #fbbf24, #34d399); }
.advice-priority-4 { background: linear-gradient(135deg, #34d399, #60a5fa); }
.advice-priority-5 { background: linear-gradient(135deg, #60a5fa, #c084fc); }

.advice-content {
    flex: 1;
}

.advice-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
}

.advice-category-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 8px;
}

.advice-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* Error */
.error-card {
    text-align: center;
    padding: 60px 32px;
    max-width: 500px;
    margin: 80px auto;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.error-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
}

.error-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.8;
}

/* Footer */
.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 40px 24px 30px;
    max-width: 900px;
    margin: 0 auto;
}

.footer p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.7;
}

.footer-sub {
    margin-top: 4px;
    font-size: 11px !important;
    letter-spacing: 0.02em;
}

/* === Responsive === */
@media (max-width: 768px) {
    .main-content {
        padding: 84px 16px 30px;
    }

    .glass-card {
        padding: 20px;
        border-radius: var(--radius-md);
    }

    .result-grid {
        grid-template-columns: 1fr;
    }

    .score-hero {
        flex-direction: column;
        text-align: center;
    }

    .score-number {
        font-size: 56px;
    }

    .hero-subtitle br {
        display: none;
    }

    .category-badges {
        gap: 6px;
    }

    .badge {
        font-size: 12px;
        padding: 5px 10px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 24px;
    }

    .score-number {
        font-size: 48px;
    }

    .result-face-image {
        width: 100px;
        height: 100px;
    }

    .advice-item {
        flex-direction: column;
        align-items: flex-start;
    }
}
