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

:root {
    --primary-color: #6B46C1;
    --secondary-color: #EC4899;
    --accent-color: #F59E0B;
    --background: #FAFAFA;
    --surface: #FFFFFF;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --border: #E5E7EB;
    --success: #10B981;
    --error: #EF4444;
    --morning: #FFD93D;
    --afternoon: #FF9B9B;
    --evening: #9B59B6;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.lang-switcher {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 8px;
}

.lang-btn {
    padding: 6px 12px;
    border: none;
    background: var(--surface);
    color: var(--text-secondary);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

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

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

/* 入力セクション */
.input-section {
    background: var(--surface);
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 32px;
    text-align: center;
}

.time-period {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.period-icon {
    font-size: 2rem;
}

.period-name {
    font-size: 1.5rem;
    font-weight: 500;
}

.word-inputs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.word-input {
    flex: 1;
    min-width: 150px;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--background);
}

.word-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.1);
}

.save-btn {
    padding: 12px 32px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

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

.save-btn:active {
    transform: translateY(0);
}

/* タブ */
.view-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--surface);
    padding: 4px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.tab-btn {
    flex: 1;
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: var(--shadow);
}

/* ビューセクション */
.view-section {
    background: var(--surface);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    min-height: 400px;
}

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

/* カレンダー */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-nav {
    padding: 8px 16px;
    border: none;
    background: var(--background);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.calendar-nav:hover {
    background: var(--border);
}

.calendar-month {
    font-size: 1.2rem;
    font-weight: 500;
}

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

.calendar-header-day {
    text-align: center;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 8px;
    font-size: 0.875rem;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--background);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    font-size: 0.9rem;
}

.calendar-day:hover {
    background: var(--border);
}

.calendar-day.has-entry {
    background: white;
    border: 2px solid var(--border);
    font-weight: 500;
}

.period-indicators {
    position: absolute;
    bottom: 4px;
    display: flex;
    gap: 2px;
}

.period-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.period-dot.morning {
    background: var(--morning);
}

.period-dot.afternoon {
    background: var(--afternoon);
}

.period-dot.evening {
    background: var(--evening);
}

/* グラフ */
.graph-container {
    height: 300px;
    margin-bottom: 32px;
}

.word-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.word-cloud-item {
    padding: 8px 16px;
    background: var(--background);
    border-radius: 20px;
    color: var(--text-primary);
    transition: all 0.3s ease;
    cursor: default;
}

.word-cloud-item:hover {
    background: var(--border);
    transform: scale(1.1);
}

/* リスト */
.list-container {
    max-height: 600px;
    overflow-y: auto;
}

.list-item {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    transition: all 0.3s ease;
}

.list-item:hover {
    background: var(--background);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.list-date {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.list-period {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.list-words {
    font-size: 1.1rem;
    font-weight: 500;
}

.empty-message {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
}

/* モーダル */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--surface);
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h2 {
    margin-bottom: 12px;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.modal-buttons {
    display: flex;
    gap: 12px;
}

.modal-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn:first-child {
    background: var(--primary-color);
    color: white;
}

.modal-btn.secondary {
    background: var(--background);
    color: var(--text-primary);
}

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

/* 日付詳細モーダル */
.day-entries h3 {
    margin-bottom: 20px;
}

.entries-list {
    margin-bottom: 24px;
}

.entry-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--background);
    border-radius: 8px;
    margin-bottom: 8px;
}

.entry-period {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.entry-words {
    font-weight: 500;
}

/* メッセージ */
.message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    animation: slideIn 0.3s ease;
}

.message.success {
    background: var(--success);
}

.message.error {
    background: var(--error);
}

.message.fade-out {
    animation: fadeOut 0.3s ease;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
}

/* フッター */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* レスポンシブ */
@media (max-width: 600px) {
    .container {
        padding: 12px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .input-section {
        padding: 20px;
    }
    
    .word-inputs {
        flex-direction: column;
    }
    
    .word-input {
        width: 100%;
    }
    
    .lang-switcher {
        position: static;
        justify-content: center;
        margin-top: 16px;
    }
    
    .calendar-grid {
        gap: 4px;
    }
    
    .calendar-day {
        font-size: 0.8rem;
    }
    
    .modal-content {
        padding: 20px;
    }
}