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

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --background-color: #f9fafb;
    --card-background: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --error-color: #ef4444;
    --info-color: #3b82f6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.title-en {
    font-weight: 600;
}

.title-ja {
    font-size: 1.5rem;
    font-weight: 400;
    opacity: 0.9;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.input-section {
    background: var(--card-background);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
}

.input-section h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.date-input {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 20px;
    font-family: inherit;
}

.emotion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.emotion-btn {
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.emotion-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.emotion-btn.selected {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.05);
}

.emotion-btn .emoji {
    font-size: 2rem;
}

.emotion-btn .label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.intensity-control {
    margin-bottom: 20px;
}

.intensity-control label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
}

.intensity-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-color);
    border-radius: 4px;
    outline: none;
}

.intensity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.intensity-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.note-input {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 20px;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.save-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 14px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.visualization-section {
    background: var(--card-background);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
}

.view-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.view-btn {
    background: var(--background-color);
    border: 2px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.view-btn:hover {
    background: var(--border-color);
}

.view-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.visualization {
    position: relative;
    min-height: 400px;
}

#emotion-canvas {
    width: 100%;
    height: 400px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.view-panel {
    width: 100%;
    min-height: 400px;
}

.view-panel.hidden {
    display: none;
}

.calendar {
    width: 100%;
}

.calendar-header {
    text-align: center;
    margin-bottom: 20px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.calendar-weekday {
    text-align: center;
    font-weight: 600;
    padding: 10px;
    color: var(--text-secondary);
}

.calendar-day {
    aspect-ratio: 1;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.calendar-day.empty {
    border: none;
}

.day-number {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.day-emotion {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--background-color);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-card.full-width {
    grid-column: 1 / -1;
}

.stat-card h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.emotion-breakdown {
    margin-top: 20px;
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.breakdown-label {
    min-width: 80px;
    font-weight: 500;
}

.breakdown-bar {
    flex: 1;
    height: 20px;
    background: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.breakdown-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.breakdown-value {
    min-width: 50px;
    text-align: right;
    font-weight: 600;
}

.export-section {
    background: var(--card-background);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
}

.export-section h3 {
    margin-bottom: 20px;
}

.export-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.export-btn {
    background: var(--background-color);
    border: 2px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.export-btn:hover {
    background: var(--border-color);
    transform: translateY(-2px);
}

.export-btn.danger {
    color: var(--error-color);
    border-color: var(--error-color);
}

.export-btn.danger:hover {
    background: var(--error-color);
    color: white;
}

footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-secondary);
}

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--text-primary);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: all 0.3s ease;
}

.toast.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--error-color);
}

.toast.info {
    background: var(--info-color);
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        padding: 30px 20px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .title-ja {
        font-size: 1.2rem;
    }
    
    .emotion-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .emotion-btn {
        padding: 15px;
    }
    
    .export-controls {
        flex-direction: column;
    }
    
    .export-btn {
        width: 100%;
    }
}