/* リセット */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基本スタイル */
:root {
    --primary-color: #4A90E2;
    --secondary-color: #50C878;
    --danger-color: #E74C3C;
    --text-color: #2C3E50;
    --bg-color: #F5F7FA;
    --card-bg: #FFFFFF;
    --border-radius: 12px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* 画面管理 */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

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

/* コンテナ */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

/* タイトル */
.app-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-label {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* Todo入力エリア */
.todo-section {
    margin-bottom: 2rem;
}

#todo-input {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-family: inherit;
    border: 2px solid #E0E4E8;
    border-radius: var(--border-radius);
    background: var(--card-bg);
    resize: vertical;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

#todo-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* 完了リスト */
.completed-section {
    margin-top: 2rem;
}

.completed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.btn-clear {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    background: transparent;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.completed-list {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--shadow);
    max-height: 300px;
    overflow-y: auto;
}

.completed-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #F5F7FA;
    border-radius: 8px;
    color: #7F8C8D;
    text-decoration: line-through;
}

.completed-item:last-child {
    margin-bottom: 0;
}

.completed-empty {
    text-align: center;
    color: #95A5A6;
    padding: 2rem;
    font-style: italic;
}

/* ボタン */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn {
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-icon {
    font-size: 1.3rem;
}

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

.btn-primary:hover {
    background: #3A7BC8;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #40B868;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-success {
    background: var(--secondary-color);
    color: white;
}

.btn-success:hover {
    background: #40B868;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-outline {
    background: transparent;
    color: var(--text-color);
    border: 2px solid #E0E4E8;
}

.btn-outline:hover {
    background: #F5F7FA;
    border-color: var(--primary-color);
}

.btn:active {
    transform: scale(0.98);
}

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

.back-btn {
    background: transparent;
    border: none;
    font-size: 1rem;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.5rem;
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

.back-btn:hover {
    color: #3A7BC8;
}

/* ランダム選択画面 */
.random-result {
    text-align: center;
    margin: 3rem 0;
}

.selected-todo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    padding: 2rem;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* タイマー画面 */
.timer-container {
    text-align: center;
}

.current-task {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timer-display {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 2rem auto;
}

.timer-circle {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-circle-bg {
    fill: none;
    stroke: #E0E4E8;
    stroke-width: 8;
}

.timer-circle-progress {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-color);
}

.timer-controls {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
    justify-content: center;
}

.timer-controls .btn {
    flex: 1;
    max-width: 200px;
}

.timer-actions {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
    justify-content: center;
}

.timer-actions .btn {
    flex: 1;
    max-width: 200px;
}

.timer-settings {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.timer-settings label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
}

.timer-settings input {
    width: 60px;
    padding: 0.5rem;
    font-size: 1rem;
    border: 2px solid #E0E4E8;
    border-radius: 8px;
    text-align: center;
}

.timer-settings input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* アニメーション用のクラス */
.timer-screen.work-mode {
    background: linear-gradient(135deg, #F5F7FA 0%, #E8F4F8 100%);
    transition: background 2s ease;
}

.timer-screen.break-mode {
    background: linear-gradient(135deg, #F5F7FA 0%, #E8F8E8 100%);
    transition: background 2s ease;
}

.timer-screen.ending {
    background: linear-gradient(135deg, #F5F7FA 0%, #FFE8E8 100%);
    transition: background 2s ease;
}

/* レスポンシブ対応 */
@media (max-width: 480px) {
    .app-title {
        font-size: 2rem;
    }

    .timer-display {
        width: 250px;
        height: 250px;
    }

    .timer-text {
        font-size: 2.5rem;
    }

    .selected-todo {
        font-size: 1.5rem;
        padding: 1.5rem;
    }

    .timer-settings {
        flex-direction: column;
        gap: 1rem;
    }

    .timer-controls {
        flex-direction: column;
    }

    .timer-controls .btn {
        max-width: 100%;
    }
}
