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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.app {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cloud-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #f7fafc;
    border-radius: 20px;
    font-size: 12px;
    color: #4a5568;
}

.cloud-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #a0aec0;
    transition: background 0.3s ease;
}

.room-btn {
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.room-btn:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.app-header h1 {
    font-size: 22px;
    color: #4a5568;
    font-weight: 600;
}

.view-switcher {
    display: flex;
    background: #f0f4f8;
    border-radius: 10px;
    padding: 4px;
}

.view-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #718096;
    transition: all 0.2s ease;
}

.view-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.view-btn:hover:not(.active) {
    color: #4a5568;
}

.date-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.nav-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #f0f4f8;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    color: #4a5568;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    background: #e2e8f0;
}

.date-display {
    font-size: 16px;
    font-weight: 600;
    color: #4a5568;
    min-width: 140px;
    text-align: center;
}

.today-btn {
    padding: 8px 16px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.today-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.task-input-section {
    margin-bottom: 20px;
}

.task-input-wrapper {
    display: flex;
    gap: 12px;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    align-items: center;
}

.icon-picker-btn {
    width: 44px;
    height: 44px;
    border: 2px dashed #cbd5e0;
    background: #f7fafc;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 20px;
    flex-shrink: 0;
}

.icon-picker-btn:hover {
    border-color: #667eea;
    background: #edf2f7;
    transform: scale(1.05);
}

.icon-picker-btn img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
}

#taskInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s ease;
    min-width: 0;
}

#taskInput:focus {
    border-color: #667eea;
}

.add-task-btn {
    padding: 12px 24px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.add-task-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    min-height: 300px;
}

.task-list {
    list-style: none;
}

.task-item {
    display: flex;
    align-items: center;
    padding: 16px;
    margin-bottom: 12px;
    background: #f7fafc;
    border-radius: 12px;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.task-item:hover {
    background: #edf2f7;
    transform: translateX(4px);
}

.task-item.completed {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-color: rgba(102, 126, 234, 0.3);
}

.task-checkbox {
    width: 40px;
    height: 40px;
    border: 2px solid #cbd5e0;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 22px;
    overflow: hidden;
    position: relative;
}

.task-checkbox:hover {
    border-color: #667eea;
}

.task-item.completed .task-checkbox {
    border-color: rgba(102, 126, 234, 0.5);
    background: rgba(102, 126, 234, 0.1);
}

.task-checkbox .checkbox-icon {
    font-size: 20px;
    line-height: 1;
}

.task-checkbox img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.task-checkbox .check-overlay {
    position: absolute;
    inset: 0;
    background: rgba(102, 126, 234, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.task-item.completed .task-checkbox .check-overlay {
    opacity: 1;
}

.task-checkbox svg {
    width: 20px;
    height: 20px;
    stroke: white;
    stroke-width: 3;
    fill: none;
}

.task-name {
    flex: 1;
    font-size: 16px;
    color: #2d3748;
    cursor: pointer;
}

.task-item.completed .task-name {
    text-decoration: line-through;
    color: #a0aec0;
}

.task-delete {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #cbd5e0;
    cursor: pointer;
    border-radius: 6px;
    font-size: 18px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-delete:hover {
    background: #fed7d7;
    color: #e53e3e;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #a0aec0;
}

.empty-state p {
    font-size: 16px;
}

.calendar-view {
    padding: 10px 0;
}

.calendar-header {
    text-align: center;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
    color: #4a5568;
}

.calendar-grid {
    display: grid;
    gap: 8px;
}

.calendar-grid.weekly {
    grid-template-columns: 1fr;
}

.calendar-grid.monthly {
    grid-template-columns: repeat(7, 1fr);
}

.weekly-row {
    display: flex;
    align-items: stretch;
    background: #f7fafc;
    border-radius: 12px;
    padding: 10px;
    gap: 10px;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    cursor: pointer;
}

.weekly-row:hover {
    background: #edf2f7;
    border-color: rgba(102, 126, 234, 0.3);
}

.weekly-row.today-row {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border-color: rgba(102, 126, 234, 0.4);
}

.weekly-row-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    padding: 4px 8px;
    border-right: 2px solid #e2e8f0;
    flex-shrink: 0;
}

.weekly-row-label .day-name {
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
}

.weekly-row-label .day-date {
    font-size: 12px;
    color: #718096;
    margin-top: 2px;
}

.weekly-row-label .day-hint {
    font-size: 10px;
    color: #a0aec0;
    margin-top: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.weekly-row:hover .weekly-row-label .day-hint {
    opacity: 1;
    color: #667eea;
}

.weekly-row.today-row .weekly-row-label .day-name {
    color: #667eea;
}

.weekly-row-tasks {
    display: flex;
    gap: 8px;
    flex: 1;
    flex-wrap: wrap;
    align-items: center;
}

.weekly-task-cell {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: #e2e8f0;
    opacity: 0.35;
    transition: all 0.2s ease;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

.weekly-task-cell:hover {
    transform: scale(1.1);
    opacity: 0.8;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.weekly-task-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.weekly-task-cell.completed {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 1;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.35);
    transform: scale(1.05);
}

.weekly-task-cell.completed.photo-cell {
    background: #f7fafc;
    border: 2px solid #667eea;
    width: 44px;
    height: 44px;
}

.weekly-task-cell .task-tooltip {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.weekly-task-cell:hover .task-tooltip {
    opacity: 1;
}

.calendar-cell {
    aspect-ratio: 1;
    background: #f7fafc;
    border-radius: 10px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    border: 2px solid transparent;
    overflow: hidden;
}

.calendar-cell:hover {
    background: #edf2f7;
    transform: scale(1.04);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.25);
    z-index: 2;
}

.calendar-cell:hover .cell-date {
    color: #667eea;
    font-weight: 700;
}

.calendar-cell.has-checkin {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(118, 75, 162, 0.12) 100%);
    border-color: rgba(102, 126, 234, 0.4);
}

.calendar-cell.today {
    border-color: #667eea;
}

.cell-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.calendar-cell:hover .cell-tooltip {
    opacity: 1;
}

.calendar-cell.empty {
    background: transparent;
    cursor: default;
}

.calendar-cell.empty:hover {
    transform: none;
}

.cell-date {
    font-size: 13px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 6px;
    width: 100%;
    text-align: center;
}

.calendar-cell.has-checkin .cell-date {
    color: #667eea;
}

.cell-icons {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    flex: 1;
    align-content: flex-start;
}

.cell-icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: #e2e8f0;
    opacity: 0.35;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    overflow: hidden;
}

.cell-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cell-icon.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 1;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
    font-size: 12px;
}

.cell-icon.active.photo-icon {
    background: transparent;
    border: 1.5px solid #667eea;
    width: 20px;
    height: 20px;
}

.cell-icon.active.photo-icon img {
    border-radius: 3px;
}

.cell-icon.active:not(.photo-icon) img {
    opacity: 0.9;
}

.weekday-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.weekday-label {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #a0aec0;
    padding: 4px 0;
}

.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #718096;
}

.legend-icon {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    overflow: hidden;
}

.legend-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.icon-picker-modal,
.checkin-modal,
.detail-modal,
.room-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.icon-picker-modal.active,
.checkin-modal.active,
.detail-modal.active,
.room-modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    font-size: 18px;
    color: #2d3748;
}

