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

html {
    width: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    width: 100%;
    min-width: 400px;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.main-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    min-height: 100vh;
}

.content-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
    align-items: stretch;
}

/* 広告用のスタイル */
.ad-container {
    width: 300px;
    height: 1100px;
    min-height: 1100px;
    padding: 10px;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: center !important;
}

.content-area {
    width: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
    box-sizing: border-box;
    min-height: 100vh;
}

.desktop-ads {
    width: 25%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 100vh;
}

.desktop-ads:first-child {
    justify-content: flex-end;
}

.desktop-ads:last-child {
    justify-content: flex-start;
}


/* スマホ用広告のスタイル */
.mobile-ad {
    width: 100%;
    height: 100px;
    min-height: 100px;
    margin: 10px 0;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.mobile-ad-top {
    margin-top: 0;
}

.mobile-ad-bottom {
    margin-bottom: 0;
}

/* デスクトップ用広告の表示/非表示 */
@media (max-width: 1024px) {
    .main-wrapper {
        flex-direction: column;
        padding: 10px;
    }
    
    .content-wrapper {
        flex-direction: column;
    }
    
    .desktop-ads {
        display: none;
    }
    
    .mobile-ad {
        display: block;
        width: 100%;
    }

    .content-area {
        width: 100%;
    }
    
    .container {
        max-width: none;
        width: 100%;
        padding: 20px;
        margin: 10px auto;
        margin-bottom: 20px;
        box-sizing: border-box;
    }
    
    .chart-container {
        width: 100%;
        max-width: 400px;
        aspect-ratio: 1;
        margin: 0 auto 30px;
        box-sizing: border-box;
    }
}

/* デスクトップ用広告の表示/非表示 */
@media (min-width: 1025px) {
    .desktop-ads {
        display: flex;
    }
    
    .mobile-ad {
        display: none;
    }
}

/* スマホ専用の最適化 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        max-width: none;
        width: 100%;
        margin: 5px auto;
        margin-bottom: 20px;
    }
    
    .tip-text {
        font-size: 0.9rem;
        line-height: 1.4;
        padding: 0 15px;
    }
    
    /* 時間入力フィールドのスマホ対応 */
    #timeInputsFixed {
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    #timeInputsFixed > div {
        flex: none !important;
        width: 100% !important;
    }
    
    /* 400px以下ではさらにgapを縮小 */
    #timeInputsFixed {
        gap: 10px !important;
    }
}

/* 非常に小さな画面用 */
@media (max-width: 480px) {
    .container {
        padding: 10px;
        margin: 0;
        border-radius: 10px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .chart-container {
        width: 100%;
        max-width: 350px;
        aspect-ratio: 1;
        margin: 0 auto 30px;
    }
    
    .ad-sidebar {
        height: 60px;
        margin: 5px 0;
    }
    }
    

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 40px;
    width: 100%;
    box-sizing: border-box;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 2.5rem;
}

.hint-message {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.hint-message p {
    color: #555;
    font-size: 1.1rem;
    margin: 0;
    font-weight: 500;
}

.chart-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1;
    margin: 0 auto 30px;
    box-sizing: border-box;
}

#scheduleChart {
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.time-label {
    position: absolute;
    font-size: 14px;
    font-weight: bold;
    color: #555;
    pointer-events: none;
}

.schedule-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    background: #f9f9f9;
}

.schedule-item {
    background: white;
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s;
    border-left: 4px solid transparent;
}

.schedule-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    background: #f8f9ff;
}

/* Dynamic border colors are set via JavaScript */

.schedule-item.done {
    background: #f0f8f0;
    opacity: 0.7;
}

.schedule-item.done .schedule-text {
    text-decoration: line-through;
    color: #666;
}

.schedule-time {
    font-weight: bold;
    color: #667eea;
}

.schedule-text {
    flex: 1;
    margin: 0 15px;
    color: #333;
}

.schedule-actions {
    display: flex;
    gap: 5px;
    align-items: center;
}

.done-btn {
    background: #26de81;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
    font-size: 12px;
}

.done-btn:hover {
    background: #20c973;
}

.done-btn.completed {
    background: #666;
    cursor: default;
}

.start-btn {
    background: #4a90e2;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
    font-size: 12px;
}

.start-btn:hover {
    background: #357abd;
}

.extend-btn {
    background: #f39c12;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
    font-size: 12px;
    margin-left: 5px;
}

.extend-btn:hover {
    background: #e67e22;
}


.task-type-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    color: white;
    font-weight: bold;
}

/* Dynamic badge colors are set via JavaScript */

.task-order-controls {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-right: 10px;
}

