:root {
    /* Color Palette (Slate & Accents) */
    --bg-main: #0f172a;       /* slate-900 */
    --text-main: #f8fafc;     /* slate-50 */
    --text-muted: #94a3b8;    /* slate-400 */
    --text-light: #cbd5e1;    /* slate-300 */
    
    --accent-pink: #f472b6;   /* pink-400 */
    --accent-purple: #c084fc; /* purple-400 */
    --accent-indigo: #818cf8; /* indigo-400 */
    
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-bg-hover: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-border-hover: rgba(255, 255, 255, 0.3);
    
    --font-sans: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    --font-serif: 'Georgia', 'Cambria', 'Times New Roman', 'Times', 'serif';
}

* {
    box-sizing: border-box;
}

::selection {
    background-color: #ec4899; /* pink-500 */
    color: white;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: #334155; /* slate-700 */
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #475569; /* slate-600 */
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-sans);
    overflow-x: hidden; /* 横スクロール防止 */
    display: flex;
    flex-direction: column;
}

#root {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* centerからflex-startに変更：スマホでの見切れ対策 */
    min-height: 100vh;
    padding: 2rem 1.5rem;
    width: 100%;
}

/* --- Layout Components --- */

.app-container {
    width: 100%;
    max-width: 56rem; /* 4xl */
    z-index: 10;
    position: relative;
    /* justify-content: flex-start に伴い、PCでは少し下に下げる */
    margin-top: 1rem; 
}
@media (min-width: 768px) {
    .app-container {
        margin-top: 3rem; 
    }
}