.close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #f7fafc;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    color: #718096;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: #edf2f7;
    color: #4a5568;
}

.modal-body {
    padding: 24px;
}

.icon-picker-section {
    margin-bottom: 24px;
}

.picker-label {
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 12px;
}

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

.emoji-item {
    width: 36px;
    height: 36px;
    border: 2px solid #e2e8f0;
    background: #f7fafc;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.15s ease;
}

.emoji-item:hover {
    border-color: #667eea;
    transform: scale(1.1);
}

.emoji-item.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.custom-icon-upload {
    display: flex;
    align-items: center;
    gap: 12px;
}

.custom-icon-preview {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    background: #f7fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-icon-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#checkinText {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    outline: none;
    transition: border-color 0.2s ease;
    margin-bottom: 16px;
}

#checkinText:focus {
    border-color: #667eea;
}

.image-upload {
    margin-bottom: 8px;
}

.upload-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #f7fafc;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #4a5568;
    transition: all 0.2s ease;
}

.upload-label:hover {
    background: #edf2f7;
}

.upload-icon {
    font-size: 18px;
}

.image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(229, 62, 62, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid #e2e8f0;
}

.btn-cancel,
.btn-confirm {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-cancel {
    background: #f7fafc;
    color: #4a5568;
}

.btn-cancel:hover {
    background: #edf2f7;
}

.btn-cancel.btn-block {
    width: 100%;
    flex: none;
}

.btn-confirm {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.detail-content {
    line-height: 1.8;
}

.detail-text {
    font-size: 15px;
    color: #2d3748;
    margin-bottom: 16px;
    white-space: pre-wrap;
}

.detail-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.detail-images img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.detail-images img:hover {
    transform: scale(1.05);
}

.detail-time {
    font-size: 13px;
    color: #a0aec0;
}

.room-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.room-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.room-status-row,
.room-current-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.room-status-label {
    font-size: 14px;
    color: #718096;
}

.room-status-value {
    font-size: 14px;
    font-weight: 600;
    color: #48bb78;
}

.room-code-display {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 4px;
    color: #667eea;
    cursor: pointer;
    padding: 4px 12px;
    background: #f0f4ff;
    border-radius: 8px;
    user-select: none;
    transition: all 0.2s ease;
}

.room-code-display:hover {
    background: #e6edff;
}

.room-input-row {
    display: flex;
    gap: 8px;
}

#roomCodeInput {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 2px;
    text-align: center;
    outline: none;
    transition: border-color 0.2s ease;
}

#roomCodeInput:focus {
    border-color: #667eea;
}

.room-hint {
    font-size: 13px;
    color: #a0aec0;
    margin-bottom: 12px;
    line-height: 1.5;
}

.header-actions {
    gap: 12px;
}

.cloud-text {
    font-weight: 500;
}

@media (max-width: 600px) {
    .app {
        padding: 12px;
    }

    .app-header {
        flex-direction: column;
        gap: 12px;
        padding: 14px 16px;
    }

    .app-header h1 {
        font-size: 20px;
    }

    .view-switcher {
        width: 100%;
    }

    .view-btn {
        flex: 1;
        padding: 8px 12px;
        font-size: 13px;
    }

    .task-item {
        padding: 14px;
    }

    .task-checkbox {
        width: 36px;
        height: 36px;
        margin-right: 12px;
    }

    .icon-picker-btn {
        width: 38px;
        height: 38px;
    }

    .calendar-grid.monthly {
        gap: 4px;
    }

    .cell-date {
        font-size: 11px;
    }

    .cell-icon {
        width: 12px;
        height: 12px;
    }

    .cell-icon.active.photo-icon {
        width: 14px;
        height: 14px;
    }

    .weekly-row {
        padding: 8px;
        gap: 6px;
    }

    .weekly-row-label {
        min-width: 40px;
    }

    .weekly-task-cell {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .weekly-task-cell.completed.photo-cell {
        width: 36px;
        height: 36px;
    }

    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}
