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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #B8963F 0%, #9B7F3C 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    overflow: hidden;
}

/* ヘッダー */
.header {
    background: linear-gradient(135deg, #9B7F3C 0%, #6B5A2A 100%);
    color: white;
    padding: 30px;
    padding-right: 140px;
    text-align: center;
    position: relative;
    min-height: 100px;
}

.header h1 {
    font-size: 28px;
    margin-bottom: 10px;
    font-weight: 600;
}

.header .subtitle {
    font-size: 14px;
    opacity: 0.9;
}

/* ログアウトボタン */
.logout-btn {
    position: absolute;
    top: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 今から寝る!ボタンセクション */
.quick-sleep-section {
    background: linear-gradient(135deg, #F4E8D0 0%, #FBF7ED 100%);
    padding: 25px;
    margin: 20px;
    border-radius: 15px;
    text-align: center;
    border: 2px solid #9B7F3C;
}

.quick-sleep-label {
    color: #6B5A2A;
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: 500;
}

.sleep-now-button {
    background: linear-gradient(135deg, #9B7F3C 0%, #6B5A2A 100%);
    color: white;
    border: none;
    padding: 20px 50px;
    font-size: 24px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 8px 20px rgba(155, 127, 60, 0.3);
    transition: all 0.3s ease;
    margin-top: 10px;
}

.sleep-now-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(155, 127, 60, 0.4);
}

.sleep-now-button:active {
    transform: translateY(0);
}

/* 睡眠中セクション */
.sleeping-section {
    background: linear-gradient(135deg, #6B5A2A 0%, #4A3D1A 100%);
    padding: 50px 25px;
    margin: 20px;
    border-radius: 15px;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

/* アニメーション効果 */
@keyframes pulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

.sleeping-icon {
    font-size: 80px;
    animation: pulse 2s ease-in-out infinite;
    margin-bottom: 20px;
}

.sleeping-status {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 15px;
    letter-spacing: 2px;
}

.sleep-start-time {
    font-size: 18px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.elapsed-time {
    font-size: 48px;
    font-weight: bold;
    margin: 30px 0;
    font-family: 'Courier New', monospace;
    color: #F4E8D0;
}

.wake-up-button {
    background: linear-gradient(135deg, #B8963F 0%, #9B7F3C 100%);
    color: white;
    border: none;
    padding: 25px 60px;
    font-size: 28px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 10px 30px rgba(184, 150, 63, 0.4);
    transition: all 0.3s ease;
    margin-top: 20px;
}

.wake-up-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(184, 150, 63, 0.5);
}

.wake-up-button:active {
    transform: translateY(0);
}

.timeout-notice {
    font-size: 14px;
    margin-top: 20px;
    opacity: 0.7;
}

/* 星の装飾 */
.stars {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle 3s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

.star:nth-child(1) {
    width: 3px;
    height: 3px;
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.star:nth-child(2) {
    width: 2px;
    height: 2px;
    top: 40%;
    left: 80%;
    animation-delay: 0.5s;
}

.star:nth-child(3) {
    width: 4px;
    height: 4px;
    top: 60%;
    left: 30%;
    animation-delay: 1s;
}

.star:nth-child(4) {
    width: 2px;
    height: 2px;
    top: 80%;
    left: 70%;
    animation-delay: 1.5s;
}

.star:nth-child(5) {
    width: 3px;
    height: 3px;
    top: 30%;
    left: 50%;
    animation-delay: 2s;
}

/* 日替わりコメント（酒井浩用） */
.daily-comment {
    background: #FBF7ED;
    padding: 25px;
    padding-top: 65px;
    margin: 20px;
    margin-left: 40px;
    border-radius: 15px;
    border-left: 6px solid #B8963F;
    position: relative;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.daily-comment::before {
    content: "💡";
    position: absolute;
    left: 15px;
    top: -15px;
    background: white;
    padding: 10px;
    border-radius: 50%;
    font-size: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1;
    border: 3px solid #FBF7ED;
}

.daily-comment p {
    color: #6B5A2A;
    line-height: 1.8;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 2;
}

/* 統計セクション */
.stats-section {
    padding: 20px;
}

.stats-container {
    background: #FBF7ED;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
}

.stat-item {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    border: 2px solid #F4E8D0;
    transition: all 0.3s;
}

.stat-item:hover {
    border-color: #B8963F;
    box-shadow: 0 5px 15px rgba(139,157,195,0.2);
}

.stat-title {
    font-size: 16px;
    font-weight: bold;
    color: #6B5A2A;
    margin-bottom: 10px;
}

.stat-details {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    color: #9B7F3C;
}

.stat-main {
    font-size: 18px;
    font-weight: bold;
    color: #6B5A2A;
}

.stat-diff {
    padding: 4px 10px;
    border-radius: 5px;
    font-weight: bold;
}

.stat-diff.shortage {
    background: #FFE5E5;
    color: #D63031;
}

.stat-diff.good {
    background: #E5F5E5;
    color: #7A6B3A;
}

.stat-percent {
    font-size: 24px;
    font-weight: bold;
    color: #9B7F3C;
}

/* 分析コメント */
.analysis-comment {
    background: #F4E8D0;
    padding: 20px;
    border-radius: 10px;
    margin-top: 10px;
}

.analysis-comment p {
    color: #6B5A2A;
    line-height: 1.6;
    font-size: 15px;
    font-weight: 500;
}

/* カレンダー */
.calendar-container {
    padding: 20px;
}

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

.calendar-header h2 {
    font-size: 22px;
    color: #6B5A2A;
}

.calendar-nav {
    display: flex;
    gap: 10px;
}

.calendar-nav button {
    background: #9B7F3C;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.calendar-nav button:hover {
    background: #6B5A2A;
}

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

.calendar-weekday {
    text-align: center;
    font-weight: bold;
    color: #9B7F3C;
    padding: 10px;
    font-size: 14px;
}

.calendar-day {
    background: white;
    border: 2px solid #F4E8D0;
    border-radius: 10px;
    padding: 10px;
    min-height: 80px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.calendar-day:hover {
    border-color: #B8963F;
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(139,157,195,0.3);
}

.calendar-day .date {
    font-weight: bold;
    color: #6B5A2A;
    margin-bottom: 5px;
}

.calendar-day .sleep-time {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 5px;
    text-align: center;
    font-weight: 500;
}

.calendar-day .diff-time {
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    margin-top: 5px;
}

.calendar-day .diff-time.plus {
    color: #6B5A2A;
}

.calendar-day .diff-time.minus {
    color: #D63031;
}

.calendar-day.good .sleep-time {
    background: #F4E8D0;
    color: #6B5A2A;
    border: 1px solid #B8963F;
}

.calendar-day.normal .sleep-time {
    background: #FBF7ED;
    color: #9B7F3C;
}

.calendar-day.poor .sleep-time {
    background: #FFE5E5;
    color: #D63031;
}

.calendar-day.no-data .sleep-time {
    background: #FAFAFA;
    color: #A0A0A0;
}

.calendar-day.today {
    background: linear-gradient(135deg, #B8963F 0%, #9B7F3C 100%);
    color: white;
}

.calendar-day.today .date {
    color: white;
}

.calendar-day.today .sleep-time {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.calendar-day.today .diff-time {
    color: white;
}

/* 睡眠バーカレンダー */
.sleep-bar-container {
    padding: 20px;
    margin-top: 20px;
}

.sleep-bar-header {
    margin-bottom: 20px;
}

.sleep-bar-header h2 {
    font-size: 22px;
    color: #6B5A2A;
}

.sleep-bar-chart {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.sleep-bar-row {
    display: flex;
    align-items: center;
    height: 30px;
    margin-bottom: 2px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.sleep-bar-row:hover {
    background-color: rgba(76, 175, 80, 0.05);
}

.sleep-bar-date {
    width: 50px;
    font-size: 12px;
    font-weight: bold;
    color: #333;
    text-align: center;
    border-right: 1px solid #ccc;
    padding-right: 5px;
}

.sleep-bar-day {
    width: 25px;
    font-size: 11px;
    color: #666;
    text-align: center;
    margin-right: 5px;
}

.sleep-bar-graph {
    flex: 1;
    position: relative;
    height: 25px;
    background: white;
    border: 1px solid #DDD;
    overflow: hidden;
}

.sleep-bar-row.weekend {
    background-color: rgba(255, 235, 238, 0.3);
}

.sleep-bar-row.weekend:hover {
    background-color: rgba(255, 235, 238, 0.5);
}

.sleep-bar-row.weekend .sleep-bar-day {
    color: #D63031;
    font-weight: bold;
}

/* グリッド線（時間用） */
.sleep-bar-graph::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: repeating-linear-gradient(
        to right,
        transparent,
        transparent calc(100% / 24 - 0.5px),
        #E0E0E0 calc(100% / 24 - 0.5px),
        #E0E0E0 calc(100% / 24)
    );
    pointer-events: none;
    z-index: 1;
}

/* 睡眠時間バー */
.sleep-bar {
    position: absolute;
    height: 100%;
    background: #D4AF37;
    z-index: 2;
}

.sleep-bar.next-day {
    background: #D4AF37;
    opacity: 0.8;
}

/* データなしの行 */
.sleep-bar-row.no-data .sleep-bar-graph {
    background: #F8F8F8;
}

/* 時間ラベル */
.sleep-bar-time-labels {
    display: flex;
    margin-left: 80px;
    margin-bottom: 5px;
    font-size: 10px;
    color: #999;
    border-bottom: 1px solid #DDD;
    padding-bottom: 3px;
}

.sleep-bar-time-label {
    width: calc(100% / 24);
    text-align: center;
}

/* ツールチップ */
.sleep-bar-tooltip {
    position: absolute;
    background: #333;
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    white-space: nowrap;
    z-index: 10;
}

.sleep-bar:hover .sleep-bar-tooltip {
    display: block;
}

/* 今日のハイライト */
.sleep-bar-row.today {
    background: #FFF9E6;
}

/* ログインページ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    text-align: center;
}

.login-box h1 {
    color: #6B5A2A;
    margin-bottom: 10px;
}

.login-box .subtitle {
    color: #9B7F3C;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    color: #6B5A2A;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #F4E8D0;
    border-radius: 8px;
    font-size: 16px;
}

.form-group input:focus {
    outline: none;
    border-color: #B8963F;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: #9B7F3C;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-login:hover {
    background: #6B5A2A;
}

/* 入力ページ */
.input-container {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.sleep-row {
    background: #FBF7ED;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 10px;
}

.sleep-row label {
    display: block;
    font-weight: bold;
    color: #6B5A2A;
    margin-bottom: 10px;
}

.time-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.time-inputs select {
    padding: 8px;
    border: 2px solid #F4E8D0;
    border-radius: 5px;
    background: white;
    color: #6B5A2A;
}

.wake-label {
    margin-left: 20px;
}

.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 30px;
}

.btn-save, .btn-clear, .btn-back {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-save {
    background: #9B7F3C;
    color: white;
}

.btn-save:hover {
    background: #6B5A2A;
}

.btn-clear {
    background: #FFE5E5;
    color: #D63031;
}

.btn-clear:hover {
    background: #FFD5D5;
}

.btn-back {
    background: #F4E8D0;
    color: #6B5A2A;
}

.btn-back:hover {
    background: #CFD4DD;
}

.error-message, .success-message {
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
    text-align: center;
    display: none;
}

.error-message {
    background: #FFE5E5;
    color: #D63031;
}

.success-message {
    background: #E5F5E5;
    color: #7A6B3A;
}

/* レスポンシブ - タブレット */
@media (max-width: 768px) {
    .header {
        padding: 25px;
        padding-right: 120px;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .logout-btn {
        top: 25px;
        right: 20px;
        font-size: 13px;
        padding: 7px 14px;
    }

    .sleeping-icon {
        font-size: 60px;
    }

    .sleeping-status {
        font-size: 24px;
    }

    .elapsed-time {
        font-size: 36px;
    }

    .wake-up-button {
        padding: 20px 45px;
        font-size: 22px;
    }

    .sleep-now-button {
        padding: 18px 40px;
        font-size: 20px;
    }

    .stat-details {
        font-size: 12px;
    }

    .stat-main {
        font-size: 16px;
    }

    .stat-percent {
        font-size: 20px;
    }

    .calendar-grid {
        gap: 5px;
    }

    .calendar-day {
        min-height: 60px;
        padding: 5px;
    }

    .calendar-day .date {
        font-size: 12px;
    }

    .calendar-day .sleep-time {
        font-size: 10px;
        padding: 2px 4px;
    }
}

/* レスポンシブ - モバイル */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .header {
        padding: 60px 20px 20px 20px;
    }
    
    .logout-btn {
        top: 15px;
        right: 15px;
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .header h1 {
        font-size: 22px;
    }
    
    .header .subtitle {
        font-size: 12px;
    }

    .sleeping-icon {
        font-size: 50px;
    }

    .sleeping-status {
        font-size: 20px;
    }

    .elapsed-time {
        font-size: 28px;
    }

    .wake-up-button {
        padding: 18px 35px;
        font-size: 20px;
    }

    .sleep-now-button {
        padding: 16px 35px;
        font-size: 18px;
    }

    .stat-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .time-inputs {
        font-size: 14px;
    }

    .time-inputs select {
        padding: 6px;
    }

    .button-group {
        flex-direction: column;
    }
}