/* Background Blobs */
.blob {
    position: fixed;
    border-radius: 9999px;
    filter: blur(100px);
    pointer-events: none;
    z-index: 0;
    animation: pulse 4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.blob-purple {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    max-width: 24rem;
    max-height: 24rem;
    background-color: rgba(147, 51, 234, 0.2); /* purple-600/20 */
}
.blob-blue {
    bottom: -10%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    max-width: 24rem;
    max-height: 24rem;
    background-color: rgba(37, 99, 235, 0.2); /* blue-600/20 */
    animation-delay: 1s;
}

/* Header */
.header {
    margin-bottom: 3rem;
    text-align: center;
}
.header h1 {
    font-family: var(--font-serif);
    font-size: 1.875rem; /* 3xl */
    font-weight: 300;
    letter-spacing: 0.05em;
    margin: 0 0 0.5rem 0;
    background: linear-gradient(to right, #f9a8d4, #d8b4fe, #a5b4fc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
@media (min-width: 768px) {
    .header h1 { font-size: 3rem; } /* 5xl */
}
.header p {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0;
}
@media (min-width: 768px) {
    .header p { font-size: 1rem; }
}

/* Introduction Text */
.intro-text {
    text-align: center;
    font-size: 1.25rem;
    margin-bottom: 2rem;
    font-weight: 300;
    color: #e2e8f0;
}

/* Mood Grid */
.mood-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}
@media (min-width: 768px) {
    .mood-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

/* Mood Button */
.mood-button {
    position: relative;
    overflow: hidden;
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(4px);
    border-radius: 1rem;
    padding: 1rem; /* スマホ用に余白を少し縮小 */
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.75rem;
    cursor: pointer;
    color: inherit;
    font: inherit;
}
@media (min-width: 768px) {
    .mood-button {
        padding: 1.5rem; /* PCでは元の大きさに */
    }
}
.mood-button:hover {
    background-color: var(--glass-bg-hover);
    transform: scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(168, 85, 247, 0.1);
}

.icon-wrapper {
    padding: 0.75rem;
    border-radius: 9999px;
    background: linear-gradient(to bottom right, rgba(255,255,255,0.1), transparent);
    transition: all 0.3s;
}
.mood-button:hover .icon-wrapper {
    background: linear-gradient(to bottom right, rgba(255,255,255,0.2), transparent);
}

.label-main {
    display: block;
    font-size: 0.95rem; /* スマホ用に少し小さく */
    font-weight: 500;
    letter-spacing: 0.025em;
    white-space: nowrap; /* 改行を禁止（エネルギッシュ対策） */
}
@media (min-width: 768px) {
    .label-main {
        font-size: 1.125rem; /* PCでは元のサイズに */
    }
}

.label-sub {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.25rem;
}

/* Loading Screen */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 16rem;
}
.spinner-wrapper {
    position: relative;
    width: 6rem;
    height: 6rem;
}
.spinner-ring {
    position: absolute;
    border-radius: 9999px;
    border-top: 2px solid;
    border-right: 2px solid;
    animation: spin 1s linear infinite;
}
.ring-1 { inset: 0; border-color: var(--accent-pink); }
.ring-2 { inset: 0.5rem; border-color: var(--accent-purple); animation-direction: reverse; animation-duration: 1.2s; }
.ring-3 { inset: 1rem; border-color: var(--accent-indigo); animation-duration: 1.5s; }

.loading-text {
    margin-top: 2rem;
    color: var(--text-light);
    letter-spacing: 0.1em;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Result Section */
.result-header {
    text-align: center;
    margin-bottom: 2rem;
}
.mood-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.25rem 1rem;
    border-radius: 9999px;
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}
.mood-description {
    color: var(--text-muted);
    font-weight: 300;
    max-width: 32rem;
    margin: 0 auto;
}

/* Palette Grid */
.palette-grid {
    display: grid;
    grid-template-columns: 1fr;
    height: 50vh;
    width: 100%;
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    margin-bottom: 2rem;
}
@media (min-width: 768px) {
    .palette-grid {
        grid-template-columns: repeat(3, 1fr);
        height: 20rem;
    }
}

.color-card {
    position: relative;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.5s;
    cursor: pointer;
}
@media (min-width: 768px) {
    .color-card:hover { flex: 1.5; }
}

.color-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s;
}
.color-card:hover .color-overlay { opacity: 1; }

.color-content {
    z-index: 10;
    transform: translateY(1rem);
    opacity: 0;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.color-card:hover .color-content {
    transform: translateY(0);
    opacity: 1;
}

.color-code {
    color: rgba(255, 255, 255, 0.9);
    font-family: monospace;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: 0.1em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
@media (min-width: 768px) {
    .color-code { font-size: 1.5rem; }
}

.copy-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 9999px;
    backdrop-filter: blur(4px);
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}
.copy-button:hover { background-color: rgba(255, 255, 255, 0.3); }

/* Action Buttons */
.action-area {
    display: flex;
    justify-content: center;
    flex-wrap: wrap; /* スマホでボタンが溢れないように */
}
.reset-button {
    display: flex;
    align-items: center;
    justify-content: center; /* 中央揃え */
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 9999px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}
.reset-button:hover {
    background-color: var(--glass-bg-hover);
    color: white;
    border-color: var(--glass-border-hover);
}

/* Footer (Layout Fix) */
.footer {
    position: relative;
    margin-top: 4rem;
    padding-bottom: 4rem; /* フッター下部にしっかり余白を追加 */
    text-align: center;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    z-index: 10;
    width: 100%;
}
.footer a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s;
}
.footer a:hover {
    color: #cbd5e1;
    text-decoration: underline;
}

/* --- About Page Styles (Added) --- */
.text-content {
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    color: var(--text-light);
    line-height: 1.8;
}
@media (min-width: 768px) {
    .text-content { padding: 3rem; }
}

.text-content h2 {
    font-size: 1.5rem;
    font-weight: 500;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}
.text-content h2:first-child { margin-top: 0; }

.text-content h3 {
    font-size: 1.2rem;
    font-weight: 500;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--accent-indigo);
}

.text-content p {
    margin-bottom: 1.5rem;
}

.text-content ul {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}
.text-content li {
    margin-bottom: 0.5rem;
}
.text-content strong {
    color: var(--text-main);
    font-weight: 600;
}

/* --- Animations --- */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(2rem); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.animate-fade-in { animation: fadeIn 0.5s ease-out forwards; }
.animate-slide-up { animation: slideUp 0.7s ease-out forwards; }
.animate-zoom-in { animation: zoomIn 0.5s ease-out forwards; }