.order-btn {
    background: #e0e0e0;
    border: none;
    width: 20px;
    height: 16px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.order-btn:hover {
    background: #d0d0d0;
}

.order-btn:disabled {
    background: #f5f5f5;
    color: #ccc;
    cursor: not-allowed;
}

.delete-btn {
    background: #ff4757;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.delete-btn:hover {
    background: #ff3838;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    animation: slideIn 0.3s ease;
}

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

.modal-header {
    margin-bottom: 20px;
}

.modal-header h2 {
    color: #333;
    font-size: 1.5rem;
}

.modal-body input,
.modal-body textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.modal-body input:focus,
.modal-body textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* Task type radio button styles */
.modal-body input[name="taskType"]:checked + span {
    position: relative;
}

.modal-body label:has(input[name="taskType"]:checked) {
    background: #e8f2ff !important;
    border-color: #667eea !important;
}

.modal-body label:has(input[name="taskType"][value="flexible"]:checked) {
    background: #e8f8f0 !important;
    border-color: #26de81 !important;
}

.modal-body textarea {
    resize: vertical;
    min-height: 100px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: transform 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}
.btn-danger {
    background: #dc3545;
    color: white;
}
.btn-danger:hover {
    background: #c82333;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.clear-all {
    text-align: center;
    margin-top: 20px;
}

.btn-clear {
    background: #ff6b6b;
    color: white;
    padding: 10px 30px;
    font-size: 16px;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #667eea;
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 2000;
    max-width: 300px;
    animation: slideInRight 0.3s ease;
}

.notification.alarm {
    background: #ff4757;
    animation: shake 0.5s ease-in-out 0s 3;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.notification-close {
    float: right;
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    margin-left: 10px;
}

.settings-button {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: #667eea;
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    z-index: 1500;
}

.settings-button:hover {
    background: #5a6fd8;
    transform: rotate(90deg) scale(1.1);
}

.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.settings-modal.active {
    display: flex;
}

.settings-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    animation: slideIn 0.3s ease;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.settings-header h2 {
    color: #333;
    font-size: 1.8rem;
    margin: 0;
}

.settings-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-close:hover {
    background: #f0f0f0;
    color: #333;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

.time-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.time-input {
    flex: 1;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
}

.time-input:focus {
    outline: none;
    border-color: #667eea;
}

.settings-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 30px;
}

.daily-summary h3 {
    color: #333;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.3rem;
}

.progress-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
}

.current-task-status {
    background: linear-gradient(135deg, #26de81 0%, #00c896 100%);
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1rem;
    font-weight: bold;
    display: none;
    box-shadow: 0 4px 12px rgba(38, 222, 129, 0.3);
}

.current-task-status.active {
    display: block;
}

.current-task-name {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.current-task-time {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.progress-bar-container {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    height: 40px;
    margin-top: 15px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #2ed573 0%, #ffa502 50%, #ff4757 100%);
    border-radius: 25px;
    transition: width 0.8s ease-out;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    position: absolute;
    left: 0;
    top: 0;
}

.progress-text {
    font-size: 1.1rem;
    font-weight: bold;
    color: white;
    z-index: 10;
    position: relative;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.progress-time-text {
    font-size: 0.9rem;
    margin-top: 8px;
    opacity: 0.9;
}

.productivity-tip {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    margin-bottom: 30px;
    text-align: center;
    font-size: 0.9rem;
    overflow: hidden;
    position: relative;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tip-text {
    position: absolute;
    width: 100%;
    transition: transform 0.5s ease-in-out;
    white-space: normal;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 0 10px;
    box-sizing: border-box;
}

.tip-text.slide-out-left {
    transform: translateX(-100%);
}

.tip-text.slide-in-right {
    transform: translateX(100%);
}

.tip-text.slide-in-center {
    transform: translateX(0);
}

/* フッターのスタイル */
.footer {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding: 20px 0;
    margin-top: 40px;
    text-align: center;
    color: white;
    width: 100%;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 5px !important;
}

.footer p {
    margin: 0 !important;
    font-size: 14px !important;
    display: block !important;
    width: 100% !important;
    text-align: center !important;
}

.footer a {
    color: #fff !important;
    text-decoration: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3) !important;
    transition: all 0.3s ease !important;
    display: inline-block !important;
}

.footer a:hover {
    color: #f0f8ff !important;
    border-bottom-color: #f0f8ff !important;
}

/* スマホ用フッター調整 */
@media (max-width: 1024px) {
    .footer {
        margin-top: 20px;
        padding: 15px 0;
    }
    
    .footer-content {
        padding: 0 15px;
    }
    
    .footer p {
        font-size: 12px;
    }
}

/* お問い合わせモーダルのスタイル */
.contact-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 20px 0;
}

.contact-option {
    padding: 20px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.contact-option:hover {
    border-color: #667eea;
    background: #f0f2ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.contact-option h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 18px;
}

.contact-option p {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 14px;
}

.contact-option .btn {
    display: inline-block;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.contact-option .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* お問い合わせモーダルの特別なスタイル */
#contactModal .modal-content {
    max-width: 500px;
    width: 90%;
}

#contactModal .modal-header h2 {
    color: #333;
    margin: 0;
}

#contactModal .close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

#contactModal .close:hover {
    color: #667eea;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    #contactModal .modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .contact-options {
        gap: 15px;
    }
    
    .contact-option {
        padding: 15px;
    }
    
    .contact-option h3 {
        font-size: 16px;
    }
    
    .contact-option p {
        font-size: 13px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-actions .btn {
        width: 100%;
    }
}